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;
288 struct snd_jack *jack;
291 #define MUX_IDX_UNDEF ((unsigned char)-1)
293 struct alc_customize_define {
294 unsigned int sku_cfg;
295 unsigned char port_connectivity;
296 unsigned char check_sum;
297 unsigned char customization;
298 unsigned char external_amp;
299 unsigned int enable_pcbeep:1;
300 unsigned int platform_type:1;
302 unsigned int override:1;
303 unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */
309 /* codec parameterization */
310 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
311 unsigned int num_mixers;
312 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
313 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
315 const struct hda_verb *init_verbs[10]; /* initialization verbs
319 unsigned int num_init_verbs;
321 char stream_name_analog[32]; /* analog PCM stream */
322 struct hda_pcm_stream *stream_analog_playback;
323 struct hda_pcm_stream *stream_analog_capture;
324 struct hda_pcm_stream *stream_analog_alt_playback;
325 struct hda_pcm_stream *stream_analog_alt_capture;
327 char stream_name_digital[32]; /* digital PCM stream */
328 struct hda_pcm_stream *stream_digital_playback;
329 struct hda_pcm_stream *stream_digital_capture;
332 struct hda_multi_out multiout; /* playback set-up
333 * max_channels, dacs must be set
334 * dig_out_nid and hp_nid are optional
336 hda_nid_t alt_dac_nid;
337 hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */
341 unsigned int num_adc_nids;
343 hda_nid_t *capsrc_nids;
344 hda_nid_t dig_in_nid; /* digital-in NID; optional */
346 /* capture setup for dynamic dual-adc switch */
347 unsigned int cur_adc_idx;
349 unsigned int cur_adc_stream_tag;
350 unsigned int cur_adc_format;
353 unsigned int num_mux_defs;
354 const struct hda_input_mux *input_mux;
355 unsigned int cur_mux[3];
356 struct alc_mic_route ext_mic;
357 struct alc_mic_route int_mic;
360 const struct hda_channel_mode *channel_mode;
361 int num_channel_mode;
363 int const_channel_count;
364 int ext_channel_count;
366 /* PCM information */
367 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
370 struct snd_array jacks;
372 /* dynamic controls, init_verbs and input_mux */
373 struct auto_pin_cfg autocfg;
374 struct alc_customize_define cdefine;
375 struct snd_array kctls;
376 struct hda_input_mux private_imux[3];
377 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
378 hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS];
379 hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS];
382 void (*init_hook)(struct hda_codec *codec);
383 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
384 #ifdef CONFIG_SND_HDA_POWER_SAVE
385 void (*power_hook)(struct hda_codec *codec);
388 /* for pin sensing */
389 unsigned int sense_updated: 1;
390 unsigned int jack_present: 1;
391 unsigned int master_sw: 1;
392 unsigned int auto_mic:1;
395 unsigned int no_analog :1; /* digital I/O only */
396 unsigned int dual_adc_switch:1; /* switch ADCs (for ALC275) */
397 unsigned int single_input_src:1;
399 int codec_variant; /* flag for other variants */
401 /* for virtual master */
402 hda_nid_t vmaster_nid;
403 #ifdef CONFIG_SND_HDA_POWER_SAVE
404 struct hda_loopback_check loopback;
409 unsigned int pll_coef_idx, pll_coef_bit;
413 const struct alc_fixup *fixup_list;
414 const char *fixup_name;
418 * configuration template - to be copied to the spec instance
420 struct alc_config_preset {
421 struct snd_kcontrol_new *mixers[5]; /* should be identical size
424 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
425 const struct hda_verb *init_verbs[5];
426 unsigned int num_dacs;
428 hda_nid_t dig_out_nid; /* optional */
429 hda_nid_t hp_nid; /* optional */
430 hda_nid_t *slave_dig_outs;
431 unsigned int num_adc_nids;
433 hda_nid_t *capsrc_nids;
434 hda_nid_t dig_in_nid;
435 unsigned int num_channel_mode;
436 const struct hda_channel_mode *channel_mode;
438 int const_channel_count;
439 unsigned int num_mux_defs;
440 const struct hda_input_mux *input_mux;
441 void (*unsol_event)(struct hda_codec *, unsigned int);
442 void (*setup)(struct hda_codec *);
443 void (*init_hook)(struct hda_codec *);
444 #ifdef CONFIG_SND_HDA_POWER_SAVE
445 struct hda_amp_list *loopbacks;
446 void (*power_hook)(struct hda_codec *codec);
454 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
455 struct snd_ctl_elem_info *uinfo)
457 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
458 struct alc_spec *spec = codec->spec;
459 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
460 if (mux_idx >= spec->num_mux_defs)
462 if (!spec->input_mux[mux_idx].num_items && mux_idx > 0)
464 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
467 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
468 struct snd_ctl_elem_value *ucontrol)
470 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
471 struct alc_spec *spec = codec->spec;
472 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
474 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
478 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
479 struct snd_ctl_elem_value *ucontrol)
481 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
482 struct alc_spec *spec = codec->spec;
483 const struct hda_input_mux *imux;
484 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
485 unsigned int mux_idx;
486 hda_nid_t nid = spec->capsrc_nids ?
487 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
490 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
491 imux = &spec->input_mux[mux_idx];
492 if (!imux->num_items && mux_idx > 0)
493 imux = &spec->input_mux[0];
495 type = get_wcaps_type(get_wcaps(codec, nid));
496 if (type == AC_WID_AUD_MIX) {
497 /* Matrix-mixer style (e.g. ALC882) */
498 unsigned int *cur_val = &spec->cur_mux[adc_idx];
501 idx = ucontrol->value.enumerated.item[0];
502 if (idx >= imux->num_items)
503 idx = imux->num_items - 1;
506 for (i = 0; i < imux->num_items; i++) {
507 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
508 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
509 imux->items[i].index,
515 /* MUX style (e.g. ALC880) */
516 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
517 &spec->cur_mux[adc_idx]);
522 * channel mode setting
524 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
525 struct snd_ctl_elem_info *uinfo)
527 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
528 struct alc_spec *spec = codec->spec;
529 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
530 spec->num_channel_mode);
533 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
534 struct snd_ctl_elem_value *ucontrol)
536 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
537 struct alc_spec *spec = codec->spec;
538 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
539 spec->num_channel_mode,
540 spec->ext_channel_count);
543 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
544 struct snd_ctl_elem_value *ucontrol)
546 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
547 struct alc_spec *spec = codec->spec;
548 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
549 spec->num_channel_mode,
550 &spec->ext_channel_count);
551 if (err >= 0 && !spec->const_channel_count) {
552 spec->multiout.max_channels = spec->ext_channel_count;
553 if (spec->need_dac_fix)
554 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
560 * Control the mode of pin widget settings via the mixer. "pc" is used
561 * instead of "%" to avoid consequences of accidently treating the % as
562 * being part of a format specifier. Maximum allowed length of a value is
563 * 63 characters plus NULL terminator.
565 * Note: some retasking pin complexes seem to ignore requests for input
566 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
567 * are requested. Therefore order this list so that this behaviour will not
568 * cause problems when mixer clients move through the enum sequentially.
569 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
572 static char *alc_pin_mode_names[] = {
573 "Mic 50pc bias", "Mic 80pc bias",
574 "Line in", "Line out", "Headphone out",
576 static unsigned char alc_pin_mode_values[] = {
577 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
579 /* The control can present all 5 options, or it can limit the options based
580 * in the pin being assumed to be exclusively an input or an output pin. In
581 * addition, "input" pins may or may not process the mic bias option
582 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
583 * accept requests for bias as of chip versions up to March 2006) and/or
584 * wiring in the computer.
586 #define ALC_PIN_DIR_IN 0x00
587 #define ALC_PIN_DIR_OUT 0x01
588 #define ALC_PIN_DIR_INOUT 0x02
589 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
590 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
592 /* Info about the pin modes supported by the different pin direction modes.
593 * For each direction the minimum and maximum values are given.
595 static signed char alc_pin_mode_dir_info[5][2] = {
596 { 0, 2 }, /* ALC_PIN_DIR_IN */
597 { 3, 4 }, /* ALC_PIN_DIR_OUT */
598 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
599 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
600 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
602 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
603 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
604 #define alc_pin_mode_n_items(_dir) \
605 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
607 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
608 struct snd_ctl_elem_info *uinfo)
610 unsigned int item_num = uinfo->value.enumerated.item;
611 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
613 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
615 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
617 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
618 item_num = alc_pin_mode_min(dir);
619 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
623 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
624 struct snd_ctl_elem_value *ucontrol)
627 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
628 hda_nid_t nid = kcontrol->private_value & 0xffff;
629 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
630 long *valp = ucontrol->value.integer.value;
631 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
632 AC_VERB_GET_PIN_WIDGET_CONTROL,
635 /* Find enumerated value for current pinctl setting */
636 i = alc_pin_mode_min(dir);
637 while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl)
639 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
643 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
644 struct snd_ctl_elem_value *ucontrol)
647 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
648 hda_nid_t nid = kcontrol->private_value & 0xffff;
649 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
650 long val = *ucontrol->value.integer.value;
651 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
652 AC_VERB_GET_PIN_WIDGET_CONTROL,
655 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
656 val = alc_pin_mode_min(dir);
658 change = pinctl != alc_pin_mode_values[val];
660 /* Set pin mode to that requested */
661 snd_hda_codec_write_cache(codec, nid, 0,
662 AC_VERB_SET_PIN_WIDGET_CONTROL,
663 alc_pin_mode_values[val]);
665 /* Also enable the retasking pin's input/output as required
666 * for the requested pin mode. Enum values of 2 or less are
669 * Dynamically switching the input/output buffers probably
670 * reduces noise slightly (particularly on input) so we'll
671 * do it. However, having both input and output buffers
672 * enabled simultaneously doesn't seem to be problematic if
673 * this turns out to be necessary in the future.
676 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
677 HDA_AMP_MUTE, HDA_AMP_MUTE);
678 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
681 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
682 HDA_AMP_MUTE, HDA_AMP_MUTE);
683 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
690 #define ALC_PIN_MODE(xname, nid, dir) \
691 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
692 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
693 .info = alc_pin_mode_info, \
694 .get = alc_pin_mode_get, \
695 .put = alc_pin_mode_put, \
696 .private_value = nid | (dir<<16) }
698 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
699 * together using a mask with more than one bit set. This control is
700 * currently used only by the ALC260 test model. At this stage they are not
701 * needed for any "production" models.
703 #ifdef CONFIG_SND_DEBUG
704 #define alc_gpio_data_info snd_ctl_boolean_mono_info
706 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
707 struct snd_ctl_elem_value *ucontrol)
709 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
710 hda_nid_t nid = kcontrol->private_value & 0xffff;
711 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
712 long *valp = ucontrol->value.integer.value;
713 unsigned int val = snd_hda_codec_read(codec, nid, 0,
714 AC_VERB_GET_GPIO_DATA, 0x00);
716 *valp = (val & mask) != 0;
719 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
720 struct snd_ctl_elem_value *ucontrol)
723 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
724 hda_nid_t nid = kcontrol->private_value & 0xffff;
725 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
726 long val = *ucontrol->value.integer.value;
727 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
728 AC_VERB_GET_GPIO_DATA,
731 /* Set/unset the masked GPIO bit(s) as needed */
732 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
737 snd_hda_codec_write_cache(codec, nid, 0,
738 AC_VERB_SET_GPIO_DATA, gpio_data);
742 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
743 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
744 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
745 .info = alc_gpio_data_info, \
746 .get = alc_gpio_data_get, \
747 .put = alc_gpio_data_put, \
748 .private_value = nid | (mask<<16) }
749 #endif /* CONFIG_SND_DEBUG */
751 /* A switch control to allow the enabling of the digital IO pins on the
752 * ALC260. This is incredibly simplistic; the intention of this control is
753 * to provide something in the test model allowing digital outputs to be
754 * identified if present. If models are found which can utilise these
755 * outputs a more complete mixer control can be devised for those models if
758 #ifdef CONFIG_SND_DEBUG
759 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
761 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
762 struct snd_ctl_elem_value *ucontrol)
764 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
765 hda_nid_t nid = kcontrol->private_value & 0xffff;
766 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
767 long *valp = ucontrol->value.integer.value;
768 unsigned int val = snd_hda_codec_read(codec, nid, 0,
769 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
771 *valp = (val & mask) != 0;
774 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
775 struct snd_ctl_elem_value *ucontrol)
778 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
779 hda_nid_t nid = kcontrol->private_value & 0xffff;
780 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
781 long val = *ucontrol->value.integer.value;
782 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
783 AC_VERB_GET_DIGI_CONVERT_1,
786 /* Set/unset the masked control bit(s) as needed */
787 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
792 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
797 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
798 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
799 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
800 .info = alc_spdif_ctrl_info, \
801 .get = alc_spdif_ctrl_get, \
802 .put = alc_spdif_ctrl_put, \
803 .private_value = nid | (mask<<16) }
804 #endif /* CONFIG_SND_DEBUG */
806 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
807 * Again, this is only used in the ALC26x test models to help identify when
808 * the EAPD line must be asserted for features to work.
810 #ifdef CONFIG_SND_DEBUG
811 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
813 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
814 struct snd_ctl_elem_value *ucontrol)
816 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
817 hda_nid_t nid = kcontrol->private_value & 0xffff;
818 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
819 long *valp = ucontrol->value.integer.value;
820 unsigned int val = snd_hda_codec_read(codec, nid, 0,
821 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
823 *valp = (val & mask) != 0;
827 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
828 struct snd_ctl_elem_value *ucontrol)
831 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
832 hda_nid_t nid = kcontrol->private_value & 0xffff;
833 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
834 long val = *ucontrol->value.integer.value;
835 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
836 AC_VERB_GET_EAPD_BTLENABLE,
839 /* Set/unset the masked control bit(s) as needed */
840 change = (!val ? 0 : mask) != (ctrl_data & mask);
845 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
851 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
852 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
853 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
854 .info = alc_eapd_ctrl_info, \
855 .get = alc_eapd_ctrl_get, \
856 .put = alc_eapd_ctrl_put, \
857 .private_value = nid | (mask<<16) }
858 #endif /* CONFIG_SND_DEBUG */
861 * set up the input pin config (depending on the given auto-pin type)
863 static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
866 unsigned int val = PIN_IN;
868 if (auto_pin_type == AUTO_PIN_MIC) {
871 oldval = snd_hda_codec_read(codec, nid, 0,
872 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
873 pincap = snd_hda_query_pin_caps(codec, nid);
874 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
875 /* if the default pin setup is vref50, we give it priority */
876 if ((pincap & AC_PINCAP_VREF_80) && oldval != PIN_VREF50)
878 else if (pincap & AC_PINCAP_VREF_50)
880 else if (pincap & AC_PINCAP_VREF_100)
882 else if (pincap & AC_PINCAP_VREF_GRD)
885 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val);
888 static void alc_fixup_autocfg_pin_nums(struct hda_codec *codec)
890 struct alc_spec *spec = codec->spec;
891 struct auto_pin_cfg *cfg = &spec->autocfg;
893 if (!cfg->line_outs) {
894 while (cfg->line_outs < AUTO_CFG_MAX_OUTS &&
895 cfg->line_out_pins[cfg->line_outs])
898 if (!cfg->speaker_outs) {
899 while (cfg->speaker_outs < AUTO_CFG_MAX_OUTS &&
900 cfg->speaker_pins[cfg->speaker_outs])
904 while (cfg->hp_outs < AUTO_CFG_MAX_OUTS &&
905 cfg->hp_pins[cfg->hp_outs])
912 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
914 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
916 spec->mixers[spec->num_mixers++] = mix;
919 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
921 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
923 spec->init_verbs[spec->num_init_verbs++] = verb;
927 * set up from the preset table
929 static void setup_preset(struct hda_codec *codec,
930 const struct alc_config_preset *preset)
932 struct alc_spec *spec = codec->spec;
935 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
936 add_mixer(spec, preset->mixers[i]);
937 spec->cap_mixer = preset->cap_mixer;
938 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
940 add_verb(spec, preset->init_verbs[i]);
942 spec->channel_mode = preset->channel_mode;
943 spec->num_channel_mode = preset->num_channel_mode;
944 spec->need_dac_fix = preset->need_dac_fix;
945 spec->const_channel_count = preset->const_channel_count;
947 if (preset->const_channel_count)
948 spec->multiout.max_channels = preset->const_channel_count;
950 spec->multiout.max_channels = spec->channel_mode[0].channels;
951 spec->ext_channel_count = spec->channel_mode[0].channels;
953 spec->multiout.num_dacs = preset->num_dacs;
954 spec->multiout.dac_nids = preset->dac_nids;
955 spec->multiout.dig_out_nid = preset->dig_out_nid;
956 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
957 spec->multiout.hp_nid = preset->hp_nid;
959 spec->num_mux_defs = preset->num_mux_defs;
960 if (!spec->num_mux_defs)
961 spec->num_mux_defs = 1;
962 spec->input_mux = preset->input_mux;
964 spec->num_adc_nids = preset->num_adc_nids;
965 spec->adc_nids = preset->adc_nids;
966 spec->capsrc_nids = preset->capsrc_nids;
967 spec->dig_in_nid = preset->dig_in_nid;
969 spec->unsol_event = preset->unsol_event;
970 spec->init_hook = preset->init_hook;
971 #ifdef CONFIG_SND_HDA_POWER_SAVE
972 spec->power_hook = preset->power_hook;
973 spec->loopback.amplist = preset->loopbacks;
977 preset->setup(codec);
979 alc_fixup_autocfg_pin_nums(codec);
982 /* Enable GPIO mask and set output */
983 static struct hda_verb alc_gpio1_init_verbs[] = {
984 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
985 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
986 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
990 static struct hda_verb alc_gpio2_init_verbs[] = {
991 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
992 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
993 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
997 static struct hda_verb alc_gpio3_init_verbs[] = {
998 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
999 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
1000 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
1005 * Fix hardware PLL issue
1006 * On some codecs, the analog PLL gating control must be off while
1007 * the default value is 1.
1009 static void alc_fix_pll(struct hda_codec *codec)
1011 struct alc_spec *spec = codec->spec;
1016 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
1017 spec->pll_coef_idx);
1018 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
1019 AC_VERB_GET_PROC_COEF, 0);
1020 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
1021 spec->pll_coef_idx);
1022 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
1023 val & ~(1 << spec->pll_coef_bit));
1026 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
1027 unsigned int coef_idx, unsigned int coef_bit)
1029 struct alc_spec *spec = codec->spec;
1030 spec->pll_nid = nid;
1031 spec->pll_coef_idx = coef_idx;
1032 spec->pll_coef_bit = coef_bit;
1036 #ifdef CONFIG_SND_HDA_INPUT_JACK
1037 static void alc_free_jack_priv(struct snd_jack *jack)
1039 struct alc_jack *jacks = jack->private_data;
1044 static int alc_add_jack(struct hda_codec *codec,
1045 hda_nid_t nid, int type)
1047 struct alc_spec *spec;
1048 struct alc_jack *jack;
1053 snd_array_init(&spec->jacks, sizeof(*jack), 32);
1054 jack = snd_array_new(&spec->jacks);
1060 name = (type == SND_JACK_HEADPHONE) ? "Headphone" : "Mic" ;
1062 err = snd_jack_new(codec->bus->card, name, type, &jack->jack);
1065 jack->jack->private_data = jack;
1066 jack->jack->private_free = alc_free_jack_priv;
1070 static void alc_report_jack(struct hda_codec *codec, hda_nid_t nid)
1072 struct alc_spec *spec = codec->spec;
1073 struct alc_jack *jacks = spec->jacks.list;
1077 for (i = 0; i < spec->jacks.used; i++) {
1078 if (jacks->nid == nid) {
1079 unsigned int present;
1080 present = snd_hda_jack_detect(codec, nid);
1082 present = (present) ? jacks->type : 0;
1084 snd_jack_report(jacks->jack, present);
1091 static int alc_init_jacks(struct hda_codec *codec)
1093 struct alc_spec *spec = codec->spec;
1095 unsigned int hp_nid = spec->autocfg.hp_pins[0];
1096 unsigned int mic_nid = spec->ext_mic.pin;
1099 err = alc_add_jack(codec, hp_nid, SND_JACK_HEADPHONE);
1102 alc_report_jack(codec, hp_nid);
1106 err = alc_add_jack(codec, mic_nid, SND_JACK_MICROPHONE);
1109 alc_report_jack(codec, mic_nid);
1115 static inline void alc_report_jack(struct hda_codec *codec, hda_nid_t nid)
1119 static inline int alc_init_jacks(struct hda_codec *codec)
1125 static void alc_automute_speaker(struct hda_codec *codec, int pinctl)
1127 struct alc_spec *spec = codec->spec;
1132 spec->jack_present = 0;
1133 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
1134 nid = spec->autocfg.hp_pins[i];
1137 alc_report_jack(codec, nid);
1138 spec->jack_present |= snd_hda_jack_detect(codec, nid);
1141 mute = spec->jack_present ? HDA_AMP_MUTE : 0;
1142 /* Toggle internal speakers muting */
1143 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1144 nid = spec->autocfg.speaker_pins[i];
1148 snd_hda_codec_write(codec, nid, 0,
1149 AC_VERB_SET_PIN_WIDGET_CONTROL,
1150 spec->jack_present ? 0 : PIN_OUT);
1152 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1153 HDA_AMP_MUTE, mute);
1158 static void alc_automute_pin(struct hda_codec *codec)
1160 alc_automute_speaker(codec, 1);
1163 static int get_connection_index(struct hda_codec *codec, hda_nid_t mux,
1166 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
1169 nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn));
1170 for (i = 0; i < nums; i++)
1176 /* switch the current ADC according to the jack state */
1177 static void alc_dual_mic_adc_auto_switch(struct hda_codec *codec)
1179 struct alc_spec *spec = codec->spec;
1180 unsigned int present;
1183 present = snd_hda_jack_detect(codec, spec->ext_mic.pin);
1185 spec->cur_adc_idx = 1;
1187 spec->cur_adc_idx = 0;
1188 new_adc = spec->adc_nids[spec->cur_adc_idx];
1189 if (spec->cur_adc && spec->cur_adc != new_adc) {
1190 /* stream is running, let's swap the current ADC */
1191 __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1);
1192 spec->cur_adc = new_adc;
1193 snd_hda_codec_setup_stream(codec, new_adc,
1194 spec->cur_adc_stream_tag, 0,
1195 spec->cur_adc_format);
1199 static void alc_mic_automute(struct hda_codec *codec)
1201 struct alc_spec *spec = codec->spec;
1202 struct alc_mic_route *dead, *alive;
1203 unsigned int present, type;
1206 if (!spec->auto_mic)
1208 if (!spec->int_mic.pin || !spec->ext_mic.pin)
1210 if (snd_BUG_ON(!spec->adc_nids))
1213 if (spec->dual_adc_switch) {
1214 alc_dual_mic_adc_auto_switch(codec);
1218 cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0];
1220 present = snd_hda_jack_detect(codec, spec->ext_mic.pin);
1222 alive = &spec->ext_mic;
1223 dead = &spec->int_mic;
1225 alive = &spec->int_mic;
1226 dead = &spec->ext_mic;
1229 type = get_wcaps_type(get_wcaps(codec, cap_nid));
1230 if (type == AC_WID_AUD_MIX) {
1231 /* Matrix-mixer style (e.g. ALC882) */
1232 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1235 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1237 HDA_AMP_MUTE, HDA_AMP_MUTE);
1239 /* MUX style (e.g. ALC880) */
1240 snd_hda_codec_write_cache(codec, cap_nid, 0,
1241 AC_VERB_SET_CONNECT_SEL,
1244 alc_report_jack(codec, spec->ext_mic.pin);
1246 /* FIXME: analog mixer */
1249 /* unsolicited event for HP jack sensing */
1250 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
1252 if (codec->vendor_id == 0x10ec0880)
1257 case ALC880_HP_EVENT:
1258 alc_automute_pin(codec);
1260 case ALC880_MIC_EVENT:
1261 alc_mic_automute(codec);
1266 static void alc_inithook(struct hda_codec *codec)
1268 alc_automute_pin(codec);
1269 alc_mic_automute(codec);
1272 /* additional initialization for ALC888 variants */
1273 static void alc888_coef_init(struct hda_codec *codec)
1277 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
1278 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1279 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1280 if ((tmp & 0xf0) == 0x20)
1282 snd_hda_codec_read(codec, 0x20, 0,
1283 AC_VERB_SET_PROC_COEF, 0x830);
1286 snd_hda_codec_read(codec, 0x20, 0,
1287 AC_VERB_SET_PROC_COEF, 0x3030);
1290 static void alc889_coef_init(struct hda_codec *codec)
1294 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1295 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1296 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1297 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010);
1300 /* turn on/off EAPD control (only if available) */
1301 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
1303 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
1305 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
1306 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
1310 static void alc_auto_init_amp(struct hda_codec *codec, int type)
1315 case ALC_INIT_GPIO1:
1316 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1318 case ALC_INIT_GPIO2:
1319 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1321 case ALC_INIT_GPIO3:
1322 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1324 case ALC_INIT_DEFAULT:
1325 switch (codec->vendor_id) {
1327 set_eapd(codec, 0x0f, 1);
1328 set_eapd(codec, 0x10, 1);
1341 set_eapd(codec, 0x14, 1);
1342 set_eapd(codec, 0x15, 1);
1345 switch (codec->vendor_id) {
1347 snd_hda_codec_write(codec, 0x1a, 0,
1348 AC_VERB_SET_COEF_INDEX, 7);
1349 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1350 AC_VERB_GET_PROC_COEF, 0);
1351 snd_hda_codec_write(codec, 0x1a, 0,
1352 AC_VERB_SET_COEF_INDEX, 7);
1353 snd_hda_codec_write(codec, 0x1a, 0,
1354 AC_VERB_SET_PROC_COEF,
1363 /*case 0x10ec0889:*/ /* this causes an SPDIF problem */
1364 alc889_coef_init(codec);
1367 alc888_coef_init(codec);
1369 #if 0 /* XXX: This may cause the silent output on speaker on some machines */
1372 snd_hda_codec_write(codec, 0x20, 0,
1373 AC_VERB_SET_COEF_INDEX, 7);
1374 tmp = snd_hda_codec_read(codec, 0x20, 0,
1375 AC_VERB_GET_PROC_COEF, 0);
1376 snd_hda_codec_write(codec, 0x20, 0,
1377 AC_VERB_SET_COEF_INDEX, 7);
1378 snd_hda_codec_write(codec, 0x20, 0,
1379 AC_VERB_SET_PROC_COEF,
1388 static void alc_init_auto_hp(struct hda_codec *codec)
1390 struct alc_spec *spec = codec->spec;
1391 struct auto_pin_cfg *cfg = &spec->autocfg;
1394 if (!cfg->hp_pins[0]) {
1395 if (cfg->line_out_type != AUTO_PIN_HP_OUT)
1399 if (!cfg->speaker_pins[0]) {
1400 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT)
1402 memcpy(cfg->speaker_pins, cfg->line_out_pins,
1403 sizeof(cfg->speaker_pins));
1404 cfg->speaker_outs = cfg->line_outs;
1407 if (!cfg->hp_pins[0]) {
1408 memcpy(cfg->hp_pins, cfg->line_out_pins,
1409 sizeof(cfg->hp_pins));
1410 cfg->hp_outs = cfg->line_outs;
1413 for (i = 0; i < cfg->hp_outs; i++) {
1414 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1416 snd_hda_codec_write_cache(codec, cfg->hp_pins[i], 0,
1417 AC_VERB_SET_UNSOLICITED_ENABLE,
1418 AC_USRSP_EN | ALC880_HP_EVENT);
1420 spec->unsol_event = alc_sku_unsol_event;
1423 static void alc_init_auto_mic(struct hda_codec *codec)
1425 struct alc_spec *spec = codec->spec;
1426 struct auto_pin_cfg *cfg = &spec->autocfg;
1427 hda_nid_t fixed, ext;
1430 /* there must be only two mic inputs exclusively */
1431 for (i = 0; i < cfg->num_inputs; i++)
1432 if (cfg->inputs[i].type >= AUTO_PIN_LINE_IN)
1436 for (i = 0; i < cfg->num_inputs; i++) {
1437 hda_nid_t nid = cfg->inputs[i].pin;
1438 unsigned int defcfg;
1439 defcfg = snd_hda_codec_get_pincfg(codec, nid);
1440 switch (snd_hda_get_input_pin_attr(defcfg)) {
1441 case INPUT_PIN_ATTR_INT:
1443 return; /* already occupied */
1446 case INPUT_PIN_ATTR_UNUSED:
1447 return; /* invalid entry */
1450 return; /* already occupied */
1457 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP))
1458 return; /* no unsol support */
1459 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n",
1461 spec->ext_mic.pin = ext;
1462 spec->int_mic.pin = fixed;
1463 spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1464 spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1466 snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0,
1467 AC_VERB_SET_UNSOLICITED_ENABLE,
1468 AC_USRSP_EN | ALC880_MIC_EVENT);
1469 spec->unsol_event = alc_sku_unsol_event;
1472 /* Could be any non-zero and even value. When used as fixup, tells
1473 * the driver to ignore any present sku defines.
1475 #define ALC_FIXUP_SKU_IGNORE (2)
1477 static int alc_auto_parse_customize_define(struct hda_codec *codec)
1479 unsigned int ass, tmp, i;
1481 struct alc_spec *spec = codec->spec;
1483 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
1485 if (spec->cdefine.fixup) {
1486 ass = spec->cdefine.sku_cfg;
1487 if (ass == ALC_FIXUP_SKU_IGNORE)
1492 ass = codec->subsystem_id & 0xffff;
1493 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
1497 if (codec->vendor_id == 0x10ec0260)
1499 ass = snd_hda_codec_get_pincfg(codec, nid);
1502 printk(KERN_INFO "hda_codec: %s: SKU not ready 0x%08x\n",
1503 codec->chip_name, ass);
1509 for (i = 1; i < 16; i++) {
1513 if (((ass >> 16) & 0xf) != tmp)
1516 spec->cdefine.port_connectivity = ass >> 30;
1517 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
1518 spec->cdefine.check_sum = (ass >> 16) & 0xf;
1519 spec->cdefine.customization = ass >> 8;
1521 spec->cdefine.sku_cfg = ass;
1522 spec->cdefine.external_amp = (ass & 0x38) >> 3;
1523 spec->cdefine.platform_type = (ass & 0x4) >> 2;
1524 spec->cdefine.swap = (ass & 0x2) >> 1;
1525 spec->cdefine.override = ass & 0x1;
1527 snd_printd("SKU: Nid=0x%x sku_cfg=0x%08x\n",
1528 nid, spec->cdefine.sku_cfg);
1529 snd_printd("SKU: port_connectivity=0x%x\n",
1530 spec->cdefine.port_connectivity);
1531 snd_printd("SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
1532 snd_printd("SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
1533 snd_printd("SKU: customization=0x%08x\n", spec->cdefine.customization);
1534 snd_printd("SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
1535 snd_printd("SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
1536 snd_printd("SKU: swap=0x%x\n", spec->cdefine.swap);
1537 snd_printd("SKU: override=0x%x\n", spec->cdefine.override);
1542 /* check subsystem ID and set up device-specific initialization;
1543 * return 1 if initialized, 0 if invalid SSID
1545 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1546 * 31 ~ 16 : Manufacture ID
1548 * 7 ~ 0 : Assembly ID
1549 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1551 static int alc_subsystem_id(struct hda_codec *codec,
1552 hda_nid_t porta, hda_nid_t porte,
1553 hda_nid_t portd, hda_nid_t porti)
1555 unsigned int ass, tmp, i;
1557 struct alc_spec *spec = codec->spec;
1559 if (spec->cdefine.fixup) {
1560 ass = spec->cdefine.sku_cfg;
1561 if (ass == ALC_FIXUP_SKU_IGNORE)
1566 ass = codec->subsystem_id & 0xffff;
1567 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1570 /* invalid SSID, check the special NID pin defcfg instead */
1572 * 31~30 : port connectivity
1575 * 19~16 : Check sum (15:1)
1580 if (codec->vendor_id == 0x10ec0260)
1582 ass = snd_hda_codec_get_pincfg(codec, nid);
1583 snd_printd("realtek: No valid SSID, "
1584 "checking pincfg 0x%08x for NID 0x%x\n",
1588 if ((ass >> 30) != 1) /* no physical connection */
1593 for (i = 1; i < 16; i++) {
1597 if (((ass >> 16) & 0xf) != tmp)
1600 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1601 ass & 0xffff, codec->vendor_id);
1605 * 2 : 0 --> Desktop, 1 --> Laptop
1606 * 3~5 : External Amplifier control
1609 tmp = (ass & 0x38) >> 3; /* external Amp control */
1612 spec->init_amp = ALC_INIT_GPIO1;
1615 spec->init_amp = ALC_INIT_GPIO2;
1618 spec->init_amp = ALC_INIT_GPIO3;
1622 spec->init_amp = ALC_INIT_DEFAULT;
1626 /* is laptop or Desktop and enable the function "Mute internal speaker
1627 * when the external headphone out jack is plugged"
1629 if (!(ass & 0x8000))
1632 * 10~8 : Jack location
1633 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1635 * 15 : 1 --> enable the function "Mute internal speaker
1636 * when the external headphone out jack is plugged"
1638 if (!spec->autocfg.hp_pins[0]) {
1640 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1651 for (i = 0; i < spec->autocfg.line_outs; i++)
1652 if (spec->autocfg.line_out_pins[i] == nid)
1654 spec->autocfg.hp_pins[0] = nid;
1657 alc_init_auto_hp(codec);
1658 alc_init_auto_mic(codec);
1662 static void alc_ssid_check(struct hda_codec *codec,
1663 hda_nid_t porta, hda_nid_t porte,
1664 hda_nid_t portd, hda_nid_t porti)
1666 if (!alc_subsystem_id(codec, porta, porte, portd, porti)) {
1667 struct alc_spec *spec = codec->spec;
1668 snd_printd("realtek: "
1669 "Enable default setup for auto mode as fallback\n");
1670 spec->init_amp = ALC_INIT_DEFAULT;
1671 alc_init_auto_hp(codec);
1672 alc_init_auto_mic(codec);
1677 * Fix-up pin default configurations and add default verbs
1685 struct alc_model_fixup {
1696 const struct alc_pincfg *pins;
1697 const struct hda_verb *verbs;
1698 void (*func)(struct hda_codec *codec,
1699 const struct alc_fixup *fix,
1713 ALC_FIXUP_ACT_PRE_PROBE,
1714 ALC_FIXUP_ACT_PROBE,
1718 static void alc_apply_fixup(struct hda_codec *codec, int action)
1720 struct alc_spec *spec = codec->spec;
1721 int id = spec->fixup_id;
1722 #ifdef CONFIG_SND_DEBUG_VERBOSE
1723 const char *modelname = spec->fixup_name;
1727 if (!spec->fixup_list)
1731 const struct alc_fixup *fix = spec->fixup_list + id;
1732 const struct alc_pincfg *cfg;
1734 switch (fix->type) {
1736 if (action != ALC_FIXUP_ACT_PRE_PROBE || !fix->v.sku)
1738 snd_printdd(KERN_INFO "hda_codec: %s: "
1739 "Apply sku override for %s\n",
1740 codec->chip_name, modelname);
1741 spec->cdefine.sku_cfg = fix->v.sku;
1742 spec->cdefine.fixup = 1;
1744 case ALC_FIXUP_PINS:
1746 if (action != ALC_FIXUP_ACT_PRE_PROBE || !cfg)
1748 snd_printdd(KERN_INFO "hda_codec: %s: "
1749 "Apply pincfg for %s\n",
1750 codec->chip_name, modelname);
1751 for (; cfg->nid; cfg++)
1752 snd_hda_codec_set_pincfg(codec, cfg->nid,
1755 case ALC_FIXUP_VERBS:
1756 if (action != ALC_FIXUP_ACT_PROBE || !fix->v.verbs)
1758 snd_printdd(KERN_INFO "hda_codec: %s: "
1759 "Apply fix-verbs for %s\n",
1760 codec->chip_name, modelname);
1761 add_verb(codec->spec, fix->v.verbs);
1763 case ALC_FIXUP_FUNC:
1766 snd_printdd(KERN_INFO "hda_codec: %s: "
1767 "Apply fix-func for %s\n",
1768 codec->chip_name, modelname);
1769 fix->v.func(codec, fix, action);
1772 snd_printk(KERN_ERR "hda_codec: %s: "
1773 "Invalid fixup type %d\n",
1774 codec->chip_name, fix->type);
1777 if (!fix[id].chained)
1781 id = fix[id].chain_id;
1785 static void alc_pick_fixup(struct hda_codec *codec,
1786 const struct alc_model_fixup *models,
1787 const struct snd_pci_quirk *quirk,
1788 const struct alc_fixup *fixlist)
1790 struct alc_spec *spec = codec->spec;
1792 const char *name = NULL;
1794 if (codec->modelname && models) {
1795 while (models->name) {
1796 if (!strcmp(codec->modelname, models->name)) {
1798 name = models->name;
1805 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1808 #ifdef CONFIG_SND_DEBUG_VERBOSE
1814 spec->fixup_id = id;
1816 spec->fixup_list = fixlist;
1817 spec->fixup_name = name;
1821 static int alc_read_coef_idx(struct hda_codec *codec,
1822 unsigned int coef_idx)
1825 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX,
1827 val = snd_hda_codec_read(codec, 0x20, 0,
1828 AC_VERB_GET_PROC_COEF, 0);
1832 static void alc_write_coef_idx(struct hda_codec *codec, unsigned int coef_idx,
1833 unsigned int coef_val)
1835 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX,
1837 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF,
1841 /* set right pin controls for digital I/O */
1842 static void alc_auto_init_digital(struct hda_codec *codec)
1844 struct alc_spec *spec = codec->spec;
1848 for (i = 0; i < spec->autocfg.dig_outs; i++) {
1849 pin = spec->autocfg.dig_out_pins[i];
1851 snd_hda_codec_write(codec, pin, 0,
1852 AC_VERB_SET_PIN_WIDGET_CONTROL,
1856 pin = spec->autocfg.dig_in_pin;
1858 snd_hda_codec_write(codec, pin, 0,
1859 AC_VERB_SET_PIN_WIDGET_CONTROL,
1863 /* parse digital I/Os and set up NIDs in BIOS auto-parse mode */
1864 static void alc_auto_parse_digital(struct hda_codec *codec)
1866 struct alc_spec *spec = codec->spec;
1870 /* support multiple SPDIFs; the secondary is set up as a slave */
1871 for (i = 0; i < spec->autocfg.dig_outs; i++) {
1872 err = snd_hda_get_connections(codec,
1873 spec->autocfg.dig_out_pins[i],
1878 spec->multiout.dig_out_nid = dig_nid;
1879 spec->dig_out_type = spec->autocfg.dig_out_type[0];
1881 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
1882 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
1884 spec->slave_dig_outs[i - 1] = dig_nid;
1888 if (spec->autocfg.dig_in_pin) {
1889 dig_nid = codec->start_nid;
1890 for (i = 0; i < codec->num_nodes; i++, dig_nid++) {
1891 unsigned int wcaps = get_wcaps(codec, dig_nid);
1892 if (get_wcaps_type(wcaps) != AC_WID_AUD_IN)
1894 if (!(wcaps & AC_WCAP_DIGITAL))
1896 if (!(wcaps & AC_WCAP_CONN_LIST))
1898 err = get_connection_index(codec, dig_nid,
1899 spec->autocfg.dig_in_pin);
1901 spec->dig_in_nid = dig_nid;
1915 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1916 /* Mic-in jack as mic in */
1917 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1918 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1919 /* Line-in jack as Line in */
1920 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1921 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1922 /* Line-Out as Front */
1923 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1930 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1931 /* Mic-in jack as mic in */
1932 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1933 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1934 /* Line-in jack as Surround */
1935 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1936 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1937 /* Line-Out as Front */
1938 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1945 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1946 /* Mic-in jack as CLFE */
1947 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1948 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1949 /* Line-in jack as Surround */
1950 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1951 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1952 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1953 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1960 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1961 /* Mic-in jack as CLFE */
1962 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1963 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1964 /* Line-in jack as Surround */
1965 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1966 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1967 /* Line-Out as Side */
1968 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1972 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1973 { 2, alc888_4ST_ch2_intel_init },
1974 { 4, alc888_4ST_ch4_intel_init },
1975 { 6, alc888_4ST_ch6_intel_init },
1976 { 8, alc888_4ST_ch8_intel_init },
1980 * ALC888 Fujitsu Siemens Amillo xa3530
1983 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1984 /* Front Mic: set to PIN_IN (empty by default) */
1985 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1986 /* Connect Internal HP to Front */
1987 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1988 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1989 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1990 /* Connect Bass HP to Front */
1991 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1992 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1993 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1994 /* Connect Line-Out side jack (SPDIF) to Side */
1995 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1996 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1997 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1998 /* Connect Mic jack to CLFE */
1999 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2000 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2001 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
2002 /* Connect Line-in jack to Surround */
2003 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2004 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2005 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
2006 /* Connect HP out jack to Front */
2007 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2008 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2009 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2010 /* Enable unsolicited event for HP jack and Line-out jack */
2011 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2012 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2016 static void alc_automute_amp(struct hda_codec *codec)
2018 alc_automute_speaker(codec, 0);
2021 static void alc_automute_amp_unsol_event(struct hda_codec *codec,
2024 if (codec->vendor_id == 0x10ec0880)
2028 if (res == ALC880_HP_EVENT)
2029 alc_automute_amp(codec);
2032 static void alc889_automute_setup(struct hda_codec *codec)
2034 struct alc_spec *spec = codec->spec;
2036 spec->autocfg.hp_pins[0] = 0x15;
2037 spec->autocfg.speaker_pins[0] = 0x14;
2038 spec->autocfg.speaker_pins[1] = 0x16;
2039 spec->autocfg.speaker_pins[2] = 0x17;
2040 spec->autocfg.speaker_pins[3] = 0x19;
2041 spec->autocfg.speaker_pins[4] = 0x1a;
2044 static void alc889_intel_init_hook(struct hda_codec *codec)
2046 alc889_coef_init(codec);
2047 alc_automute_amp(codec);
2050 static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec)
2052 struct alc_spec *spec = codec->spec;
2054 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
2055 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
2056 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
2057 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
2061 * ALC888 Acer Aspire 4930G model
2064 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
2065 /* Front Mic: set to PIN_IN (empty by default) */
2066 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2067 /* Unselect Front Mic by default in input mixer 3 */
2068 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
2069 /* Enable unsolicited event for HP jack */
2070 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2071 /* Connect Internal HP to front */
2072 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2073 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2074 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
2075 /* Connect HP out to front */
2076 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2077 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2078 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2079 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
2084 * ALC888 Acer Aspire 6530G model
2087 static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
2088 /* Route to built-in subwoofer as well as speakers */
2089 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2090 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2091 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2092 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2093 /* Bias voltage on for external mic port */
2094 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
2095 /* Front Mic: set to PIN_IN (empty by default) */
2096 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2097 /* Unselect Front Mic by default in input mixer 3 */
2098 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
2099 /* Enable unsolicited event for HP jack */
2100 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2101 /* Enable speaker output */
2102 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2103 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2104 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
2105 /* Enable headphone output */
2106 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
2107 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2108 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2109 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
2114 *ALC888 Acer Aspire 7730G model
2117 static struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
2118 /* Bias voltage on for external mic port */
2119 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
2120 /* Front Mic: set to PIN_IN (empty by default) */
2121 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2122 /* Unselect Front Mic by default in input mixer 3 */
2123 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
2124 /* Enable unsolicited event for HP jack */
2125 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2126 /* Enable speaker output */
2127 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2128 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2129 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
2130 /* Enable headphone output */
2131 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
2132 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2133 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2134 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
2135 /*Enable internal subwoofer */
2136 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2137 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2138 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
2139 {0x17, AC_VERB_SET_EAPD_BTLENABLE, 2},
2144 * ALC889 Acer Aspire 8930G model
2147 static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
2148 /* Front Mic: set to PIN_IN (empty by default) */
2149 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2150 /* Unselect Front Mic by default in input mixer 3 */
2151 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
2152 /* Enable unsolicited event for HP jack */
2153 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2154 /* Connect Internal Front to Front */
2155 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2156 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2157 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
2158 /* Connect Internal Rear to Rear */
2159 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2160 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2161 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
2162 /* Connect Internal CLFE to CLFE */
2163 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2164 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2165 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
2166 /* Connect HP out to Front */
2167 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
2168 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2169 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2170 /* Enable all DACs */
2171 /* DAC DISABLE/MUTE 1? */
2172 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
2173 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
2174 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
2175 /* DAC DISABLE/MUTE 2? */
2176 /* some bit here disables the other DACs. Init=0x4900 */
2177 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
2178 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
2180 * This laptop has a stereo digital microphone. The mics are only 1cm apart
2181 * which makes the stereo useless. However, either the mic or the ALC889
2182 * makes the signal become a difference/sum signal instead of standard
2183 * stereo, which is annoying. So instead we flip this bit which makes the
2184 * codec replicate the sum signal to both channels, turning it into a
2187 /* DMIC_CONTROL? Init value = 0x0001 */
2188 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
2189 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
2193 static struct hda_input_mux alc888_2_capture_sources[2] = {
2194 /* Front mic only available on one ADC */
2201 { "Front Mic", 0xb },
2214 static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
2215 /* Interal mic only available on one ADC */
2222 { "Input Mix", 0xa },
2223 { "Internal Mic", 0xb },
2232 { "Input Mix", 0xa },
2237 static struct hda_input_mux alc889_capture_sources[3] = {
2238 /* Digital mic only available on first "ADC" */
2245 { "Front Mic", 0xb },
2246 { "Input Mix", 0xa },
2255 { "Input Mix", 0xa },
2264 { "Input Mix", 0xa },
2269 static struct snd_kcontrol_new alc888_base_mixer[] = {
2270 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2271 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2272 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2273 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2274 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
2276 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2277 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2278 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2279 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2280 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2281 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2282 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2283 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2284 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2285 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2286 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
2287 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2291 static struct snd_kcontrol_new alc888_acer_aspire_4930g_mixer[] = {
2292 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2293 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2294 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2295 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2296 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0f, 2, 0x0,
2298 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0f, 2, 2, HDA_INPUT),
2299 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0f, 1, 0x0, HDA_OUTPUT),
2300 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0f, 1, 2, HDA_INPUT),
2301 HDA_CODEC_VOLUME("Side Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
2302 HDA_BIND_MUTE("Side Playback Switch", 0x0e, 2, HDA_INPUT),
2303 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2304 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2305 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2306 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2307 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2308 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
2309 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2314 static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = {
2315 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2316 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2317 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2318 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2319 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
2321 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2322 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2323 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2324 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2325 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2326 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2327 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
2328 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2333 static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
2335 struct alc_spec *spec = codec->spec;
2337 spec->autocfg.hp_pins[0] = 0x15;
2338 spec->autocfg.speaker_pins[0] = 0x14;
2339 spec->autocfg.speaker_pins[1] = 0x16;
2340 spec->autocfg.speaker_pins[2] = 0x17;
2343 static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
2345 struct alc_spec *spec = codec->spec;
2347 spec->autocfg.hp_pins[0] = 0x15;
2348 spec->autocfg.speaker_pins[0] = 0x14;
2349 spec->autocfg.speaker_pins[1] = 0x16;
2350 spec->autocfg.speaker_pins[2] = 0x17;
2353 static void alc888_acer_aspire_7730g_setup(struct hda_codec *codec)
2355 struct alc_spec *spec = codec->spec;
2357 spec->autocfg.hp_pins[0] = 0x15;
2358 spec->autocfg.speaker_pins[0] = 0x14;
2359 spec->autocfg.speaker_pins[1] = 0x16;
2360 spec->autocfg.speaker_pins[2] = 0x17;
2363 static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
2365 struct alc_spec *spec = codec->spec;
2367 spec->autocfg.hp_pins[0] = 0x15;
2368 spec->autocfg.speaker_pins[0] = 0x14;
2369 spec->autocfg.speaker_pins[1] = 0x16;
2370 spec->autocfg.speaker_pins[2] = 0x1b;
2374 * ALC880 3-stack model
2376 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
2377 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
2378 * F-Mic = 0x1b, HP = 0x19
2381 static hda_nid_t alc880_dac_nids[4] = {
2382 /* front, rear, clfe, rear_surr */
2383 0x02, 0x05, 0x04, 0x03
2386 static hda_nid_t alc880_adc_nids[3] = {
2391 /* The datasheet says the node 0x07 is connected from inputs,
2392 * but it shows zero connection in the real implementation on some devices.
2393 * Note: this is a 915GAV bug, fixed on 915GLV
2395 static hda_nid_t alc880_adc_nids_alt[2] = {
2400 #define ALC880_DIGOUT_NID 0x06
2401 #define ALC880_DIGIN_NID 0x0a
2403 static struct hda_input_mux alc880_capture_source = {
2407 { "Front Mic", 0x3 },
2413 /* channel source setting (2/6 channel selection for 3-stack) */
2415 static struct hda_verb alc880_threestack_ch2_init[] = {
2416 /* set line-in to input, mute it */
2417 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2418 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2419 /* set mic-in to input vref 80%, mute it */
2420 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2421 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2426 static struct hda_verb alc880_threestack_ch6_init[] = {
2427 /* set line-in to output, unmute it */
2428 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2429 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2430 /* set mic-in to output, unmute it */
2431 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2432 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2436 static struct hda_channel_mode alc880_threestack_modes[2] = {
2437 { 2, alc880_threestack_ch2_init },
2438 { 6, alc880_threestack_ch6_init },
2441 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
2442 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2443 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2444 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2445 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2446 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2447 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2448 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2449 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2450 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2451 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2452 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2453 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2454 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2455 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2456 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
2457 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
2458 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
2460 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2461 .name = "Channel Mode",
2462 .info = alc_ch_mode_info,
2463 .get = alc_ch_mode_get,
2464 .put = alc_ch_mode_put,
2469 /* capture mixer elements */
2470 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
2471 struct snd_ctl_elem_info *uinfo)
2473 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2474 struct alc_spec *spec = codec->spec;
2477 mutex_lock(&codec->control_mutex);
2478 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
2480 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
2481 mutex_unlock(&codec->control_mutex);
2485 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
2486 unsigned int size, unsigned int __user *tlv)
2488 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2489 struct alc_spec *spec = codec->spec;
2492 mutex_lock(&codec->control_mutex);
2493 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
2495 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
2496 mutex_unlock(&codec->control_mutex);
2500 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
2501 struct snd_ctl_elem_value *ucontrol);
2503 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
2504 struct snd_ctl_elem_value *ucontrol,
2507 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2508 struct alc_spec *spec = codec->spec;
2509 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
2512 mutex_lock(&codec->control_mutex);
2513 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
2515 err = func(kcontrol, ucontrol);
2516 mutex_unlock(&codec->control_mutex);
2520 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
2521 struct snd_ctl_elem_value *ucontrol)
2523 return alc_cap_getput_caller(kcontrol, ucontrol,
2524 snd_hda_mixer_amp_volume_get);
2527 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
2528 struct snd_ctl_elem_value *ucontrol)
2530 return alc_cap_getput_caller(kcontrol, ucontrol,
2531 snd_hda_mixer_amp_volume_put);
2534 /* capture mixer elements */
2535 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
2537 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
2538 struct snd_ctl_elem_value *ucontrol)
2540 return alc_cap_getput_caller(kcontrol, ucontrol,
2541 snd_hda_mixer_amp_switch_get);
2544 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
2545 struct snd_ctl_elem_value *ucontrol)
2547 return alc_cap_getput_caller(kcontrol, ucontrol,
2548 snd_hda_mixer_amp_switch_put);
2551 #define _DEFINE_CAPMIX(num) \
2553 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2554 .name = "Capture Switch", \
2555 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
2557 .info = alc_cap_sw_info, \
2558 .get = alc_cap_sw_get, \
2559 .put = alc_cap_sw_put, \
2562 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2563 .name = "Capture Volume", \
2564 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
2565 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
2566 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
2568 .info = alc_cap_vol_info, \
2569 .get = alc_cap_vol_get, \
2570 .put = alc_cap_vol_put, \
2571 .tlv = { .c = alc_cap_vol_tlv }, \
2574 #define _DEFINE_CAPSRC(num) \
2576 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2577 /* .name = "Capture Source", */ \
2578 .name = "Input Source", \
2580 .info = alc_mux_enum_info, \
2581 .get = alc_mux_enum_get, \
2582 .put = alc_mux_enum_put, \
2585 #define DEFINE_CAPMIX(num) \
2586 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2587 _DEFINE_CAPMIX(num), \
2588 _DEFINE_CAPSRC(num), \
2592 #define DEFINE_CAPMIX_NOSRC(num) \
2593 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2594 _DEFINE_CAPMIX(num), \
2598 /* up to three ADCs */
2602 DEFINE_CAPMIX_NOSRC(1);
2603 DEFINE_CAPMIX_NOSRC(2);
2604 DEFINE_CAPMIX_NOSRC(3);
2607 * ALC880 5-stack model
2609 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2611 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2612 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2615 /* additional mixers to alc880_three_stack_mixer */
2616 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2617 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2618 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2622 /* channel source setting (6/8 channel selection for 5-stack) */
2624 static struct hda_verb alc880_fivestack_ch6_init[] = {
2625 /* set line-in to input, mute it */
2626 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2627 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2632 static struct hda_verb alc880_fivestack_ch8_init[] = {
2633 /* set line-in to output, unmute it */
2634 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2635 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2639 static struct hda_channel_mode alc880_fivestack_modes[2] = {
2640 { 6, alc880_fivestack_ch6_init },
2641 { 8, alc880_fivestack_ch8_init },
2646 * ALC880 6-stack model
2648 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2649 * Side = 0x05 (0x0f)
2650 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2651 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2654 static hda_nid_t alc880_6st_dac_nids[4] = {
2655 /* front, rear, clfe, rear_surr */
2656 0x02, 0x03, 0x04, 0x05
2659 static struct hda_input_mux alc880_6stack_capture_source = {
2663 { "Front Mic", 0x1 },
2669 /* fixed 8-channels */
2670 static struct hda_channel_mode alc880_sixstack_modes[1] = {
2674 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2675 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2676 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2677 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2678 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2679 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2680 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2681 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2682 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2683 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2684 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2685 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2686 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2687 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2688 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2689 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2690 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2691 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2692 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2694 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2695 .name = "Channel Mode",
2696 .info = alc_ch_mode_info,
2697 .get = alc_ch_mode_get,
2698 .put = alc_ch_mode_put,
2707 * W810 has rear IO for:
2710 * Center/LFE (DAC 04)
2713 * The system also has a pair of internal speakers, and a headphone jack.
2714 * These are both connected to Line2 on the codec, hence to DAC 02.
2716 * There is a variable resistor to control the speaker or headphone
2717 * volume. This is a hardware-only device without a software API.
2719 * Plugging headphones in will disable the internal speakers. This is
2720 * implemented in hardware, not via the driver using jack sense. In
2721 * a similar fashion, plugging into the rear socket marked "front" will
2722 * disable both the speakers and headphones.
2724 * For input, there's a microphone jack, and an "audio in" jack.
2725 * These may not do anything useful with this driver yet, because I
2726 * haven't setup any initialization verbs for these yet...
2729 static hda_nid_t alc880_w810_dac_nids[3] = {
2730 /* front, rear/surround, clfe */
2734 /* fixed 6 channels */
2735 static struct hda_channel_mode alc880_w810_modes[1] = {
2739 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2740 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2741 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2742 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2743 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2744 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2745 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2746 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2747 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2748 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2749 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2757 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2758 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2762 static hda_nid_t alc880_z71v_dac_nids[1] = {
2765 #define ALC880_Z71V_HP_DAC 0x03
2767 /* fixed 2 channels */
2768 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2772 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2773 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2774 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2775 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2776 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2777 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2778 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2779 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2780 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2786 * ALC880 F1734 model
2788 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2789 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2792 static hda_nid_t alc880_f1734_dac_nids[1] = {
2795 #define ALC880_F1734_HP_DAC 0x02
2797 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2798 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2799 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2800 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2801 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2802 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2803 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2804 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2805 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2809 static struct hda_input_mux alc880_f1734_capture_source = {
2821 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2822 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2823 * Mic = 0x18, Line = 0x1a
2826 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2827 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2829 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2830 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2831 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2832 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2833 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2834 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2835 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2836 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2837 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2838 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2839 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2840 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2841 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2842 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2843 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2845 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2846 .name = "Channel Mode",
2847 .info = alc_ch_mode_info,
2848 .get = alc_ch_mode_get,
2849 .put = alc_ch_mode_put,
2855 * ALC880 ASUS W1V model
2857 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2858 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2859 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2862 /* additional mixers to alc880_asus_mixer */
2863 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2864 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2865 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2870 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2871 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2872 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2873 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2874 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2875 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2876 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2877 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2878 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2879 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2884 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2885 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2886 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2887 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2888 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2889 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2890 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2891 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2892 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2893 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2894 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2895 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2896 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2897 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2898 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2899 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2900 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2902 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2903 .name = "Channel Mode",
2904 .info = alc_ch_mode_info,
2905 .get = alc_ch_mode_get,
2906 .put = alc_ch_mode_put,
2911 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2912 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2913 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2914 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2915 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 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("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2919 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2920 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2921 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2925 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2926 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2927 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2928 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2929 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2930 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2931 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2936 * virtual master controls
2940 * slave controls for virtual master
2942 static const char * const alc_slave_vols[] = {
2943 "Front Playback Volume",
2944 "Surround Playback Volume",
2945 "Center Playback Volume",
2946 "LFE Playback Volume",
2947 "Side Playback Volume",
2948 "Headphone Playback Volume",
2949 "Speaker Playback Volume",
2950 "Mono Playback Volume",
2951 "Line-Out Playback Volume",
2952 "PCM Playback Volume",
2956 static const char * const alc_slave_sws[] = {
2957 "Front Playback Switch",
2958 "Surround Playback Switch",
2959 "Center Playback Switch",
2960 "LFE Playback Switch",
2961 "Side Playback Switch",
2962 "Headphone Playback Switch",
2963 "Speaker Playback Switch",
2964 "Mono Playback Switch",
2965 "IEC958 Playback Switch",
2966 "Line-Out Playback Switch",
2967 "PCM Playback Switch",
2972 * build control elements
2975 #define NID_MAPPING (-1)
2977 #define SUBDEV_SPEAKER_ (0 << 6)
2978 #define SUBDEV_HP_ (1 << 6)
2979 #define SUBDEV_LINE_ (2 << 6)
2980 #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f))
2981 #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f))
2982 #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f))
2984 static void alc_free_kctls(struct hda_codec *codec);
2986 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2987 /* additional beep mixers; the actual parameters are overwritten at build */
2988 static struct snd_kcontrol_new alc_beep_mixer[] = {
2989 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2990 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
2995 static int alc_build_controls(struct hda_codec *codec)
2997 struct alc_spec *spec = codec->spec;
2998 struct snd_kcontrol *kctl = NULL;
2999 struct snd_kcontrol_new *knew;
3004 for (i = 0; i < spec->num_mixers; i++) {
3005 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
3009 if (spec->cap_mixer) {
3010 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
3014 if (spec->multiout.dig_out_nid) {
3015 err = snd_hda_create_spdif_out_ctls(codec,
3016 spec->multiout.dig_out_nid);
3019 if (!spec->no_analog) {
3020 err = snd_hda_create_spdif_share_sw(codec,
3024 spec->multiout.share_spdif = 1;
3027 if (spec->dig_in_nid) {
3028 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
3033 #ifdef CONFIG_SND_HDA_INPUT_BEEP
3034 /* create beep controls if needed */
3035 if (spec->beep_amp) {
3036 struct snd_kcontrol_new *knew;
3037 for (knew = alc_beep_mixer; knew->name; knew++) {
3038 struct snd_kcontrol *kctl;
3039 kctl = snd_ctl_new1(knew, codec);
3042 kctl->private_value = spec->beep_amp;
3043 err = snd_hda_ctl_add(codec, 0, kctl);
3050 /* if we have no master control, let's create it */
3051 if (!spec->no_analog &&
3052 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
3053 unsigned int vmaster_tlv[4];
3054 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
3055 HDA_OUTPUT, vmaster_tlv);
3056 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
3057 vmaster_tlv, alc_slave_vols);
3061 if (!spec->no_analog &&
3062 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
3063 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
3064 NULL, alc_slave_sws);
3069 /* assign Capture Source enums to NID */
3070 if (spec->capsrc_nids || spec->adc_nids) {
3071 kctl = snd_hda_find_mixer_ctl(codec, "Capture Source");
3073 kctl = snd_hda_find_mixer_ctl(codec, "Input Source");
3074 for (i = 0; kctl && i < kctl->count; i++) {
3075 hda_nid_t *nids = spec->capsrc_nids;
3077 nids = spec->adc_nids;
3078 err = snd_hda_add_nid(codec, kctl, i, nids[i]);
3083 if (spec->cap_mixer) {
3084 const char *kname = kctl ? kctl->id.name : NULL;
3085 for (knew = spec->cap_mixer; knew->name; knew++) {
3086 if (kname && strcmp(knew->name, kname) == 0)
3088 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
3089 for (i = 0; kctl && i < kctl->count; i++) {
3090 err = snd_hda_add_nid(codec, kctl, i,
3098 /* other nid->control mapping */
3099 for (i = 0; i < spec->num_mixers; i++) {
3100 for (knew = spec->mixers[i]; knew->name; knew++) {
3101 if (knew->iface != NID_MAPPING)
3103 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
3106 u = knew->subdevice;
3107 for (j = 0; j < 4; j++, u >>= 8) {
3112 case SUBDEV_SPEAKER_:
3113 nid = spec->autocfg.speaker_pins[nid];
3116 nid = spec->autocfg.line_out_pins[nid];
3119 nid = spec->autocfg.hp_pins[nid];
3124 err = snd_hda_add_nid(codec, kctl, 0, nid);
3128 u = knew->private_value;
3129 for (j = 0; j < 4; j++, u >>= 8) {
3133 err = snd_hda_add_nid(codec, kctl, 0, nid);
3140 alc_free_kctls(codec); /* no longer needed */
3147 * initialize the codec volumes, etc
3151 * generic initialization of ADC, input mixers and output mixers
3153 static struct hda_verb alc880_volume_init_verbs[] = {
3155 * Unmute ADC0-2 and set the default input to mic-in
3157 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3158 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3159 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3160 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3161 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3162 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3164 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
3166 * Note: PASD motherboards uses the Line In 2 as the input for front
3169 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
3170 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3171 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3172 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3173 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3174 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3175 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3176 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3179 * Set up output mixers (0x0c - 0x0f)
3181 /* set vol=0 to output mixers */
3182 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3183 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3184 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3185 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3186 /* set up input amps for analog loopback */
3187 /* Amp Indices: DAC = 0, mixer = 1 */
3188 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3189 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3190 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3191 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3192 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3193 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3194 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3195 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3201 * 3-stack pin configuration:
3202 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
3204 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
3206 * preset connection lists of input pins
3207 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
3209 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3210 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3211 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3214 * Set pin mode and muting
3216 /* set front pin widgets 0x14 for output */
3217 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3218 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3219 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3220 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3221 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3222 /* Mic2 (as headphone out) for HP output */
3223 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3224 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3225 /* Line In pin widget for input */
3226 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3227 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3228 /* Line2 (as front mic) pin widget for input and vref at 80% */
3229 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3230 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3231 /* CD pin widget for input */
3232 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3238 * 5-stack pin configuration:
3239 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
3240 * line-in/side = 0x1a, f-mic = 0x1b
3242 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
3244 * preset connection lists of input pins
3245 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
3247 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3248 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
3251 * Set pin mode and muting
3253 /* set pin widgets 0x14-0x17 for output */
3254 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3255 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3256 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3257 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3258 /* unmute pins for output (no gain on this amp) */
3259 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3260 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3261 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3262 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3264 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3265 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3266 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3267 /* Mic2 (as headphone out) for HP output */
3268 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3269 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3270 /* Line In pin widget for input */
3271 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3272 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3273 /* Line2 (as front mic) pin widget for input and vref at 80% */
3274 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3275 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3276 /* CD pin widget for input */
3277 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3283 * W810 pin configuration:
3284 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
3286 static struct hda_verb alc880_pin_w810_init_verbs[] = {
3287 /* hphone/speaker input selector: front DAC */
3288 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
3290 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3291 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3292 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3293 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3294 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3295 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3297 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3298 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3304 * Z71V pin configuration:
3305 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
3307 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
3308 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3309 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3310 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3311 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3313 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3314 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3315 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3316 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3322 * 6-stack pin configuration:
3323 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
3324 * f-mic = 0x19, line = 0x1a, HP = 0x1b
3326 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
3327 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3329 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3330 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3331 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3332 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3333 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3334 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3335 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3336 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3338 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3339 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3340 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3341 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3342 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3343 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3344 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3345 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3346 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3352 * Uniwill pin configuration:
3353 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
3356 static struct hda_verb alc880_uniwill_init_verbs[] = {
3357 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3359 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3360 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3361 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3362 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3363 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3364 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3365 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3366 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3367 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3368 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3369 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3370 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3371 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3372 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3374 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3375 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3376 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3377 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3378 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3379 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3380 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
3381 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
3382 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3384 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3385 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
3392 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
3394 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
3395 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3397 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3398 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3399 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3400 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3401 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3402 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3403 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3404 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3405 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3406 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3407 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3408 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3410 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3411 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3412 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3413 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3414 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3415 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3417 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3418 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
3423 static struct hda_verb alc880_beep_init_verbs[] = {
3424 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
3428 /* auto-toggle front mic */
3429 static void alc88x_simple_mic_automute(struct hda_codec *codec)
3431 unsigned int present;
3434 present = snd_hda_jack_detect(codec, 0x18);
3435 bits = present ? HDA_AMP_MUTE : 0;
3436 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
3439 static void alc880_uniwill_setup(struct hda_codec *codec)
3441 struct alc_spec *spec = codec->spec;
3443 spec->autocfg.hp_pins[0] = 0x14;
3444 spec->autocfg.speaker_pins[0] = 0x15;
3445 spec->autocfg.speaker_pins[0] = 0x16;
3448 static void alc880_uniwill_init_hook(struct hda_codec *codec)
3450 alc_automute_amp(codec);
3451 alc88x_simple_mic_automute(codec);
3454 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
3457 /* Looks like the unsol event is incompatible with the standard
3458 * definition. 4bit tag is placed at 28 bit!
3460 switch (res >> 28) {
3461 case ALC880_MIC_EVENT:
3462 alc88x_simple_mic_automute(codec);
3465 alc_automute_amp_unsol_event(codec, res);
3470 static void alc880_uniwill_p53_setup(struct hda_codec *codec)
3472 struct alc_spec *spec = codec->spec;
3474 spec->autocfg.hp_pins[0] = 0x14;
3475 spec->autocfg.speaker_pins[0] = 0x15;
3478 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
3480 unsigned int present;
3482 present = snd_hda_codec_read(codec, 0x21, 0,
3483 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
3484 present &= HDA_AMP_VOLMASK;
3485 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
3486 HDA_AMP_VOLMASK, present);
3487 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
3488 HDA_AMP_VOLMASK, present);
3491 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
3494 /* Looks like the unsol event is incompatible with the standard
3495 * definition. 4bit tag is placed at 28 bit!
3497 if ((res >> 28) == ALC880_DCVOL_EVENT)
3498 alc880_uniwill_p53_dcvol_automute(codec);
3500 alc_automute_amp_unsol_event(codec, res);
3504 * F1734 pin configuration:
3505 * HP = 0x14, speaker-out = 0x15, mic = 0x18
3507 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
3508 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
3509 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3510 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3511 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3512 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3514 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3515 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3516 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3517 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3519 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3520 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3521 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
3522 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3523 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3524 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3525 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3526 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3527 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3529 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
3530 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
3536 * ASUS pin configuration:
3537 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
3539 static struct hda_verb alc880_pin_asus_init_verbs[] = {
3540 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3541 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3542 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3543 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3545 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3546 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3547 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3548 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3549 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3550 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3551 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3552 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3554 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3555 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3556 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3557 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3558 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3559 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3560 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3561 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3562 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3567 /* Enable GPIO mask and set output */
3568 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
3569 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
3570 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
3572 /* Clevo m520g init */
3573 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
3574 /* headphone output */
3575 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3577 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3578 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3580 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3581 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3583 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3584 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3585 /* Mic1 (rear panel) */
3586 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3587 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3588 /* Mic2 (front panel) */
3589 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3590 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3592 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3593 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3594 /* change to EAPD mode */
3595 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3596 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3601 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
3602 /* change to EAPD mode */
3603 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3604 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3606 /* Headphone output */
3607 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3609 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3610 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
3612 /* Line In pin widget for input */
3613 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3614 /* CD pin widget for input */
3615 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3616 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3617 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3619 /* change to EAPD mode */
3620 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3621 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
3627 * LG m1 express dual
3630 * Rear Line-In/Out (blue): 0x14
3631 * Build-in Mic-In: 0x15
3633 * HP-Out (green): 0x1b
3634 * Mic-In/Out (red): 0x19
3638 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
3639 static hda_nid_t alc880_lg_dac_nids[3] = {
3643 /* seems analog CD is not working */
3644 static struct hda_input_mux alc880_lg_capture_source = {
3649 { "Internal Mic", 0x6 },
3653 /* 2,4,6 channel modes */
3654 static struct hda_verb alc880_lg_ch2_init[] = {
3655 /* set line-in and mic-in to input */
3656 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
3657 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3661 static struct hda_verb alc880_lg_ch4_init[] = {
3662 /* set line-in to out and mic-in to input */
3663 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3664 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3668 static struct hda_verb alc880_lg_ch6_init[] = {
3669 /* set line-in and mic-in to output */
3670 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3671 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3675 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
3676 { 2, alc880_lg_ch2_init },
3677 { 4, alc880_lg_ch4_init },
3678 { 6, alc880_lg_ch6_init },
3681 static struct snd_kcontrol_new alc880_lg_mixer[] = {
3682 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3683 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3684 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3685 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3686 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3687 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3688 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3689 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3690 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3691 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3692 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3693 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3694 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3695 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3697 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3698 .name = "Channel Mode",
3699 .info = alc_ch_mode_info,
3700 .get = alc_ch_mode_get,
3701 .put = alc_ch_mode_put,
3706 static struct hda_verb alc880_lg_init_verbs[] = {
3707 /* set capture source to mic-in */
3708 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3709 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3710 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3711 /* mute all amp mixer inputs */
3712 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3713 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3714 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3715 /* line-in to input */
3716 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3717 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3719 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3720 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3722 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3723 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3724 /* mic-in to input */
3725 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3726 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3727 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3729 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3730 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3731 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3733 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3737 /* toggle speaker-output according to the hp-jack state */
3738 static void alc880_lg_setup(struct hda_codec *codec)
3740 struct alc_spec *spec = codec->spec;
3742 spec->autocfg.hp_pins[0] = 0x1b;
3743 spec->autocfg.speaker_pins[0] = 0x17;
3752 * Built-in Mic-In: 0x19
3758 static struct hda_input_mux alc880_lg_lw_capture_source = {
3762 { "Internal Mic", 0x1 },
3767 #define alc880_lg_lw_modes alc880_threestack_modes
3769 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3770 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3771 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3772 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3773 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3774 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3775 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3776 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3777 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3778 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3779 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3780 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3781 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3782 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
3783 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
3785 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3786 .name = "Channel Mode",
3787 .info = alc_ch_mode_info,
3788 .get = alc_ch_mode_get,
3789 .put = alc_ch_mode_put,
3794 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3795 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3796 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3797 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3799 /* set capture source to mic-in */
3800 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3801 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3802 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3803 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3805 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3806 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3808 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3809 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3810 /* mic-in to input */
3811 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3812 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3814 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3815 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3817 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3821 /* toggle speaker-output according to the hp-jack state */
3822 static void alc880_lg_lw_setup(struct hda_codec *codec)
3824 struct alc_spec *spec = codec->spec;
3826 spec->autocfg.hp_pins[0] = 0x1b;
3827 spec->autocfg.speaker_pins[0] = 0x14;
3830 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3831 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3832 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3833 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3834 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3835 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3836 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3840 static struct hda_input_mux alc880_medion_rim_capture_source = {
3844 { "Internal Mic", 0x1 },
3848 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3849 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3851 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3852 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3854 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3855 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3856 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3857 /* Mic2 (as headphone out) for HP output */
3858 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3859 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3860 /* Internal Speaker */
3861 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3862 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3864 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3865 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3867 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3871 /* toggle speaker-output according to the hp-jack state */
3872 static void alc880_medion_rim_automute(struct hda_codec *codec)
3874 struct alc_spec *spec = codec->spec;
3875 alc_automute_amp(codec);
3877 if (spec->jack_present)
3878 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3880 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3883 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3886 /* Looks like the unsol event is incompatible with the standard
3887 * definition. 4bit tag is placed at 28 bit!
3889 if ((res >> 28) == ALC880_HP_EVENT)
3890 alc880_medion_rim_automute(codec);
3893 static void alc880_medion_rim_setup(struct hda_codec *codec)
3895 struct alc_spec *spec = codec->spec;
3897 spec->autocfg.hp_pins[0] = 0x14;
3898 spec->autocfg.speaker_pins[0] = 0x1b;
3901 #ifdef CONFIG_SND_HDA_POWER_SAVE
3902 static struct hda_amp_list alc880_loopbacks[] = {
3903 { 0x0b, HDA_INPUT, 0 },
3904 { 0x0b, HDA_INPUT, 1 },
3905 { 0x0b, HDA_INPUT, 2 },
3906 { 0x0b, HDA_INPUT, 3 },
3907 { 0x0b, HDA_INPUT, 4 },
3911 static struct hda_amp_list alc880_lg_loopbacks[] = {
3912 { 0x0b, HDA_INPUT, 1 },
3913 { 0x0b, HDA_INPUT, 6 },
3914 { 0x0b, HDA_INPUT, 7 },
3923 static void alc_init_special_input_src(struct hda_codec *codec);
3925 static int alc_init(struct hda_codec *codec)
3927 struct alc_spec *spec = codec->spec;
3931 alc_auto_init_amp(codec, spec->init_amp);
3933 for (i = 0; i < spec->num_init_verbs; i++)
3934 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3935 alc_init_special_input_src(codec);
3937 if (spec->init_hook)
3938 spec->init_hook(codec);
3940 alc_apply_fixup(codec, ALC_FIXUP_ACT_INIT);
3942 hda_call_check_power_status(codec, 0x01);
3946 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3948 struct alc_spec *spec = codec->spec;
3950 if (spec->unsol_event)
3951 spec->unsol_event(codec, res);
3954 #ifdef CONFIG_SND_HDA_POWER_SAVE
3955 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3957 struct alc_spec *spec = codec->spec;
3958 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3963 * Analog playback callbacks
3965 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3966 struct hda_codec *codec,
3967 struct snd_pcm_substream *substream)
3969 struct alc_spec *spec = codec->spec;
3970 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3974 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3975 struct hda_codec *codec,
3976 unsigned int stream_tag,
3977 unsigned int format,
3978 struct snd_pcm_substream *substream)
3980 struct alc_spec *spec = codec->spec;
3981 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3982 stream_tag, format, substream);
3985 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3986 struct hda_codec *codec,
3987 struct snd_pcm_substream *substream)
3989 struct alc_spec *spec = codec->spec;
3990 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3996 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3997 struct hda_codec *codec,
3998 struct snd_pcm_substream *substream)
4000 struct alc_spec *spec = codec->spec;
4001 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
4004 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
4005 struct hda_codec *codec,
4006 unsigned int stream_tag,
4007 unsigned int format,
4008 struct snd_pcm_substream *substream)
4010 struct alc_spec *spec = codec->spec;
4011 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
4012 stream_tag, format, substream);
4015 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
4016 struct hda_codec *codec,
4017 struct snd_pcm_substream *substream)
4019 struct alc_spec *spec = codec->spec;
4020 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
4023 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
4024 struct hda_codec *codec,
4025 struct snd_pcm_substream *substream)
4027 struct alc_spec *spec = codec->spec;
4028 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
4034 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
4035 struct hda_codec *codec,
4036 unsigned int stream_tag,
4037 unsigned int format,
4038 struct snd_pcm_substream *substream)
4040 struct alc_spec *spec = codec->spec;
4042 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
4043 stream_tag, 0, format);
4047 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
4048 struct hda_codec *codec,
4049 struct snd_pcm_substream *substream)
4051 struct alc_spec *spec = codec->spec;
4053 snd_hda_codec_cleanup_stream(codec,
4054 spec->adc_nids[substream->number + 1]);
4058 /* analog capture with dynamic dual-adc changes */
4059 static int dualmic_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
4060 struct hda_codec *codec,
4061 unsigned int stream_tag,
4062 unsigned int format,
4063 struct snd_pcm_substream *substream)
4065 struct alc_spec *spec = codec->spec;
4066 spec->cur_adc = spec->adc_nids[spec->cur_adc_idx];
4067 spec->cur_adc_stream_tag = stream_tag;
4068 spec->cur_adc_format = format;
4069 snd_hda_codec_setup_stream(codec, spec->cur_adc, stream_tag, 0, format);
4073 static int dualmic_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
4074 struct hda_codec *codec,
4075 struct snd_pcm_substream *substream)
4077 struct alc_spec *spec = codec->spec;
4078 snd_hda_codec_cleanup_stream(codec, spec->cur_adc);
4083 static struct hda_pcm_stream dualmic_pcm_analog_capture = {
4087 .nid = 0, /* fill later */
4089 .prepare = dualmic_capture_pcm_prepare,
4090 .cleanup = dualmic_capture_pcm_cleanup
4096 static struct hda_pcm_stream alc880_pcm_analog_playback = {
4100 /* NID is set in alc_build_pcms */
4102 .open = alc880_playback_pcm_open,
4103 .prepare = alc880_playback_pcm_prepare,
4104 .cleanup = alc880_playback_pcm_cleanup
4108 static struct hda_pcm_stream alc880_pcm_analog_capture = {
4112 /* NID is set in alc_build_pcms */
4115 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
4119 /* NID is set in alc_build_pcms */
4122 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
4123 .substreams = 2, /* can be overridden */
4126 /* NID is set in alc_build_pcms */
4128 .prepare = alc880_alt_capture_pcm_prepare,
4129 .cleanup = alc880_alt_capture_pcm_cleanup
4133 static struct hda_pcm_stream alc880_pcm_digital_playback = {
4137 /* NID is set in alc_build_pcms */
4139 .open = alc880_dig_playback_pcm_open,
4140 .close = alc880_dig_playback_pcm_close,
4141 .prepare = alc880_dig_playback_pcm_prepare,
4142 .cleanup = alc880_dig_playback_pcm_cleanup
4146 static struct hda_pcm_stream alc880_pcm_digital_capture = {
4150 /* NID is set in alc_build_pcms */
4153 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
4154 static struct hda_pcm_stream alc_pcm_null_stream = {
4160 static int alc_build_pcms(struct hda_codec *codec)
4162 struct alc_spec *spec = codec->spec;
4163 struct hda_pcm *info = spec->pcm_rec;
4166 codec->num_pcms = 1;
4167 codec->pcm_info = info;
4169 if (spec->no_analog)
4172 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
4173 "%s Analog", codec->chip_name);
4174 info->name = spec->stream_name_analog;
4176 if (spec->stream_analog_playback) {
4177 if (snd_BUG_ON(!spec->multiout.dac_nids))
4179 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
4180 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
4182 if (spec->stream_analog_capture) {
4183 if (snd_BUG_ON(!spec->adc_nids))
4185 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
4186 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
4189 if (spec->channel_mode) {
4190 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
4191 for (i = 0; i < spec->num_channel_mode; i++) {
4192 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
4193 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
4199 /* SPDIF for stream index #1 */
4200 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
4201 snprintf(spec->stream_name_digital,
4202 sizeof(spec->stream_name_digital),
4203 "%s Digital", codec->chip_name);
4204 codec->num_pcms = 2;
4205 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
4206 info = spec->pcm_rec + 1;
4207 info->name = spec->stream_name_digital;
4208 if (spec->dig_out_type)
4209 info->pcm_type = spec->dig_out_type;
4211 info->pcm_type = HDA_PCM_TYPE_SPDIF;
4212 if (spec->multiout.dig_out_nid &&
4213 spec->stream_digital_playback) {
4214 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
4215 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
4217 if (spec->dig_in_nid &&
4218 spec->stream_digital_capture) {
4219 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
4220 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
4222 /* FIXME: do we need this for all Realtek codec models? */
4223 codec->spdif_status_reset = 1;
4226 if (spec->no_analog)
4229 /* If the use of more than one ADC is requested for the current
4230 * model, configure a second analog capture-only PCM.
4232 /* Additional Analaog capture for index #2 */
4233 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
4234 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
4235 codec->num_pcms = 3;
4236 info = spec->pcm_rec + 2;
4237 info->name = spec->stream_name_analog;
4238 if (spec->alt_dac_nid) {
4239 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
4240 *spec->stream_analog_alt_playback;
4241 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
4244 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
4245 alc_pcm_null_stream;
4246 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
4248 if (spec->num_adc_nids > 1) {
4249 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
4250 *spec->stream_analog_alt_capture;
4251 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
4253 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
4254 spec->num_adc_nids - 1;
4256 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
4257 alc_pcm_null_stream;
4258 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
4265 static inline void alc_shutup(struct hda_codec *codec)
4267 snd_hda_shutup_pins(codec);
4270 static void alc_free_kctls(struct hda_codec *codec)
4272 struct alc_spec *spec = codec->spec;
4274 if (spec->kctls.list) {
4275 struct snd_kcontrol_new *kctl = spec->kctls.list;
4277 for (i = 0; i < spec->kctls.used; i++)
4278 kfree(kctl[i].name);
4280 snd_array_free(&spec->kctls);
4283 static void alc_free(struct hda_codec *codec)
4285 struct alc_spec *spec = codec->spec;
4291 alc_free_kctls(codec);
4293 snd_hda_detach_beep_device(codec);
4296 #ifdef CONFIG_SND_HDA_POWER_SAVE
4297 static void alc_power_eapd(struct hda_codec *codec)
4299 /* We currently only handle front, HP */
4300 switch (codec->vendor_id) {
4302 set_eapd(codec, 0x0f, 0);
4303 set_eapd(codec, 0x10, 0);
4316 set_eapd(codec, 0x14, 0);
4317 set_eapd(codec, 0x15, 0);
4322 static int alc_suspend(struct hda_codec *codec, pm_message_t state)
4324 struct alc_spec *spec = codec->spec;
4326 if (spec && spec->power_hook)
4327 spec->power_hook(codec);
4332 #ifdef SND_HDA_NEEDS_RESUME
4333 static int alc_resume(struct hda_codec *codec)
4335 codec->patch_ops.init(codec);
4336 snd_hda_codec_resume_amp(codec);
4337 snd_hda_codec_resume_cache(codec);
4338 hda_call_check_power_status(codec, 0x01);
4345 static struct hda_codec_ops alc_patch_ops = {
4346 .build_controls = alc_build_controls,
4347 .build_pcms = alc_build_pcms,
4350 .unsol_event = alc_unsol_event,
4351 #ifdef SND_HDA_NEEDS_RESUME
4352 .resume = alc_resume,
4354 #ifdef CONFIG_SND_HDA_POWER_SAVE
4355 .suspend = alc_suspend,
4356 .check_power_status = alc_check_power_status,
4358 .reboot_notify = alc_shutup,
4361 /* replace the codec chip_name with the given string */
4362 static int alc_codec_rename(struct hda_codec *codec, const char *name)
4364 kfree(codec->chip_name);
4365 codec->chip_name = kstrdup(name, GFP_KERNEL);
4366 if (!codec->chip_name) {
4374 * Test configuration for debugging
4376 * Almost all inputs/outputs are enabled. I/O pins can be configured via
4379 #ifdef CONFIG_SND_DEBUG
4380 static hda_nid_t alc880_test_dac_nids[4] = {
4381 0x02, 0x03, 0x04, 0x05
4384 static struct hda_input_mux alc880_test_capture_source = {
4393 { "Surround", 0x6 },
4397 static struct hda_channel_mode alc880_test_modes[4] = {
4404 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
4405 struct snd_ctl_elem_info *uinfo)
4407 static char *texts[] = {
4408 "N/A", "Line Out", "HP Out",
4409 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
4411 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
4413 uinfo->value.enumerated.items = 8;
4414 if (uinfo->value.enumerated.item >= 8)
4415 uinfo->value.enumerated.item = 7;
4416 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
4420 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
4421 struct snd_ctl_elem_value *ucontrol)
4423 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4424 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4425 unsigned int pin_ctl, item = 0;
4427 pin_ctl = snd_hda_codec_read(codec, nid, 0,
4428 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
4429 if (pin_ctl & AC_PINCTL_OUT_EN) {
4430 if (pin_ctl & AC_PINCTL_HP_EN)
4434 } else if (pin_ctl & AC_PINCTL_IN_EN) {
4435 switch (pin_ctl & AC_PINCTL_VREFEN) {
4436 case AC_PINCTL_VREF_HIZ: item = 3; break;
4437 case AC_PINCTL_VREF_50: item = 4; break;
4438 case AC_PINCTL_VREF_GRD: item = 5; break;
4439 case AC_PINCTL_VREF_80: item = 6; break;
4440 case AC_PINCTL_VREF_100: item = 7; break;
4443 ucontrol->value.enumerated.item[0] = item;
4447 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
4448 struct snd_ctl_elem_value *ucontrol)
4450 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4451 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4452 static unsigned int ctls[] = {
4453 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
4454 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
4455 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
4456 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
4457 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
4458 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
4460 unsigned int old_ctl, new_ctl;
4462 old_ctl = snd_hda_codec_read(codec, nid, 0,
4463 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
4464 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
4465 if (old_ctl != new_ctl) {
4467 snd_hda_codec_write_cache(codec, nid, 0,
4468 AC_VERB_SET_PIN_WIDGET_CONTROL,
4470 val = ucontrol->value.enumerated.item[0] >= 3 ?
4472 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
4479 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
4480 struct snd_ctl_elem_info *uinfo)
4482 static char *texts[] = {
4483 "Front", "Surround", "CLFE", "Side"
4485 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
4487 uinfo->value.enumerated.items = 4;
4488 if (uinfo->value.enumerated.item >= 4)
4489 uinfo->value.enumerated.item = 3;
4490 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
4494 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
4495 struct snd_ctl_elem_value *ucontrol)
4497 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4498 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4501 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
4502 ucontrol->value.enumerated.item[0] = sel & 3;
4506 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
4507 struct snd_ctl_elem_value *ucontrol)
4509 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4510 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4513 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
4514 if (ucontrol->value.enumerated.item[0] != sel) {
4515 sel = ucontrol->value.enumerated.item[0] & 3;
4516 snd_hda_codec_write_cache(codec, nid, 0,
4517 AC_VERB_SET_CONNECT_SEL, sel);
4523 #define PIN_CTL_TEST(xname,nid) { \
4524 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4526 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4527 .info = alc_test_pin_ctl_info, \
4528 .get = alc_test_pin_ctl_get, \
4529 .put = alc_test_pin_ctl_put, \
4530 .private_value = nid \
4533 #define PIN_SRC_TEST(xname,nid) { \
4534 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4536 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4537 .info = alc_test_pin_src_info, \
4538 .get = alc_test_pin_src_get, \
4539 .put = alc_test_pin_src_put, \
4540 .private_value = nid \
4543 static struct snd_kcontrol_new alc880_test_mixer[] = {
4544 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
4545 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
4546 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
4547 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
4548 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
4549 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
4550 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
4551 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
4552 PIN_CTL_TEST("Front Pin Mode", 0x14),
4553 PIN_CTL_TEST("Surround Pin Mode", 0x15),
4554 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
4555 PIN_CTL_TEST("Side Pin Mode", 0x17),
4556 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
4557 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
4558 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
4559 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
4560 PIN_SRC_TEST("In-1 Pin Source", 0x18),
4561 PIN_SRC_TEST("In-2 Pin Source", 0x19),
4562 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
4563 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
4564 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
4565 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
4566 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
4567 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
4568 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
4569 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
4570 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
4571 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
4572 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
4573 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
4575 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4576 .name = "Channel Mode",
4577 .info = alc_ch_mode_info,
4578 .get = alc_ch_mode_get,
4579 .put = alc_ch_mode_put,
4584 static struct hda_verb alc880_test_init_verbs[] = {
4585 /* Unmute inputs of 0x0c - 0x0f */
4586 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4587 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4588 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4589 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4590 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4591 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4592 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4593 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4594 /* Vol output for 0x0c-0x0f */
4595 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4596 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4597 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4598 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4599 /* Set output pins 0x14-0x17 */
4600 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4601 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4602 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4603 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4604 /* Unmute output pins 0x14-0x17 */
4605 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4606 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4607 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4608 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4609 /* Set input pins 0x18-0x1c */
4610 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4611 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4612 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4613 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4614 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4615 /* Mute input pins 0x18-0x1b */
4616 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4617 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4618 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4619 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4621 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4622 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
4623 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4624 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
4625 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4626 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
4627 /* Analog input/passthru */
4628 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4629 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4630 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4631 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4632 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4640 static const char * const alc880_models[ALC880_MODEL_LAST] = {
4641 [ALC880_3ST] = "3stack",
4642 [ALC880_TCL_S700] = "tcl",
4643 [ALC880_3ST_DIG] = "3stack-digout",
4644 [ALC880_CLEVO] = "clevo",
4645 [ALC880_5ST] = "5stack",
4646 [ALC880_5ST_DIG] = "5stack-digout",
4647 [ALC880_W810] = "w810",
4648 [ALC880_Z71V] = "z71v",
4649 [ALC880_6ST] = "6stack",
4650 [ALC880_6ST_DIG] = "6stack-digout",
4651 [ALC880_ASUS] = "asus",
4652 [ALC880_ASUS_W1V] = "asus-w1v",
4653 [ALC880_ASUS_DIG] = "asus-dig",
4654 [ALC880_ASUS_DIG2] = "asus-dig2",
4655 [ALC880_UNIWILL_DIG] = "uniwill",
4656 [ALC880_UNIWILL_P53] = "uniwill-p53",
4657 [ALC880_FUJITSU] = "fujitsu",
4658 [ALC880_F1734] = "F1734",
4660 [ALC880_LG_LW] = "lg-lw",
4661 [ALC880_MEDION_RIM] = "medion",
4662 #ifdef CONFIG_SND_DEBUG
4663 [ALC880_TEST] = "test",
4665 [ALC880_AUTO] = "auto",
4668 static struct snd_pci_quirk alc880_cfg_tbl[] = {
4669 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
4670 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
4671 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
4672 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
4673 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
4674 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
4675 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
4676 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
4677 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
4678 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
4679 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
4680 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
4681 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
4682 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
4683 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
4684 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
4685 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
4686 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
4687 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
4688 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
4689 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
4690 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
4691 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
4692 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
4693 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
4694 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
4695 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
4696 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
4697 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
4698 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
4699 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
4700 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
4701 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
4702 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
4703 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
4704 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
4705 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
4706 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
4707 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
4708 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
4709 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
4710 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
4711 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
4712 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
4713 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
4714 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
4715 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
4716 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
4717 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
4718 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734),
4719 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
4720 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
4721 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
4722 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_LG),
4723 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
4724 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
4725 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
4726 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
4727 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
4728 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
4729 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
4730 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
4731 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
4732 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
4733 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
4734 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
4735 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
4736 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
4737 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
4739 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
4740 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
4741 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
4746 * ALC880 codec presets
4748 static struct alc_config_preset alc880_presets[] = {
4750 .mixers = { alc880_three_stack_mixer },
4751 .init_verbs = { alc880_volume_init_verbs,
4752 alc880_pin_3stack_init_verbs },
4753 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4754 .dac_nids = alc880_dac_nids,
4755 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4756 .channel_mode = alc880_threestack_modes,
4758 .input_mux = &alc880_capture_source,
4760 [ALC880_3ST_DIG] = {
4761 .mixers = { alc880_three_stack_mixer },
4762 .init_verbs = { alc880_volume_init_verbs,
4763 alc880_pin_3stack_init_verbs },
4764 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4765 .dac_nids = alc880_dac_nids,
4766 .dig_out_nid = ALC880_DIGOUT_NID,
4767 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4768 .channel_mode = alc880_threestack_modes,
4770 .input_mux = &alc880_capture_source,
4772 [ALC880_TCL_S700] = {
4773 .mixers = { alc880_tcl_s700_mixer },
4774 .init_verbs = { alc880_volume_init_verbs,
4775 alc880_pin_tcl_S700_init_verbs,
4776 alc880_gpio2_init_verbs },
4777 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4778 .dac_nids = alc880_dac_nids,
4779 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4780 .num_adc_nids = 1, /* single ADC */
4782 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4783 .channel_mode = alc880_2_jack_modes,
4784 .input_mux = &alc880_capture_source,
4787 .mixers = { alc880_three_stack_mixer,
4788 alc880_five_stack_mixer},
4789 .init_verbs = { alc880_volume_init_verbs,
4790 alc880_pin_5stack_init_verbs },
4791 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4792 .dac_nids = alc880_dac_nids,
4793 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4794 .channel_mode = alc880_fivestack_modes,
4795 .input_mux = &alc880_capture_source,
4797 [ALC880_5ST_DIG] = {
4798 .mixers = { alc880_three_stack_mixer,
4799 alc880_five_stack_mixer },
4800 .init_verbs = { alc880_volume_init_verbs,
4801 alc880_pin_5stack_init_verbs },
4802 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4803 .dac_nids = alc880_dac_nids,
4804 .dig_out_nid = ALC880_DIGOUT_NID,
4805 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4806 .channel_mode = alc880_fivestack_modes,
4807 .input_mux = &alc880_capture_source,
4810 .mixers = { alc880_six_stack_mixer },
4811 .init_verbs = { alc880_volume_init_verbs,
4812 alc880_pin_6stack_init_verbs },
4813 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4814 .dac_nids = alc880_6st_dac_nids,
4815 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4816 .channel_mode = alc880_sixstack_modes,
4817 .input_mux = &alc880_6stack_capture_source,
4819 [ALC880_6ST_DIG] = {
4820 .mixers = { alc880_six_stack_mixer },
4821 .init_verbs = { alc880_volume_init_verbs,
4822 alc880_pin_6stack_init_verbs },
4823 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4824 .dac_nids = alc880_6st_dac_nids,
4825 .dig_out_nid = ALC880_DIGOUT_NID,
4826 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4827 .channel_mode = alc880_sixstack_modes,
4828 .input_mux = &alc880_6stack_capture_source,
4831 .mixers = { alc880_w810_base_mixer },
4832 .init_verbs = { alc880_volume_init_verbs,
4833 alc880_pin_w810_init_verbs,
4834 alc880_gpio2_init_verbs },
4835 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
4836 .dac_nids = alc880_w810_dac_nids,
4837 .dig_out_nid = ALC880_DIGOUT_NID,
4838 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4839 .channel_mode = alc880_w810_modes,
4840 .input_mux = &alc880_capture_source,
4843 .mixers = { alc880_z71v_mixer },
4844 .init_verbs = { alc880_volume_init_verbs,
4845 alc880_pin_z71v_init_verbs },
4846 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
4847 .dac_nids = alc880_z71v_dac_nids,
4848 .dig_out_nid = ALC880_DIGOUT_NID,
4850 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4851 .channel_mode = alc880_2_jack_modes,
4852 .input_mux = &alc880_capture_source,
4855 .mixers = { alc880_f1734_mixer },
4856 .init_verbs = { alc880_volume_init_verbs,
4857 alc880_pin_f1734_init_verbs },
4858 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
4859 .dac_nids = alc880_f1734_dac_nids,
4861 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4862 .channel_mode = alc880_2_jack_modes,
4863 .input_mux = &alc880_f1734_capture_source,
4864 .unsol_event = alc880_uniwill_p53_unsol_event,
4865 .setup = alc880_uniwill_p53_setup,
4866 .init_hook = alc_automute_amp,
4869 .mixers = { alc880_asus_mixer },
4870 .init_verbs = { alc880_volume_init_verbs,
4871 alc880_pin_asus_init_verbs,
4872 alc880_gpio1_init_verbs },
4873 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4874 .dac_nids = alc880_asus_dac_nids,
4875 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4876 .channel_mode = alc880_asus_modes,
4878 .input_mux = &alc880_capture_source,
4880 [ALC880_ASUS_DIG] = {
4881 .mixers = { alc880_asus_mixer },
4882 .init_verbs = { alc880_volume_init_verbs,
4883 alc880_pin_asus_init_verbs,
4884 alc880_gpio1_init_verbs },
4885 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4886 .dac_nids = alc880_asus_dac_nids,
4887 .dig_out_nid = ALC880_DIGOUT_NID,
4888 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4889 .channel_mode = alc880_asus_modes,
4891 .input_mux = &alc880_capture_source,
4893 [ALC880_ASUS_DIG2] = {
4894 .mixers = { alc880_asus_mixer },
4895 .init_verbs = { alc880_volume_init_verbs,
4896 alc880_pin_asus_init_verbs,
4897 alc880_gpio2_init_verbs }, /* use GPIO2 */
4898 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4899 .dac_nids = alc880_asus_dac_nids,
4900 .dig_out_nid = ALC880_DIGOUT_NID,
4901 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4902 .channel_mode = alc880_asus_modes,
4904 .input_mux = &alc880_capture_source,
4906 [ALC880_ASUS_W1V] = {
4907 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4908 .init_verbs = { alc880_volume_init_verbs,
4909 alc880_pin_asus_init_verbs,
4910 alc880_gpio1_init_verbs },
4911 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4912 .dac_nids = alc880_asus_dac_nids,
4913 .dig_out_nid = ALC880_DIGOUT_NID,
4914 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4915 .channel_mode = alc880_asus_modes,
4917 .input_mux = &alc880_capture_source,
4919 [ALC880_UNIWILL_DIG] = {
4920 .mixers = { alc880_asus_mixer },
4921 .init_verbs = { alc880_volume_init_verbs,
4922 alc880_pin_asus_init_verbs },
4923 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4924 .dac_nids = alc880_asus_dac_nids,
4925 .dig_out_nid = ALC880_DIGOUT_NID,
4926 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4927 .channel_mode = alc880_asus_modes,
4929 .input_mux = &alc880_capture_source,
4931 [ALC880_UNIWILL] = {
4932 .mixers = { alc880_uniwill_mixer },
4933 .init_verbs = { alc880_volume_init_verbs,
4934 alc880_uniwill_init_verbs },
4935 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4936 .dac_nids = alc880_asus_dac_nids,
4937 .dig_out_nid = ALC880_DIGOUT_NID,
4938 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4939 .channel_mode = alc880_threestack_modes,
4941 .input_mux = &alc880_capture_source,
4942 .unsol_event = alc880_uniwill_unsol_event,
4943 .setup = alc880_uniwill_setup,
4944 .init_hook = alc880_uniwill_init_hook,
4946 [ALC880_UNIWILL_P53] = {
4947 .mixers = { alc880_uniwill_p53_mixer },
4948 .init_verbs = { alc880_volume_init_verbs,
4949 alc880_uniwill_p53_init_verbs },
4950 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4951 .dac_nids = alc880_asus_dac_nids,
4952 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4953 .channel_mode = alc880_threestack_modes,
4954 .input_mux = &alc880_capture_source,
4955 .unsol_event = alc880_uniwill_p53_unsol_event,
4956 .setup = alc880_uniwill_p53_setup,
4957 .init_hook = alc_automute_amp,
4959 [ALC880_FUJITSU] = {
4960 .mixers = { alc880_fujitsu_mixer },
4961 .init_verbs = { alc880_volume_init_verbs,
4962 alc880_uniwill_p53_init_verbs,
4963 alc880_beep_init_verbs },
4964 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4965 .dac_nids = alc880_dac_nids,
4966 .dig_out_nid = ALC880_DIGOUT_NID,
4967 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4968 .channel_mode = alc880_2_jack_modes,
4969 .input_mux = &alc880_capture_source,
4970 .unsol_event = alc880_uniwill_p53_unsol_event,
4971 .setup = alc880_uniwill_p53_setup,
4972 .init_hook = alc_automute_amp,
4975 .mixers = { alc880_three_stack_mixer },
4976 .init_verbs = { alc880_volume_init_verbs,
4977 alc880_pin_clevo_init_verbs },
4978 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4979 .dac_nids = alc880_dac_nids,
4981 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4982 .channel_mode = alc880_threestack_modes,
4984 .input_mux = &alc880_capture_source,
4987 .mixers = { alc880_lg_mixer },
4988 .init_verbs = { alc880_volume_init_verbs,
4989 alc880_lg_init_verbs },
4990 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4991 .dac_nids = alc880_lg_dac_nids,
4992 .dig_out_nid = ALC880_DIGOUT_NID,
4993 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4994 .channel_mode = alc880_lg_ch_modes,
4996 .input_mux = &alc880_lg_capture_source,
4997 .unsol_event = alc_automute_amp_unsol_event,
4998 .setup = alc880_lg_setup,
4999 .init_hook = alc_automute_amp,
5000 #ifdef CONFIG_SND_HDA_POWER_SAVE
5001 .loopbacks = alc880_lg_loopbacks,
5005 .mixers = { alc880_lg_lw_mixer },
5006 .init_verbs = { alc880_volume_init_verbs,
5007 alc880_lg_lw_init_verbs },
5008 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
5009 .dac_nids = alc880_dac_nids,
5010 .dig_out_nid = ALC880_DIGOUT_NID,
5011 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
5012 .channel_mode = alc880_lg_lw_modes,
5013 .input_mux = &alc880_lg_lw_capture_source,
5014 .unsol_event = alc_automute_amp_unsol_event,
5015 .setup = alc880_lg_lw_setup,
5016 .init_hook = alc_automute_amp,
5018 [ALC880_MEDION_RIM] = {
5019 .mixers = { alc880_medion_rim_mixer },
5020 .init_verbs = { alc880_volume_init_verbs,
5021 alc880_medion_rim_init_verbs,
5022 alc_gpio2_init_verbs },
5023 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
5024 .dac_nids = alc880_dac_nids,
5025 .dig_out_nid = ALC880_DIGOUT_NID,
5026 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
5027 .channel_mode = alc880_2_jack_modes,
5028 .input_mux = &alc880_medion_rim_capture_source,
5029 .unsol_event = alc880_medion_rim_unsol_event,
5030 .setup = alc880_medion_rim_setup,
5031 .init_hook = alc880_medion_rim_automute,
5033 #ifdef CONFIG_SND_DEBUG
5035 .mixers = { alc880_test_mixer },
5036 .init_verbs = { alc880_test_init_verbs },
5037 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
5038 .dac_nids = alc880_test_dac_nids,
5039 .dig_out_nid = ALC880_DIGOUT_NID,
5040 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
5041 .channel_mode = alc880_test_modes,
5042 .input_mux = &alc880_test_capture_source,
5048 * Automatic parse of I/O pins from the BIOS configuration
5053 ALC_CTL_WIDGET_MUTE,
5056 static struct snd_kcontrol_new alc880_control_templates[] = {
5057 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
5058 HDA_CODEC_MUTE(NULL, 0, 0, 0),
5059 HDA_BIND_MUTE(NULL, 0, 0, 0),
5062 /* add dynamic controls */
5063 static int add_control(struct alc_spec *spec, int type, const char *name,
5064 int cidx, unsigned long val)
5066 struct snd_kcontrol_new *knew;
5068 snd_array_init(&spec->kctls, sizeof(*knew), 32);
5069 knew = snd_array_new(&spec->kctls);
5072 *knew = alc880_control_templates[type];
5073 knew->name = kstrdup(name, GFP_KERNEL);
5077 if (get_amp_nid_(val))
5078 knew->subdevice = HDA_SUBDEV_AMP_FLAG;
5079 knew->private_value = val;
5083 static int add_control_with_pfx(struct alc_spec *spec, int type,
5084 const char *pfx, const char *dir,
5085 const char *sfx, int cidx, unsigned long val)
5088 snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx);
5089 return add_control(spec, type, name, cidx, val);
5092 #define add_pb_vol_ctrl(spec, type, pfx, val) \
5093 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", 0, val)
5094 #define add_pb_sw_ctrl(spec, type, pfx, val) \
5095 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", 0, val)
5096 #define __add_pb_vol_ctrl(spec, type, pfx, cidx, val) \
5097 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", cidx, val)
5098 #define __add_pb_sw_ctrl(spec, type, pfx, cidx, val) \
5099 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", cidx, val)
5101 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
5102 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
5103 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
5104 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
5105 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
5106 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
5107 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
5108 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
5109 #define ALC880_PIN_CD_NID 0x1c
5111 /* fill in the dac_nids table from the parsed pin configuration */
5112 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
5113 const struct auto_pin_cfg *cfg)
5119 memset(assigned, 0, sizeof(assigned));
5120 spec->multiout.dac_nids = spec->private_dac_nids;
5122 /* check the pins hardwired to audio widget */
5123 for (i = 0; i < cfg->line_outs; i++) {
5124 nid = cfg->line_out_pins[i];
5125 if (alc880_is_fixed_pin(nid)) {
5126 int idx = alc880_fixed_pin_idx(nid);
5127 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
5131 /* left pins can be connect to any audio widget */
5132 for (i = 0; i < cfg->line_outs; i++) {
5133 nid = cfg->line_out_pins[i];
5134 if (alc880_is_fixed_pin(nid))
5136 /* search for an empty channel */
5137 for (j = 0; j < cfg->line_outs; j++) {
5139 spec->multiout.dac_nids[i] =
5140 alc880_idx_to_dac(j);
5146 spec->multiout.num_dacs = cfg->line_outs;
5150 static const char *alc_get_line_out_pfx(const struct auto_pin_cfg *cfg,
5153 if (!cfg->hp_outs && !cfg->speaker_outs && can_be_master)
5156 switch (cfg->line_out_type) {
5157 case AUTO_PIN_SPEAKER_OUT:
5158 if (cfg->line_outs == 1)
5161 case AUTO_PIN_HP_OUT:
5164 if (cfg->line_outs == 1)
5171 /* add playback controls from the parsed DAC table */
5172 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
5173 const struct auto_pin_cfg *cfg)
5175 static const char * const chname[4] = {
5176 "Front", "Surround", NULL /*CLFE*/, "Side"
5178 const char *pfx = alc_get_line_out_pfx(cfg, false);
5182 for (i = 0; i < cfg->line_outs; i++) {
5183 if (!spec->multiout.dac_nids[i])
5185 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
5186 if (!pfx && i == 2) {
5188 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
5190 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
5194 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
5196 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
5200 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
5202 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
5206 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
5208 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
5213 const char *name = pfx;
5219 err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
5221 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
5225 err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
5227 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
5236 /* add playback controls for speaker and HP outputs */
5237 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
5246 if (alc880_is_fixed_pin(pin)) {
5247 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
5248 /* specify the DAC as the extra output */
5249 if (!spec->multiout.hp_nid)
5250 spec->multiout.hp_nid = nid;
5252 spec->multiout.extra_out_nid[0] = nid;
5253 /* control HP volume/switch on the output mixer amp */
5254 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
5255 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
5256 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
5259 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
5260 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
5263 } else if (alc880_is_multi_pin(pin)) {
5264 /* set manual connection */
5265 /* we have only a switch on HP-out PIN */
5266 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
5267 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
5274 /* create input playback/capture controls for the given pin */
5275 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
5276 const char *ctlname, int ctlidx,
5277 int idx, hda_nid_t mix_nid)
5281 err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, ctlidx,
5282 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
5285 err = __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, ctlidx,
5286 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
5292 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
5294 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
5295 return (pincap & AC_PINCAP_IN) != 0;
5298 /* create playback/capture controls for input pins */
5299 static int alc_auto_create_input_ctls(struct hda_codec *codec,
5300 const struct auto_pin_cfg *cfg,
5302 hda_nid_t cap1, hda_nid_t cap2)
5304 struct alc_spec *spec = codec->spec;
5305 struct hda_input_mux *imux = &spec->private_imux[0];
5306 int i, err, idx, type_idx = 0;
5307 const char *prev_label = NULL;
5309 for (i = 0; i < cfg->num_inputs; i++) {
5313 pin = cfg->inputs[i].pin;
5314 if (!alc_is_input_pin(codec, pin))
5317 label = hda_get_autocfg_input_label(codec, cfg, i);
5318 if (prev_label && !strcmp(label, prev_label))
5325 idx = get_connection_index(codec, mixer, pin);
5327 err = new_analog_input(spec, pin,
5337 idx = get_connection_index(codec, cap1, pin);
5338 if (idx < 0 && cap2)
5339 idx = get_connection_index(codec, cap2, pin);
5341 snd_hda_add_imux_item(imux, label, idx, NULL);
5346 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
5347 const struct auto_pin_cfg *cfg)
5349 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
5352 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
5353 unsigned int pin_type)
5355 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5358 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
5362 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
5363 hda_nid_t nid, int pin_type,
5366 alc_set_pin_output(codec, nid, pin_type);
5367 /* need the manual connection? */
5368 if (alc880_is_multi_pin(nid)) {
5369 struct alc_spec *spec = codec->spec;
5370 int idx = alc880_multi_pin_idx(nid);
5371 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
5372 AC_VERB_SET_CONNECT_SEL,
5373 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
5377 static int get_pin_type(int line_out_type)
5379 if (line_out_type == AUTO_PIN_HP_OUT)
5385 static void alc880_auto_init_multi_out(struct hda_codec *codec)
5387 struct alc_spec *spec = codec->spec;
5390 for (i = 0; i < spec->autocfg.line_outs; i++) {
5391 hda_nid_t nid = spec->autocfg.line_out_pins[i];
5392 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5393 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
5397 static void alc880_auto_init_extra_out(struct hda_codec *codec)
5399 struct alc_spec *spec = codec->spec;
5402 pin = spec->autocfg.speaker_pins[0];
5403 if (pin) /* connect to front */
5404 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
5405 pin = spec->autocfg.hp_pins[0];
5406 if (pin) /* connect to front */
5407 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
5410 static void alc880_auto_init_analog_input(struct hda_codec *codec)
5412 struct alc_spec *spec = codec->spec;
5413 struct auto_pin_cfg *cfg = &spec->autocfg;
5416 for (i = 0; i < cfg->num_inputs; i++) {
5417 hda_nid_t nid = cfg->inputs[i].pin;
5418 if (alc_is_input_pin(codec, nid)) {
5419 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
5420 if (nid != ALC880_PIN_CD_NID &&
5421 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
5422 snd_hda_codec_write(codec, nid, 0,
5423 AC_VERB_SET_AMP_GAIN_MUTE,
5429 static void alc880_auto_init_input_src(struct hda_codec *codec)
5431 struct alc_spec *spec = codec->spec;
5434 for (c = 0; c < spec->num_adc_nids; c++) {
5435 unsigned int mux_idx;
5436 const struct hda_input_mux *imux;
5437 mux_idx = c >= spec->num_mux_defs ? 0 : c;
5438 imux = &spec->input_mux[mux_idx];
5439 if (!imux->num_items && mux_idx > 0)
5440 imux = &spec->input_mux[0];
5442 snd_hda_codec_write(codec, spec->adc_nids[c], 0,
5443 AC_VERB_SET_CONNECT_SEL,
5444 imux->items[0].index);
5448 /* parse the BIOS configuration and set up the alc_spec */
5449 /* return 1 if successful, 0 if the proper config is not found,
5450 * or a negative error code
5452 static int alc880_parse_auto_config(struct hda_codec *codec)
5454 struct alc_spec *spec = codec->spec;
5456 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
5458 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5462 if (!spec->autocfg.line_outs)
5463 return 0; /* can't find valid BIOS pin config */
5465 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
5468 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
5471 err = alc880_auto_create_extra_out(spec,
5472 spec->autocfg.speaker_pins[0],
5476 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
5480 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
5484 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
5486 alc_auto_parse_digital(codec);
5488 if (spec->kctls.list)
5489 add_mixer(spec, spec->kctls.list);
5491 add_verb(spec, alc880_volume_init_verbs);
5493 spec->num_mux_defs = 1;
5494 spec->input_mux = &spec->private_imux[0];
5496 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
5501 /* additional initialization for auto-configuration model */
5502 static void alc880_auto_init(struct hda_codec *codec)
5504 struct alc_spec *spec = codec->spec;
5505 alc880_auto_init_multi_out(codec);
5506 alc880_auto_init_extra_out(codec);
5507 alc880_auto_init_analog_input(codec);
5508 alc880_auto_init_input_src(codec);
5509 alc_auto_init_digital(codec);
5510 if (spec->unsol_event)
5511 alc_inithook(codec);
5514 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
5515 * one of two digital mic pins, e.g. on ALC272
5517 static void fixup_automic_adc(struct hda_codec *codec)
5519 struct alc_spec *spec = codec->spec;
5522 for (i = 0; i < spec->num_adc_nids; i++) {
5523 hda_nid_t cap = spec->capsrc_nids ?
5524 spec->capsrc_nids[i] : spec->adc_nids[i];
5527 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
5530 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
5533 spec->int_mic.mux_idx = iidx;
5534 spec->ext_mic.mux_idx = eidx;
5535 if (spec->capsrc_nids)
5536 spec->capsrc_nids += i;
5537 spec->adc_nids += i;
5538 spec->num_adc_nids = 1;
5541 snd_printd(KERN_INFO "hda_codec: %s: "
5542 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
5543 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
5544 spec->auto_mic = 0; /* disable auto-mic to be sure */
5547 /* select or unmute the given capsrc route */
5548 static void select_or_unmute_capsrc(struct hda_codec *codec, hda_nid_t cap,
5551 if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) {
5552 snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx,
5555 snd_hda_codec_write_cache(codec, cap, 0,
5556 AC_VERB_SET_CONNECT_SEL, idx);
5560 /* set the default connection to that pin */
5561 static int init_capsrc_for_pin(struct hda_codec *codec, hda_nid_t pin)
5563 struct alc_spec *spec = codec->spec;
5566 for (i = 0; i < spec->num_adc_nids; i++) {
5567 hda_nid_t cap = spec->capsrc_nids ?
5568 spec->capsrc_nids[i] : spec->adc_nids[i];
5571 idx = get_connection_index(codec, cap, pin);
5574 select_or_unmute_capsrc(codec, cap, idx);
5575 return i; /* return the found index */
5577 return -1; /* not found */
5580 /* choose the ADC/MUX containing the input pin and initialize the setup */
5581 static void fixup_single_adc(struct hda_codec *codec)
5583 struct alc_spec *spec = codec->spec;
5584 struct auto_pin_cfg *cfg = &spec->autocfg;
5587 /* search for the input pin; there must be only one */
5588 if (cfg->num_inputs != 1)
5590 i = init_capsrc_for_pin(codec, cfg->inputs[0].pin);
5592 /* use only this ADC */
5593 if (spec->capsrc_nids)
5594 spec->capsrc_nids += i;
5595 spec->adc_nids += i;
5596 spec->num_adc_nids = 1;
5597 spec->single_input_src = 1;
5601 /* initialize dual adcs */
5602 static void fixup_dual_adc_switch(struct hda_codec *codec)
5604 struct alc_spec *spec = codec->spec;
5605 init_capsrc_for_pin(codec, spec->ext_mic.pin);
5606 init_capsrc_for_pin(codec, spec->int_mic.pin);
5609 /* initialize some special cases for input sources */
5610 static void alc_init_special_input_src(struct hda_codec *codec)
5612 struct alc_spec *spec = codec->spec;
5613 if (spec->dual_adc_switch)
5614 fixup_dual_adc_switch(codec);
5615 else if (spec->single_input_src)
5616 init_capsrc_for_pin(codec, spec->autocfg.inputs[0].pin);
5619 static void set_capture_mixer(struct hda_codec *codec)
5621 struct alc_spec *spec = codec->spec;
5622 static struct snd_kcontrol_new *caps[2][3] = {
5623 { alc_capture_mixer_nosrc1,
5624 alc_capture_mixer_nosrc2,
5625 alc_capture_mixer_nosrc3 },
5626 { alc_capture_mixer1,
5628 alc_capture_mixer3 },
5630 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
5632 int num_adcs = spec->num_adc_nids;
5633 if (spec->dual_adc_switch)
5635 else if (spec->auto_mic)
5636 fixup_automic_adc(codec);
5637 else if (spec->input_mux) {
5638 if (spec->input_mux->num_items > 1)
5640 else if (spec->input_mux->num_items == 1)
5641 fixup_single_adc(codec);
5643 spec->cap_mixer = caps[mux][num_adcs - 1];
5647 /* fill adc_nids (and capsrc_nids) containing all active input pins */
5648 static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids,
5651 struct alc_spec *spec = codec->spec;
5652 struct auto_pin_cfg *cfg = &spec->autocfg;
5654 hda_nid_t fallback_adc = 0, fallback_cap = 0;
5656 for (n = 0; n < num_nids; n++) {
5658 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
5662 if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN)
5665 nconns = snd_hda_get_connections(codec, cap, conn,
5669 nconns = snd_hda_get_connections(codec, cap, conn,
5674 if (!fallback_adc) {
5678 for (i = 0; i < cfg->num_inputs; i++) {
5679 hda_nid_t nid = cfg->inputs[i].pin;
5680 for (j = 0; j < nconns; j++) {
5687 if (i >= cfg->num_inputs) {
5688 int num_adcs = spec->num_adc_nids;
5689 spec->private_adc_nids[num_adcs] = adc;
5690 spec->private_capsrc_nids[num_adcs] = cap;
5691 spec->num_adc_nids++;
5692 spec->adc_nids = spec->private_adc_nids;
5694 spec->capsrc_nids = spec->private_capsrc_nids;
5697 if (!spec->num_adc_nids) {
5698 printk(KERN_WARNING "hda_codec: %s: no valid ADC found;"
5699 " using fallback 0x%x\n",
5700 codec->chip_name, fallback_adc);
5701 spec->private_adc_nids[0] = fallback_adc;
5702 spec->adc_nids = spec->private_adc_nids;
5703 if (fallback_adc != fallback_cap) {
5704 spec->private_capsrc_nids[0] = fallback_cap;
5705 spec->capsrc_nids = spec->private_adc_nids;
5710 #ifdef CONFIG_SND_HDA_INPUT_BEEP
5711 #define set_beep_amp(spec, nid, idx, dir) \
5712 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
5714 static struct snd_pci_quirk beep_white_list[] = {
5715 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
5716 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
5717 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
5721 static inline int has_cdefine_beep(struct hda_codec *codec)
5723 struct alc_spec *spec = codec->spec;
5724 const struct snd_pci_quirk *q;
5725 q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list);
5728 return spec->cdefine.enable_pcbeep;
5731 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
5732 #define has_cdefine_beep(codec) 0
5736 * OK, here we have finally the patch for ALC880
5739 static int patch_alc880(struct hda_codec *codec)
5741 struct alc_spec *spec;
5745 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5751 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
5754 if (board_config < 0) {
5755 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
5757 board_config = ALC880_AUTO;
5760 if (board_config == ALC880_AUTO) {
5761 /* automatic parse from the BIOS config */
5762 err = alc880_parse_auto_config(codec);
5768 "hda_codec: Cannot set up configuration "
5769 "from BIOS. Using 3-stack mode...\n");
5770 board_config = ALC880_3ST;
5774 err = snd_hda_attach_beep_device(codec, 0x1);
5780 if (board_config != ALC880_AUTO)
5781 setup_preset(codec, &alc880_presets[board_config]);
5783 spec->stream_analog_playback = &alc880_pcm_analog_playback;
5784 spec->stream_analog_capture = &alc880_pcm_analog_capture;
5785 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
5787 spec->stream_digital_playback = &alc880_pcm_digital_playback;
5788 spec->stream_digital_capture = &alc880_pcm_digital_capture;
5790 if (!spec->adc_nids && spec->input_mux) {
5791 /* check whether NID 0x07 is valid */
5792 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
5794 wcap = get_wcaps_type(wcap);
5795 if (wcap != AC_WID_AUD_IN) {
5796 spec->adc_nids = alc880_adc_nids_alt;
5797 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
5799 spec->adc_nids = alc880_adc_nids;
5800 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
5803 set_capture_mixer(codec);
5804 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
5806 spec->vmaster_nid = 0x0c;
5808 codec->patch_ops = alc_patch_ops;
5809 if (board_config == ALC880_AUTO)
5810 spec->init_hook = alc880_auto_init;
5811 #ifdef CONFIG_SND_HDA_POWER_SAVE
5812 if (!spec->loopback.amplist)
5813 spec->loopback.amplist = alc880_loopbacks;
5824 static hda_nid_t alc260_dac_nids[1] = {
5829 static hda_nid_t alc260_adc_nids[1] = {
5834 static hda_nid_t alc260_adc_nids_alt[1] = {
5839 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
5840 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
5842 static hda_nid_t alc260_dual_adc_nids[2] = {
5847 #define ALC260_DIGOUT_NID 0x03
5848 #define ALC260_DIGIN_NID 0x06
5850 static struct hda_input_mux alc260_capture_source = {
5854 { "Front Mic", 0x1 },
5860 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
5861 * headphone jack and the internal CD lines since these are the only pins at
5862 * which audio can appear. For flexibility, also allow the option of
5863 * recording the mixer output on the second ADC (ADC0 doesn't have a
5864 * connection to the mixer output).
5866 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
5870 { "Mic/Line", 0x0 },
5872 { "Headphone", 0x2 },
5878 { "Mic/Line", 0x0 },
5880 { "Headphone", 0x2 },
5887 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
5888 * the Fujitsu S702x, but jacks are marked differently.
5890 static struct hda_input_mux alc260_acer_capture_sources[2] = {
5897 { "Headphone", 0x5 },
5906 { "Headphone", 0x6 },
5912 /* Maxdata Favorit 100XS */
5913 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
5917 { "Line/Mic", 0x0 },
5924 { "Line/Mic", 0x0 },
5932 * This is just place-holder, so there's something for alc_build_pcms to look
5933 * at when it calculates the maximum number of channels. ALC260 has no mixer
5934 * element which allows changing the channel mode, so the verb list is
5937 static struct hda_channel_mode alc260_modes[1] = {
5942 /* Mixer combinations
5944 * basic: base_output + input + pc_beep + capture
5945 * HP: base_output + input + capture_alt
5946 * HP_3013: hp_3013 + input + capture
5947 * fujitsu: fujitsu + capture
5948 * acer: acer + capture
5951 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
5952 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5953 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5954 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5955 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5956 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5957 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5961 static struct snd_kcontrol_new alc260_input_mixer[] = {
5962 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5963 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5964 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5965 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5966 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5967 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5968 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
5969 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
5973 /* update HP, line and mono out pins according to the master switch */
5974 static void alc260_hp_master_update(struct hda_codec *codec,
5975 hda_nid_t hp, hda_nid_t line,
5978 struct alc_spec *spec = codec->spec;
5979 unsigned int val = spec->master_sw ? PIN_HP : 0;
5980 /* change HP and line-out pins */
5981 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5983 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5985 /* mono (speaker) depending on the HP jack sense */
5986 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5987 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5991 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5992 struct snd_ctl_elem_value *ucontrol)
5994 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5995 struct alc_spec *spec = codec->spec;
5996 *ucontrol->value.integer.value = spec->master_sw;
6000 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
6001 struct snd_ctl_elem_value *ucontrol)
6003 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
6004 struct alc_spec *spec = codec->spec;
6005 int val = !!*ucontrol->value.integer.value;
6006 hda_nid_t hp, line, mono;
6008 if (val == spec->master_sw)
6010 spec->master_sw = val;
6011 hp = (kcontrol->private_value >> 16) & 0xff;
6012 line = (kcontrol->private_value >> 8) & 0xff;
6013 mono = kcontrol->private_value & 0xff;
6014 alc260_hp_master_update(codec, hp, line, mono);
6018 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
6020 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6021 .name = "Master Playback Switch",
6022 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
6023 .info = snd_ctl_boolean_mono_info,
6024 .get = alc260_hp_master_sw_get,
6025 .put = alc260_hp_master_sw_put,
6026 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
6028 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6029 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
6030 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6031 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
6032 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
6034 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
6038 static struct hda_verb alc260_hp_unsol_verbs[] = {
6039 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6043 static void alc260_hp_automute(struct hda_codec *codec)
6045 struct alc_spec *spec = codec->spec;
6047 spec->jack_present = snd_hda_jack_detect(codec, 0x10);
6048 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
6051 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
6053 if ((res >> 26) == ALC880_HP_EVENT)
6054 alc260_hp_automute(codec);
6057 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
6059 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6060 .name = "Master Playback Switch",
6061 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
6062 .info = snd_ctl_boolean_mono_info,
6063 .get = alc260_hp_master_sw_get,
6064 .put = alc260_hp_master_sw_put,
6065 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
6067 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6068 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
6069 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
6070 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
6071 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6072 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6073 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
6074 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
6078 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
6079 .ops = &snd_hda_bind_vol,
6081 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
6082 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
6083 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
6088 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
6089 .ops = &snd_hda_bind_sw,
6091 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
6092 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
6097 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
6098 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
6099 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
6100 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
6101 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
6105 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
6106 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6110 static void alc260_hp_3013_automute(struct hda_codec *codec)
6112 struct alc_spec *spec = codec->spec;
6114 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
6115 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
6118 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
6121 if ((res >> 26) == ALC880_HP_EVENT)
6122 alc260_hp_3013_automute(codec);
6125 static void alc260_hp_3012_automute(struct hda_codec *codec)
6127 unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT;
6129 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6131 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6133 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6137 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
6140 if ((res >> 26) == ALC880_HP_EVENT)
6141 alc260_hp_3012_automute(codec);
6144 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
6145 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
6147 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
6148 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6149 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
6150 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6151 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6152 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6153 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
6154 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
6155 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
6156 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6157 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
6161 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
6162 * versions of the ALC260 don't act on requests to enable mic bias from NID
6163 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
6164 * datasheet doesn't mention this restriction. At this stage it's not clear
6165 * whether this behaviour is intentional or is a hardware bug in chip
6166 * revisions available in early 2006. Therefore for now allow the
6167 * "Headphone Jack Mode" control to span all choices, but if it turns out
6168 * that the lack of mic bias for this NID is intentional we could change the
6169 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6171 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
6172 * don't appear to make the mic bias available from the "line" jack, even
6173 * though the NID used for this jack (0x14) can supply it. The theory is
6174 * that perhaps Acer have included blocking capacitors between the ALC260
6175 * and the output jack. If this turns out to be the case for all such
6176 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
6177 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
6179 * The C20x Tablet series have a mono internal speaker which is controlled
6180 * via the chip's Mono sum widget and pin complex, so include the necessary
6181 * controls for such models. On models without a "mono speaker" the control
6182 * won't do anything.
6184 static struct snd_kcontrol_new alc260_acer_mixer[] = {
6185 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6186 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
6187 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
6188 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
6190 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
6192 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6193 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6194 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6195 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6196 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6197 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
6198 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
6199 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6203 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
6205 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
6206 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6207 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
6208 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
6209 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6210 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6211 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6215 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
6216 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
6218 static struct snd_kcontrol_new alc260_will_mixer[] = {
6219 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6220 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
6221 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6222 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6223 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6224 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
6225 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
6226 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6227 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6228 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6232 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
6233 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
6235 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
6236 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6237 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
6238 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6239 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6240 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6241 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
6242 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
6243 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
6244 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
6245 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6250 * initialization verbs
6252 static struct hda_verb alc260_init_verbs[] = {
6253 /* Line In pin widget for input */
6254 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6255 /* CD pin widget for input */
6256 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6257 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6258 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6259 /* Mic2 (front panel) pin widget for input and vref at 80% */
6260 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6261 /* LINE-2 is used for line-out in rear */
6262 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6263 /* select line-out */
6264 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
6266 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6268 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6270 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6271 /* mute capture amp left and right */
6272 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6273 /* set connection select to line in (default select for this ADC) */
6274 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
6275 /* mute capture amp left and right */
6276 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6277 /* set connection select to line in (default select for this ADC) */
6278 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
6279 /* set vol=0 Line-Out mixer amp left and right */
6280 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6281 /* unmute pin widget amp left and right (no gain on this amp) */
6282 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6283 /* set vol=0 HP mixer amp left and right */
6284 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6285 /* unmute pin widget amp left and right (no gain on this amp) */
6286 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6287 /* set vol=0 Mono mixer amp left and right */
6288 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6289 /* unmute pin widget amp left and right (no gain on this amp) */
6290 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6291 /* unmute LINE-2 out pin */
6292 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6293 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6296 /* mute analog inputs */
6297 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6298 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6299 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6300 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6301 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6302 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6303 /* mute Front out path */
6304 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6305 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6306 /* mute Headphone out path */
6307 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6308 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6309 /* mute Mono out path */
6310 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6311 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6315 #if 0 /* should be identical with alc260_init_verbs? */
6316 static struct hda_verb alc260_hp_init_verbs[] = {
6317 /* Headphone and output */
6318 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
6320 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6321 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6322 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6323 /* Mic2 (front panel) pin widget for input and vref at 80% */
6324 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6325 /* Line In pin widget for input */
6326 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6327 /* Line-2 pin widget for output */
6328 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6329 /* CD pin widget for input */
6330 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6331 /* unmute amp left and right */
6332 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
6333 /* set connection select to line in (default select for this ADC) */
6334 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
6335 /* unmute Line-Out mixer amp left and right (volume = 0) */
6336 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6337 /* mute pin widget amp left and right (no gain on this amp) */
6338 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6339 /* unmute HP mixer amp left and right (volume = 0) */
6340 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6341 /* mute pin widget amp left and right (no gain on this amp) */
6342 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6343 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6346 /* mute analog inputs */
6347 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6348 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6349 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6350 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6351 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6352 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6353 /* Unmute Front out path */
6354 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6355 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6356 /* Unmute Headphone out path */
6357 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6358 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6359 /* Unmute Mono out path */
6360 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6361 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6366 static struct hda_verb alc260_hp_3013_init_verbs[] = {
6367 /* Line out and output */
6368 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6370 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6371 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6372 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6373 /* Mic2 (front panel) pin widget for input and vref at 80% */
6374 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6375 /* Line In pin widget for input */
6376 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6377 /* Headphone pin widget for output */
6378 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
6379 /* CD pin widget for input */
6380 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6381 /* unmute amp left and right */
6382 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
6383 /* set connection select to line in (default select for this ADC) */
6384 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
6385 /* unmute Line-Out mixer amp left and right (volume = 0) */
6386 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6387 /* mute pin widget amp left and right (no gain on this amp) */
6388 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6389 /* unmute HP mixer amp left and right (volume = 0) */
6390 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6391 /* mute pin widget amp left and right (no gain on this amp) */
6392 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6393 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6396 /* mute analog inputs */
6397 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6398 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6399 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6400 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6401 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6402 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6403 /* Unmute Front out path */
6404 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6405 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6406 /* Unmute Headphone out path */
6407 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6408 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6409 /* Unmute Mono out path */
6410 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6411 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6415 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
6416 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
6417 * audio = 0x16, internal speaker = 0x10.
6419 static struct hda_verb alc260_fujitsu_init_verbs[] = {
6420 /* Disable all GPIOs */
6421 {0x01, AC_VERB_SET_GPIO_MASK, 0},
6422 /* Internal speaker is connected to headphone pin */
6423 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6424 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
6425 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6426 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
6427 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6428 /* Ensure all other unused pins are disabled and muted. */
6429 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6430 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6431 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6432 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6433 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6434 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6435 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6436 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6438 /* Disable digital (SPDIF) pins */
6439 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6440 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6442 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
6443 * when acting as an output.
6445 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6447 /* Start with output sum widgets muted and their output gains at min */
6448 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6449 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6450 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6451 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6452 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6453 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6454 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6455 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6456 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6458 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
6459 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6460 /* Unmute Line1 pin widget output buffer since it starts as an output.
6461 * If the pin mode is changed by the user the pin mode control will
6462 * take care of enabling the pin's input/output buffers as needed.
6463 * Therefore there's no need to enable the input buffer at this
6466 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6467 /* Unmute input buffer of pin widget used for Line-in (no equiv
6470 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6472 /* Mute capture amp left and right */
6473 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6474 /* Set ADC connection select to match default mixer setting - line
6477 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6479 /* Do the same for the second ADC: mute capture input amp and
6480 * set ADC connection to line in (on mic1 pin)
6482 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6483 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6485 /* Mute all inputs to mixer widget (even unconnected ones) */
6486 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6487 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6488 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6489 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6490 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6491 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6492 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6493 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6498 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
6499 * similar laptops (adapted from Fujitsu init verbs).
6501 static struct hda_verb alc260_acer_init_verbs[] = {
6502 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
6503 * the headphone jack. Turn this on and rely on the standard mute
6504 * methods whenever the user wants to turn these outputs off.
6506 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6507 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6508 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
6509 /* Internal speaker/Headphone jack is connected to Line-out pin */
6510 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6511 /* Internal microphone/Mic jack is connected to Mic1 pin */
6512 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
6513 /* Line In jack is connected to Line1 pin */
6514 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6515 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
6516 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6517 /* Ensure all other unused pins are disabled and muted. */
6518 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6519 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6520 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6521 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6522 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6523 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6524 /* Disable digital (SPDIF) pins */
6525 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6526 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6528 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6529 * bus when acting as outputs.
6531 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6532 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6534 /* Start with output sum widgets muted and their output gains at min */
6535 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6536 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6537 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6538 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6539 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6540 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6541 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6542 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6543 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6545 /* Unmute Line-out pin widget amp left and right
6546 * (no equiv mixer ctrl)
6548 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6549 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
6550 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6551 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6552 * inputs. If the pin mode is changed by the user the pin mode control
6553 * will take care of enabling the pin's input/output buffers as needed.
6554 * Therefore there's no need to enable the input buffer at this
6557 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6558 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6560 /* Mute capture amp left and right */
6561 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6562 /* Set ADC connection select to match default mixer setting - mic
6565 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6567 /* Do similar with the second ADC: mute capture input amp and
6568 * set ADC connection to mic to match ALSA's default state.
6570 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6571 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6573 /* Mute all inputs to mixer widget (even unconnected ones) */
6574 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6575 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6576 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6577 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6578 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6579 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6580 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6581 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6586 /* Initialisation sequence for Maxdata Favorit 100XS
6587 * (adapted from Acer init verbs).
6589 static struct hda_verb alc260_favorit100_init_verbs[] = {
6590 /* GPIO 0 enables the output jack.
6591 * Turn this on and rely on the standard mute
6592 * methods whenever the user wants to turn these outputs off.
6594 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6595 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6596 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
6597 /* Line/Mic input jack is connected to Mic1 pin */
6598 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
6599 /* Ensure all other unused pins are disabled and muted. */
6600 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6601 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6602 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6603 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6604 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6605 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6606 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6607 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6608 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6609 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6610 /* Disable digital (SPDIF) pins */
6611 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6612 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6614 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6615 * bus when acting as outputs.
6617 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6618 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6620 /* Start with output sum widgets muted and their output gains at min */
6621 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6622 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6623 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6624 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6625 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6626 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6627 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6628 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6629 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6631 /* Unmute Line-out pin widget amp left and right
6632 * (no equiv mixer ctrl)
6634 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6635 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6636 * inputs. If the pin mode is changed by the user the pin mode control
6637 * will take care of enabling the pin's input/output buffers as needed.
6638 * Therefore there's no need to enable the input buffer at this
6641 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6643 /* Mute capture amp left and right */
6644 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6645 /* Set ADC connection select to match default mixer setting - mic
6648 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6650 /* Do similar with the second ADC: mute capture input amp and
6651 * set ADC connection to mic to match ALSA's default state.
6653 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6654 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6656 /* Mute all inputs to mixer widget (even unconnected ones) */
6657 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6658 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6659 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6660 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6661 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6662 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6663 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6664 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6669 static struct hda_verb alc260_will_verbs[] = {
6670 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6671 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
6672 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
6673 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6674 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6675 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
6679 static struct hda_verb alc260_replacer_672v_verbs[] = {
6680 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6681 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6682 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
6684 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6685 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6686 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6688 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6692 /* toggle speaker-output according to the hp-jack state */
6693 static void alc260_replacer_672v_automute(struct hda_codec *codec)
6695 unsigned int present;
6697 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
6698 present = snd_hda_jack_detect(codec, 0x0f);
6700 snd_hda_codec_write_cache(codec, 0x01, 0,
6701 AC_VERB_SET_GPIO_DATA, 1);
6702 snd_hda_codec_write_cache(codec, 0x0f, 0,
6703 AC_VERB_SET_PIN_WIDGET_CONTROL,
6706 snd_hda_codec_write_cache(codec, 0x01, 0,
6707 AC_VERB_SET_GPIO_DATA, 0);
6708 snd_hda_codec_write_cache(codec, 0x0f, 0,
6709 AC_VERB_SET_PIN_WIDGET_CONTROL,
6714 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
6717 if ((res >> 26) == ALC880_HP_EVENT)
6718 alc260_replacer_672v_automute(codec);
6721 static struct hda_verb alc260_hp_dc7600_verbs[] = {
6722 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
6723 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6724 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6725 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6726 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6727 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6728 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6729 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6730 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6731 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6735 /* Test configuration for debugging, modelled after the ALC880 test
6738 #ifdef CONFIG_SND_DEBUG
6739 static hda_nid_t alc260_test_dac_nids[1] = {
6742 static hda_nid_t alc260_test_adc_nids[2] = {
6745 /* For testing the ALC260, each input MUX needs its own definition since
6746 * the signal assignments are different. This assumes that the first ADC
6749 static struct hda_input_mux alc260_test_capture_sources[2] = {
6753 { "MIC1 pin", 0x0 },
6754 { "MIC2 pin", 0x1 },
6755 { "LINE1 pin", 0x2 },
6756 { "LINE2 pin", 0x3 },
6758 { "LINE-OUT pin", 0x5 },
6759 { "HP-OUT pin", 0x6 },
6765 { "MIC1 pin", 0x0 },
6766 { "MIC2 pin", 0x1 },
6767 { "LINE1 pin", 0x2 },
6768 { "LINE2 pin", 0x3 },
6771 { "LINE-OUT pin", 0x6 },
6772 { "HP-OUT pin", 0x7 },
6776 static struct snd_kcontrol_new alc260_test_mixer[] = {
6777 /* Output driver widgets */
6778 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
6779 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
6780 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6781 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
6782 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6783 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
6785 /* Modes for retasking pin widgets
6786 * Note: the ALC260 doesn't seem to act on requests to enable mic
6787 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
6788 * mention this restriction. At this stage it's not clear whether
6789 * this behaviour is intentional or is a hardware bug in chip
6790 * revisions available at least up until early 2006. Therefore for
6791 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
6792 * choices, but if it turns out that the lack of mic bias for these
6793 * NIDs is intentional we could change their modes from
6794 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6796 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
6797 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
6798 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
6799 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
6800 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
6801 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
6803 /* Loopback mixer controls */
6804 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
6805 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
6806 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
6807 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
6808 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
6809 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
6810 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
6811 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
6812 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6813 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6814 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
6815 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
6816 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
6817 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
6819 /* Controls for GPIO pins, assuming they are configured as outputs */
6820 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
6821 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
6822 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
6823 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
6825 /* Switches to allow the digital IO pins to be enabled. The datasheet
6826 * is ambigious as to which NID is which; testing on laptops which
6827 * make this output available should provide clarification.
6829 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
6830 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
6832 /* A switch allowing EAPD to be enabled. Some laptops seem to use
6833 * this output to turn on an external amplifier.
6835 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
6836 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
6840 static struct hda_verb alc260_test_init_verbs[] = {
6841 /* Enable all GPIOs as outputs with an initial value of 0 */
6842 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
6843 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6844 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
6846 /* Enable retasking pins as output, initially without power amp */
6847 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6848 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6849 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6850 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6851 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6852 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6854 /* Disable digital (SPDIF) pins initially, but users can enable
6855 * them via a mixer switch. In the case of SPDIF-out, this initverb
6856 * payload also sets the generation to 0, output to be in "consumer"
6857 * PCM format, copyright asserted, no pre-emphasis and no validity
6860 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6861 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6863 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
6864 * OUT1 sum bus when acting as an output.
6866 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6867 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
6868 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6869 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
6871 /* Start with output sum widgets muted and their output gains at min */
6872 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6873 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6874 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6875 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6876 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6877 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6878 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6879 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6880 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6882 /* Unmute retasking pin widget output buffers since the default
6883 * state appears to be output. As the pin mode is changed by the
6884 * user the pin mode control will take care of enabling the pin's
6885 * input/output buffers as needed.
6887 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6888 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6889 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6890 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6891 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6892 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6893 /* Also unmute the mono-out pin widget */
6894 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6896 /* Mute capture amp left and right */
6897 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6898 /* Set ADC connection select to match default mixer setting (mic1
6901 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6903 /* Do the same for the second ADC: mute capture input amp and
6904 * set ADC connection to mic1 pin
6906 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6907 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6909 /* Mute all inputs to mixer widget (even unconnected ones) */
6910 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6911 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6912 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6913 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6914 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6915 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6916 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6917 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6923 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
6924 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
6926 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
6927 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
6930 * for BIOS auto-configuration
6933 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
6934 const char *pfx, int *vol_bits)
6937 unsigned long vol_val, sw_val;
6940 if (nid >= 0x0f && nid < 0x11) {
6941 nid_vol = nid - 0x7;
6942 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6943 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6944 } else if (nid == 0x11) {
6945 nid_vol = nid - 0x7;
6946 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
6947 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
6948 } else if (nid >= 0x12 && nid <= 0x15) {
6950 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6951 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6955 if (!(*vol_bits & (1 << nid_vol))) {
6956 /* first control for the volume widget */
6957 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val);
6960 *vol_bits |= (1 << nid_vol);
6962 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val);
6968 /* add playback controls from the parsed DAC table */
6969 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6970 const struct auto_pin_cfg *cfg)
6976 spec->multiout.num_dacs = 1;
6977 spec->multiout.dac_nids = spec->private_dac_nids;
6978 spec->multiout.dac_nids[0] = 0x02;
6980 nid = cfg->line_out_pins[0];
6983 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6985 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6989 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6994 nid = cfg->speaker_pins[0];
6996 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
7001 nid = cfg->hp_pins[0];
7003 err = alc260_add_playback_controls(spec, nid, "Headphone",
7011 /* create playback/capture controls for input pins */
7012 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
7013 const struct auto_pin_cfg *cfg)
7015 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
7018 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
7019 hda_nid_t nid, int pin_type,
7022 alc_set_pin_output(codec, nid, pin_type);
7023 /* need the manual connection? */
7025 int idx = nid - 0x12;
7026 snd_hda_codec_write(codec, idx + 0x0b, 0,
7027 AC_VERB_SET_CONNECT_SEL, sel_idx);
7031 static void alc260_auto_init_multi_out(struct hda_codec *codec)
7033 struct alc_spec *spec = codec->spec;
7036 nid = spec->autocfg.line_out_pins[0];
7038 int pin_type = get_pin_type(spec->autocfg.line_out_type);
7039 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
7042 nid = spec->autocfg.speaker_pins[0];
7044 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
7046 nid = spec->autocfg.hp_pins[0];
7048 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
7051 #define ALC260_PIN_CD_NID 0x16
7052 static void alc260_auto_init_analog_input(struct hda_codec *codec)
7054 struct alc_spec *spec = codec->spec;
7055 struct auto_pin_cfg *cfg = &spec->autocfg;
7058 for (i = 0; i < cfg->num_inputs; i++) {
7059 hda_nid_t nid = cfg->inputs[i].pin;
7061 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
7062 if (nid != ALC260_PIN_CD_NID &&
7063 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
7064 snd_hda_codec_write(codec, nid, 0,
7065 AC_VERB_SET_AMP_GAIN_MUTE,
7071 #define alc260_auto_init_input_src alc880_auto_init_input_src
7074 * generic initialization of ADC, input mixers and output mixers
7076 static struct hda_verb alc260_volume_init_verbs[] = {
7078 * Unmute ADC0-1 and set the default input to mic-in
7080 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
7081 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7082 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
7083 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7085 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7087 * Note: PASD motherboards uses the Line In 2 as the input for
7088 * front panel mic (mic 2)
7090 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7091 /* mute analog inputs */
7092 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7093 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7094 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7095 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7096 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7099 * Set up output mixers (0x08 - 0x0a)
7101 /* set vol=0 to output mixers */
7102 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7103 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7104 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7105 /* set up input amps for analog loopback */
7106 /* Amp Indices: DAC = 0, mixer = 1 */
7107 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7108 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7109 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7110 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7111 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7112 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7117 static int alc260_parse_auto_config(struct hda_codec *codec)
7119 struct alc_spec *spec = codec->spec;
7121 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
7123 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
7127 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
7130 if (!spec->kctls.list)
7131 return 0; /* can't find valid BIOS pin config */
7132 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
7136 spec->multiout.max_channels = 2;
7138 if (spec->autocfg.dig_outs)
7139 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
7140 if (spec->kctls.list)
7141 add_mixer(spec, spec->kctls.list);
7143 add_verb(spec, alc260_volume_init_verbs);
7145 spec->num_mux_defs = 1;
7146 spec->input_mux = &spec->private_imux[0];
7148 alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0);
7153 /* additional initialization for auto-configuration model */
7154 static void alc260_auto_init(struct hda_codec *codec)
7156 struct alc_spec *spec = codec->spec;
7157 alc260_auto_init_multi_out(codec);
7158 alc260_auto_init_analog_input(codec);
7159 alc260_auto_init_input_src(codec);
7160 alc_auto_init_digital(codec);
7161 if (spec->unsol_event)
7162 alc_inithook(codec);
7165 #ifdef CONFIG_SND_HDA_POWER_SAVE
7166 static struct hda_amp_list alc260_loopbacks[] = {
7167 { 0x07, HDA_INPUT, 0 },
7168 { 0x07, HDA_INPUT, 1 },
7169 { 0x07, HDA_INPUT, 2 },
7170 { 0x07, HDA_INPUT, 3 },
7171 { 0x07, HDA_INPUT, 4 },
7183 static const struct alc_fixup alc260_fixups[] = {
7184 [PINFIX_HP_DC5750] = {
7185 .type = ALC_FIXUP_PINS,
7186 .v.pins = (const struct alc_pincfg[]) {
7187 { 0x11, 0x90130110 }, /* speaker */
7193 static struct snd_pci_quirk alc260_fixup_tbl[] = {
7194 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", PINFIX_HP_DC5750),
7199 * ALC260 configurations
7201 static const char * const alc260_models[ALC260_MODEL_LAST] = {
7202 [ALC260_BASIC] = "basic",
7204 [ALC260_HP_3013] = "hp-3013",
7205 [ALC260_HP_DC7600] = "hp-dc7600",
7206 [ALC260_FUJITSU_S702X] = "fujitsu",
7207 [ALC260_ACER] = "acer",
7208 [ALC260_WILL] = "will",
7209 [ALC260_REPLACER_672V] = "replacer",
7210 [ALC260_FAVORIT100] = "favorit100",
7211 #ifdef CONFIG_SND_DEBUG
7212 [ALC260_TEST] = "test",
7214 [ALC260_AUTO] = "auto",
7217 static struct snd_pci_quirk alc260_cfg_tbl[] = {
7218 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
7219 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
7220 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
7221 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
7222 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
7223 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */
7224 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
7225 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
7226 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
7227 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
7228 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
7229 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
7230 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
7231 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
7232 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
7233 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
7234 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
7235 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
7236 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
7237 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
7241 static struct alc_config_preset alc260_presets[] = {
7243 .mixers = { alc260_base_output_mixer,
7244 alc260_input_mixer },
7245 .init_verbs = { alc260_init_verbs },
7246 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7247 .dac_nids = alc260_dac_nids,
7248 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7249 .adc_nids = alc260_dual_adc_nids,
7250 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7251 .channel_mode = alc260_modes,
7252 .input_mux = &alc260_capture_source,
7255 .mixers = { alc260_hp_output_mixer,
7256 alc260_input_mixer },
7257 .init_verbs = { alc260_init_verbs,
7258 alc260_hp_unsol_verbs },
7259 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7260 .dac_nids = alc260_dac_nids,
7261 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
7262 .adc_nids = alc260_adc_nids_alt,
7263 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7264 .channel_mode = alc260_modes,
7265 .input_mux = &alc260_capture_source,
7266 .unsol_event = alc260_hp_unsol_event,
7267 .init_hook = alc260_hp_automute,
7269 [ALC260_HP_DC7600] = {
7270 .mixers = { alc260_hp_dc7600_mixer,
7271 alc260_input_mixer },
7272 .init_verbs = { alc260_init_verbs,
7273 alc260_hp_dc7600_verbs },
7274 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7275 .dac_nids = alc260_dac_nids,
7276 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
7277 .adc_nids = alc260_adc_nids_alt,
7278 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7279 .channel_mode = alc260_modes,
7280 .input_mux = &alc260_capture_source,
7281 .unsol_event = alc260_hp_3012_unsol_event,
7282 .init_hook = alc260_hp_3012_automute,
7284 [ALC260_HP_3013] = {
7285 .mixers = { alc260_hp_3013_mixer,
7286 alc260_input_mixer },
7287 .init_verbs = { alc260_hp_3013_init_verbs,
7288 alc260_hp_3013_unsol_verbs },
7289 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7290 .dac_nids = alc260_dac_nids,
7291 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
7292 .adc_nids = alc260_adc_nids_alt,
7293 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7294 .channel_mode = alc260_modes,
7295 .input_mux = &alc260_capture_source,
7296 .unsol_event = alc260_hp_3013_unsol_event,
7297 .init_hook = alc260_hp_3013_automute,
7299 [ALC260_FUJITSU_S702X] = {
7300 .mixers = { alc260_fujitsu_mixer },
7301 .init_verbs = { alc260_fujitsu_init_verbs },
7302 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7303 .dac_nids = alc260_dac_nids,
7304 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7305 .adc_nids = alc260_dual_adc_nids,
7306 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7307 .channel_mode = alc260_modes,
7308 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
7309 .input_mux = alc260_fujitsu_capture_sources,
7312 .mixers = { alc260_acer_mixer },
7313 .init_verbs = { alc260_acer_init_verbs },
7314 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7315 .dac_nids = alc260_dac_nids,
7316 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7317 .adc_nids = alc260_dual_adc_nids,
7318 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7319 .channel_mode = alc260_modes,
7320 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
7321 .input_mux = alc260_acer_capture_sources,
7323 [ALC260_FAVORIT100] = {
7324 .mixers = { alc260_favorit100_mixer },
7325 .init_verbs = { alc260_favorit100_init_verbs },
7326 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7327 .dac_nids = alc260_dac_nids,
7328 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7329 .adc_nids = alc260_dual_adc_nids,
7330 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7331 .channel_mode = alc260_modes,
7332 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
7333 .input_mux = alc260_favorit100_capture_sources,
7336 .mixers = { alc260_will_mixer },
7337 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
7338 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7339 .dac_nids = alc260_dac_nids,
7340 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
7341 .adc_nids = alc260_adc_nids,
7342 .dig_out_nid = ALC260_DIGOUT_NID,
7343 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7344 .channel_mode = alc260_modes,
7345 .input_mux = &alc260_capture_source,
7347 [ALC260_REPLACER_672V] = {
7348 .mixers = { alc260_replacer_672v_mixer },
7349 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
7350 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7351 .dac_nids = alc260_dac_nids,
7352 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
7353 .adc_nids = alc260_adc_nids,
7354 .dig_out_nid = ALC260_DIGOUT_NID,
7355 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7356 .channel_mode = alc260_modes,
7357 .input_mux = &alc260_capture_source,
7358 .unsol_event = alc260_replacer_672v_unsol_event,
7359 .init_hook = alc260_replacer_672v_automute,
7361 #ifdef CONFIG_SND_DEBUG
7363 .mixers = { alc260_test_mixer },
7364 .init_verbs = { alc260_test_init_verbs },
7365 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
7366 .dac_nids = alc260_test_dac_nids,
7367 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
7368 .adc_nids = alc260_test_adc_nids,
7369 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7370 .channel_mode = alc260_modes,
7371 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
7372 .input_mux = alc260_test_capture_sources,
7377 static int patch_alc260(struct hda_codec *codec)
7379 struct alc_spec *spec;
7380 int err, board_config;
7382 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
7388 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
7391 if (board_config < 0) {
7392 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
7394 board_config = ALC260_AUTO;
7397 if (board_config == ALC260_AUTO) {
7398 alc_pick_fixup(codec, NULL, alc260_fixup_tbl, alc260_fixups);
7399 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
7402 if (board_config == ALC260_AUTO) {
7403 /* automatic parse from the BIOS config */
7404 err = alc260_parse_auto_config(codec);
7410 "hda_codec: Cannot set up configuration "
7411 "from BIOS. Using base mode...\n");
7412 board_config = ALC260_BASIC;
7416 err = snd_hda_attach_beep_device(codec, 0x1);
7422 if (board_config != ALC260_AUTO)
7423 setup_preset(codec, &alc260_presets[board_config]);
7425 spec->stream_analog_playback = &alc260_pcm_analog_playback;
7426 spec->stream_analog_capture = &alc260_pcm_analog_capture;
7427 spec->stream_analog_alt_capture = &alc260_pcm_analog_capture;
7429 spec->stream_digital_playback = &alc260_pcm_digital_playback;
7430 spec->stream_digital_capture = &alc260_pcm_digital_capture;
7432 if (!spec->adc_nids && spec->input_mux) {
7433 /* check whether NID 0x04 is valid */
7434 unsigned int wcap = get_wcaps(codec, 0x04);
7435 wcap = get_wcaps_type(wcap);
7437 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
7438 spec->adc_nids = alc260_adc_nids_alt;
7439 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
7441 spec->adc_nids = alc260_adc_nids;
7442 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
7445 set_capture_mixer(codec);
7446 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
7448 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
7450 spec->vmaster_nid = 0x08;
7452 codec->patch_ops = alc_patch_ops;
7453 if (board_config == ALC260_AUTO)
7454 spec->init_hook = alc260_auto_init;
7455 #ifdef CONFIG_SND_HDA_POWER_SAVE
7456 if (!spec->loopback.amplist)
7457 spec->loopback.amplist = alc260_loopbacks;
7465 * ALC882/883/885/888/889 support
7467 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
7468 * configuration. Each pin widget can choose any input DACs and a mixer.
7469 * Each ADC is connected from a mixer of all inputs. This makes possible
7470 * 6-channel independent captures.
7472 * In addition, an independent DAC for the multi-playback (not used in this
7475 #define ALC882_DIGOUT_NID 0x06
7476 #define ALC882_DIGIN_NID 0x0a
7477 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
7478 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
7479 #define ALC1200_DIGOUT_NID 0x10
7482 static struct hda_channel_mode alc882_ch_modes[1] = {
7487 static hda_nid_t alc882_dac_nids[4] = {
7488 /* front, rear, clfe, rear_surr */
7489 0x02, 0x03, 0x04, 0x05
7491 #define alc883_dac_nids alc882_dac_nids
7494 #define alc882_adc_nids alc880_adc_nids
7495 #define alc882_adc_nids_alt alc880_adc_nids_alt
7496 #define alc883_adc_nids alc882_adc_nids_alt
7497 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
7498 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
7499 #define alc889_adc_nids alc880_adc_nids
7501 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
7502 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
7503 #define alc883_capsrc_nids alc882_capsrc_nids_alt
7504 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
7505 #define alc889_capsrc_nids alc882_capsrc_nids
7508 /* FIXME: should be a matrix-type input source selection */
7510 static struct hda_input_mux alc882_capture_source = {
7514 { "Front Mic", 0x1 },
7520 #define alc883_capture_source alc882_capture_source
7522 static struct hda_input_mux alc889_capture_source = {
7525 { "Front Mic", 0x0 },
7531 static struct hda_input_mux mb5_capture_source = {
7540 static struct hda_input_mux macmini3_capture_source = {
7548 static struct hda_input_mux alc883_3stack_6ch_intel = {
7552 { "Front Mic", 0x0 },
7558 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
7566 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
7570 { "Internal Mic", 0x1 },
7576 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
7580 { "Internal Mic", 0x1 },
7584 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
7588 { "Front Mic", 0x1 },
7593 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
7601 static struct hda_input_mux alc889A_mb31_capture_source = {
7605 /* Front Mic (0x01) unused */
7607 /* Line 2 (0x03) unused */
7608 /* CD (0x04) unused? */
7612 static struct hda_input_mux alc889A_imac91_capture_source = {
7616 { "Line", 0x2 }, /* Not sure! */
7623 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
7630 static struct hda_verb alc882_3ST_ch2_init[] = {
7631 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7632 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7633 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7634 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7641 static struct hda_verb alc882_3ST_ch4_init[] = {
7642 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7643 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7644 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7645 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7646 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7653 static struct hda_verb alc882_3ST_ch6_init[] = {
7654 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7655 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7656 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7657 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7658 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7659 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7663 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
7664 { 2, alc882_3ST_ch2_init },
7665 { 4, alc882_3ST_ch4_init },
7666 { 6, alc882_3ST_ch6_init },
7669 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
7674 static struct hda_verb alc883_3ST_ch2_clevo_init[] = {
7675 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
7676 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7677 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7678 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7679 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7686 static struct hda_verb alc883_3ST_ch4_clevo_init[] = {
7687 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7688 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7689 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7690 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7691 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7692 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7699 static struct hda_verb alc883_3ST_ch6_clevo_init[] = {
7700 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7701 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7702 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7703 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7704 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7705 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7706 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7710 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
7711 { 2, alc883_3ST_ch2_clevo_init },
7712 { 4, alc883_3ST_ch4_clevo_init },
7713 { 6, alc883_3ST_ch6_clevo_init },
7720 static struct hda_verb alc882_sixstack_ch6_init[] = {
7721 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7722 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7723 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7724 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7731 static struct hda_verb alc882_sixstack_ch8_init[] = {
7732 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7733 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7734 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7735 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7739 static struct hda_channel_mode alc882_sixstack_modes[2] = {
7740 { 6, alc882_sixstack_ch6_init },
7741 { 8, alc882_sixstack_ch8_init },
7745 /* Macbook Air 2,1 */
7747 static struct hda_channel_mode alc885_mba21_ch_modes[1] = {
7752 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
7758 static struct hda_verb alc885_mbp_ch2_init[] = {
7759 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7760 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7761 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7768 static struct hda_verb alc885_mbp_ch4_init[] = {
7769 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7770 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7771 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7772 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7773 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7777 static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
7778 { 2, alc885_mbp_ch2_init },
7779 { 4, alc885_mbp_ch4_init },
7784 * Speakers/Woofer/HP = Front
7787 static struct hda_verb alc885_mb5_ch2_init[] = {
7788 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7789 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7795 * Speakers/HP = Front
7799 static struct hda_verb alc885_mb5_ch6_init[] = {
7800 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7801 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7802 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7806 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
7807 { 2, alc885_mb5_ch2_init },
7808 { 6, alc885_mb5_ch6_init },
7811 #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes
7816 static struct hda_verb alc883_4ST_ch2_init[] = {
7817 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7818 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7819 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7820 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7821 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7822 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7829 static struct hda_verb alc883_4ST_ch4_init[] = {
7830 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7831 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7832 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7833 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7834 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7835 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7836 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7843 static struct hda_verb alc883_4ST_ch6_init[] = {
7844 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7845 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7846 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7847 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7848 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7849 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7850 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7851 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7858 static struct hda_verb alc883_4ST_ch8_init[] = {
7859 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7860 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7861 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7862 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7863 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7864 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7865 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7866 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7867 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7871 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
7872 { 2, alc883_4ST_ch2_init },
7873 { 4, alc883_4ST_ch4_init },
7874 { 6, alc883_4ST_ch6_init },
7875 { 8, alc883_4ST_ch8_init },
7882 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7883 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7884 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7885 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7886 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7893 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7894 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7895 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7896 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7897 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7898 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7905 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7906 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7907 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7908 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7909 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7910 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7911 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7915 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7916 { 2, alc883_3ST_ch2_intel_init },
7917 { 4, alc883_3ST_ch4_intel_init },
7918 { 6, alc883_3ST_ch6_intel_init },
7924 static struct hda_verb alc889_ch2_intel_init[] = {
7925 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7926 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
7927 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
7928 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
7929 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7930 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7937 static struct hda_verb alc889_ch6_intel_init[] = {
7938 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7939 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7940 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7941 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7942 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7943 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7950 static struct hda_verb alc889_ch8_intel_init[] = {
7951 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7952 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7953 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7954 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7955 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
7956 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7957 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7961 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
7962 { 2, alc889_ch2_intel_init },
7963 { 6, alc889_ch6_intel_init },
7964 { 8, alc889_ch8_intel_init },
7970 static struct hda_verb alc883_sixstack_ch6_init[] = {
7971 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7972 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7973 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7974 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7981 static struct hda_verb alc883_sixstack_ch8_init[] = {
7982 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7983 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7984 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7985 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7989 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7990 { 6, alc883_sixstack_ch6_init },
7991 { 8, alc883_sixstack_ch8_init },
7995 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7996 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7998 static struct snd_kcontrol_new alc882_base_mixer[] = {
7999 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8000 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8001 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8002 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8003 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8004 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8005 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8006 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8007 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8008 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8009 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8010 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8011 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8012 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8013 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8014 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8015 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8016 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8017 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8018 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
8019 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8023 /* Macbook Air 2,1 same control for HP and internal Speaker */
8025 static struct snd_kcontrol_new alc885_mba21_mixer[] = {
8026 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8027 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT),
8032 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
8033 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8034 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
8035 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
8036 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
8037 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8038 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8039 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8040 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8041 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8042 HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT),
8043 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT),
8047 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
8048 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8049 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8050 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8051 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8052 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
8053 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
8054 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
8055 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
8056 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
8057 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
8058 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8059 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8060 HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT),
8061 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0x00, HDA_INPUT),
8065 static struct snd_kcontrol_new alc885_macmini3_mixer[] = {
8066 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8067 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8068 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8069 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8070 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
8071 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
8072 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
8073 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
8074 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
8075 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
8076 HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT),
8080 static struct snd_kcontrol_new alc885_imac91_mixer[] = {
8081 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8082 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
8087 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
8088 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8089 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8090 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8091 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8092 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8093 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8094 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8095 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8096 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8100 static struct snd_kcontrol_new alc882_targa_mixer[] = {
8101 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8102 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8103 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8104 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8105 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8106 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8107 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8108 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8109 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8110 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8111 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8112 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8113 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
8117 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
8118 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
8120 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
8121 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8122 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8123 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8124 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
8125 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8126 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8127 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8128 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8129 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
8130 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
8131 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8132 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8133 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8137 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
8138 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8139 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8140 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8141 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8142 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8143 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8144 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8145 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8146 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8147 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8151 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
8153 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8154 .name = "Channel Mode",
8155 .info = alc_ch_mode_info,
8156 .get = alc_ch_mode_get,
8157 .put = alc_ch_mode_put,
8162 static struct hda_verb alc882_base_init_verbs[] = {
8163 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8164 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8165 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8167 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8168 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8170 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8171 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8173 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8174 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8176 /* Front Pin: output 0 (0x0c) */
8177 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8178 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8179 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8180 /* Rear Pin: output 1 (0x0d) */
8181 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8182 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8183 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8184 /* CLFE Pin: output 2 (0x0e) */
8185 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8186 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8187 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
8188 /* Side Pin: output 3 (0x0f) */
8189 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8190 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8191 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8192 /* Mic (rear) pin: input vref at 80% */
8193 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8194 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8195 /* Front Mic pin: input vref at 80% */
8196 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8197 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8198 /* Line In pin: input */
8199 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8200 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8201 /* Line-2 In: Headphone output (output 0 - 0x0c) */
8202 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8203 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8204 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8205 /* CD pin widget for input */
8206 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8208 /* FIXME: use matrix-type input source selection */
8209 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8211 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8213 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8214 /* ADC2: mute amp left and right */
8215 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8216 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8217 /* ADC3: mute amp left and right */
8218 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8219 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8224 static struct hda_verb alc882_adc1_init_verbs[] = {
8225 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8226 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8227 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8228 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8229 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8230 /* ADC1: mute amp left and right */
8231 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8232 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8236 static struct hda_verb alc882_eapd_verbs[] = {
8237 /* change to EAPD mode */
8238 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8239 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
8243 static struct hda_verb alc889_eapd_verbs[] = {
8244 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
8245 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
8249 static struct hda_verb alc_hp15_unsol_verbs[] = {
8250 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8251 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8255 static struct hda_verb alc885_init_verbs[] = {
8256 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8257 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8258 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8260 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8261 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8263 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8264 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8266 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8267 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8269 /* Front HP Pin: output 0 (0x0c) */
8270 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8271 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8272 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8273 /* Front Pin: output 0 (0x0c) */
8274 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8275 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8276 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8277 /* Rear Pin: output 1 (0x0d) */
8278 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8279 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8280 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
8281 /* CLFE Pin: output 2 (0x0e) */
8282 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8283 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8284 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
8285 /* Side Pin: output 3 (0x0f) */
8286 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8287 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8288 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8289 /* Mic (rear) pin: input vref at 80% */
8290 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8291 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8292 /* Front Mic pin: input vref at 80% */
8293 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8294 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8295 /* Line In pin: input */
8296 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8297 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8299 /* Mixer elements: 0x18, , 0x1a, 0x1b */
8301 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8303 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8305 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8306 /* ADC2: mute amp left and right */
8307 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8308 /* ADC3: mute amp left and right */
8309 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8314 static struct hda_verb alc885_init_input_verbs[] = {
8315 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8316 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8317 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
8322 /* Unmute Selector 24h and set the default input to front mic */
8323 static struct hda_verb alc889_init_input_verbs[] = {
8324 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
8325 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8330 #define alc883_init_verbs alc882_base_init_verbs
8333 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
8334 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8335 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8336 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
8337 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
8338 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
8339 /* FIXME: this looks suspicious...
8340 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
8341 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
8346 static struct hda_verb alc882_macpro_init_verbs[] = {
8347 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8348 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8349 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8350 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8351 /* Front Pin: output 0 (0x0c) */
8352 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8353 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8354 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8355 /* Front Mic pin: input vref at 80% */
8356 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8357 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8358 /* Speaker: output */
8359 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8360 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8361 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
8362 /* Headphone output (output 0 - 0x0c) */
8363 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8364 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8365 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8367 /* FIXME: use matrix-type input source selection */
8368 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8369 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8370 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8371 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8372 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8373 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8375 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8376 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8377 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8378 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8380 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8381 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8382 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8383 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8384 /* ADC1: mute amp left and right */
8385 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8386 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8387 /* ADC2: mute amp left and right */
8388 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8389 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8390 /* ADC3: mute amp left and right */
8391 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8392 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8398 static struct hda_verb alc885_mb5_init_verbs[] = {
8400 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8401 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8402 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8403 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8405 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8406 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8407 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8408 /* Surround mixer */
8409 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8410 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8411 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8413 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8414 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8415 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8417 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8418 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8419 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8420 /* Front Pin (0x0c) */
8421 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8422 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8423 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8424 /* LFE Pin (0x0e) */
8425 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8426 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8427 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
8429 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8430 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8431 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
8432 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8433 /* Front Mic pin: input vref at 80% */
8434 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8435 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8437 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8438 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8440 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)},
8441 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)},
8442 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)},
8447 static struct hda_verb alc885_macmini3_init_verbs[] = {
8449 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8450 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8451 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8452 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8454 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8455 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8456 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8457 /* Surround mixer */
8458 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8459 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8460 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8462 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8463 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8464 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8466 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8467 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8468 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8469 /* Front Pin (0x0c) */
8470 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8471 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8472 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8473 /* LFE Pin (0x0e) */
8474 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8475 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8476 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
8478 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8479 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8480 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
8481 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8483 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8484 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8486 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8487 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8488 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8489 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8494 static struct hda_verb alc885_mba21_init_verbs[] = {
8495 /*Internal and HP Speaker Mixer*/
8496 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8497 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8498 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8499 /*Internal Speaker Pin (0x0c)*/
8500 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8501 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8502 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8503 /* HP Pin: output 0 (0x0e) */
8504 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
8505 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8506 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8507 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
8508 /* Line in (is hp when jack connected)*/
8509 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
8510 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8516 /* Macbook Pro rev3 */
8517 static struct hda_verb alc885_mbp3_init_verbs[] = {
8518 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8519 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8520 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8521 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8523 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8524 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8525 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8527 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8528 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8529 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8530 /* Front Pin: output 0 (0x0c) */
8531 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8532 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8533 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8534 /* HP Pin: output 0 (0x0e) */
8535 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
8536 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8537 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
8538 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8539 /* Mic (rear) pin: input vref at 80% */
8540 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8541 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8542 /* Front Mic pin: input vref at 80% */
8543 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8544 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8545 /* Line In pin: use output 1 when in LineOut mode */
8546 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8547 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8548 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8550 /* FIXME: use matrix-type input source selection */
8551 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8552 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8553 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8554 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8555 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8556 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8558 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8559 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8560 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8561 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8563 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8564 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8565 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8566 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8567 /* ADC1: mute amp left and right */
8568 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8569 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8570 /* ADC2: mute amp left and right */
8571 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8572 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8573 /* ADC3: mute amp left and right */
8574 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8575 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8581 static struct hda_verb alc885_imac91_init_verbs[] = {
8582 /* Internal Speaker Pin (0x0c) */
8583 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8584 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8585 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8586 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8587 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8588 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8590 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8591 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8592 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8593 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
8595 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
8596 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8597 /* Front Mic pin: input vref at 80% */
8598 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8599 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8601 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8602 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8603 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8604 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
8605 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8606 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8607 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8608 /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8609 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8610 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8611 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8612 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8613 /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8614 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8615 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8616 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8617 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8618 /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8619 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8620 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8621 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8622 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8623 /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8624 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8625 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8626 /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8627 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8628 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8629 /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8630 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8631 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8635 /* iMac 24 mixer. */
8636 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
8637 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8638 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
8642 /* iMac 24 init verbs. */
8643 static struct hda_verb alc885_imac24_init_verbs[] = {
8644 /* Internal speakers: output 0 (0x0c) */
8645 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8646 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8647 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8648 /* Internal speakers: output 0 (0x0c) */
8649 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8650 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8651 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8652 /* Headphone: output 0 (0x0c) */
8653 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8654 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8655 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8656 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8657 /* Front Mic: input vref at 80% */
8658 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8659 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8663 /* Toggle speaker-output according to the hp-jack state */
8664 static void alc885_imac24_setup(struct hda_codec *codec)
8666 struct alc_spec *spec = codec->spec;
8668 spec->autocfg.hp_pins[0] = 0x14;
8669 spec->autocfg.speaker_pins[0] = 0x18;
8670 spec->autocfg.speaker_pins[1] = 0x1a;
8673 #define alc885_mb5_setup alc885_imac24_setup
8674 #define alc885_macmini3_setup alc885_imac24_setup
8676 /* Macbook Air 2,1 */
8677 static void alc885_mba21_setup(struct hda_codec *codec)
8679 struct alc_spec *spec = codec->spec;
8681 spec->autocfg.hp_pins[0] = 0x14;
8682 spec->autocfg.speaker_pins[0] = 0x18;
8687 static void alc885_mbp3_setup(struct hda_codec *codec)
8689 struct alc_spec *spec = codec->spec;
8691 spec->autocfg.hp_pins[0] = 0x15;
8692 spec->autocfg.speaker_pins[0] = 0x14;
8695 static void alc885_imac91_setup(struct hda_codec *codec)
8697 struct alc_spec *spec = codec->spec;
8699 spec->autocfg.hp_pins[0] = 0x14;
8700 spec->autocfg.speaker_pins[0] = 0x18;
8701 spec->autocfg.speaker_pins[1] = 0x1a;
8704 static struct hda_verb alc882_targa_verbs[] = {
8705 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8706 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8708 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8709 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8711 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8712 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8713 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8715 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8719 /* toggle speaker-output according to the hp-jack state */
8720 static void alc882_targa_automute(struct hda_codec *codec)
8722 struct alc_spec *spec = codec->spec;
8723 alc_automute_amp(codec);
8724 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
8725 spec->jack_present ? 1 : 3);
8728 static void alc882_targa_setup(struct hda_codec *codec)
8730 struct alc_spec *spec = codec->spec;
8732 spec->autocfg.hp_pins[0] = 0x14;
8733 spec->autocfg.speaker_pins[0] = 0x1b;
8736 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
8738 if ((res >> 26) == ALC880_HP_EVENT)
8739 alc882_targa_automute(codec);
8742 static struct hda_verb alc882_asus_a7j_verbs[] = {
8743 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8744 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8746 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8747 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8748 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8750 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8751 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8752 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8754 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8755 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8756 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8760 static struct hda_verb alc882_asus_a7m_verbs[] = {
8761 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8762 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8764 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8765 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8766 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8768 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8769 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8770 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8772 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8773 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8774 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8778 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
8780 unsigned int gpiostate, gpiomask, gpiodir;
8782 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
8783 AC_VERB_GET_GPIO_DATA, 0);
8786 gpiostate |= (1 << pin);
8788 gpiostate &= ~(1 << pin);
8790 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
8791 AC_VERB_GET_GPIO_MASK, 0);
8792 gpiomask |= (1 << pin);
8794 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
8795 AC_VERB_GET_GPIO_DIRECTION, 0);
8796 gpiodir |= (1 << pin);
8799 snd_hda_codec_write(codec, codec->afg, 0,
8800 AC_VERB_SET_GPIO_MASK, gpiomask);
8801 snd_hda_codec_write(codec, codec->afg, 0,
8802 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
8806 snd_hda_codec_write(codec, codec->afg, 0,
8807 AC_VERB_SET_GPIO_DATA, gpiostate);
8810 /* set up GPIO at initialization */
8811 static void alc885_macpro_init_hook(struct hda_codec *codec)
8813 alc882_gpio_mute(codec, 0, 0);
8814 alc882_gpio_mute(codec, 1, 0);
8817 /* set up GPIO and update auto-muting at initialization */
8818 static void alc885_imac24_init_hook(struct hda_codec *codec)
8820 alc885_macpro_init_hook(codec);
8821 alc_automute_amp(codec);
8825 * generic initialization of ADC, input mixers and output mixers
8827 static struct hda_verb alc883_auto_init_verbs[] = {
8829 * Unmute ADC0-2 and set the default input to mic-in
8831 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8832 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8833 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8834 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8837 * Set up output mixers (0x0c - 0x0f)
8839 /* set vol=0 to output mixers */
8840 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8841 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8842 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8843 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8844 /* set up input amps for analog loopback */
8845 /* Amp Indices: DAC = 0, mixer = 1 */
8846 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8847 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8848 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8849 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8850 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8851 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8852 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8853 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8854 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8855 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8857 /* FIXME: use matrix-type input source selection */
8858 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8860 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8862 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8866 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
8867 static struct hda_verb alc889A_mb31_ch2_init[] = {
8868 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8869 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8870 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8871 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8875 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
8876 static struct hda_verb alc889A_mb31_ch4_init[] = {
8877 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8878 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8879 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8880 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8884 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
8885 static struct hda_verb alc889A_mb31_ch5_init[] = {
8886 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
8887 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8888 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8889 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8893 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
8894 static struct hda_verb alc889A_mb31_ch6_init[] = {
8895 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
8896 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
8897 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8898 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8902 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
8903 { 2, alc889A_mb31_ch2_init },
8904 { 4, alc889A_mb31_ch4_init },
8905 { 5, alc889A_mb31_ch5_init },
8906 { 6, alc889A_mb31_ch6_init },
8909 static struct hda_verb alc883_medion_eapd_verbs[] = {
8910 /* eanable EAPD on medion laptop */
8911 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8912 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
8916 #define alc883_base_mixer alc882_base_mixer
8918 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
8919 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8920 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8921 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8922 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8923 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8924 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8925 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8926 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8927 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8928 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8929 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8930 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
8931 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8935 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
8936 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8937 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8938 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8939 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8940 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8941 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8942 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8943 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8944 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
8945 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8949 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
8950 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8951 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8952 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8953 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8954 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8955 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8956 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8957 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8958 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
8959 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8963 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
8964 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8965 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8966 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8967 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8968 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8969 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8970 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8971 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8972 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8973 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8974 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8975 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
8976 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8980 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
8981 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8982 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8983 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8984 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8985 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8986 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8987 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8988 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8989 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8990 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8991 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8992 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8993 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8994 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8995 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8996 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8997 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8998 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
8999 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9003 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
9004 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9005 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9006 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9007 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
9008 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
9010 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9011 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
9012 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
9013 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9014 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9015 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9016 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9017 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9018 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9019 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT),
9020 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9021 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9022 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT),
9023 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9027 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
9028 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9029 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9030 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9031 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
9032 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
9034 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9035 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
9036 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
9037 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
9038 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
9039 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9040 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9041 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9042 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
9043 HDA_CODEC_VOLUME("Mic Boost Volume", 0x1b, 0, HDA_INPUT),
9044 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
9045 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9046 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT),
9047 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9051 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
9052 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9053 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9054 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9055 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
9056 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
9057 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9058 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
9059 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
9060 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9061 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9062 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9063 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9064 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9065 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9066 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9067 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9068 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9069 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
9070 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9074 static struct snd_kcontrol_new alc883_targa_mixer[] = {
9075 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9076 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9077 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9078 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9079 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9080 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
9081 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
9082 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9083 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
9084 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
9085 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9086 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9087 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9088 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9089 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9090 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9091 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9095 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
9096 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9097 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9098 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9099 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9100 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9101 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9102 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9103 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9104 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9105 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9106 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
9107 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9111 static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
9112 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
9113 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
9114 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9115 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
9116 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9120 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
9121 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9122 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9123 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9124 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
9125 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9126 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9127 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9128 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9132 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
9133 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9134 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
9135 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9136 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9137 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9138 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9139 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9140 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9141 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9145 static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = {
9146 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9147 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9148 HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9149 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
9150 HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT),
9151 HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT),
9155 static struct hda_verb alc883_medion_wim2160_verbs[] = {
9156 /* Unmute front mixer */
9157 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9158 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9160 /* Set speaker pin to front mixer */
9161 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9163 /* Init headphone pin */
9164 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9165 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9166 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
9167 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9172 /* toggle speaker-output according to the hp-jack state */
9173 static void alc883_medion_wim2160_setup(struct hda_codec *codec)
9175 struct alc_spec *spec = codec->spec;
9177 spec->autocfg.hp_pins[0] = 0x1a;
9178 spec->autocfg.speaker_pins[0] = 0x15;
9181 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
9182 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9183 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9184 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9185 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9186 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9187 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9188 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9189 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9193 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
9194 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9195 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
9196 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9197 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9198 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9199 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9200 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9201 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9202 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9206 static struct snd_kcontrol_new alc888_lenovo_sky_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", 0x0e, 0x0, HDA_OUTPUT),
9210 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
9211 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
9212 0x0d, 1, 0x0, HDA_OUTPUT),
9213 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
9214 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
9215 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
9216 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
9217 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
9218 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9219 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9220 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9221 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9222 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9223 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9224 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9225 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9226 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
9227 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9231 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
9233 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
9234 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
9235 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
9236 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
9237 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
9239 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
9240 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
9241 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
9242 /* Output switches */
9243 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
9244 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
9245 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
9247 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT),
9248 HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT),
9250 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
9251 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
9252 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9253 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9257 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
9258 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9259 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9260 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9261 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9262 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT),
9263 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9267 static struct hda_bind_ctls alc883_bind_cap_vol = {
9268 .ops = &snd_hda_bind_vol,
9270 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
9271 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
9276 static struct hda_bind_ctls alc883_bind_cap_switch = {
9277 .ops = &snd_hda_bind_sw,
9279 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
9280 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
9285 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
9286 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9287 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9288 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9289 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9290 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9291 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9292 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9293 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9297 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
9298 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
9299 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
9301 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9302 /* .name = "Capture Source", */
9303 .name = "Input Source",
9305 .info = alc_mux_enum_info,
9306 .get = alc_mux_enum_get,
9307 .put = alc_mux_enum_put,
9312 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
9314 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9315 .name = "Channel Mode",
9316 .info = alc_ch_mode_info,
9317 .get = alc_ch_mode_get,
9318 .put = alc_ch_mode_put,
9323 /* toggle speaker-output according to the hp-jack state */
9324 static void alc883_mitac_setup(struct hda_codec *codec)
9326 struct alc_spec *spec = codec->spec;
9328 spec->autocfg.hp_pins[0] = 0x15;
9329 spec->autocfg.speaker_pins[0] = 0x14;
9330 spec->autocfg.speaker_pins[1] = 0x17;
9333 static struct hda_verb alc883_mitac_verbs[] = {
9335 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9336 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9338 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
9339 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9341 /* enable unsolicited event */
9342 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9343 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
9348 static struct hda_verb alc883_clevo_m540r_verbs[] = {
9350 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9351 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9353 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
9355 /* enable unsolicited event */
9357 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9358 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9364 static struct hda_verb alc883_clevo_m720_verbs[] = {
9366 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9367 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9369 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
9370 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9372 /* enable unsolicited event */
9373 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9374 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9379 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
9381 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9382 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9384 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9385 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9387 /* enable unsolicited event */
9388 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9393 static struct hda_verb alc883_targa_verbs[] = {
9394 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9395 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9397 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9398 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9400 /* Connect Line-Out side jack (SPDIF) to Side */
9401 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9402 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9403 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
9404 /* Connect Mic jack to CLFE */
9405 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9406 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9407 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
9408 /* Connect Line-in jack to Surround */
9409 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9410 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9411 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
9412 /* Connect HP out jack to Front */
9413 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9414 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9415 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9417 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9422 static struct hda_verb alc883_lenovo_101e_verbs[] = {
9423 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9424 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
9425 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
9429 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
9430 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9431 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9432 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9433 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9437 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
9438 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9439 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9440 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9441 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
9442 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9446 static struct hda_verb alc883_haier_w66_verbs[] = {
9447 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9448 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9450 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9452 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9453 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9454 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9455 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9459 static struct hda_verb alc888_lenovo_sky_verbs[] = {
9460 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9461 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9462 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9463 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9464 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9465 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9466 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
9467 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9471 static struct hda_verb alc888_6st_dell_verbs[] = {
9472 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9476 static struct hda_verb alc883_vaiott_verbs[] = {
9478 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9479 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9481 /* enable unsolicited event */
9482 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9487 static void alc888_3st_hp_setup(struct hda_codec *codec)
9489 struct alc_spec *spec = codec->spec;
9491 spec->autocfg.hp_pins[0] = 0x1b;
9492 spec->autocfg.speaker_pins[0] = 0x14;
9493 spec->autocfg.speaker_pins[1] = 0x16;
9494 spec->autocfg.speaker_pins[2] = 0x18;
9497 static struct hda_verb alc888_3st_hp_verbs[] = {
9498 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
9499 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
9500 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
9501 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9508 static struct hda_verb alc888_3st_hp_2ch_init[] = {
9509 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
9510 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9511 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
9512 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9519 static struct hda_verb alc888_3st_hp_4ch_init[] = {
9520 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
9521 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9522 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9523 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9524 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
9531 static struct hda_verb alc888_3st_hp_6ch_init[] = {
9532 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9533 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9534 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
9535 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9536 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9537 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
9541 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
9542 { 2, alc888_3st_hp_2ch_init },
9543 { 4, alc888_3st_hp_4ch_init },
9544 { 6, alc888_3st_hp_6ch_init },
9547 /* toggle front-jack and RCA according to the hp-jack state */
9548 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
9550 unsigned int present = snd_hda_jack_detect(codec, 0x1b);
9552 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9553 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9554 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9555 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9558 /* toggle RCA according to the front-jack state */
9559 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
9561 unsigned int present = snd_hda_jack_detect(codec, 0x14);
9563 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9564 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9567 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
9570 if ((res >> 26) == ALC880_HP_EVENT)
9571 alc888_lenovo_ms7195_front_automute(codec);
9572 if ((res >> 26) == ALC880_FRONT_EVENT)
9573 alc888_lenovo_ms7195_rca_automute(codec);
9576 /* toggle speaker-output according to the hp-jack state */
9577 static void alc883_lenovo_nb0763_setup(struct hda_codec *codec)
9579 struct alc_spec *spec = codec->spec;
9581 spec->autocfg.hp_pins[0] = 0x14;
9582 spec->autocfg.speaker_pins[0] = 0x15;
9585 /* toggle speaker-output according to the hp-jack state */
9586 #define alc883_targa_init_hook alc882_targa_init_hook
9587 #define alc883_targa_unsol_event alc882_targa_unsol_event
9589 static void alc883_clevo_m720_setup(struct hda_codec *codec)
9591 struct alc_spec *spec = codec->spec;
9593 spec->autocfg.hp_pins[0] = 0x15;
9594 spec->autocfg.speaker_pins[0] = 0x14;
9597 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
9599 alc_automute_amp(codec);
9600 alc88x_simple_mic_automute(codec);
9603 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
9606 switch (res >> 26) {
9607 case ALC880_MIC_EVENT:
9608 alc88x_simple_mic_automute(codec);
9611 alc_automute_amp_unsol_event(codec, res);
9616 /* toggle speaker-output according to the hp-jack state */
9617 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
9619 struct alc_spec *spec = codec->spec;
9621 spec->autocfg.hp_pins[0] = 0x14;
9622 spec->autocfg.speaker_pins[0] = 0x15;
9625 static void alc883_haier_w66_setup(struct hda_codec *codec)
9627 struct alc_spec *spec = codec->spec;
9629 spec->autocfg.hp_pins[0] = 0x1b;
9630 spec->autocfg.speaker_pins[0] = 0x14;
9633 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
9635 int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0;
9637 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9638 HDA_AMP_MUTE, bits);
9641 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
9643 int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0;
9645 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9646 HDA_AMP_MUTE, bits);
9647 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9648 HDA_AMP_MUTE, bits);
9651 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
9654 if ((res >> 26) == ALC880_HP_EVENT)
9655 alc883_lenovo_101e_all_automute(codec);
9656 if ((res >> 26) == ALC880_FRONT_EVENT)
9657 alc883_lenovo_101e_ispeaker_automute(codec);
9660 /* toggle speaker-output according to the hp-jack state */
9661 static void alc883_acer_aspire_setup(struct hda_codec *codec)
9663 struct alc_spec *spec = codec->spec;
9665 spec->autocfg.hp_pins[0] = 0x14;
9666 spec->autocfg.speaker_pins[0] = 0x15;
9667 spec->autocfg.speaker_pins[1] = 0x16;
9670 static struct hda_verb alc883_acer_eapd_verbs[] = {
9671 /* HP Pin: output 0 (0x0c) */
9672 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9673 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9674 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9675 /* Front Pin: output 0 (0x0c) */
9676 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9677 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9678 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9679 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
9680 /* eanable EAPD on medion laptop */
9681 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9682 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
9683 /* enable unsolicited event */
9684 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9688 static void alc888_6st_dell_setup(struct hda_codec *codec)
9690 struct alc_spec *spec = codec->spec;
9692 spec->autocfg.hp_pins[0] = 0x1b;
9693 spec->autocfg.speaker_pins[0] = 0x14;
9694 spec->autocfg.speaker_pins[1] = 0x15;
9695 spec->autocfg.speaker_pins[2] = 0x16;
9696 spec->autocfg.speaker_pins[3] = 0x17;
9699 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
9701 struct alc_spec *spec = codec->spec;
9703 spec->autocfg.hp_pins[0] = 0x1b;
9704 spec->autocfg.speaker_pins[0] = 0x14;
9705 spec->autocfg.speaker_pins[1] = 0x15;
9706 spec->autocfg.speaker_pins[2] = 0x16;
9707 spec->autocfg.speaker_pins[3] = 0x17;
9708 spec->autocfg.speaker_pins[4] = 0x1a;
9711 static void alc883_vaiott_setup(struct hda_codec *codec)
9713 struct alc_spec *spec = codec->spec;
9715 spec->autocfg.hp_pins[0] = 0x15;
9716 spec->autocfg.speaker_pins[0] = 0x14;
9717 spec->autocfg.speaker_pins[1] = 0x17;
9720 static struct hda_verb alc888_asus_m90v_verbs[] = {
9721 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9722 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9723 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9724 /* enable unsolicited event */
9725 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9726 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9730 static void alc883_mode2_setup(struct hda_codec *codec)
9732 struct alc_spec *spec = codec->spec;
9734 spec->autocfg.hp_pins[0] = 0x1b;
9735 spec->autocfg.speaker_pins[0] = 0x14;
9736 spec->autocfg.speaker_pins[1] = 0x15;
9737 spec->autocfg.speaker_pins[2] = 0x16;
9738 spec->ext_mic.pin = 0x18;
9739 spec->int_mic.pin = 0x19;
9740 spec->ext_mic.mux_idx = 0;
9741 spec->int_mic.mux_idx = 1;
9745 static struct hda_verb alc888_asus_eee1601_verbs[] = {
9746 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9747 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9748 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9749 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9750 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9751 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
9752 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
9753 /* enable unsolicited event */
9754 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9758 static void alc883_eee1601_inithook(struct hda_codec *codec)
9760 struct alc_spec *spec = codec->spec;
9762 spec->autocfg.hp_pins[0] = 0x14;
9763 spec->autocfg.speaker_pins[0] = 0x1b;
9764 alc_automute_pin(codec);
9767 static struct hda_verb alc889A_mb31_verbs[] = {
9768 /* Init rear pin (used as headphone output) */
9769 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
9770 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
9771 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9772 /* Init line pin (used as output in 4ch and 6ch mode) */
9773 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
9774 /* Init line 2 pin (used as headphone out by default) */
9775 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
9776 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
9780 /* Mute speakers according to the headphone jack state */
9781 static void alc889A_mb31_automute(struct hda_codec *codec)
9783 unsigned int present;
9785 /* Mute only in 2ch or 4ch mode */
9786 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
9788 present = snd_hda_jack_detect(codec, 0x15);
9789 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9790 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9791 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9792 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9796 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
9798 if ((res >> 26) == ALC880_HP_EVENT)
9799 alc889A_mb31_automute(codec);
9803 #ifdef CONFIG_SND_HDA_POWER_SAVE
9804 #define alc882_loopbacks alc880_loopbacks
9807 /* pcm configuration: identical with ALC880 */
9808 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
9809 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
9810 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
9811 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
9813 static hda_nid_t alc883_slave_dig_outs[] = {
9814 ALC1200_DIGOUT_NID, 0,
9817 static hda_nid_t alc1200_slave_dig_outs[] = {
9818 ALC883_DIGOUT_NID, 0,
9822 * configuration and preset
9824 static const char * const alc882_models[ALC882_MODEL_LAST] = {
9825 [ALC882_3ST_DIG] = "3stack-dig",
9826 [ALC882_6ST_DIG] = "6stack-dig",
9827 [ALC882_ARIMA] = "arima",
9828 [ALC882_W2JC] = "w2jc",
9829 [ALC882_TARGA] = "targa",
9830 [ALC882_ASUS_A7J] = "asus-a7j",
9831 [ALC882_ASUS_A7M] = "asus-a7m",
9832 [ALC885_MACPRO] = "macpro",
9833 [ALC885_MB5] = "mb5",
9834 [ALC885_MACMINI3] = "macmini3",
9835 [ALC885_MBA21] = "mba21",
9836 [ALC885_MBP3] = "mbp3",
9837 [ALC885_IMAC24] = "imac24",
9838 [ALC885_IMAC91] = "imac91",
9839 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
9840 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
9841 [ALC883_3ST_6ch] = "3stack-6ch",
9842 [ALC883_6ST_DIG] = "alc883-6stack-dig",
9843 [ALC883_TARGA_DIG] = "targa-dig",
9844 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
9845 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
9846 [ALC883_ACER] = "acer",
9847 [ALC883_ACER_ASPIRE] = "acer-aspire",
9848 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
9849 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
9850 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
9851 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
9852 [ALC883_MEDION] = "medion",
9853 [ALC883_MEDION_WIM2160] = "medion-wim2160",
9854 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
9855 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
9856 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
9857 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
9858 [ALC888_LENOVO_SKY] = "lenovo-sky",
9859 [ALC883_HAIER_W66] = "haier-w66",
9860 [ALC888_3ST_HP] = "3stack-hp",
9861 [ALC888_6ST_DELL] = "6stack-dell",
9862 [ALC883_MITAC] = "mitac",
9863 [ALC883_CLEVO_M540R] = "clevo-m540r",
9864 [ALC883_CLEVO_M720] = "clevo-m720",
9865 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
9866 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
9867 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
9868 [ALC889A_INTEL] = "intel-alc889a",
9869 [ALC889_INTEL] = "intel-x58",
9870 [ALC1200_ASUS_P5Q] = "asus-p5q",
9871 [ALC889A_MB31] = "mb31",
9872 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
9873 [ALC882_AUTO] = "auto",
9876 static struct snd_pci_quirk alc882_cfg_tbl[] = {
9877 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
9879 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
9880 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
9881 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
9882 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
9883 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
9884 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
9885 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
9886 ALC888_ACER_ASPIRE_4930G),
9887 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
9888 ALC888_ACER_ASPIRE_4930G),
9889 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
9890 ALC888_ACER_ASPIRE_8930G),
9891 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
9892 ALC888_ACER_ASPIRE_8930G),
9893 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
9894 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
9895 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
9896 ALC888_ACER_ASPIRE_6530G),
9897 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
9898 ALC888_ACER_ASPIRE_6530G),
9899 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
9900 ALC888_ACER_ASPIRE_7730G),
9901 /* default Acer -- disabled as it causes more problems.
9902 * model=auto should work fine now
9904 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
9906 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
9908 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
9909 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
9910 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
9911 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
9912 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
9913 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
9915 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
9916 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
9917 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
9918 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
9919 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
9920 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
9921 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
9922 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
9923 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
9924 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
9925 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
9927 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
9928 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
9929 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
9930 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
9931 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
9932 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
9933 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
9934 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
9935 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
9937 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
9938 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
9939 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
9940 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
9941 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
9942 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
9943 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
9944 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
9945 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
9946 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
9947 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
9948 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
9949 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
9950 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
9951 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
9952 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
9953 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
9954 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
9955 SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG),
9956 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
9957 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
9958 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
9959 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
9960 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
9961 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
9962 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
9963 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
9964 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
9965 SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG),
9966 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
9967 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
9969 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
9970 SND_PCI_QUIRK(0x1558, 0x0571, "Clevo laptop M570U", ALC883_3ST_6ch_DIG),
9971 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
9972 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
9973 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
9974 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
9975 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
9976 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
9977 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
9978 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9979 ALC883_FUJITSU_PI2515),
9980 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9981 ALC888_FUJITSU_XA3530),
9982 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
9983 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9984 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9985 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9986 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
9987 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
9988 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
9989 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
9991 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
9992 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
9993 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
9994 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
9995 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
9996 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
9997 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG),
10002 /* codec SSID table for Intel Mac */
10003 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
10004 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
10005 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
10006 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
10007 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
10008 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
10009 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
10010 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
10011 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31),
10012 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_ASUS_A7M),
10013 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3),
10014 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21),
10015 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
10016 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
10017 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
10018 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
10019 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
10020 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5),
10021 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
10022 * so apparently no perfect solution yet
10024 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
10025 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
10026 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3),
10027 {} /* terminator */
10030 static struct alc_config_preset alc882_presets[] = {
10031 [ALC882_3ST_DIG] = {
10032 .mixers = { alc882_base_mixer },
10033 .init_verbs = { alc882_base_init_verbs,
10034 alc882_adc1_init_verbs },
10035 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10036 .dac_nids = alc882_dac_nids,
10037 .dig_out_nid = ALC882_DIGOUT_NID,
10038 .dig_in_nid = ALC882_DIGIN_NID,
10039 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
10040 .channel_mode = alc882_ch_modes,
10042 .input_mux = &alc882_capture_source,
10044 [ALC882_6ST_DIG] = {
10045 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
10046 .init_verbs = { alc882_base_init_verbs,
10047 alc882_adc1_init_verbs },
10048 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10049 .dac_nids = alc882_dac_nids,
10050 .dig_out_nid = ALC882_DIGOUT_NID,
10051 .dig_in_nid = ALC882_DIGIN_NID,
10052 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
10053 .channel_mode = alc882_sixstack_modes,
10054 .input_mux = &alc882_capture_source,
10057 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
10058 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10059 alc882_eapd_verbs },
10060 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10061 .dac_nids = alc882_dac_nids,
10062 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
10063 .channel_mode = alc882_sixstack_modes,
10064 .input_mux = &alc882_capture_source,
10067 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
10068 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10069 alc882_eapd_verbs, alc880_gpio1_init_verbs },
10070 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10071 .dac_nids = alc882_dac_nids,
10072 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
10073 .channel_mode = alc880_threestack_modes,
10075 .input_mux = &alc882_capture_source,
10076 .dig_out_nid = ALC882_DIGOUT_NID,
10079 .mixers = { alc885_mba21_mixer },
10080 .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs },
10082 .dac_nids = alc882_dac_nids,
10083 .channel_mode = alc885_mba21_ch_modes,
10084 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
10085 .input_mux = &alc882_capture_source,
10086 .unsol_event = alc_automute_amp_unsol_event,
10087 .setup = alc885_mba21_setup,
10088 .init_hook = alc_automute_amp,
10091 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
10092 .init_verbs = { alc885_mbp3_init_verbs,
10093 alc880_gpio1_init_verbs },
10095 .dac_nids = alc882_dac_nids,
10097 .channel_mode = alc885_mbp_4ch_modes,
10098 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
10099 .input_mux = &alc882_capture_source,
10100 .dig_out_nid = ALC882_DIGOUT_NID,
10101 .dig_in_nid = ALC882_DIGIN_NID,
10102 .unsol_event = alc_automute_amp_unsol_event,
10103 .setup = alc885_mbp3_setup,
10104 .init_hook = alc_automute_amp,
10107 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
10108 .init_verbs = { alc885_mb5_init_verbs,
10109 alc880_gpio1_init_verbs },
10110 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10111 .dac_nids = alc882_dac_nids,
10112 .channel_mode = alc885_mb5_6ch_modes,
10113 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
10114 .input_mux = &mb5_capture_source,
10115 .dig_out_nid = ALC882_DIGOUT_NID,
10116 .dig_in_nid = ALC882_DIGIN_NID,
10117 .unsol_event = alc_automute_amp_unsol_event,
10118 .setup = alc885_mb5_setup,
10119 .init_hook = alc_automute_amp,
10121 [ALC885_MACMINI3] = {
10122 .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer },
10123 .init_verbs = { alc885_macmini3_init_verbs,
10124 alc880_gpio1_init_verbs },
10125 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10126 .dac_nids = alc882_dac_nids,
10127 .channel_mode = alc885_macmini3_6ch_modes,
10128 .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes),
10129 .input_mux = &macmini3_capture_source,
10130 .dig_out_nid = ALC882_DIGOUT_NID,
10131 .dig_in_nid = ALC882_DIGIN_NID,
10132 .unsol_event = alc_automute_amp_unsol_event,
10133 .setup = alc885_macmini3_setup,
10134 .init_hook = alc_automute_amp,
10136 [ALC885_MACPRO] = {
10137 .mixers = { alc882_macpro_mixer },
10138 .init_verbs = { alc882_macpro_init_verbs },
10139 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10140 .dac_nids = alc882_dac_nids,
10141 .dig_out_nid = ALC882_DIGOUT_NID,
10142 .dig_in_nid = ALC882_DIGIN_NID,
10143 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
10144 .channel_mode = alc882_ch_modes,
10145 .input_mux = &alc882_capture_source,
10146 .init_hook = alc885_macpro_init_hook,
10148 [ALC885_IMAC24] = {
10149 .mixers = { alc885_imac24_mixer },
10150 .init_verbs = { alc885_imac24_init_verbs },
10151 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10152 .dac_nids = alc882_dac_nids,
10153 .dig_out_nid = ALC882_DIGOUT_NID,
10154 .dig_in_nid = ALC882_DIGIN_NID,
10155 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
10156 .channel_mode = alc882_ch_modes,
10157 .input_mux = &alc882_capture_source,
10158 .unsol_event = alc_automute_amp_unsol_event,
10159 .setup = alc885_imac24_setup,
10160 .init_hook = alc885_imac24_init_hook,
10162 [ALC885_IMAC91] = {
10163 .mixers = {alc885_imac91_mixer},
10164 .init_verbs = { alc885_imac91_init_verbs,
10165 alc880_gpio1_init_verbs },
10166 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10167 .dac_nids = alc882_dac_nids,
10168 .channel_mode = alc885_mba21_ch_modes,
10169 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
10170 .input_mux = &alc889A_imac91_capture_source,
10171 .dig_out_nid = ALC882_DIGOUT_NID,
10172 .dig_in_nid = ALC882_DIGIN_NID,
10173 .unsol_event = alc_automute_amp_unsol_event,
10174 .setup = alc885_imac91_setup,
10175 .init_hook = alc_automute_amp,
10178 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
10179 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10180 alc880_gpio3_init_verbs, alc882_targa_verbs},
10181 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10182 .dac_nids = alc882_dac_nids,
10183 .dig_out_nid = ALC882_DIGOUT_NID,
10184 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
10185 .adc_nids = alc882_adc_nids,
10186 .capsrc_nids = alc882_capsrc_nids,
10187 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
10188 .channel_mode = alc882_3ST_6ch_modes,
10190 .input_mux = &alc882_capture_source,
10191 .unsol_event = alc882_targa_unsol_event,
10192 .setup = alc882_targa_setup,
10193 .init_hook = alc882_targa_automute,
10195 [ALC882_ASUS_A7J] = {
10196 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
10197 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10198 alc882_asus_a7j_verbs},
10199 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10200 .dac_nids = alc882_dac_nids,
10201 .dig_out_nid = ALC882_DIGOUT_NID,
10202 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
10203 .adc_nids = alc882_adc_nids,
10204 .capsrc_nids = alc882_capsrc_nids,
10205 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
10206 .channel_mode = alc882_3ST_6ch_modes,
10208 .input_mux = &alc882_capture_source,
10210 [ALC882_ASUS_A7M] = {
10211 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
10212 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10213 alc882_eapd_verbs, alc880_gpio1_init_verbs,
10214 alc882_asus_a7m_verbs },
10215 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10216 .dac_nids = alc882_dac_nids,
10217 .dig_out_nid = ALC882_DIGOUT_NID,
10218 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
10219 .channel_mode = alc880_threestack_modes,
10221 .input_mux = &alc882_capture_source,
10223 [ALC883_3ST_2ch_DIG] = {
10224 .mixers = { alc883_3ST_2ch_mixer },
10225 .init_verbs = { alc883_init_verbs },
10226 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10227 .dac_nids = alc883_dac_nids,
10228 .dig_out_nid = ALC883_DIGOUT_NID,
10229 .dig_in_nid = ALC883_DIGIN_NID,
10230 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10231 .channel_mode = alc883_3ST_2ch_modes,
10232 .input_mux = &alc883_capture_source,
10234 [ALC883_3ST_6ch_DIG] = {
10235 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10236 .init_verbs = { alc883_init_verbs },
10237 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10238 .dac_nids = alc883_dac_nids,
10239 .dig_out_nid = ALC883_DIGOUT_NID,
10240 .dig_in_nid = ALC883_DIGIN_NID,
10241 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10242 .channel_mode = alc883_3ST_6ch_modes,
10244 .input_mux = &alc883_capture_source,
10246 [ALC883_3ST_6ch] = {
10247 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10248 .init_verbs = { alc883_init_verbs },
10249 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10250 .dac_nids = alc883_dac_nids,
10251 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10252 .channel_mode = alc883_3ST_6ch_modes,
10254 .input_mux = &alc883_capture_source,
10256 [ALC883_3ST_6ch_INTEL] = {
10257 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
10258 .init_verbs = { alc883_init_verbs },
10259 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10260 .dac_nids = alc883_dac_nids,
10261 .dig_out_nid = ALC883_DIGOUT_NID,
10262 .dig_in_nid = ALC883_DIGIN_NID,
10263 .slave_dig_outs = alc883_slave_dig_outs,
10264 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
10265 .channel_mode = alc883_3ST_6ch_intel_modes,
10267 .input_mux = &alc883_3stack_6ch_intel,
10269 [ALC889A_INTEL] = {
10270 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
10271 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
10272 alc_hp15_unsol_verbs },
10273 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10274 .dac_nids = alc883_dac_nids,
10275 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10276 .adc_nids = alc889_adc_nids,
10277 .dig_out_nid = ALC883_DIGOUT_NID,
10278 .dig_in_nid = ALC883_DIGIN_NID,
10279 .slave_dig_outs = alc883_slave_dig_outs,
10280 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
10281 .channel_mode = alc889_8ch_intel_modes,
10282 .capsrc_nids = alc889_capsrc_nids,
10283 .input_mux = &alc889_capture_source,
10284 .setup = alc889_automute_setup,
10285 .init_hook = alc_automute_amp,
10286 .unsol_event = alc_automute_amp_unsol_event,
10290 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
10291 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
10292 alc889_eapd_verbs, alc_hp15_unsol_verbs},
10293 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10294 .dac_nids = alc883_dac_nids,
10295 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10296 .adc_nids = alc889_adc_nids,
10297 .dig_out_nid = ALC883_DIGOUT_NID,
10298 .dig_in_nid = ALC883_DIGIN_NID,
10299 .slave_dig_outs = alc883_slave_dig_outs,
10300 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
10301 .channel_mode = alc889_8ch_intel_modes,
10302 .capsrc_nids = alc889_capsrc_nids,
10303 .input_mux = &alc889_capture_source,
10304 .setup = alc889_automute_setup,
10305 .init_hook = alc889_intel_init_hook,
10306 .unsol_event = alc_automute_amp_unsol_event,
10309 [ALC883_6ST_DIG] = {
10310 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10311 .init_verbs = { alc883_init_verbs },
10312 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10313 .dac_nids = alc883_dac_nids,
10314 .dig_out_nid = ALC883_DIGOUT_NID,
10315 .dig_in_nid = ALC883_DIGIN_NID,
10316 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10317 .channel_mode = alc883_sixstack_modes,
10318 .input_mux = &alc883_capture_source,
10320 [ALC883_TARGA_DIG] = {
10321 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
10322 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10323 alc883_targa_verbs},
10324 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10325 .dac_nids = alc883_dac_nids,
10326 .dig_out_nid = ALC883_DIGOUT_NID,
10327 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10328 .channel_mode = alc883_3ST_6ch_modes,
10330 .input_mux = &alc883_capture_source,
10331 .unsol_event = alc883_targa_unsol_event,
10332 .setup = alc882_targa_setup,
10333 .init_hook = alc882_targa_automute,
10335 [ALC883_TARGA_2ch_DIG] = {
10336 .mixers = { alc883_targa_2ch_mixer},
10337 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10338 alc883_targa_verbs},
10339 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10340 .dac_nids = alc883_dac_nids,
10341 .adc_nids = alc883_adc_nids_alt,
10342 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10343 .capsrc_nids = alc883_capsrc_nids,
10344 .dig_out_nid = ALC883_DIGOUT_NID,
10345 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10346 .channel_mode = alc883_3ST_2ch_modes,
10347 .input_mux = &alc883_capture_source,
10348 .unsol_event = alc883_targa_unsol_event,
10349 .setup = alc882_targa_setup,
10350 .init_hook = alc882_targa_automute,
10352 [ALC883_TARGA_8ch_DIG] = {
10353 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
10354 alc883_chmode_mixer },
10355 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10356 alc883_targa_verbs },
10357 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10358 .dac_nids = alc883_dac_nids,
10359 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10360 .adc_nids = alc883_adc_nids_rev,
10361 .capsrc_nids = alc883_capsrc_nids_rev,
10362 .dig_out_nid = ALC883_DIGOUT_NID,
10363 .dig_in_nid = ALC883_DIGIN_NID,
10364 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
10365 .channel_mode = alc883_4ST_8ch_modes,
10367 .input_mux = &alc883_capture_source,
10368 .unsol_event = alc883_targa_unsol_event,
10369 .setup = alc882_targa_setup,
10370 .init_hook = alc882_targa_automute,
10373 .mixers = { alc883_base_mixer },
10374 /* On TravelMate laptops, GPIO 0 enables the internal speaker
10375 * and the headphone jack. Turn this on and rely on the
10376 * standard mute methods whenever the user wants to turn
10377 * these outputs off.
10379 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
10380 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10381 .dac_nids = alc883_dac_nids,
10382 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10383 .channel_mode = alc883_3ST_2ch_modes,
10384 .input_mux = &alc883_capture_source,
10386 [ALC883_ACER_ASPIRE] = {
10387 .mixers = { alc883_acer_aspire_mixer },
10388 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
10389 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10390 .dac_nids = alc883_dac_nids,
10391 .dig_out_nid = ALC883_DIGOUT_NID,
10392 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10393 .channel_mode = alc883_3ST_2ch_modes,
10394 .input_mux = &alc883_capture_source,
10395 .unsol_event = alc_automute_amp_unsol_event,
10396 .setup = alc883_acer_aspire_setup,
10397 .init_hook = alc_automute_amp,
10399 [ALC888_ACER_ASPIRE_4930G] = {
10400 .mixers = { alc888_acer_aspire_4930g_mixer,
10401 alc883_chmode_mixer },
10402 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10403 alc888_acer_aspire_4930g_verbs },
10404 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10405 .dac_nids = alc883_dac_nids,
10406 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10407 .adc_nids = alc883_adc_nids_rev,
10408 .capsrc_nids = alc883_capsrc_nids_rev,
10409 .dig_out_nid = ALC883_DIGOUT_NID,
10410 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10411 .channel_mode = alc883_3ST_6ch_modes,
10413 .const_channel_count = 6,
10415 ARRAY_SIZE(alc888_2_capture_sources),
10416 .input_mux = alc888_2_capture_sources,
10417 .unsol_event = alc_automute_amp_unsol_event,
10418 .setup = alc888_acer_aspire_4930g_setup,
10419 .init_hook = alc_automute_amp,
10421 [ALC888_ACER_ASPIRE_6530G] = {
10422 .mixers = { alc888_acer_aspire_6530_mixer },
10423 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10424 alc888_acer_aspire_6530g_verbs },
10425 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10426 .dac_nids = alc883_dac_nids,
10427 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10428 .adc_nids = alc883_adc_nids_rev,
10429 .capsrc_nids = alc883_capsrc_nids_rev,
10430 .dig_out_nid = ALC883_DIGOUT_NID,
10431 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10432 .channel_mode = alc883_3ST_2ch_modes,
10434 ARRAY_SIZE(alc888_2_capture_sources),
10435 .input_mux = alc888_acer_aspire_6530_sources,
10436 .unsol_event = alc_automute_amp_unsol_event,
10437 .setup = alc888_acer_aspire_6530g_setup,
10438 .init_hook = alc_automute_amp,
10440 [ALC888_ACER_ASPIRE_8930G] = {
10441 .mixers = { alc889_acer_aspire_8930g_mixer,
10442 alc883_chmode_mixer },
10443 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10444 alc889_acer_aspire_8930g_verbs,
10445 alc889_eapd_verbs},
10446 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10447 .dac_nids = alc883_dac_nids,
10448 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10449 .adc_nids = alc889_adc_nids,
10450 .capsrc_nids = alc889_capsrc_nids,
10451 .dig_out_nid = ALC883_DIGOUT_NID,
10452 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10453 .channel_mode = alc883_3ST_6ch_modes,
10455 .const_channel_count = 6,
10457 ARRAY_SIZE(alc889_capture_sources),
10458 .input_mux = alc889_capture_sources,
10459 .unsol_event = alc_automute_amp_unsol_event,
10460 .setup = alc889_acer_aspire_8930g_setup,
10461 .init_hook = alc_automute_amp,
10462 #ifdef CONFIG_SND_HDA_POWER_SAVE
10463 .power_hook = alc_power_eapd,
10466 [ALC888_ACER_ASPIRE_7730G] = {
10467 .mixers = { alc883_3ST_6ch_mixer,
10468 alc883_chmode_mixer },
10469 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10470 alc888_acer_aspire_7730G_verbs },
10471 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10472 .dac_nids = alc883_dac_nids,
10473 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10474 .adc_nids = alc883_adc_nids_rev,
10475 .capsrc_nids = alc883_capsrc_nids_rev,
10476 .dig_out_nid = ALC883_DIGOUT_NID,
10477 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10478 .channel_mode = alc883_3ST_6ch_modes,
10480 .const_channel_count = 6,
10481 .input_mux = &alc883_capture_source,
10482 .unsol_event = alc_automute_amp_unsol_event,
10483 .setup = alc888_acer_aspire_7730g_setup,
10484 .init_hook = alc_automute_amp,
10486 [ALC883_MEDION] = {
10487 .mixers = { alc883_fivestack_mixer,
10488 alc883_chmode_mixer },
10489 .init_verbs = { alc883_init_verbs,
10490 alc883_medion_eapd_verbs },
10491 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10492 .dac_nids = alc883_dac_nids,
10493 .adc_nids = alc883_adc_nids_alt,
10494 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10495 .capsrc_nids = alc883_capsrc_nids,
10496 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10497 .channel_mode = alc883_sixstack_modes,
10498 .input_mux = &alc883_capture_source,
10500 [ALC883_MEDION_WIM2160] = {
10501 .mixers = { alc883_medion_wim2160_mixer },
10502 .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs },
10503 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10504 .dac_nids = alc883_dac_nids,
10505 .dig_out_nid = ALC883_DIGOUT_NID,
10506 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10507 .adc_nids = alc883_adc_nids,
10508 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10509 .channel_mode = alc883_3ST_2ch_modes,
10510 .input_mux = &alc883_capture_source,
10511 .unsol_event = alc_automute_amp_unsol_event,
10512 .setup = alc883_medion_wim2160_setup,
10513 .init_hook = alc_automute_amp,
10515 [ALC883_LAPTOP_EAPD] = {
10516 .mixers = { alc883_base_mixer },
10517 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
10518 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10519 .dac_nids = alc883_dac_nids,
10520 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10521 .channel_mode = alc883_3ST_2ch_modes,
10522 .input_mux = &alc883_capture_source,
10524 [ALC883_CLEVO_M540R] = {
10525 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10526 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
10527 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10528 .dac_nids = alc883_dac_nids,
10529 .dig_out_nid = ALC883_DIGOUT_NID,
10530 .dig_in_nid = ALC883_DIGIN_NID,
10531 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
10532 .channel_mode = alc883_3ST_6ch_clevo_modes,
10534 .input_mux = &alc883_capture_source,
10535 /* This machine has the hardware HP auto-muting, thus
10536 * we need no software mute via unsol event
10539 [ALC883_CLEVO_M720] = {
10540 .mixers = { alc883_clevo_m720_mixer },
10541 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
10542 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10543 .dac_nids = alc883_dac_nids,
10544 .dig_out_nid = ALC883_DIGOUT_NID,
10545 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10546 .channel_mode = alc883_3ST_2ch_modes,
10547 .input_mux = &alc883_capture_source,
10548 .unsol_event = alc883_clevo_m720_unsol_event,
10549 .setup = alc883_clevo_m720_setup,
10550 .init_hook = alc883_clevo_m720_init_hook,
10552 [ALC883_LENOVO_101E_2ch] = {
10553 .mixers = { alc883_lenovo_101e_2ch_mixer},
10554 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
10555 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10556 .dac_nids = alc883_dac_nids,
10557 .adc_nids = alc883_adc_nids_alt,
10558 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10559 .capsrc_nids = alc883_capsrc_nids,
10560 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10561 .channel_mode = alc883_3ST_2ch_modes,
10562 .input_mux = &alc883_lenovo_101e_capture_source,
10563 .unsol_event = alc883_lenovo_101e_unsol_event,
10564 .init_hook = alc883_lenovo_101e_all_automute,
10566 [ALC883_LENOVO_NB0763] = {
10567 .mixers = { alc883_lenovo_nb0763_mixer },
10568 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
10569 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10570 .dac_nids = alc883_dac_nids,
10571 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10572 .channel_mode = alc883_3ST_2ch_modes,
10574 .input_mux = &alc883_lenovo_nb0763_capture_source,
10575 .unsol_event = alc_automute_amp_unsol_event,
10576 .setup = alc883_lenovo_nb0763_setup,
10577 .init_hook = alc_automute_amp,
10579 [ALC888_LENOVO_MS7195_DIG] = {
10580 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10581 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
10582 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10583 .dac_nids = alc883_dac_nids,
10584 .dig_out_nid = ALC883_DIGOUT_NID,
10585 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10586 .channel_mode = alc883_3ST_6ch_modes,
10588 .input_mux = &alc883_capture_source,
10589 .unsol_event = alc883_lenovo_ms7195_unsol_event,
10590 .init_hook = alc888_lenovo_ms7195_front_automute,
10592 [ALC883_HAIER_W66] = {
10593 .mixers = { alc883_targa_2ch_mixer},
10594 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
10595 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10596 .dac_nids = alc883_dac_nids,
10597 .dig_out_nid = ALC883_DIGOUT_NID,
10598 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10599 .channel_mode = alc883_3ST_2ch_modes,
10600 .input_mux = &alc883_capture_source,
10601 .unsol_event = alc_automute_amp_unsol_event,
10602 .setup = alc883_haier_w66_setup,
10603 .init_hook = alc_automute_amp,
10605 [ALC888_3ST_HP] = {
10606 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10607 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
10608 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10609 .dac_nids = alc883_dac_nids,
10610 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
10611 .channel_mode = alc888_3st_hp_modes,
10613 .input_mux = &alc883_capture_source,
10614 .unsol_event = alc_automute_amp_unsol_event,
10615 .setup = alc888_3st_hp_setup,
10616 .init_hook = alc_automute_amp,
10618 [ALC888_6ST_DELL] = {
10619 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10620 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
10621 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10622 .dac_nids = alc883_dac_nids,
10623 .dig_out_nid = ALC883_DIGOUT_NID,
10624 .dig_in_nid = ALC883_DIGIN_NID,
10625 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10626 .channel_mode = alc883_sixstack_modes,
10627 .input_mux = &alc883_capture_source,
10628 .unsol_event = alc_automute_amp_unsol_event,
10629 .setup = alc888_6st_dell_setup,
10630 .init_hook = alc_automute_amp,
10633 .mixers = { alc883_mitac_mixer },
10634 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
10635 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10636 .dac_nids = alc883_dac_nids,
10637 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10638 .channel_mode = alc883_3ST_2ch_modes,
10639 .input_mux = &alc883_capture_source,
10640 .unsol_event = alc_automute_amp_unsol_event,
10641 .setup = alc883_mitac_setup,
10642 .init_hook = alc_automute_amp,
10644 [ALC883_FUJITSU_PI2515] = {
10645 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
10646 .init_verbs = { alc883_init_verbs,
10647 alc883_2ch_fujitsu_pi2515_verbs},
10648 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10649 .dac_nids = alc883_dac_nids,
10650 .dig_out_nid = ALC883_DIGOUT_NID,
10651 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10652 .channel_mode = alc883_3ST_2ch_modes,
10653 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10654 .unsol_event = alc_automute_amp_unsol_event,
10655 .setup = alc883_2ch_fujitsu_pi2515_setup,
10656 .init_hook = alc_automute_amp,
10658 [ALC888_FUJITSU_XA3530] = {
10659 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
10660 .init_verbs = { alc883_init_verbs,
10661 alc888_fujitsu_xa3530_verbs },
10662 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10663 .dac_nids = alc883_dac_nids,
10664 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10665 .adc_nids = alc883_adc_nids_rev,
10666 .capsrc_nids = alc883_capsrc_nids_rev,
10667 .dig_out_nid = ALC883_DIGOUT_NID,
10668 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
10669 .channel_mode = alc888_4ST_8ch_intel_modes,
10671 ARRAY_SIZE(alc888_2_capture_sources),
10672 .input_mux = alc888_2_capture_sources,
10673 .unsol_event = alc_automute_amp_unsol_event,
10674 .setup = alc888_fujitsu_xa3530_setup,
10675 .init_hook = alc_automute_amp,
10677 [ALC888_LENOVO_SKY] = {
10678 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
10679 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
10680 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10681 .dac_nids = alc883_dac_nids,
10682 .dig_out_nid = ALC883_DIGOUT_NID,
10683 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10684 .channel_mode = alc883_sixstack_modes,
10686 .input_mux = &alc883_lenovo_sky_capture_source,
10687 .unsol_event = alc_automute_amp_unsol_event,
10688 .setup = alc888_lenovo_sky_setup,
10689 .init_hook = alc_automute_amp,
10691 [ALC888_ASUS_M90V] = {
10692 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10693 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
10694 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10695 .dac_nids = alc883_dac_nids,
10696 .dig_out_nid = ALC883_DIGOUT_NID,
10697 .dig_in_nid = ALC883_DIGIN_NID,
10698 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10699 .channel_mode = alc883_3ST_6ch_modes,
10701 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10702 .unsol_event = alc_sku_unsol_event,
10703 .setup = alc883_mode2_setup,
10704 .init_hook = alc_inithook,
10706 [ALC888_ASUS_EEE1601] = {
10707 .mixers = { alc883_asus_eee1601_mixer },
10708 .cap_mixer = alc883_asus_eee1601_cap_mixer,
10709 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
10710 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10711 .dac_nids = alc883_dac_nids,
10712 .dig_out_nid = ALC883_DIGOUT_NID,
10713 .dig_in_nid = ALC883_DIGIN_NID,
10714 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10715 .channel_mode = alc883_3ST_2ch_modes,
10717 .input_mux = &alc883_asus_eee1601_capture_source,
10718 .unsol_event = alc_sku_unsol_event,
10719 .init_hook = alc883_eee1601_inithook,
10721 [ALC1200_ASUS_P5Q] = {
10722 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10723 .init_verbs = { alc883_init_verbs },
10724 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10725 .dac_nids = alc883_dac_nids,
10726 .dig_out_nid = ALC1200_DIGOUT_NID,
10727 .dig_in_nid = ALC883_DIGIN_NID,
10728 .slave_dig_outs = alc1200_slave_dig_outs,
10729 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10730 .channel_mode = alc883_sixstack_modes,
10731 .input_mux = &alc883_capture_source,
10734 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
10735 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
10736 alc880_gpio1_init_verbs },
10737 .adc_nids = alc883_adc_nids,
10738 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10739 .capsrc_nids = alc883_capsrc_nids,
10740 .dac_nids = alc883_dac_nids,
10741 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10742 .channel_mode = alc889A_mb31_6ch_modes,
10743 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
10744 .input_mux = &alc889A_mb31_capture_source,
10745 .dig_out_nid = ALC883_DIGOUT_NID,
10746 .unsol_event = alc889A_mb31_unsol_event,
10747 .init_hook = alc889A_mb31_automute,
10749 [ALC883_SONY_VAIO_TT] = {
10750 .mixers = { alc883_vaiott_mixer },
10751 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
10752 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10753 .dac_nids = alc883_dac_nids,
10754 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10755 .channel_mode = alc883_3ST_2ch_modes,
10756 .input_mux = &alc883_capture_source,
10757 .unsol_event = alc_automute_amp_unsol_event,
10758 .setup = alc883_vaiott_setup,
10759 .init_hook = alc_automute_amp,
10768 PINFIX_ABIT_AW9D_MAX,
10769 PINFIX_LENOVO_Y530,
10771 PINFIX_ACER_ASPIRE_7736,
10774 static const struct alc_fixup alc882_fixups[] = {
10775 [PINFIX_ABIT_AW9D_MAX] = {
10776 .type = ALC_FIXUP_PINS,
10777 .v.pins = (const struct alc_pincfg[]) {
10778 { 0x15, 0x01080104 }, /* side */
10779 { 0x16, 0x01011012 }, /* rear */
10780 { 0x17, 0x01016011 }, /* clfe */
10784 [PINFIX_LENOVO_Y530] = {
10785 .type = ALC_FIXUP_PINS,
10786 .v.pins = (const struct alc_pincfg[]) {
10787 { 0x15, 0x99130112 }, /* rear int speakers */
10788 { 0x16, 0x99130111 }, /* subwoofer */
10792 [PINFIX_PB_M5210] = {
10793 .type = ALC_FIXUP_VERBS,
10794 .v.verbs = (const struct hda_verb[]) {
10795 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 },
10799 [PINFIX_ACER_ASPIRE_7736] = {
10800 .type = ALC_FIXUP_SKU,
10801 .v.sku = ALC_FIXUP_SKU_IGNORE,
10805 static struct snd_pci_quirk alc882_fixup_tbl[] = {
10806 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210),
10807 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", PINFIX_LENOVO_Y530),
10808 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
10809 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", PINFIX_ACER_ASPIRE_7736),
10814 * BIOS auto configuration
10816 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
10817 const struct auto_pin_cfg *cfg)
10819 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
10822 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
10823 hda_nid_t nid, int pin_type,
10828 /* set as output */
10829 alc_set_pin_output(codec, nid, pin_type);
10833 else if (dac >= 0x02 && dac <= 0x05)
10837 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
10840 static void alc882_auto_init_multi_out(struct hda_codec *codec)
10842 struct alc_spec *spec = codec->spec;
10845 for (i = 0; i <= HDA_SIDE; i++) {
10846 hda_nid_t nid = spec->autocfg.line_out_pins[i];
10847 int pin_type = get_pin_type(spec->autocfg.line_out_type);
10849 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
10850 spec->multiout.dac_nids[i]);
10854 static void alc882_auto_init_hp_out(struct hda_codec *codec)
10856 struct alc_spec *spec = codec->spec;
10857 hda_nid_t pin, dac;
10860 if (spec->autocfg.line_out_type != AUTO_PIN_HP_OUT) {
10861 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
10862 pin = spec->autocfg.hp_pins[i];
10865 dac = spec->multiout.hp_nid;
10867 dac = spec->multiout.dac_nids[0]; /* to front */
10868 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac);
10872 if (spec->autocfg.line_out_type != AUTO_PIN_SPEAKER_OUT) {
10873 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
10874 pin = spec->autocfg.speaker_pins[i];
10877 dac = spec->multiout.extra_out_nid[0];
10879 dac = spec->multiout.dac_nids[0]; /* to front */
10880 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac);
10885 static void alc882_auto_init_analog_input(struct hda_codec *codec)
10887 struct alc_spec *spec = codec->spec;
10888 struct auto_pin_cfg *cfg = &spec->autocfg;
10891 for (i = 0; i < cfg->num_inputs; i++) {
10892 hda_nid_t nid = cfg->inputs[i].pin;
10893 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
10894 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
10895 snd_hda_codec_write(codec, nid, 0,
10896 AC_VERB_SET_AMP_GAIN_MUTE,
10901 static void alc882_auto_init_input_src(struct hda_codec *codec)
10903 struct alc_spec *spec = codec->spec;
10906 for (c = 0; c < spec->num_adc_nids; c++) {
10907 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
10908 hda_nid_t nid = spec->capsrc_nids[c];
10909 unsigned int mux_idx;
10910 const struct hda_input_mux *imux;
10911 int conns, mute, idx, item;
10913 conns = snd_hda_get_connections(codec, nid, conn_list,
10914 ARRAY_SIZE(conn_list));
10917 mux_idx = c >= spec->num_mux_defs ? 0 : c;
10918 imux = &spec->input_mux[mux_idx];
10919 if (!imux->num_items && mux_idx > 0)
10920 imux = &spec->input_mux[0];
10921 for (idx = 0; idx < conns; idx++) {
10922 /* if the current connection is the selected one,
10923 * unmute it as default - otherwise mute it
10925 mute = AMP_IN_MUTE(idx);
10926 for (item = 0; item < imux->num_items; item++) {
10927 if (imux->items[item].index == idx) {
10928 if (spec->cur_mux[c] == item)
10929 mute = AMP_IN_UNMUTE(idx);
10933 /* check if we have a selector or mixer
10934 * we could check for the widget type instead, but
10935 * just check for Amp-In presence (in case of mixer
10936 * without amp-in there is something wrong, this
10937 * function shouldn't be used or capsrc nid is wrong)
10939 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
10940 snd_hda_codec_write(codec, nid, 0,
10941 AC_VERB_SET_AMP_GAIN_MUTE,
10943 else if (mute != AMP_IN_MUTE(idx))
10944 snd_hda_codec_write(codec, nid, 0,
10945 AC_VERB_SET_CONNECT_SEL,
10951 /* add mic boosts if needed */
10952 static int alc_auto_add_mic_boost(struct hda_codec *codec)
10954 struct alc_spec *spec = codec->spec;
10955 struct auto_pin_cfg *cfg = &spec->autocfg;
10959 const char *prev_label = NULL;
10961 for (i = 0; i < cfg->num_inputs; i++) {
10962 if (cfg->inputs[i].type > AUTO_PIN_MIC)
10964 nid = cfg->inputs[i].pin;
10965 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) {
10967 char boost_label[32];
10969 label = hda_get_autocfg_input_label(codec, cfg, i);
10970 if (prev_label && !strcmp(label, prev_label))
10974 prev_label = label;
10976 snprintf(boost_label, sizeof(boost_label),
10977 "%s Boost Volume", label);
10978 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10979 boost_label, type_idx,
10980 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10988 /* almost identical with ALC880 parser... */
10989 static int alc882_parse_auto_config(struct hda_codec *codec)
10991 struct alc_spec *spec = codec->spec;
10992 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
10995 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10999 if (!spec->autocfg.line_outs)
11000 return 0; /* can't find valid BIOS pin config */
11002 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
11005 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
11008 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
11012 err = alc880_auto_create_extra_out(spec,
11013 spec->autocfg.speaker_pins[0],
11017 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
11021 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11023 alc_auto_parse_digital(codec);
11025 if (spec->kctls.list)
11026 add_mixer(spec, spec->kctls.list);
11028 add_verb(spec, alc883_auto_init_verbs);
11029 /* if ADC 0x07 is available, initialize it, too */
11030 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
11031 add_verb(spec, alc882_adc1_init_verbs);
11033 spec->num_mux_defs = 1;
11034 spec->input_mux = &spec->private_imux[0];
11036 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
11038 err = alc_auto_add_mic_boost(codec);
11042 return 1; /* config found */
11045 /* additional initialization for auto-configuration model */
11046 static void alc882_auto_init(struct hda_codec *codec)
11048 struct alc_spec *spec = codec->spec;
11049 alc882_auto_init_multi_out(codec);
11050 alc882_auto_init_hp_out(codec);
11051 alc882_auto_init_analog_input(codec);
11052 alc882_auto_init_input_src(codec);
11053 alc_auto_init_digital(codec);
11054 if (spec->unsol_event)
11055 alc_inithook(codec);
11058 static int patch_alc882(struct hda_codec *codec)
11060 struct alc_spec *spec;
11061 int err, board_config;
11063 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11067 codec->spec = spec;
11069 switch (codec->vendor_id) {
11074 /* ALC883 and variants */
11075 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11079 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
11083 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
11084 board_config = snd_hda_check_board_codec_sid_config(codec,
11085 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
11087 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
11088 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
11090 board_config = ALC882_AUTO;
11093 if (board_config == ALC882_AUTO) {
11094 alc_pick_fixup(codec, NULL, alc882_fixup_tbl, alc882_fixups);
11095 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
11098 alc_auto_parse_customize_define(codec);
11100 if (board_config == ALC882_AUTO) {
11101 /* automatic parse from the BIOS config */
11102 err = alc882_parse_auto_config(codec);
11108 "hda_codec: Cannot set up configuration "
11109 "from BIOS. Using base mode...\n");
11110 board_config = ALC882_3ST_DIG;
11114 if (has_cdefine_beep(codec)) {
11115 err = snd_hda_attach_beep_device(codec, 0x1);
11122 if (board_config != ALC882_AUTO)
11123 setup_preset(codec, &alc882_presets[board_config]);
11125 spec->stream_analog_playback = &alc882_pcm_analog_playback;
11126 spec->stream_analog_capture = &alc882_pcm_analog_capture;
11127 /* FIXME: setup DAC5 */
11128 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
11129 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
11131 spec->stream_digital_playback = &alc882_pcm_digital_playback;
11132 spec->stream_digital_capture = &alc882_pcm_digital_capture;
11134 if (!spec->adc_nids && spec->input_mux) {
11136 spec->num_adc_nids = 0;
11137 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
11138 const struct hda_input_mux *imux = spec->input_mux;
11140 hda_nid_t items[16];
11141 hda_nid_t nid = alc882_adc_nids[i];
11142 unsigned int wcap = get_wcaps(codec, nid);
11144 wcap = get_wcaps_type(wcap);
11145 if (wcap != AC_WID_AUD_IN)
11147 spec->private_adc_nids[spec->num_adc_nids] = nid;
11148 err = snd_hda_get_connections(codec, nid, &cap, 1);
11151 err = snd_hda_get_connections(codec, cap, items,
11152 ARRAY_SIZE(items));
11155 for (j = 0; j < imux->num_items; j++)
11156 if (imux->items[j].index >= err)
11158 if (j < imux->num_items)
11160 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
11161 spec->num_adc_nids++;
11163 spec->adc_nids = spec->private_adc_nids;
11164 spec->capsrc_nids = spec->private_capsrc_nids;
11167 set_capture_mixer(codec);
11169 if (has_cdefine_beep(codec))
11170 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11172 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
11174 spec->vmaster_nid = 0x0c;
11176 codec->patch_ops = alc_patch_ops;
11177 if (board_config == ALC882_AUTO)
11178 spec->init_hook = alc882_auto_init;
11180 alc_init_jacks(codec);
11181 #ifdef CONFIG_SND_HDA_POWER_SAVE
11182 if (!spec->loopback.amplist)
11183 spec->loopback.amplist = alc882_loopbacks;
11194 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
11195 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
11197 #define alc262_dac_nids alc260_dac_nids
11198 #define alc262_adc_nids alc882_adc_nids
11199 #define alc262_adc_nids_alt alc882_adc_nids_alt
11200 #define alc262_capsrc_nids alc882_capsrc_nids
11201 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
11203 #define alc262_modes alc260_modes
11204 #define alc262_capture_source alc882_capture_source
11206 static hda_nid_t alc262_dmic_adc_nids[1] = {
11211 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
11213 static struct snd_kcontrol_new alc262_base_mixer[] = {
11214 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11215 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11216 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11217 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11218 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11219 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11220 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11221 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11222 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11223 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11224 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11225 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11226 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
11227 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11228 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
11229 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
11233 /* update HP, line and mono-out pins according to the master switch */
11234 static void alc262_hp_master_update(struct hda_codec *codec)
11236 struct alc_spec *spec = codec->spec;
11237 int val = spec->master_sw;
11239 /* HP & line-out */
11240 snd_hda_codec_write_cache(codec, 0x1b, 0,
11241 AC_VERB_SET_PIN_WIDGET_CONTROL,
11243 snd_hda_codec_write_cache(codec, 0x15, 0,
11244 AC_VERB_SET_PIN_WIDGET_CONTROL,
11246 /* mono (speaker) depending on the HP jack sense */
11247 val = val && !spec->jack_present;
11248 snd_hda_codec_write_cache(codec, 0x16, 0,
11249 AC_VERB_SET_PIN_WIDGET_CONTROL,
11250 val ? PIN_OUT : 0);
11253 static void alc262_hp_bpc_automute(struct hda_codec *codec)
11255 struct alc_spec *spec = codec->spec;
11257 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
11258 alc262_hp_master_update(codec);
11261 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
11263 if ((res >> 26) != ALC880_HP_EVENT)
11265 alc262_hp_bpc_automute(codec);
11268 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
11270 struct alc_spec *spec = codec->spec;
11272 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11273 alc262_hp_master_update(codec);
11276 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
11279 if ((res >> 26) != ALC880_HP_EVENT)
11281 alc262_hp_wildwest_automute(codec);
11284 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
11286 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
11287 struct snd_ctl_elem_value *ucontrol)
11289 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11290 struct alc_spec *spec = codec->spec;
11291 int val = !!*ucontrol->value.integer.value;
11293 if (val == spec->master_sw)
11295 spec->master_sw = val;
11296 alc262_hp_master_update(codec);
11300 #define ALC262_HP_MASTER_SWITCH \
11302 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
11303 .name = "Master Playback Switch", \
11304 .info = snd_ctl_boolean_mono_info, \
11305 .get = alc262_hp_master_sw_get, \
11306 .put = alc262_hp_master_sw_put, \
11309 .iface = NID_MAPPING, \
11310 .name = "Master Playback Switch", \
11311 .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \
11315 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
11316 ALC262_HP_MASTER_SWITCH,
11317 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11318 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11319 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11320 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
11322 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
11324 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11325 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11326 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11327 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11328 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11329 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11330 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11331 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11332 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11333 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11334 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
11335 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
11339 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
11340 ALC262_HP_MASTER_SWITCH,
11341 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11342 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11343 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11344 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11345 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
11347 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
11349 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
11350 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
11351 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x1a, 0, HDA_INPUT),
11352 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
11353 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
11354 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11355 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11359 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
11360 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11361 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11362 HDA_CODEC_VOLUME("Rear Mic Boost Volume", 0x18, 0, HDA_INPUT),
11366 /* mute/unmute internal speaker according to the hp jack and mute state */
11367 static void alc262_hp_t5735_setup(struct hda_codec *codec)
11369 struct alc_spec *spec = codec->spec;
11371 spec->autocfg.hp_pins[0] = 0x15;
11372 spec->autocfg.speaker_pins[0] = 0x14;
11375 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
11376 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11377 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11378 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11379 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11380 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11381 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11382 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11386 static struct hda_verb alc262_hp_t5735_verbs[] = {
11387 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11388 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11390 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11394 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
11395 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11396 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11397 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
11398 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
11399 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
11400 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
11404 static struct hda_verb alc262_hp_rp5700_verbs[] = {
11405 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11406 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11407 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11408 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11409 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11410 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11411 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11412 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11413 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
11414 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
11418 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
11425 /* bind hp and internal speaker mute (with plug check) as master switch */
11426 static void alc262_hippo_master_update(struct hda_codec *codec)
11428 struct alc_spec *spec = codec->spec;
11429 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11430 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
11431 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
11435 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
11436 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
11437 HDA_AMP_MUTE, mute);
11438 /* mute internal speaker per jack sense */
11439 if (spec->jack_present)
11440 mute = HDA_AMP_MUTE;
11442 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
11443 HDA_AMP_MUTE, mute);
11444 if (speaker_nid && speaker_nid != line_nid)
11445 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
11446 HDA_AMP_MUTE, mute);
11449 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
11451 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
11452 struct snd_ctl_elem_value *ucontrol)
11454 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11455 struct alc_spec *spec = codec->spec;
11456 int val = !!*ucontrol->value.integer.value;
11458 if (val == spec->master_sw)
11460 spec->master_sw = val;
11461 alc262_hippo_master_update(codec);
11465 #define ALC262_HIPPO_MASTER_SWITCH \
11467 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
11468 .name = "Master Playback Switch", \
11469 .info = snd_ctl_boolean_mono_info, \
11470 .get = alc262_hippo_master_sw_get, \
11471 .put = alc262_hippo_master_sw_put, \
11474 .iface = NID_MAPPING, \
11475 .name = "Master Playback Switch", \
11476 .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \
11477 (SUBDEV_SPEAKER(0) << 16), \
11480 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
11481 ALC262_HIPPO_MASTER_SWITCH,
11482 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11483 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11484 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11485 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11486 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11487 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11488 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11489 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11490 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11491 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11492 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11493 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11497 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
11498 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11499 ALC262_HIPPO_MASTER_SWITCH,
11500 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11501 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11502 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11503 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11504 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11505 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11506 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11507 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11508 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11509 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11513 /* mute/unmute internal speaker according to the hp jack and mute state */
11514 static void alc262_hippo_automute(struct hda_codec *codec)
11516 struct alc_spec *spec = codec->spec;
11517 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11519 spec->jack_present = snd_hda_jack_detect(codec, hp_nid);
11520 alc262_hippo_master_update(codec);
11523 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
11525 if ((res >> 26) != ALC880_HP_EVENT)
11527 alc262_hippo_automute(codec);
11530 static void alc262_hippo_setup(struct hda_codec *codec)
11532 struct alc_spec *spec = codec->spec;
11534 spec->autocfg.hp_pins[0] = 0x15;
11535 spec->autocfg.speaker_pins[0] = 0x14;
11538 static void alc262_hippo1_setup(struct hda_codec *codec)
11540 struct alc_spec *spec = codec->spec;
11542 spec->autocfg.hp_pins[0] = 0x1b;
11543 spec->autocfg.speaker_pins[0] = 0x14;
11547 static struct snd_kcontrol_new alc262_sony_mixer[] = {
11548 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11549 ALC262_HIPPO_MASTER_SWITCH,
11550 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11551 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11552 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11553 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11557 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
11558 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11559 ALC262_HIPPO_MASTER_SWITCH,
11560 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11561 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11562 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11563 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11564 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11568 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
11569 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11570 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11571 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
11572 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
11573 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11574 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11575 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11576 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11577 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11578 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11579 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11580 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11584 static struct hda_verb alc262_tyan_verbs[] = {
11585 /* Headphone automute */
11586 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11587 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11588 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11590 /* P11 AUX_IN, white 4-pin connector */
11591 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11592 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
11593 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
11594 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
11599 /* unsolicited event for HP jack sensing */
11600 static void alc262_tyan_setup(struct hda_codec *codec)
11602 struct alc_spec *spec = codec->spec;
11604 spec->autocfg.hp_pins[0] = 0x1b;
11605 spec->autocfg.speaker_pins[0] = 0x15;
11609 #define alc262_capture_mixer alc882_capture_mixer
11610 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
11613 * generic initialization of ADC, input mixers and output mixers
11615 static struct hda_verb alc262_init_verbs[] = {
11617 * Unmute ADC0-2 and set the default input to mic-in
11619 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11620 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11621 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11622 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11623 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11624 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11626 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11628 * Note: PASD motherboards uses the Line In 2 as the input for
11629 * front panel mic (mic 2)
11631 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11632 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11633 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11634 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11635 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11636 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11639 * Set up output mixers (0x0c - 0x0e)
11641 /* set vol=0 to output mixers */
11642 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11643 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11644 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11645 /* set up input amps for analog loopback */
11646 /* Amp Indices: DAC = 0, mixer = 1 */
11647 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11648 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11649 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11650 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11651 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11652 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11654 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11655 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11656 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11657 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11658 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11659 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11661 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11662 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11663 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11664 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11665 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11667 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11668 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11670 /* FIXME: use matrix-type input source selection */
11671 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11672 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11673 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11674 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11675 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11676 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11678 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11679 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11680 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11681 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11683 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11684 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11685 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11686 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11691 static struct hda_verb alc262_eapd_verbs[] = {
11692 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11693 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11697 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
11698 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11699 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11700 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11702 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11703 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11707 static struct hda_verb alc262_sony_unsol_verbs[] = {
11708 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11709 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11710 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
11712 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11713 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11717 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
11718 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11719 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11720 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11721 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11722 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11726 static struct hda_verb alc262_toshiba_s06_verbs[] = {
11727 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11728 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11729 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11730 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11731 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
11732 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11733 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11734 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11738 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
11740 struct alc_spec *spec = codec->spec;
11742 spec->autocfg.hp_pins[0] = 0x15;
11743 spec->autocfg.speaker_pins[0] = 0x14;
11744 spec->ext_mic.pin = 0x18;
11745 spec->ext_mic.mux_idx = 0;
11746 spec->int_mic.pin = 0x12;
11747 spec->int_mic.mux_idx = 9;
11748 spec->auto_mic = 1;
11754 * 0x16 = internal speaker
11755 * 0x18 = external mic
11758 static struct snd_kcontrol_new alc262_nec_mixer[] = {
11759 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
11760 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
11762 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11763 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11764 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11766 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11767 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11771 static struct hda_verb alc262_nec_verbs[] = {
11772 /* Unmute Speaker */
11773 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11776 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11777 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11779 /* External mic to headphone */
11780 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11781 /* External mic to speaker */
11782 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11788 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
11789 * 0x1b = port replicator headphone out
11792 #define ALC_HP_EVENT 0x37
11794 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
11795 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11796 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11797 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11798 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11802 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
11803 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11804 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11808 static struct hda_verb alc262_lenovo_3000_init_verbs[] = {
11809 /* Front Mic pin: input vref at 50% */
11810 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
11811 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11815 static struct hda_input_mux alc262_fujitsu_capture_source = {
11819 { "Internal Mic", 0x1 },
11824 static struct hda_input_mux alc262_HP_capture_source = {
11828 { "Front Mic", 0x1 },
11835 static struct hda_input_mux alc262_HP_D7000_capture_source = {
11839 { "Front Mic", 0x2 },
11845 /* mute/unmute internal speaker according to the hp jacks and mute state */
11846 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
11848 struct alc_spec *spec = codec->spec;
11851 if (force || !spec->sense_updated) {
11852 spec->jack_present = snd_hda_jack_detect(codec, 0x14) ||
11853 snd_hda_jack_detect(codec, 0x1b);
11854 spec->sense_updated = 1;
11856 /* unmute internal speaker only if both HPs are unplugged and
11857 * master switch is on
11859 if (spec->jack_present)
11860 mute = HDA_AMP_MUTE;
11862 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11863 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11864 HDA_AMP_MUTE, mute);
11867 /* unsolicited event for HP jack sensing */
11868 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
11871 if ((res >> 26) != ALC_HP_EVENT)
11873 alc262_fujitsu_automute(codec, 1);
11876 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
11878 alc262_fujitsu_automute(codec, 1);
11881 /* bind volumes of both NID 0x0c and 0x0d */
11882 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
11883 .ops = &snd_hda_bind_vol,
11885 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
11886 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
11891 /* mute/unmute internal speaker according to the hp jack and mute state */
11892 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
11894 struct alc_spec *spec = codec->spec;
11897 if (force || !spec->sense_updated) {
11898 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
11899 spec->sense_updated = 1;
11901 if (spec->jack_present) {
11902 /* mute internal speaker */
11903 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11904 HDA_AMP_MUTE, HDA_AMP_MUTE);
11905 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11906 HDA_AMP_MUTE, HDA_AMP_MUTE);
11908 /* unmute internal speaker if necessary */
11909 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
11910 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11911 HDA_AMP_MUTE, mute);
11912 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11913 HDA_AMP_MUTE, mute);
11917 /* unsolicited event for HP jack sensing */
11918 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
11921 if ((res >> 26) != ALC_HP_EVENT)
11923 alc262_lenovo_3000_automute(codec, 1);
11926 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
11927 int dir, int idx, long *valp)
11931 for (i = 0; i < 2; i++, valp++)
11932 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
11934 *valp ? 0 : HDA_AMP_MUTE);
11938 /* bind hp and internal speaker mute (with plug check) */
11939 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
11940 struct snd_ctl_elem_value *ucontrol)
11942 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11943 long *valp = ucontrol->value.integer.value;
11946 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
11947 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11949 alc262_fujitsu_automute(codec, 0);
11953 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
11954 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11956 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11957 .name = "Master Playback Switch",
11958 .subdevice = HDA_SUBDEV_AMP_FLAG,
11959 .info = snd_hda_mixer_amp_switch_info,
11960 .get = snd_hda_mixer_amp_switch_get,
11961 .put = alc262_fujitsu_master_sw_put,
11962 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11965 .iface = NID_MAPPING,
11966 .name = "Master Playback Switch",
11967 .private_value = 0x1b,
11969 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11970 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11971 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11972 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11973 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11974 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
11975 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11976 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11980 /* bind hp and internal speaker mute (with plug check) */
11981 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
11982 struct snd_ctl_elem_value *ucontrol)
11984 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11985 long *valp = ucontrol->value.integer.value;
11988 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11990 alc262_lenovo_3000_automute(codec, 0);
11994 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
11995 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11997 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11998 .name = "Master Playback Switch",
11999 .subdevice = HDA_SUBDEV_AMP_FLAG,
12000 .info = snd_hda_mixer_amp_switch_info,
12001 .get = snd_hda_mixer_amp_switch_get,
12002 .put = alc262_lenovo_3000_master_sw_put,
12003 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
12005 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12006 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
12007 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
12008 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12009 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12010 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
12011 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12012 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12016 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
12017 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
12018 ALC262_HIPPO_MASTER_SWITCH,
12019 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12020 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12021 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
12022 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12023 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12024 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
12028 /* additional init verbs for Benq laptops */
12029 static struct hda_verb alc262_EAPD_verbs[] = {
12030 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
12031 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
12035 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
12036 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12037 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12039 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
12040 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
12044 /* Samsung Q1 Ultra Vista model setup */
12045 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
12046 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
12047 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
12048 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12049 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12050 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT),
12051 HDA_CODEC_VOLUME("Headphone Mic Boost Volume", 0x15, 0, HDA_INPUT),
12055 static struct hda_verb alc262_ultra_verbs[] = {
12057 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12058 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12059 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12061 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12062 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12063 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12064 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12066 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12067 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12068 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12069 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12070 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12072 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12073 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12074 /* ADC, choose mic */
12075 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12076 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12077 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12078 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12079 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12080 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12081 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12082 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
12083 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
12084 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
12088 /* mute/unmute internal speaker according to the hp jack and mute state */
12089 static void alc262_ultra_automute(struct hda_codec *codec)
12091 struct alc_spec *spec = codec->spec;
12095 /* auto-mute only when HP is used as HP */
12096 if (!spec->cur_mux[0]) {
12097 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
12098 if (spec->jack_present)
12099 mute = HDA_AMP_MUTE;
12101 /* mute/unmute internal speaker */
12102 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
12103 HDA_AMP_MUTE, mute);
12104 /* mute/unmute HP */
12105 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12106 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
12109 /* unsolicited event for HP jack sensing */
12110 static void alc262_ultra_unsol_event(struct hda_codec *codec,
12113 if ((res >> 26) != ALC880_HP_EVENT)
12115 alc262_ultra_automute(codec);
12118 static struct hda_input_mux alc262_ultra_capture_source = {
12122 { "Headphone", 0x7 },
12126 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
12127 struct snd_ctl_elem_value *ucontrol)
12129 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12130 struct alc_spec *spec = codec->spec;
12133 ret = alc_mux_enum_put(kcontrol, ucontrol);
12136 /* reprogram the HP pin as mic or HP according to the input source */
12137 snd_hda_codec_write_cache(codec, 0x15, 0,
12138 AC_VERB_SET_PIN_WIDGET_CONTROL,
12139 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
12140 alc262_ultra_automute(codec); /* mute/unmute HP */
12144 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
12145 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
12146 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
12148 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12149 .name = "Capture Source",
12150 .info = alc_mux_enum_info,
12151 .get = alc_mux_enum_get,
12152 .put = alc262_ultra_mux_enum_put,
12155 .iface = NID_MAPPING,
12156 .name = "Capture Source",
12157 .private_value = 0x15,
12162 /* We use two mixers depending on the output pin; 0x16 is a mono output
12163 * and thus it's bound with a different mixer.
12164 * This function returns which mixer amp should be used.
12166 static int alc262_check_volbit(hda_nid_t nid)
12170 else if (nid == 0x16)
12176 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
12177 const char *pfx, int *vbits, int idx)
12182 vbit = alc262_check_volbit(nid);
12185 if (*vbits & vbit) /* a volume control for this mixer already there */
12189 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
12191 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
12192 return __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, idx, val);
12195 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
12196 const char *pfx, int idx)
12203 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
12205 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
12206 return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, idx, val);
12209 /* add playback controls from the parsed DAC table */
12210 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
12211 const struct auto_pin_cfg *cfg)
12217 spec->multiout.num_dacs = 1; /* only use one dac */
12218 spec->multiout.dac_nids = spec->private_dac_nids;
12219 spec->multiout.dac_nids[0] = 2;
12221 pfx = alc_get_line_out_pfx(cfg, true);
12224 for (i = 0; i < 2; i++) {
12225 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[i], pfx, i);
12228 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) {
12229 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[i],
12234 if (cfg->line_out_type != AUTO_PIN_HP_OUT) {
12235 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[i],
12242 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
12243 alc262_check_volbit(cfg->speaker_pins[0]) |
12244 alc262_check_volbit(cfg->hp_pins[0]);
12245 if (vbits == 1 || vbits == 2)
12246 pfx = "Master"; /* only one mixer is used */
12248 for (i = 0; i < 2; i++) {
12249 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[i], pfx,
12253 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) {
12254 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[i],
12255 "Speaker", &vbits, i);
12259 if (cfg->line_out_type != AUTO_PIN_HP_OUT) {
12260 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[i],
12261 "Headphone", &vbits, i);
12269 #define alc262_auto_create_input_ctls \
12270 alc882_auto_create_input_ctls
12273 * generic initialization of ADC, input mixers and output mixers
12275 static struct hda_verb alc262_volume_init_verbs[] = {
12277 * Unmute ADC0-2 and set the default input to mic-in
12279 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12280 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12281 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12282 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12283 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12284 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12286 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12288 * Note: PASD motherboards uses the Line In 2 as the input for
12289 * front panel mic (mic 2)
12291 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12292 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12293 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12294 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12295 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12296 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12299 * Set up output mixers (0x0c - 0x0f)
12301 /* set vol=0 to output mixers */
12302 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12303 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12304 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12306 /* set up input amps for analog loopback */
12307 /* Amp Indices: DAC = 0, mixer = 1 */
12308 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12309 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12310 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12311 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12312 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12313 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12315 /* FIXME: use matrix-type input source selection */
12316 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12317 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12318 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12319 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12320 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12321 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12323 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12324 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12325 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12326 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12328 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12329 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12330 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12331 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12336 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
12338 * Unmute ADC0-2 and set the default input to mic-in
12340 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12341 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12342 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12343 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12344 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12345 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12347 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12349 * Note: PASD motherboards uses the Line In 2 as the input for
12350 * front panel mic (mic 2)
12352 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12353 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12354 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12355 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12356 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12357 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12358 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12359 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
12362 * Set up output mixers (0x0c - 0x0e)
12364 /* set vol=0 to output mixers */
12365 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12366 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12367 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12369 /* set up input amps for analog loopback */
12370 /* Amp Indices: DAC = 0, mixer = 1 */
12371 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12372 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12373 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12374 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12375 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12376 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12378 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12379 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12380 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12382 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12383 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12385 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12386 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12388 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12389 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12390 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12391 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12392 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12394 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12395 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12396 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12397 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12398 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12399 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12402 /* FIXME: use matrix-type input source selection */
12403 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
12404 /* Input mixer1: only unmute Mic */
12405 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12406 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12407 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12408 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12409 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12410 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12411 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12412 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12413 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12415 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12416 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12417 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12418 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12419 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12420 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12421 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12422 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12423 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12425 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12426 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12427 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12428 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12429 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12430 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12431 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12432 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12433 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12435 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12440 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
12442 * Unmute ADC0-2 and set the default input to mic-in
12444 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12445 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12446 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12447 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12448 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12449 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12451 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12453 * Note: PASD motherboards uses the Line In 2 as the input for front
12454 * panel mic (mic 2)
12456 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12457 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12458 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12459 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12460 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12461 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12462 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12463 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
12464 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
12466 * Set up output mixers (0x0c - 0x0e)
12468 /* set vol=0 to output mixers */
12469 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12470 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12471 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12473 /* set up input amps for analog loopback */
12474 /* Amp Indices: DAC = 0, mixer = 1 */
12475 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12476 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12477 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12478 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12479 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12480 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12483 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
12484 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
12485 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
12486 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
12487 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
12488 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
12489 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
12491 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12492 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12494 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12495 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12497 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
12498 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12499 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12500 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
12501 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12502 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12504 /* FIXME: use matrix-type input source selection */
12505 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12506 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12507 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
12508 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
12509 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
12510 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
12511 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
12512 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12513 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
12515 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12516 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
12517 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
12518 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
12519 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
12520 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12521 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
12523 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12524 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
12525 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
12526 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
12527 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
12528 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12529 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
12531 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12536 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
12538 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
12539 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12540 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
12542 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
12543 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
12544 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
12545 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
12547 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
12548 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12549 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12560 static const struct alc_fixup alc262_fixups[] = {
12561 [PINFIX_FSC_H270] = {
12562 .type = ALC_FIXUP_PINS,
12563 .v.pins = (const struct alc_pincfg[]) {
12564 { 0x14, 0x99130110 }, /* speaker */
12565 { 0x15, 0x0221142f }, /* front HP */
12566 { 0x1b, 0x0121141f }, /* rear HP */
12572 static struct snd_pci_quirk alc262_fixup_tbl[] = {
12573 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", PINFIX_FSC_H270),
12578 #ifdef CONFIG_SND_HDA_POWER_SAVE
12579 #define alc262_loopbacks alc880_loopbacks
12582 /* pcm configuration: identical with ALC880 */
12583 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
12584 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
12585 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
12586 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
12589 * BIOS auto configuration
12591 static int alc262_parse_auto_config(struct hda_codec *codec)
12593 struct alc_spec *spec = codec->spec;
12595 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
12597 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12601 if (!spec->autocfg.line_outs) {
12602 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12603 spec->multiout.max_channels = 2;
12604 spec->no_analog = 1;
12607 return 0; /* can't find valid BIOS pin config */
12609 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
12612 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
12616 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12619 alc_auto_parse_digital(codec);
12621 if (spec->kctls.list)
12622 add_mixer(spec, spec->kctls.list);
12624 add_verb(spec, alc262_volume_init_verbs);
12625 spec->num_mux_defs = 1;
12626 spec->input_mux = &spec->private_imux[0];
12628 err = alc_auto_add_mic_boost(codec);
12632 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
12637 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
12638 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
12639 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
12640 #define alc262_auto_init_input_src alc882_auto_init_input_src
12643 /* init callback for auto-configuration model -- overriding the default init */
12644 static void alc262_auto_init(struct hda_codec *codec)
12646 struct alc_spec *spec = codec->spec;
12647 alc262_auto_init_multi_out(codec);
12648 alc262_auto_init_hp_out(codec);
12649 alc262_auto_init_analog_input(codec);
12650 alc262_auto_init_input_src(codec);
12651 alc_auto_init_digital(codec);
12652 if (spec->unsol_event)
12653 alc_inithook(codec);
12657 * configuration and preset
12659 static const char * const alc262_models[ALC262_MODEL_LAST] = {
12660 [ALC262_BASIC] = "basic",
12661 [ALC262_HIPPO] = "hippo",
12662 [ALC262_HIPPO_1] = "hippo_1",
12663 [ALC262_FUJITSU] = "fujitsu",
12664 [ALC262_HP_BPC] = "hp-bpc",
12665 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
12666 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
12667 [ALC262_HP_RP5700] = "hp-rp5700",
12668 [ALC262_BENQ_ED8] = "benq",
12669 [ALC262_BENQ_T31] = "benq-t31",
12670 [ALC262_SONY_ASSAMD] = "sony-assamd",
12671 [ALC262_TOSHIBA_S06] = "toshiba-s06",
12672 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
12673 [ALC262_ULTRA] = "ultra",
12674 [ALC262_LENOVO_3000] = "lenovo-3000",
12675 [ALC262_NEC] = "nec",
12676 [ALC262_TYAN] = "tyan",
12677 [ALC262_AUTO] = "auto",
12680 static struct snd_pci_quirk alc262_cfg_tbl[] = {
12681 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
12682 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
12683 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
12685 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
12687 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1500, "HP z series",
12689 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
12691 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
12692 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
12693 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
12694 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
12695 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
12696 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
12697 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
12698 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
12699 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
12700 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
12701 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
12702 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
12703 ALC262_HP_TC_T5735),
12704 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
12705 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12706 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
12707 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12708 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
12709 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
12710 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
12711 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
12712 #if 0 /* disable the quirk since model=auto works better in recent versions */
12713 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
12714 ALC262_SONY_ASSAMD),
12716 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
12717 ALC262_TOSHIBA_RX1),
12718 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
12719 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
12720 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
12721 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
12722 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
12724 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
12725 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
12726 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
12727 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
12728 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
12732 static struct alc_config_preset alc262_presets[] = {
12734 .mixers = { alc262_base_mixer },
12735 .init_verbs = { alc262_init_verbs },
12736 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12737 .dac_nids = alc262_dac_nids,
12739 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12740 .channel_mode = alc262_modes,
12741 .input_mux = &alc262_capture_source,
12744 .mixers = { alc262_hippo_mixer },
12745 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
12746 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12747 .dac_nids = alc262_dac_nids,
12749 .dig_out_nid = ALC262_DIGOUT_NID,
12750 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12751 .channel_mode = alc262_modes,
12752 .input_mux = &alc262_capture_source,
12753 .unsol_event = alc262_hippo_unsol_event,
12754 .setup = alc262_hippo_setup,
12755 .init_hook = alc262_hippo_automute,
12757 [ALC262_HIPPO_1] = {
12758 .mixers = { alc262_hippo1_mixer },
12759 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
12760 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12761 .dac_nids = alc262_dac_nids,
12763 .dig_out_nid = ALC262_DIGOUT_NID,
12764 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12765 .channel_mode = alc262_modes,
12766 .input_mux = &alc262_capture_source,
12767 .unsol_event = alc262_hippo_unsol_event,
12768 .setup = alc262_hippo1_setup,
12769 .init_hook = alc262_hippo_automute,
12771 [ALC262_FUJITSU] = {
12772 .mixers = { alc262_fujitsu_mixer },
12773 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12774 alc262_fujitsu_unsol_verbs },
12775 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12776 .dac_nids = alc262_dac_nids,
12778 .dig_out_nid = ALC262_DIGOUT_NID,
12779 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12780 .channel_mode = alc262_modes,
12781 .input_mux = &alc262_fujitsu_capture_source,
12782 .unsol_event = alc262_fujitsu_unsol_event,
12783 .init_hook = alc262_fujitsu_init_hook,
12785 [ALC262_HP_BPC] = {
12786 .mixers = { alc262_HP_BPC_mixer },
12787 .init_verbs = { alc262_HP_BPC_init_verbs },
12788 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12789 .dac_nids = alc262_dac_nids,
12791 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12792 .channel_mode = alc262_modes,
12793 .input_mux = &alc262_HP_capture_source,
12794 .unsol_event = alc262_hp_bpc_unsol_event,
12795 .init_hook = alc262_hp_bpc_automute,
12797 [ALC262_HP_BPC_D7000_WF] = {
12798 .mixers = { alc262_HP_BPC_WildWest_mixer },
12799 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12800 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12801 .dac_nids = alc262_dac_nids,
12803 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12804 .channel_mode = alc262_modes,
12805 .input_mux = &alc262_HP_D7000_capture_source,
12806 .unsol_event = alc262_hp_wildwest_unsol_event,
12807 .init_hook = alc262_hp_wildwest_automute,
12809 [ALC262_HP_BPC_D7000_WL] = {
12810 .mixers = { alc262_HP_BPC_WildWest_mixer,
12811 alc262_HP_BPC_WildWest_option_mixer },
12812 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12813 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12814 .dac_nids = alc262_dac_nids,
12816 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12817 .channel_mode = alc262_modes,
12818 .input_mux = &alc262_HP_D7000_capture_source,
12819 .unsol_event = alc262_hp_wildwest_unsol_event,
12820 .init_hook = alc262_hp_wildwest_automute,
12822 [ALC262_HP_TC_T5735] = {
12823 .mixers = { alc262_hp_t5735_mixer },
12824 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
12825 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12826 .dac_nids = alc262_dac_nids,
12828 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12829 .channel_mode = alc262_modes,
12830 .input_mux = &alc262_capture_source,
12831 .unsol_event = alc_sku_unsol_event,
12832 .setup = alc262_hp_t5735_setup,
12833 .init_hook = alc_inithook,
12835 [ALC262_HP_RP5700] = {
12836 .mixers = { alc262_hp_rp5700_mixer },
12837 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
12838 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12839 .dac_nids = alc262_dac_nids,
12840 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12841 .channel_mode = alc262_modes,
12842 .input_mux = &alc262_hp_rp5700_capture_source,
12844 [ALC262_BENQ_ED8] = {
12845 .mixers = { alc262_base_mixer },
12846 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
12847 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12848 .dac_nids = alc262_dac_nids,
12850 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12851 .channel_mode = alc262_modes,
12852 .input_mux = &alc262_capture_source,
12854 [ALC262_SONY_ASSAMD] = {
12855 .mixers = { alc262_sony_mixer },
12856 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
12857 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12858 .dac_nids = alc262_dac_nids,
12860 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12861 .channel_mode = alc262_modes,
12862 .input_mux = &alc262_capture_source,
12863 .unsol_event = alc262_hippo_unsol_event,
12864 .setup = alc262_hippo_setup,
12865 .init_hook = alc262_hippo_automute,
12867 [ALC262_BENQ_T31] = {
12868 .mixers = { alc262_benq_t31_mixer },
12869 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
12870 alc_hp15_unsol_verbs },
12871 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12872 .dac_nids = alc262_dac_nids,
12874 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12875 .channel_mode = alc262_modes,
12876 .input_mux = &alc262_capture_source,
12877 .unsol_event = alc262_hippo_unsol_event,
12878 .setup = alc262_hippo_setup,
12879 .init_hook = alc262_hippo_automute,
12882 .mixers = { alc262_ultra_mixer },
12883 .cap_mixer = alc262_ultra_capture_mixer,
12884 .init_verbs = { alc262_ultra_verbs },
12885 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12886 .dac_nids = alc262_dac_nids,
12887 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12888 .channel_mode = alc262_modes,
12889 .input_mux = &alc262_ultra_capture_source,
12890 .adc_nids = alc262_adc_nids, /* ADC0 */
12891 .capsrc_nids = alc262_capsrc_nids,
12892 .num_adc_nids = 1, /* single ADC */
12893 .unsol_event = alc262_ultra_unsol_event,
12894 .init_hook = alc262_ultra_automute,
12896 [ALC262_LENOVO_3000] = {
12897 .mixers = { alc262_lenovo_3000_mixer },
12898 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12899 alc262_lenovo_3000_unsol_verbs,
12900 alc262_lenovo_3000_init_verbs },
12901 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12902 .dac_nids = alc262_dac_nids,
12904 .dig_out_nid = ALC262_DIGOUT_NID,
12905 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12906 .channel_mode = alc262_modes,
12907 .input_mux = &alc262_fujitsu_capture_source,
12908 .unsol_event = alc262_lenovo_3000_unsol_event,
12911 .mixers = { alc262_nec_mixer },
12912 .init_verbs = { alc262_nec_verbs },
12913 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12914 .dac_nids = alc262_dac_nids,
12916 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12917 .channel_mode = alc262_modes,
12918 .input_mux = &alc262_capture_source,
12920 [ALC262_TOSHIBA_S06] = {
12921 .mixers = { alc262_toshiba_s06_mixer },
12922 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
12923 alc262_eapd_verbs },
12924 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12925 .capsrc_nids = alc262_dmic_capsrc_nids,
12926 .dac_nids = alc262_dac_nids,
12927 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
12928 .num_adc_nids = 1, /* single ADC */
12929 .dig_out_nid = ALC262_DIGOUT_NID,
12930 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12931 .channel_mode = alc262_modes,
12932 .unsol_event = alc_sku_unsol_event,
12933 .setup = alc262_toshiba_s06_setup,
12934 .init_hook = alc_inithook,
12936 [ALC262_TOSHIBA_RX1] = {
12937 .mixers = { alc262_toshiba_rx1_mixer },
12938 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
12939 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12940 .dac_nids = alc262_dac_nids,
12942 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12943 .channel_mode = alc262_modes,
12944 .input_mux = &alc262_capture_source,
12945 .unsol_event = alc262_hippo_unsol_event,
12946 .setup = alc262_hippo_setup,
12947 .init_hook = alc262_hippo_automute,
12950 .mixers = { alc262_tyan_mixer },
12951 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
12952 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12953 .dac_nids = alc262_dac_nids,
12955 .dig_out_nid = ALC262_DIGOUT_NID,
12956 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12957 .channel_mode = alc262_modes,
12958 .input_mux = &alc262_capture_source,
12959 .unsol_event = alc_automute_amp_unsol_event,
12960 .setup = alc262_tyan_setup,
12961 .init_hook = alc_automute_amp,
12965 static int patch_alc262(struct hda_codec *codec)
12967 struct alc_spec *spec;
12971 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12975 codec->spec = spec;
12977 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
12982 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12983 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
12984 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12985 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
12988 alc_auto_parse_customize_define(codec);
12990 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
12992 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
12996 if (board_config < 0) {
12997 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12999 board_config = ALC262_AUTO;
13002 if (board_config == ALC262_AUTO) {
13003 alc_pick_fixup(codec, NULL, alc262_fixup_tbl, alc262_fixups);
13004 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
13007 if (board_config == ALC262_AUTO) {
13008 /* automatic parse from the BIOS config */
13009 err = alc262_parse_auto_config(codec);
13015 "hda_codec: Cannot set up configuration "
13016 "from BIOS. Using base mode...\n");
13017 board_config = ALC262_BASIC;
13021 if (!spec->no_analog && has_cdefine_beep(codec)) {
13022 err = snd_hda_attach_beep_device(codec, 0x1);
13029 if (board_config != ALC262_AUTO)
13030 setup_preset(codec, &alc262_presets[board_config]);
13032 spec->stream_analog_playback = &alc262_pcm_analog_playback;
13033 spec->stream_analog_capture = &alc262_pcm_analog_capture;
13035 spec->stream_digital_playback = &alc262_pcm_digital_playback;
13036 spec->stream_digital_capture = &alc262_pcm_digital_capture;
13038 if (!spec->adc_nids && spec->input_mux) {
13040 /* check whether the digital-mic has to be supported */
13041 for (i = 0; i < spec->input_mux->num_items; i++) {
13042 if (spec->input_mux->items[i].index >= 9)
13045 if (i < spec->input_mux->num_items) {
13046 /* use only ADC0 */
13047 spec->adc_nids = alc262_dmic_adc_nids;
13048 spec->num_adc_nids = 1;
13049 spec->capsrc_nids = alc262_dmic_capsrc_nids;
13051 /* all analog inputs */
13052 /* check whether NID 0x07 is valid */
13053 unsigned int wcap = get_wcaps(codec, 0x07);
13056 wcap = get_wcaps_type(wcap);
13057 if (wcap != AC_WID_AUD_IN) {
13058 spec->adc_nids = alc262_adc_nids_alt;
13059 spec->num_adc_nids =
13060 ARRAY_SIZE(alc262_adc_nids_alt);
13061 spec->capsrc_nids = alc262_capsrc_nids_alt;
13063 spec->adc_nids = alc262_adc_nids;
13064 spec->num_adc_nids =
13065 ARRAY_SIZE(alc262_adc_nids);
13066 spec->capsrc_nids = alc262_capsrc_nids;
13070 if (!spec->cap_mixer && !spec->no_analog)
13071 set_capture_mixer(codec);
13072 if (!spec->no_analog && has_cdefine_beep(codec))
13073 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
13075 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
13077 spec->vmaster_nid = 0x0c;
13079 codec->patch_ops = alc_patch_ops;
13080 if (board_config == ALC262_AUTO)
13081 spec->init_hook = alc262_auto_init;
13083 alc_init_jacks(codec);
13084 #ifdef CONFIG_SND_HDA_POWER_SAVE
13085 if (!spec->loopback.amplist)
13086 spec->loopback.amplist = alc262_loopbacks;
13093 * ALC268 channel source setting (2 channel)
13095 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
13096 #define alc268_modes alc260_modes
13098 static hda_nid_t alc268_dac_nids[2] = {
13103 static hda_nid_t alc268_adc_nids[2] = {
13108 static hda_nid_t alc268_adc_nids_alt[1] = {
13113 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
13115 static struct snd_kcontrol_new alc268_base_mixer[] = {
13116 /* output mixer control */
13117 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13118 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13119 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13120 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13121 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13122 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
13123 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
13127 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
13128 /* output mixer control */
13129 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13130 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13131 ALC262_HIPPO_MASTER_SWITCH,
13132 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13133 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
13134 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
13138 /* bind Beep switches of both NID 0x0f and 0x10 */
13139 static struct hda_bind_ctls alc268_bind_beep_sw = {
13140 .ops = &snd_hda_bind_sw,
13142 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
13143 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
13148 static struct snd_kcontrol_new alc268_beep_mixer[] = {
13149 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
13150 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
13154 static struct hda_verb alc268_eapd_verbs[] = {
13155 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13156 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13160 /* Toshiba specific */
13161 static struct hda_verb alc268_toshiba_verbs[] = {
13162 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13166 /* Acer specific */
13167 /* bind volumes of both NID 0x02 and 0x03 */
13168 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
13169 .ops = &snd_hda_bind_vol,
13171 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
13172 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
13177 /* mute/unmute internal speaker according to the hp jack and mute state */
13178 static void alc268_acer_automute(struct hda_codec *codec, int force)
13180 struct alc_spec *spec = codec->spec;
13183 if (force || !spec->sense_updated) {
13184 spec->jack_present = snd_hda_jack_detect(codec, 0x14);
13185 spec->sense_updated = 1;
13187 if (spec->jack_present)
13188 mute = HDA_AMP_MUTE; /* mute internal speaker */
13189 else /* unmute internal speaker if necessary */
13190 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
13191 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
13192 HDA_AMP_MUTE, mute);
13196 /* bind hp and internal speaker mute (with plug check) */
13197 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
13198 struct snd_ctl_elem_value *ucontrol)
13200 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
13201 long *valp = ucontrol->value.integer.value;
13204 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
13206 alc268_acer_automute(codec, 0);
13210 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
13211 /* output mixer control */
13212 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13214 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13215 .name = "Master Playback Switch",
13216 .subdevice = HDA_SUBDEV_AMP_FLAG,
13217 .info = snd_hda_mixer_amp_switch_info,
13218 .get = snd_hda_mixer_amp_switch_get,
13219 .put = alc268_acer_master_sw_put,
13220 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13222 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
13226 static struct snd_kcontrol_new alc268_acer_mixer[] = {
13227 /* output mixer control */
13228 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13230 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13231 .name = "Master Playback Switch",
13232 .subdevice = HDA_SUBDEV_AMP_FLAG,
13233 .info = snd_hda_mixer_amp_switch_info,
13234 .get = snd_hda_mixer_amp_switch_get,
13235 .put = alc268_acer_master_sw_put,
13236 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13238 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13239 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
13240 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
13244 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
13245 /* output mixer control */
13246 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13248 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13249 .name = "Master Playback Switch",
13250 .subdevice = HDA_SUBDEV_AMP_FLAG,
13251 .info = snd_hda_mixer_amp_switch_info,
13252 .get = snd_hda_mixer_amp_switch_get,
13253 .put = alc268_acer_master_sw_put,
13254 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13256 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13257 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
13261 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
13262 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13263 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13264 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13265 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13266 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
13267 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
13271 static struct hda_verb alc268_acer_verbs[] = {
13272 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
13273 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13274 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13275 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13276 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13277 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13278 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13282 /* unsolicited event for HP jack sensing */
13283 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
13284 #define alc268_toshiba_setup alc262_hippo_setup
13285 #define alc268_toshiba_automute alc262_hippo_automute
13287 static void alc268_acer_unsol_event(struct hda_codec *codec,
13290 if ((res >> 26) != ALC880_HP_EVENT)
13292 alc268_acer_automute(codec, 1);
13295 static void alc268_acer_init_hook(struct hda_codec *codec)
13297 alc268_acer_automute(codec, 1);
13300 /* toggle speaker-output according to the hp-jack state */
13301 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
13303 unsigned int present;
13304 unsigned char bits;
13306 present = snd_hda_jack_detect(codec, 0x15);
13307 bits = present ? HDA_AMP_MUTE : 0;
13308 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
13309 HDA_AMP_MUTE, bits);
13310 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
13311 HDA_AMP_MUTE, bits);
13314 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
13317 switch (res >> 26) {
13318 case ALC880_HP_EVENT:
13319 alc268_aspire_one_speaker_automute(codec);
13321 case ALC880_MIC_EVENT:
13322 alc_mic_automute(codec);
13327 static void alc268_acer_lc_setup(struct hda_codec *codec)
13329 struct alc_spec *spec = codec->spec;
13330 spec->ext_mic.pin = 0x18;
13331 spec->ext_mic.mux_idx = 0;
13332 spec->int_mic.pin = 0x12;
13333 spec->int_mic.mux_idx = 6;
13334 spec->auto_mic = 1;
13337 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
13339 alc268_aspire_one_speaker_automute(codec);
13340 alc_mic_automute(codec);
13343 static struct snd_kcontrol_new alc268_dell_mixer[] = {
13344 /* output mixer control */
13345 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13346 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13347 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13348 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13349 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13350 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
13354 static struct hda_verb alc268_dell_verbs[] = {
13355 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13356 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13357 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13358 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
13362 /* mute/unmute internal speaker according to the hp jack and mute state */
13363 static void alc268_dell_setup(struct hda_codec *codec)
13365 struct alc_spec *spec = codec->spec;
13367 spec->autocfg.hp_pins[0] = 0x15;
13368 spec->autocfg.speaker_pins[0] = 0x14;
13369 spec->ext_mic.pin = 0x18;
13370 spec->ext_mic.mux_idx = 0;
13371 spec->int_mic.pin = 0x19;
13372 spec->int_mic.mux_idx = 1;
13373 spec->auto_mic = 1;
13376 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
13377 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13378 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13379 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13380 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13381 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13382 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
13383 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13384 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
13388 static struct hda_verb alc267_quanta_il1_verbs[] = {
13389 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13390 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
13394 static void alc267_quanta_il1_setup(struct hda_codec *codec)
13396 struct alc_spec *spec = codec->spec;
13397 spec->autocfg.hp_pins[0] = 0x15;
13398 spec->autocfg.speaker_pins[0] = 0x14;
13399 spec->ext_mic.pin = 0x18;
13400 spec->ext_mic.mux_idx = 0;
13401 spec->int_mic.pin = 0x19;
13402 spec->int_mic.mux_idx = 1;
13403 spec->auto_mic = 1;
13407 * generic initialization of ADC, input mixers and output mixers
13409 static struct hda_verb alc268_base_init_verbs[] = {
13410 /* Unmute DAC0-1 and set vol = 0 */
13411 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13412 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13415 * Set up output mixers (0x0c - 0x0e)
13417 /* set vol=0 to output mixers */
13418 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13419 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
13421 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13422 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13424 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
13425 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
13426 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
13427 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13428 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13429 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13430 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13431 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13433 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13434 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13435 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13436 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13437 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13439 /* set PCBEEP vol = 0, mute connections */
13440 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13441 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13442 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13444 /* Unmute Selector 23h,24h and set the default input to mic-in */
13446 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
13447 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13448 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
13449 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13455 * generic initialization of ADC, input mixers and output mixers
13457 static struct hda_verb alc268_volume_init_verbs[] = {
13458 /* set output DAC */
13459 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13460 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13462 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13463 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13464 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13465 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13466 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13468 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13469 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13470 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13472 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13473 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13475 /* set PCBEEP vol = 0, mute connections */
13476 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13477 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13478 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13483 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
13484 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13485 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13489 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
13490 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13491 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13496 static struct snd_kcontrol_new alc268_capture_mixer[] = {
13497 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13498 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13499 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
13500 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
13505 static struct hda_input_mux alc268_capture_source = {
13509 { "Front Mic", 0x1 },
13515 static struct hda_input_mux alc268_acer_capture_source = {
13519 { "Internal Mic", 0x1 },
13524 static struct hda_input_mux alc268_acer_dmic_capture_source = {
13528 { "Internal Mic", 0x6 },
13533 #ifdef CONFIG_SND_DEBUG
13534 static struct snd_kcontrol_new alc268_test_mixer[] = {
13535 /* Volume widgets */
13536 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13537 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13538 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
13539 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
13540 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
13541 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
13542 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
13543 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
13544 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
13545 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
13546 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
13547 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
13548 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
13549 /* The below appears problematic on some hardwares */
13550 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
13551 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13552 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
13553 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
13554 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
13556 /* Modes for retasking pin widgets */
13557 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
13558 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
13559 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
13560 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
13562 /* Controls for GPIO pins, assuming they are configured as outputs */
13563 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
13564 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
13565 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
13566 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
13568 /* Switches to allow the digital SPDIF output pin to be enabled.
13569 * The ALC268 does not have an SPDIF input.
13571 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
13573 /* A switch allowing EAPD to be enabled. Some laptops seem to use
13574 * this output to turn on an external amplifier.
13576 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
13577 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
13583 /* create input playback/capture controls for the given pin */
13584 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
13585 const char *ctlname, int idx)
13596 case 0x1a: /* ALC259/269 only */
13597 case 0x1b: /* ALC259/269 only */
13598 case 0x21: /* ALC269vb has this pin, too */
13602 snd_printd(KERN_WARNING "hda_codec: "
13603 "ignoring pin 0x%x as unknown\n", nid);
13606 if (spec->multiout.dac_nids[0] != dac &&
13607 spec->multiout.dac_nids[1] != dac) {
13608 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
13609 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
13613 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
13617 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
13618 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
13620 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
13621 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
13627 /* add playback controls from the parsed DAC table */
13628 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
13629 const struct auto_pin_cfg *cfg)
13634 spec->multiout.dac_nids = spec->private_dac_nids;
13636 nid = cfg->line_out_pins[0];
13639 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
13643 err = alc268_new_analog_output(spec, nid, name, 0);
13648 nid = cfg->speaker_pins[0];
13650 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
13651 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
13655 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
13659 nid = cfg->hp_pins[0];
13661 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
13666 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
13668 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
13669 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
13676 /* create playback/capture controls for input pins */
13677 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
13678 const struct auto_pin_cfg *cfg)
13680 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
13683 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
13684 hda_nid_t nid, int pin_type)
13688 alc_set_pin_output(codec, nid, pin_type);
13689 if (nid == 0x14 || nid == 0x16)
13693 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
13696 static void alc268_auto_init_multi_out(struct hda_codec *codec)
13698 struct alc_spec *spec = codec->spec;
13701 for (i = 0; i < spec->autocfg.line_outs; i++) {
13702 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13703 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13704 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
13708 static void alc268_auto_init_hp_out(struct hda_codec *codec)
13710 struct alc_spec *spec = codec->spec;
13714 for (i = 0; i < spec->autocfg.hp_outs; i++) {
13715 pin = spec->autocfg.hp_pins[i];
13716 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
13718 for (i = 0; i < spec->autocfg.speaker_outs; i++) {
13719 pin = spec->autocfg.speaker_pins[i];
13720 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
13722 if (spec->autocfg.mono_out_pin)
13723 snd_hda_codec_write(codec, spec->autocfg.mono_out_pin, 0,
13724 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
13727 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
13729 struct alc_spec *spec = codec->spec;
13730 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
13731 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
13732 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
13733 unsigned int dac_vol1, dac_vol2;
13735 if (line_nid == 0x1d || speaker_nid == 0x1d) {
13736 snd_hda_codec_write(codec, speaker_nid, 0,
13737 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
13738 /* mute mixer inputs from 0x1d */
13739 snd_hda_codec_write(codec, 0x0f, 0,
13740 AC_VERB_SET_AMP_GAIN_MUTE,
13742 snd_hda_codec_write(codec, 0x10, 0,
13743 AC_VERB_SET_AMP_GAIN_MUTE,
13746 /* unmute mixer inputs from 0x1d */
13747 snd_hda_codec_write(codec, 0x0f, 0,
13748 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13749 snd_hda_codec_write(codec, 0x10, 0,
13750 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13753 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
13754 if (line_nid == 0x14)
13755 dac_vol2 = AMP_OUT_ZERO;
13756 else if (line_nid == 0x15)
13757 dac_vol1 = AMP_OUT_ZERO;
13758 if (hp_nid == 0x14)
13759 dac_vol2 = AMP_OUT_ZERO;
13760 else if (hp_nid == 0x15)
13761 dac_vol1 = AMP_OUT_ZERO;
13762 if (line_nid != 0x16 || hp_nid != 0x16 ||
13763 spec->autocfg.line_out_pins[1] != 0x16 ||
13764 spec->autocfg.line_out_pins[2] != 0x16)
13765 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
13767 snd_hda_codec_write(codec, 0x02, 0,
13768 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
13769 snd_hda_codec_write(codec, 0x03, 0,
13770 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
13773 /* pcm configuration: identical with ALC880 */
13774 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
13775 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
13776 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
13777 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
13780 * BIOS auto configuration
13782 static int alc268_parse_auto_config(struct hda_codec *codec)
13784 struct alc_spec *spec = codec->spec;
13786 static hda_nid_t alc268_ignore[] = { 0 };
13788 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13792 if (!spec->autocfg.line_outs) {
13793 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
13794 spec->multiout.max_channels = 2;
13795 spec->no_analog = 1;
13798 return 0; /* can't find valid BIOS pin config */
13800 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
13803 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
13807 spec->multiout.max_channels = 2;
13810 /* digital only support output */
13811 alc_auto_parse_digital(codec);
13812 if (spec->kctls.list)
13813 add_mixer(spec, spec->kctls.list);
13815 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
13816 add_mixer(spec, alc268_beep_mixer);
13818 add_verb(spec, alc268_volume_init_verbs);
13819 spec->num_mux_defs = 2;
13820 spec->input_mux = &spec->private_imux[0];
13822 err = alc_auto_add_mic_boost(codec);
13826 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
13831 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
13833 /* init callback for auto-configuration model -- overriding the default init */
13834 static void alc268_auto_init(struct hda_codec *codec)
13836 struct alc_spec *spec = codec->spec;
13837 alc268_auto_init_multi_out(codec);
13838 alc268_auto_init_hp_out(codec);
13839 alc268_auto_init_mono_speaker_out(codec);
13840 alc268_auto_init_analog_input(codec);
13841 alc_auto_init_digital(codec);
13842 if (spec->unsol_event)
13843 alc_inithook(codec);
13847 * configuration and preset
13849 static const char * const alc268_models[ALC268_MODEL_LAST] = {
13850 [ALC267_QUANTA_IL1] = "quanta-il1",
13851 [ALC268_3ST] = "3stack",
13852 [ALC268_TOSHIBA] = "toshiba",
13853 [ALC268_ACER] = "acer",
13854 [ALC268_ACER_DMIC] = "acer-dmic",
13855 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
13856 [ALC268_DELL] = "dell",
13857 [ALC268_ZEPTO] = "zepto",
13858 #ifdef CONFIG_SND_DEBUG
13859 [ALC268_TEST] = "test",
13861 [ALC268_AUTO] = "auto",
13864 static struct snd_pci_quirk alc268_cfg_tbl[] = {
13865 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
13866 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
13867 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
13868 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
13869 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
13870 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
13871 ALC268_ACER_ASPIRE_ONE),
13872 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
13873 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
13874 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
13875 /* almost compatible with toshiba but with optional digital outs;
13876 * auto-probing seems working fine
13878 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
13880 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
13881 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
13882 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
13883 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
13884 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
13888 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
13889 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
13890 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
13891 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
13892 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
13897 static struct alc_config_preset alc268_presets[] = {
13898 [ALC267_QUANTA_IL1] = {
13899 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
13900 alc268_capture_nosrc_mixer },
13901 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13902 alc267_quanta_il1_verbs },
13903 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13904 .dac_nids = alc268_dac_nids,
13905 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13906 .adc_nids = alc268_adc_nids_alt,
13908 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13909 .channel_mode = alc268_modes,
13910 .unsol_event = alc_sku_unsol_event,
13911 .setup = alc267_quanta_il1_setup,
13912 .init_hook = alc_inithook,
13915 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13916 alc268_beep_mixer },
13917 .init_verbs = { alc268_base_init_verbs },
13918 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13919 .dac_nids = alc268_dac_nids,
13920 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13921 .adc_nids = alc268_adc_nids_alt,
13922 .capsrc_nids = alc268_capsrc_nids,
13924 .dig_out_nid = ALC268_DIGOUT_NID,
13925 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13926 .channel_mode = alc268_modes,
13927 .input_mux = &alc268_capture_source,
13929 [ALC268_TOSHIBA] = {
13930 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
13931 alc268_beep_mixer },
13932 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13933 alc268_toshiba_verbs },
13934 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13935 .dac_nids = alc268_dac_nids,
13936 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13937 .adc_nids = alc268_adc_nids_alt,
13938 .capsrc_nids = alc268_capsrc_nids,
13940 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13941 .channel_mode = alc268_modes,
13942 .input_mux = &alc268_capture_source,
13943 .unsol_event = alc268_toshiba_unsol_event,
13944 .setup = alc268_toshiba_setup,
13945 .init_hook = alc268_toshiba_automute,
13948 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
13949 alc268_beep_mixer },
13950 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13951 alc268_acer_verbs },
13952 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13953 .dac_nids = alc268_dac_nids,
13954 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13955 .adc_nids = alc268_adc_nids_alt,
13956 .capsrc_nids = alc268_capsrc_nids,
13958 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13959 .channel_mode = alc268_modes,
13960 .input_mux = &alc268_acer_capture_source,
13961 .unsol_event = alc268_acer_unsol_event,
13962 .init_hook = alc268_acer_init_hook,
13964 [ALC268_ACER_DMIC] = {
13965 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
13966 alc268_beep_mixer },
13967 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13968 alc268_acer_verbs },
13969 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13970 .dac_nids = alc268_dac_nids,
13971 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13972 .adc_nids = alc268_adc_nids_alt,
13973 .capsrc_nids = alc268_capsrc_nids,
13975 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13976 .channel_mode = alc268_modes,
13977 .input_mux = &alc268_acer_dmic_capture_source,
13978 .unsol_event = alc268_acer_unsol_event,
13979 .init_hook = alc268_acer_init_hook,
13981 [ALC268_ACER_ASPIRE_ONE] = {
13982 .mixers = { alc268_acer_aspire_one_mixer,
13984 alc268_capture_nosrc_mixer },
13985 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13986 alc268_acer_aspire_one_verbs },
13987 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13988 .dac_nids = alc268_dac_nids,
13989 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13990 .adc_nids = alc268_adc_nids_alt,
13991 .capsrc_nids = alc268_capsrc_nids,
13993 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13994 .channel_mode = alc268_modes,
13995 .unsol_event = alc268_acer_lc_unsol_event,
13996 .setup = alc268_acer_lc_setup,
13997 .init_hook = alc268_acer_lc_init_hook,
14000 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
14001 alc268_capture_nosrc_mixer },
14002 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
14003 alc268_dell_verbs },
14004 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
14005 .dac_nids = alc268_dac_nids,
14006 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
14007 .adc_nids = alc268_adc_nids_alt,
14008 .capsrc_nids = alc268_capsrc_nids,
14010 .num_channel_mode = ARRAY_SIZE(alc268_modes),
14011 .channel_mode = alc268_modes,
14012 .unsol_event = alc_sku_unsol_event,
14013 .setup = alc268_dell_setup,
14014 .init_hook = alc_inithook,
14017 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
14018 alc268_beep_mixer },
14019 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
14020 alc268_toshiba_verbs },
14021 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
14022 .dac_nids = alc268_dac_nids,
14023 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
14024 .adc_nids = alc268_adc_nids_alt,
14025 .capsrc_nids = alc268_capsrc_nids,
14027 .dig_out_nid = ALC268_DIGOUT_NID,
14028 .num_channel_mode = ARRAY_SIZE(alc268_modes),
14029 .channel_mode = alc268_modes,
14030 .input_mux = &alc268_capture_source,
14031 .setup = alc268_toshiba_setup,
14032 .init_hook = alc268_toshiba_automute,
14034 #ifdef CONFIG_SND_DEBUG
14036 .mixers = { alc268_test_mixer, alc268_capture_mixer },
14037 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
14038 alc268_volume_init_verbs },
14039 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
14040 .dac_nids = alc268_dac_nids,
14041 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
14042 .adc_nids = alc268_adc_nids_alt,
14043 .capsrc_nids = alc268_capsrc_nids,
14045 .dig_out_nid = ALC268_DIGOUT_NID,
14046 .num_channel_mode = ARRAY_SIZE(alc268_modes),
14047 .channel_mode = alc268_modes,
14048 .input_mux = &alc268_capture_source,
14053 static int patch_alc268(struct hda_codec *codec)
14055 struct alc_spec *spec;
14057 int i, has_beep, err;
14059 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14063 codec->spec = spec;
14065 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
14069 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
14070 board_config = snd_hda_check_board_codec_sid_config(codec,
14071 ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
14073 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
14074 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14076 board_config = ALC268_AUTO;
14079 if (board_config == ALC268_AUTO) {
14080 /* automatic parse from the BIOS config */
14081 err = alc268_parse_auto_config(codec);
14087 "hda_codec: Cannot set up configuration "
14088 "from BIOS. Using base mode...\n");
14089 board_config = ALC268_3ST;
14093 if (board_config != ALC268_AUTO)
14094 setup_preset(codec, &alc268_presets[board_config]);
14096 spec->stream_analog_playback = &alc268_pcm_analog_playback;
14097 spec->stream_analog_capture = &alc268_pcm_analog_capture;
14098 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
14100 spec->stream_digital_playback = &alc268_pcm_digital_playback;
14103 for (i = 0; i < spec->num_mixers; i++) {
14104 if (spec->mixers[i] == alc268_beep_mixer) {
14111 err = snd_hda_attach_beep_device(codec, 0x1);
14116 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
14117 /* override the amp caps for beep generator */
14118 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
14119 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
14120 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
14121 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
14122 (0 << AC_AMPCAP_MUTE_SHIFT));
14125 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
14126 /* check whether NID 0x07 is valid */
14127 unsigned int wcap = get_wcaps(codec, 0x07);
14130 spec->capsrc_nids = alc268_capsrc_nids;
14132 wcap = get_wcaps_type(wcap);
14133 if (spec->auto_mic ||
14134 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
14135 spec->adc_nids = alc268_adc_nids_alt;
14136 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
14137 if (spec->auto_mic)
14138 fixup_automic_adc(codec);
14139 if (spec->auto_mic || spec->input_mux->num_items == 1)
14140 add_mixer(spec, alc268_capture_nosrc_mixer);
14142 add_mixer(spec, alc268_capture_alt_mixer);
14144 spec->adc_nids = alc268_adc_nids;
14145 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
14146 add_mixer(spec, alc268_capture_mixer);
14148 /* set default input source */
14149 for (i = 0; i < spec->num_adc_nids; i++)
14150 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
14151 0, AC_VERB_SET_CONNECT_SEL,
14152 i < spec->num_mux_defs ?
14153 spec->input_mux[i].items[0].index :
14154 spec->input_mux->items[0].index);
14157 spec->vmaster_nid = 0x02;
14159 codec->patch_ops = alc_patch_ops;
14160 if (board_config == ALC268_AUTO)
14161 spec->init_hook = alc268_auto_init;
14163 alc_init_jacks(codec);
14169 * ALC269 channel source setting (2 channel)
14171 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
14173 #define alc269_dac_nids alc260_dac_nids
14175 static hda_nid_t alc269_adc_nids[1] = {
14180 static hda_nid_t alc269_capsrc_nids[1] = {
14184 static hda_nid_t alc269vb_adc_nids[1] = {
14189 static hda_nid_t alc269vb_capsrc_nids[1] = {
14193 static hda_nid_t alc269_adc_candidates[] = {
14194 0x08, 0x09, 0x07, 0x11,
14197 #define alc269_modes alc260_modes
14198 #define alc269_capture_source alc880_lg_lw_capture_source
14200 static struct snd_kcontrol_new alc269_base_mixer[] = {
14201 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14202 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14203 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14204 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14205 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14206 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14207 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14208 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
14209 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
14210 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
14211 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14212 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
14216 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
14217 /* output mixer control */
14218 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
14220 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14221 .name = "Master Playback Switch",
14222 .subdevice = HDA_SUBDEV_AMP_FLAG,
14223 .info = snd_hda_mixer_amp_switch_info,
14224 .get = snd_hda_mixer_amp_switch_get,
14225 .put = alc268_acer_master_sw_put,
14226 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14228 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14229 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14230 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14231 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
14232 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
14233 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
14237 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
14238 /* output mixer control */
14239 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
14241 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14242 .name = "Master Playback Switch",
14243 .subdevice = HDA_SUBDEV_AMP_FLAG,
14244 .info = snd_hda_mixer_amp_switch_info,
14245 .get = snd_hda_mixer_amp_switch_get,
14246 .put = alc268_acer_master_sw_put,
14247 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14249 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14250 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14251 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14252 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
14253 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
14254 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
14255 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
14256 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
14257 HDA_CODEC_VOLUME("Dock Mic Boost Volume", 0x1b, 0, HDA_INPUT),
14261 static struct snd_kcontrol_new alc269_laptop_mixer[] = {
14262 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14263 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14264 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14265 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14269 static struct snd_kcontrol_new alc269vb_laptop_mixer[] = {
14270 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14271 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14272 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
14273 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14277 static struct snd_kcontrol_new alc269_asus_mixer[] = {
14278 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14279 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x0, HDA_INPUT),
14283 /* capture mixer elements */
14284 static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = {
14285 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
14286 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
14287 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14288 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
14292 static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = {
14293 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
14294 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
14295 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14299 static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = {
14300 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
14301 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
14302 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14303 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
14307 static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = {
14308 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
14309 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
14310 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14315 #define alc269_fujitsu_mixer alc269_laptop_mixer
14317 static struct hda_verb alc269_quanta_fl1_verbs[] = {
14318 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14319 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14320 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14321 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
14322 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14323 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14327 static struct hda_verb alc269_lifebook_verbs[] = {
14328 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14329 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
14330 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14331 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14332 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
14333 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14334 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14335 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
14336 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14337 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14341 /* toggle speaker-output according to the hp-jack state */
14342 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
14344 unsigned int present;
14345 unsigned char bits;
14347 present = snd_hda_jack_detect(codec, 0x15);
14348 bits = present ? HDA_AMP_MUTE : 0;
14349 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14350 HDA_AMP_MUTE, bits);
14351 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14352 HDA_AMP_MUTE, bits);
14354 snd_hda_codec_write(codec, 0x20, 0,
14355 AC_VERB_SET_COEF_INDEX, 0x0c);
14356 snd_hda_codec_write(codec, 0x20, 0,
14357 AC_VERB_SET_PROC_COEF, 0x680);
14359 snd_hda_codec_write(codec, 0x20, 0,
14360 AC_VERB_SET_COEF_INDEX, 0x0c);
14361 snd_hda_codec_write(codec, 0x20, 0,
14362 AC_VERB_SET_PROC_COEF, 0x480);
14365 /* toggle speaker-output according to the hp-jacks state */
14366 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
14368 unsigned int present;
14369 unsigned char bits;
14371 /* Check laptop headphone socket */
14372 present = snd_hda_jack_detect(codec, 0x15);
14374 /* Check port replicator headphone socket */
14375 present |= snd_hda_jack_detect(codec, 0x1a);
14377 bits = present ? HDA_AMP_MUTE : 0;
14378 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14379 HDA_AMP_MUTE, bits);
14380 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14381 HDA_AMP_MUTE, bits);
14383 snd_hda_codec_write(codec, 0x20, 0,
14384 AC_VERB_SET_COEF_INDEX, 0x0c);
14385 snd_hda_codec_write(codec, 0x20, 0,
14386 AC_VERB_SET_PROC_COEF, 0x680);
14388 snd_hda_codec_write(codec, 0x20, 0,
14389 AC_VERB_SET_COEF_INDEX, 0x0c);
14390 snd_hda_codec_write(codec, 0x20, 0,
14391 AC_VERB_SET_PROC_COEF, 0x480);
14394 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
14396 unsigned int present_laptop;
14397 unsigned int present_dock;
14399 present_laptop = snd_hda_jack_detect(codec, 0x18);
14400 present_dock = snd_hda_jack_detect(codec, 0x1b);
14402 /* Laptop mic port overrides dock mic port, design decision */
14404 snd_hda_codec_write(codec, 0x23, 0,
14405 AC_VERB_SET_CONNECT_SEL, 0x3);
14406 if (present_laptop)
14407 snd_hda_codec_write(codec, 0x23, 0,
14408 AC_VERB_SET_CONNECT_SEL, 0x0);
14409 if (!present_dock && !present_laptop)
14410 snd_hda_codec_write(codec, 0x23, 0,
14411 AC_VERB_SET_CONNECT_SEL, 0x1);
14414 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
14417 switch (res >> 26) {
14418 case ALC880_HP_EVENT:
14419 alc269_quanta_fl1_speaker_automute(codec);
14421 case ALC880_MIC_EVENT:
14422 alc_mic_automute(codec);
14427 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
14430 if ((res >> 26) == ALC880_HP_EVENT)
14431 alc269_lifebook_speaker_automute(codec);
14432 if ((res >> 26) == ALC880_MIC_EVENT)
14433 alc269_lifebook_mic_autoswitch(codec);
14436 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
14438 struct alc_spec *spec = codec->spec;
14439 spec->autocfg.hp_pins[0] = 0x15;
14440 spec->autocfg.speaker_pins[0] = 0x14;
14441 spec->ext_mic.pin = 0x18;
14442 spec->ext_mic.mux_idx = 0;
14443 spec->int_mic.pin = 0x19;
14444 spec->int_mic.mux_idx = 1;
14445 spec->auto_mic = 1;
14448 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
14450 alc269_quanta_fl1_speaker_automute(codec);
14451 alc_mic_automute(codec);
14454 static void alc269_lifebook_init_hook(struct hda_codec *codec)
14456 alc269_lifebook_speaker_automute(codec);
14457 alc269_lifebook_mic_autoswitch(codec);
14460 static struct hda_verb alc269_laptop_dmic_init_verbs[] = {
14461 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14462 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
14463 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14464 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14465 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14466 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14467 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14471 static struct hda_verb alc269_laptop_amic_init_verbs[] = {
14472 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14473 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
14474 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14475 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
14476 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14477 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14481 static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = {
14482 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
14483 {0x22, AC_VERB_SET_CONNECT_SEL, 0x06},
14484 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14485 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14486 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14487 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14488 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14492 static struct hda_verb alc269vb_laptop_amic_init_verbs[] = {
14493 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
14494 {0x22, AC_VERB_SET_CONNECT_SEL, 0x01},
14495 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14496 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14497 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14498 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14499 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14503 static struct hda_verb alc271_acer_dmic_verbs[] = {
14504 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
14505 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
14506 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14507 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14508 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14509 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14510 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00},
14511 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14512 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14513 {0x22, AC_VERB_SET_CONNECT_SEL, 6},
14517 /* toggle speaker-output according to the hp-jack state */
14518 static void alc269_speaker_automute(struct hda_codec *codec)
14520 struct alc_spec *spec = codec->spec;
14521 unsigned int nid = spec->autocfg.hp_pins[0];
14522 unsigned int present;
14523 unsigned char bits;
14525 present = snd_hda_jack_detect(codec, nid);
14526 bits = present ? HDA_AMP_MUTE : 0;
14527 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14528 HDA_AMP_MUTE, bits);
14529 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14530 HDA_AMP_MUTE, bits);
14531 alc_report_jack(codec, nid);
14534 /* unsolicited event for HP jack sensing */
14535 static void alc269_laptop_unsol_event(struct hda_codec *codec,
14538 switch (res >> 26) {
14539 case ALC880_HP_EVENT:
14540 alc269_speaker_automute(codec);
14542 case ALC880_MIC_EVENT:
14543 alc_mic_automute(codec);
14548 static void alc269_laptop_amic_setup(struct hda_codec *codec)
14550 struct alc_spec *spec = codec->spec;
14551 spec->autocfg.hp_pins[0] = 0x15;
14552 spec->autocfg.speaker_pins[0] = 0x14;
14553 spec->ext_mic.pin = 0x18;
14554 spec->ext_mic.mux_idx = 0;
14555 spec->int_mic.pin = 0x19;
14556 spec->int_mic.mux_idx = 1;
14557 spec->auto_mic = 1;
14560 static void alc269_laptop_dmic_setup(struct hda_codec *codec)
14562 struct alc_spec *spec = codec->spec;
14563 spec->autocfg.hp_pins[0] = 0x15;
14564 spec->autocfg.speaker_pins[0] = 0x14;
14565 spec->ext_mic.pin = 0x18;
14566 spec->ext_mic.mux_idx = 0;
14567 spec->int_mic.pin = 0x12;
14568 spec->int_mic.mux_idx = 5;
14569 spec->auto_mic = 1;
14572 static void alc269vb_laptop_amic_setup(struct hda_codec *codec)
14574 struct alc_spec *spec = codec->spec;
14575 spec->autocfg.hp_pins[0] = 0x21;
14576 spec->autocfg.speaker_pins[0] = 0x14;
14577 spec->ext_mic.pin = 0x18;
14578 spec->ext_mic.mux_idx = 0;
14579 spec->int_mic.pin = 0x19;
14580 spec->int_mic.mux_idx = 1;
14581 spec->auto_mic = 1;
14584 static void alc269vb_laptop_dmic_setup(struct hda_codec *codec)
14586 struct alc_spec *spec = codec->spec;
14587 spec->autocfg.hp_pins[0] = 0x21;
14588 spec->autocfg.speaker_pins[0] = 0x14;
14589 spec->ext_mic.pin = 0x18;
14590 spec->ext_mic.mux_idx = 0;
14591 spec->int_mic.pin = 0x12;
14592 spec->int_mic.mux_idx = 6;
14593 spec->auto_mic = 1;
14596 static void alc269_laptop_inithook(struct hda_codec *codec)
14598 alc269_speaker_automute(codec);
14599 alc_mic_automute(codec);
14603 * generic initialization of ADC, input mixers and output mixers
14605 static struct hda_verb alc269_init_verbs[] = {
14607 * Unmute ADC0 and set the default input to mic-in
14609 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14612 * Set up output mixers (0x02 - 0x03)
14614 /* set vol=0 to output mixers */
14615 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14616 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14618 /* set up input amps for analog loopback */
14619 /* Amp Indices: DAC = 0, mixer = 1 */
14620 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14621 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14622 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14623 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14624 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14625 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14627 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14628 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14629 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14630 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14631 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14632 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14633 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14635 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14636 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14638 /* FIXME: use Mux-type input source selection */
14639 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14640 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14641 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
14644 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14648 static struct hda_verb alc269vb_init_verbs[] = {
14650 * Unmute ADC0 and set the default input to mic-in
14652 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14655 * Set up output mixers (0x02 - 0x03)
14657 /* set vol=0 to output mixers */
14658 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14659 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14661 /* set up input amps for analog loopback */
14662 /* Amp Indices: DAC = 0, mixer = 1 */
14663 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14664 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14665 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14666 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14667 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14668 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14670 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14671 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14672 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14673 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14674 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14675 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14676 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14678 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14679 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14681 /* FIXME: use Mux-type input source selection */
14682 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14683 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14684 {0x22, AC_VERB_SET_CONNECT_SEL, 0x00},
14687 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14691 #define alc269_auto_create_multi_out_ctls \
14692 alc268_auto_create_multi_out_ctls
14693 #define alc269_auto_create_input_ctls \
14694 alc268_auto_create_input_ctls
14696 #ifdef CONFIG_SND_HDA_POWER_SAVE
14697 #define alc269_loopbacks alc880_loopbacks
14700 /* pcm configuration: identical with ALC880 */
14701 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
14702 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
14703 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
14704 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
14706 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
14710 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14711 /* NID is set in alc_build_pcms */
14713 .open = alc880_playback_pcm_open,
14714 .prepare = alc880_playback_pcm_prepare,
14715 .cleanup = alc880_playback_pcm_cleanup
14719 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
14723 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14724 /* NID is set in alc_build_pcms */
14727 #ifdef CONFIG_SND_HDA_POWER_SAVE
14728 static int alc269_mic2_for_mute_led(struct hda_codec *codec)
14730 switch (codec->subsystem_id) {
14737 static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid)
14739 /* update mute-LED according to the speaker mute state */
14740 if (nid == 0x01 || nid == 0x14) {
14742 if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) &
14747 /* mic2 vref pin is used for mute LED control */
14748 snd_hda_codec_update_cache(codec, 0x19, 0,
14749 AC_VERB_SET_PIN_WIDGET_CONTROL,
14752 return alc_check_power_status(codec, nid);
14754 #endif /* CONFIG_SND_HDA_POWER_SAVE */
14756 static int alc275_setup_dual_adc(struct hda_codec *codec)
14758 struct alc_spec *spec = codec->spec;
14760 if (codec->vendor_id != 0x10ec0275 || !spec->auto_mic)
14762 if ((spec->ext_mic.pin >= 0x18 && spec->int_mic.pin <= 0x13) ||
14763 (spec->ext_mic.pin <= 0x12 && spec->int_mic.pin >= 0x18)) {
14764 if (spec->ext_mic.pin <= 0x12) {
14765 spec->private_adc_nids[0] = 0x08;
14766 spec->private_adc_nids[1] = 0x11;
14767 spec->private_capsrc_nids[0] = 0x23;
14768 spec->private_capsrc_nids[1] = 0x22;
14770 spec->private_adc_nids[0] = 0x11;
14771 spec->private_adc_nids[1] = 0x08;
14772 spec->private_capsrc_nids[0] = 0x22;
14773 spec->private_capsrc_nids[1] = 0x23;
14775 spec->adc_nids = spec->private_adc_nids;
14776 spec->capsrc_nids = spec->private_capsrc_nids;
14777 spec->num_adc_nids = 2;
14778 spec->dual_adc_switch = 1;
14779 snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n",
14780 spec->adc_nids[0], spec->adc_nids[1]);
14786 /* different alc269-variants */
14788 ALC269_TYPE_NORMAL,
14789 ALC269_TYPE_ALC258,
14790 ALC269_TYPE_ALC259,
14791 ALC269_TYPE_ALC269VB,
14792 ALC269_TYPE_ALC270,
14793 ALC269_TYPE_ALC271X,
14797 * BIOS auto configuration
14799 static int alc269_parse_auto_config(struct hda_codec *codec)
14801 struct alc_spec *spec = codec->spec;
14803 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
14805 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14810 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
14813 if (spec->codec_variant == ALC269_TYPE_NORMAL)
14814 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
14816 err = alc_auto_create_input_ctls(codec, &spec->autocfg, 0,
14821 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14823 alc_auto_parse_digital(codec);
14825 if (spec->kctls.list)
14826 add_mixer(spec, spec->kctls.list);
14828 if (spec->codec_variant != ALC269_TYPE_NORMAL) {
14829 add_verb(spec, alc269vb_init_verbs);
14830 alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21);
14832 add_verb(spec, alc269_init_verbs);
14833 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
14836 spec->num_mux_defs = 1;
14837 spec->input_mux = &spec->private_imux[0];
14839 if (!alc275_setup_dual_adc(codec))
14840 fillup_priv_adc_nids(codec, alc269_adc_candidates,
14841 sizeof(alc269_adc_candidates));
14843 /* set default input source */
14844 if (!spec->dual_adc_switch)
14845 select_or_unmute_capsrc(codec, spec->capsrc_nids[0],
14846 spec->input_mux->items[0].index);
14848 err = alc_auto_add_mic_boost(codec);
14852 if (!spec->cap_mixer && !spec->no_analog)
14853 set_capture_mixer(codec);
14858 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
14859 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
14860 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
14863 /* init callback for auto-configuration model -- overriding the default init */
14864 static void alc269_auto_init(struct hda_codec *codec)
14866 struct alc_spec *spec = codec->spec;
14867 alc269_auto_init_multi_out(codec);
14868 alc269_auto_init_hp_out(codec);
14869 alc269_auto_init_analog_input(codec);
14870 alc_auto_init_digital(codec);
14871 if (spec->unsol_event)
14872 alc_inithook(codec);
14875 #ifdef SND_HDA_NEEDS_RESUME
14876 static void alc269_toggle_power_output(struct hda_codec *codec, int power_up)
14878 int val = alc_read_coef_idx(codec, 0x04);
14883 alc_write_coef_idx(codec, 0x04, val);
14886 #ifdef CONFIG_SND_HDA_POWER_SAVE
14887 static int alc269_suspend(struct hda_codec *codec, pm_message_t state)
14889 struct alc_spec *spec = codec->spec;
14891 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017)
14892 alc269_toggle_power_output(codec, 0);
14893 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
14894 alc269_toggle_power_output(codec, 0);
14899 if (spec && spec->power_hook)
14900 spec->power_hook(codec);
14903 #endif /* CONFIG_SND_HDA_POWER_SAVE */
14905 static int alc269_resume(struct hda_codec *codec)
14907 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
14908 alc269_toggle_power_output(codec, 0);
14912 codec->patch_ops.init(codec);
14914 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) {
14915 alc269_toggle_power_output(codec, 1);
14919 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018)
14920 alc269_toggle_power_output(codec, 1);
14922 snd_hda_codec_resume_amp(codec);
14923 snd_hda_codec_resume_cache(codec);
14924 hda_call_check_power_status(codec, 0x01);
14927 #endif /* SND_HDA_NEEDS_RESUME */
14929 static void alc269_fixup_hweq(struct hda_codec *codec,
14930 const struct alc_fixup *fix, int action)
14934 if (action != ALC_FIXUP_ACT_INIT)
14936 coef = alc_read_coef_idx(codec, 0x1e);
14937 alc_write_coef_idx(codec, 0x1e, coef | 0x80);
14941 ALC269_FIXUP_SONY_VAIO,
14942 ALC275_FIXUP_SONY_VAIO_GPIO2,
14943 ALC269_FIXUP_DELL_M101Z,
14944 ALC269_FIXUP_SKU_IGNORE,
14945 ALC269_FIXUP_ASUS_G73JW,
14946 ALC269_FIXUP_LENOVO_EAPD,
14947 ALC275_FIXUP_SONY_HWEQ,
14950 static const struct alc_fixup alc269_fixups[] = {
14951 [ALC269_FIXUP_SONY_VAIO] = {
14952 .type = ALC_FIXUP_VERBS,
14953 .v.verbs = (const struct hda_verb[]) {
14954 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD},
14958 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
14959 .type = ALC_FIXUP_VERBS,
14960 .v.verbs = (const struct hda_verb[]) {
14961 {0x01, AC_VERB_SET_GPIO_MASK, 0x04},
14962 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04},
14963 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
14967 .chain_id = ALC269_FIXUP_SONY_VAIO
14969 [ALC269_FIXUP_DELL_M101Z] = {
14970 .type = ALC_FIXUP_VERBS,
14971 .v.verbs = (const struct hda_verb[]) {
14972 /* Enables internal speaker */
14973 {0x20, AC_VERB_SET_COEF_INDEX, 13},
14974 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
14978 [ALC269_FIXUP_SKU_IGNORE] = {
14979 .type = ALC_FIXUP_SKU,
14980 .v.sku = ALC_FIXUP_SKU_IGNORE,
14982 [ALC269_FIXUP_ASUS_G73JW] = {
14983 .type = ALC_FIXUP_PINS,
14984 .v.pins = (const struct alc_pincfg[]) {
14985 { 0x17, 0x99130111 }, /* subwoofer */
14989 [ALC269_FIXUP_LENOVO_EAPD] = {
14990 .type = ALC_FIXUP_VERBS,
14991 .v.verbs = (const struct hda_verb[]) {
14992 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
14996 [ALC275_FIXUP_SONY_HWEQ] = {
14997 .type = ALC_FIXUP_FUNC,
14998 .v.func = alc269_fixup_hweq,
15000 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
15004 static struct snd_pci_quirk alc269_fixup_tbl[] = {
15005 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
15006 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
15007 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
15008 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
15009 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
15010 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
15011 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
15012 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
15013 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
15014 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
15015 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
15016 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
15022 * configuration and preset
15024 static const char * const alc269_models[ALC269_MODEL_LAST] = {
15025 [ALC269_BASIC] = "basic",
15026 [ALC269_QUANTA_FL1] = "quanta",
15027 [ALC269_AMIC] = "laptop-amic",
15028 [ALC269_DMIC] = "laptop-dmic",
15029 [ALC269_FUJITSU] = "fujitsu",
15030 [ALC269_LIFEBOOK] = "lifebook",
15031 [ALC269_AUTO] = "auto",
15034 static struct snd_pci_quirk alc269_cfg_tbl[] = {
15035 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
15036 SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER),
15037 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
15039 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC),
15040 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC),
15041 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC),
15042 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC),
15043 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC),
15044 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC),
15045 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC),
15046 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC),
15047 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC),
15048 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269VB_AMIC),
15049 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC),
15050 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC),
15051 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC),
15052 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC),
15053 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC),
15054 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC),
15055 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC),
15056 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC),
15057 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC),
15058 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC),
15059 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC),
15060 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC),
15061 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC),
15062 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC),
15063 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC),
15064 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC),
15065 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC),
15066 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC),
15067 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC),
15068 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC),
15069 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC),
15070 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC),
15071 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC),
15072 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC),
15073 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC),
15074 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC),
15075 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
15077 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
15079 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC),
15080 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC),
15081 SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO),
15082 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
15083 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC),
15084 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
15085 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC),
15086 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC),
15087 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC),
15088 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC),
15092 static struct alc_config_preset alc269_presets[] = {
15094 .mixers = { alc269_base_mixer },
15095 .init_verbs = { alc269_init_verbs },
15096 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15097 .dac_nids = alc269_dac_nids,
15099 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15100 .channel_mode = alc269_modes,
15101 .input_mux = &alc269_capture_source,
15103 [ALC269_QUANTA_FL1] = {
15104 .mixers = { alc269_quanta_fl1_mixer },
15105 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
15106 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15107 .dac_nids = alc269_dac_nids,
15109 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15110 .channel_mode = alc269_modes,
15111 .input_mux = &alc269_capture_source,
15112 .unsol_event = alc269_quanta_fl1_unsol_event,
15113 .setup = alc269_quanta_fl1_setup,
15114 .init_hook = alc269_quanta_fl1_init_hook,
15117 .mixers = { alc269_laptop_mixer },
15118 .cap_mixer = alc269_laptop_analog_capture_mixer,
15119 .init_verbs = { alc269_init_verbs,
15120 alc269_laptop_amic_init_verbs },
15121 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15122 .dac_nids = alc269_dac_nids,
15124 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15125 .channel_mode = alc269_modes,
15126 .unsol_event = alc269_laptop_unsol_event,
15127 .setup = alc269_laptop_amic_setup,
15128 .init_hook = alc269_laptop_inithook,
15131 .mixers = { alc269_laptop_mixer },
15132 .cap_mixer = alc269_laptop_digital_capture_mixer,
15133 .init_verbs = { alc269_init_verbs,
15134 alc269_laptop_dmic_init_verbs },
15135 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15136 .dac_nids = alc269_dac_nids,
15138 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15139 .channel_mode = alc269_modes,
15140 .unsol_event = alc269_laptop_unsol_event,
15141 .setup = alc269_laptop_dmic_setup,
15142 .init_hook = alc269_laptop_inithook,
15144 [ALC269VB_AMIC] = {
15145 .mixers = { alc269vb_laptop_mixer },
15146 .cap_mixer = alc269vb_laptop_analog_capture_mixer,
15147 .init_verbs = { alc269vb_init_verbs,
15148 alc269vb_laptop_amic_init_verbs },
15149 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15150 .dac_nids = alc269_dac_nids,
15152 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15153 .channel_mode = alc269_modes,
15154 .unsol_event = alc269_laptop_unsol_event,
15155 .setup = alc269vb_laptop_amic_setup,
15156 .init_hook = alc269_laptop_inithook,
15158 [ALC269VB_DMIC] = {
15159 .mixers = { alc269vb_laptop_mixer },
15160 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
15161 .init_verbs = { alc269vb_init_verbs,
15162 alc269vb_laptop_dmic_init_verbs },
15163 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15164 .dac_nids = alc269_dac_nids,
15166 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15167 .channel_mode = alc269_modes,
15168 .unsol_event = alc269_laptop_unsol_event,
15169 .setup = alc269vb_laptop_dmic_setup,
15170 .init_hook = alc269_laptop_inithook,
15172 [ALC269_FUJITSU] = {
15173 .mixers = { alc269_fujitsu_mixer },
15174 .cap_mixer = alc269_laptop_digital_capture_mixer,
15175 .init_verbs = { alc269_init_verbs,
15176 alc269_laptop_dmic_init_verbs },
15177 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15178 .dac_nids = alc269_dac_nids,
15180 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15181 .channel_mode = alc269_modes,
15182 .unsol_event = alc269_laptop_unsol_event,
15183 .setup = alc269_laptop_dmic_setup,
15184 .init_hook = alc269_laptop_inithook,
15186 [ALC269_LIFEBOOK] = {
15187 .mixers = { alc269_lifebook_mixer },
15188 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
15189 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15190 .dac_nids = alc269_dac_nids,
15192 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15193 .channel_mode = alc269_modes,
15194 .input_mux = &alc269_capture_source,
15195 .unsol_event = alc269_lifebook_unsol_event,
15196 .init_hook = alc269_lifebook_init_hook,
15199 .mixers = { alc269_asus_mixer },
15200 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
15201 .init_verbs = { alc269_init_verbs, alc271_acer_dmic_verbs },
15202 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15203 .dac_nids = alc269_dac_nids,
15204 .adc_nids = alc262_dmic_adc_nids,
15205 .num_adc_nids = ARRAY_SIZE(alc262_dmic_adc_nids),
15206 .capsrc_nids = alc262_dmic_capsrc_nids,
15207 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15208 .channel_mode = alc269_modes,
15209 .input_mux = &alc269_capture_source,
15210 .dig_out_nid = ALC880_DIGOUT_NID,
15211 .unsol_event = alc_sku_unsol_event,
15212 .setup = alc269vb_laptop_dmic_setup,
15213 .init_hook = alc_inithook,
15217 static int alc269_fill_coef(struct hda_codec *codec)
15221 if ((alc_read_coef_idx(codec, 0) & 0x00ff) < 0x015) {
15222 alc_write_coef_idx(codec, 0xf, 0x960b);
15223 alc_write_coef_idx(codec, 0xe, 0x8817);
15226 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x016) {
15227 alc_write_coef_idx(codec, 0xf, 0x960b);
15228 alc_write_coef_idx(codec, 0xe, 0x8814);
15231 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) {
15232 val = alc_read_coef_idx(codec, 0x04);
15233 /* Power up output pin */
15234 alc_write_coef_idx(codec, 0x04, val | (1<<11));
15237 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
15238 val = alc_read_coef_idx(codec, 0xd);
15239 if ((val & 0x0c00) >> 10 != 0x1) {
15240 /* Capless ramp up clock control */
15241 alc_write_coef_idx(codec, 0xd, val | 1<<10);
15243 val = alc_read_coef_idx(codec, 0x17);
15244 if ((val & 0x01c0) >> 6 != 0x4) {
15245 /* Class D power on reset */
15246 alc_write_coef_idx(codec, 0x17, val | 1<<7);
15252 static int patch_alc269(struct hda_codec *codec)
15254 struct alc_spec *spec;
15255 int board_config, coef;
15258 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15262 codec->spec = spec;
15264 alc_auto_parse_customize_define(codec);
15266 if (codec->vendor_id == 0x10ec0269) {
15267 coef = alc_read_coef_idx(codec, 0);
15268 if ((coef & 0x00f0) == 0x0010) {
15269 if (codec->bus->pci->subsystem_vendor == 0x1025 &&
15270 spec->cdefine.platform_type == 1) {
15271 alc_codec_rename(codec, "ALC271X");
15272 spec->codec_variant = ALC269_TYPE_ALC271X;
15273 } else if ((coef & 0xf000) == 0x1000) {
15274 spec->codec_variant = ALC269_TYPE_ALC270;
15275 } else if ((coef & 0xf000) == 0x2000) {
15276 alc_codec_rename(codec, "ALC259");
15277 spec->codec_variant = ALC269_TYPE_ALC259;
15278 } else if ((coef & 0xf000) == 0x3000) {
15279 alc_codec_rename(codec, "ALC258");
15280 spec->codec_variant = ALC269_TYPE_ALC258;
15282 alc_codec_rename(codec, "ALC269VB");
15283 spec->codec_variant = ALC269_TYPE_ALC269VB;
15286 alc_fix_pll_init(codec, 0x20, 0x04, 15);
15287 alc269_fill_coef(codec);
15290 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
15294 if (board_config < 0) {
15295 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15297 board_config = ALC269_AUTO;
15300 if (board_config == ALC269_AUTO) {
15301 alc_pick_fixup(codec, NULL, alc269_fixup_tbl, alc269_fixups);
15302 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
15305 if (board_config == ALC269_AUTO) {
15306 /* automatic parse from the BIOS config */
15307 err = alc269_parse_auto_config(codec);
15313 "hda_codec: Cannot set up configuration "
15314 "from BIOS. Using base mode...\n");
15315 board_config = ALC269_BASIC;
15319 if (has_cdefine_beep(codec)) {
15320 err = snd_hda_attach_beep_device(codec, 0x1);
15327 if (board_config != ALC269_AUTO)
15328 setup_preset(codec, &alc269_presets[board_config]);
15330 if (board_config == ALC269_QUANTA_FL1) {
15331 /* Due to a hardware problem on Lenovo Ideadpad, we need to
15332 * fix the sample rate of analog I/O to 44.1kHz
15334 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
15335 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
15336 } else if (spec->dual_adc_switch) {
15337 spec->stream_analog_playback = &alc269_pcm_analog_playback;
15338 /* switch ADC dynamically */
15339 spec->stream_analog_capture = &dualmic_pcm_analog_capture;
15341 spec->stream_analog_playback = &alc269_pcm_analog_playback;
15342 spec->stream_analog_capture = &alc269_pcm_analog_capture;
15344 spec->stream_digital_playback = &alc269_pcm_digital_playback;
15345 spec->stream_digital_capture = &alc269_pcm_digital_capture;
15347 if (!spec->adc_nids) { /* wasn't filled automatically? use default */
15348 if (spec->codec_variant == ALC269_TYPE_NORMAL) {
15349 spec->adc_nids = alc269_adc_nids;
15350 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
15351 spec->capsrc_nids = alc269_capsrc_nids;
15353 spec->adc_nids = alc269vb_adc_nids;
15354 spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids);
15355 spec->capsrc_nids = alc269vb_capsrc_nids;
15359 if (!spec->cap_mixer)
15360 set_capture_mixer(codec);
15361 if (has_cdefine_beep(codec))
15362 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
15364 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
15366 spec->vmaster_nid = 0x02;
15368 codec->patch_ops = alc_patch_ops;
15369 #ifdef CONFIG_SND_HDA_POWER_SAVE
15370 codec->patch_ops.suspend = alc269_suspend;
15372 #ifdef SND_HDA_NEEDS_RESUME
15373 codec->patch_ops.resume = alc269_resume;
15375 if (board_config == ALC269_AUTO)
15376 spec->init_hook = alc269_auto_init;
15378 alc_init_jacks(codec);
15379 #ifdef CONFIG_SND_HDA_POWER_SAVE
15380 if (!spec->loopback.amplist)
15381 spec->loopback.amplist = alc269_loopbacks;
15382 if (alc269_mic2_for_mute_led(codec))
15383 codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps;
15390 * ALC861 channel source setting (2/6 channel selection for 3-stack)
15394 * set the path ways for 2 channel output
15395 * need to set the codec line out and mic 1 pin widgets to inputs
15397 static struct hda_verb alc861_threestack_ch2_init[] = {
15398 /* set pin widget 1Ah (line in) for input */
15399 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15400 /* set pin widget 18h (mic1/2) for input, for mic also enable
15403 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15405 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
15407 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15408 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
15414 * need to set the codec line out and mic 1 pin widgets to outputs
15416 static struct hda_verb alc861_threestack_ch6_init[] = {
15417 /* set pin widget 1Ah (line in) for output (Back Surround)*/
15418 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15419 /* set pin widget 18h (mic1) for output (CLFE)*/
15420 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15422 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
15423 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
15425 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
15427 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15428 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
15433 static struct hda_channel_mode alc861_threestack_modes[2] = {
15434 { 2, alc861_threestack_ch2_init },
15435 { 6, alc861_threestack_ch6_init },
15437 /* Set mic1 as input and unmute the mixer */
15438 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
15439 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15440 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15443 /* Set mic1 as output and mute mixer */
15444 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
15445 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15446 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15450 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
15451 { 2, alc861_uniwill_m31_ch2_init },
15452 { 4, alc861_uniwill_m31_ch4_init },
15455 /* Set mic1 and line-in as input and unmute the mixer */
15456 static struct hda_verb alc861_asus_ch2_init[] = {
15457 /* set pin widget 1Ah (line in) for input */
15458 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15459 /* set pin widget 18h (mic1/2) for input, for mic also enable
15462 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15464 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
15466 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15467 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
15471 /* Set mic1 nad line-in as output and mute mixer */
15472 static struct hda_verb alc861_asus_ch6_init[] = {
15473 /* set pin widget 1Ah (line in) for output (Back Surround)*/
15474 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15475 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
15476 /* set pin widget 18h (mic1) for output (CLFE)*/
15477 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15478 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
15479 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
15480 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
15482 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
15484 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15485 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
15490 static struct hda_channel_mode alc861_asus_modes[2] = {
15491 { 2, alc861_asus_ch2_init },
15492 { 6, alc861_asus_ch6_init },
15497 static struct snd_kcontrol_new alc861_base_mixer[] = {
15498 /* output mixer control */
15499 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15500 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15501 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15502 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15503 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
15505 /*Input mixer control */
15506 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15507 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15508 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15509 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15510 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15511 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15512 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15513 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15514 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15515 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
15520 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
15521 /* output mixer control */
15522 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15523 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15524 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15525 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15526 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
15528 /* Input mixer control */
15529 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15530 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15531 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15532 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15533 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15534 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15535 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15536 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15537 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15538 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
15541 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15542 .name = "Channel Mode",
15543 .info = alc_ch_mode_info,
15544 .get = alc_ch_mode_get,
15545 .put = alc_ch_mode_put,
15546 .private_value = ARRAY_SIZE(alc861_threestack_modes),
15551 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
15552 /* output mixer control */
15553 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15554 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15555 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15560 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
15561 /* output mixer control */
15562 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15563 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15564 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15565 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15566 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
15568 /* Input mixer control */
15569 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15570 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15571 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15572 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15573 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15574 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15575 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15576 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15577 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15578 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
15581 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15582 .name = "Channel Mode",
15583 .info = alc_ch_mode_info,
15584 .get = alc_ch_mode_get,
15585 .put = alc_ch_mode_put,
15586 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
15591 static struct snd_kcontrol_new alc861_asus_mixer[] = {
15592 /* output mixer control */
15593 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15594 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15595 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15596 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15597 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
15599 /* Input mixer control */
15600 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15601 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15602 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15603 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15604 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15605 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15606 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15607 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15608 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15609 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
15612 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15613 .name = "Channel Mode",
15614 .info = alc_ch_mode_info,
15615 .get = alc_ch_mode_get,
15616 .put = alc_ch_mode_put,
15617 .private_value = ARRAY_SIZE(alc861_asus_modes),
15622 /* additional mixer */
15623 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
15624 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15625 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15630 * generic initialization of ADC, input mixers and output mixers
15632 static struct hda_verb alc861_base_init_verbs[] = {
15634 * Unmute ADC0 and set the default input to mic-in
15636 /* port-A for surround (rear panel) */
15637 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15638 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
15639 /* port-B for mic-in (rear panel) with vref */
15640 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15641 /* port-C for line-in (rear panel) */
15642 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15643 /* port-D for Front */
15644 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15645 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15646 /* port-E for HP out (front panel) */
15647 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
15648 /* route front PCM to HP */
15649 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15650 /* port-F for mic-in (front panel) with vref */
15651 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15652 /* port-G for CLFE (rear panel) */
15653 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15654 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15655 /* port-H for side (rear panel) */
15656 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15657 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
15659 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15660 /* route front mic to ADC1*/
15661 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15662 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15664 /* Unmute DAC0~3 & spdif out*/
15665 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15666 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15667 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15668 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15669 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15671 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15672 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15673 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15674 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15675 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15677 /* Unmute Stereo Mixer 15 */
15678 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15679 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15680 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15681 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15683 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15684 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15685 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15686 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15687 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15688 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15689 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15690 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15691 /* hp used DAC 3 (Front) */
15692 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15693 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15698 static struct hda_verb alc861_threestack_init_verbs[] = {
15700 * Unmute ADC0 and set the default input to mic-in
15702 /* port-A for surround (rear panel) */
15703 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15704 /* port-B for mic-in (rear panel) with vref */
15705 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15706 /* port-C for line-in (rear panel) */
15707 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15708 /* port-D for Front */
15709 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15710 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15711 /* port-E for HP out (front panel) */
15712 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
15713 /* route front PCM to HP */
15714 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15715 /* port-F for mic-in (front panel) with vref */
15716 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15717 /* port-G for CLFE (rear panel) */
15718 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15719 /* port-H for side (rear panel) */
15720 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15722 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15723 /* route front mic to ADC1*/
15724 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15725 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15726 /* Unmute DAC0~3 & spdif out*/
15727 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15728 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15729 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15730 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15731 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15733 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15734 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15735 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15736 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15737 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15739 /* Unmute Stereo Mixer 15 */
15740 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15741 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15742 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15743 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15745 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15746 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15747 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15748 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15749 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15750 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15751 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15752 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15753 /* hp used DAC 3 (Front) */
15754 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15755 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15759 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
15761 * Unmute ADC0 and set the default input to mic-in
15763 /* port-A for surround (rear panel) */
15764 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15765 /* port-B for mic-in (rear panel) with vref */
15766 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15767 /* port-C for line-in (rear panel) */
15768 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15769 /* port-D for Front */
15770 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15771 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15772 /* port-E for HP out (front panel) */
15773 /* this has to be set to VREF80 */
15774 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15775 /* route front PCM to HP */
15776 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15777 /* port-F for mic-in (front panel) with vref */
15778 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15779 /* port-G for CLFE (rear panel) */
15780 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15781 /* port-H for side (rear panel) */
15782 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15784 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15785 /* route front mic to ADC1*/
15786 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15787 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15788 /* Unmute DAC0~3 & spdif out*/
15789 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15790 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15791 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15792 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15793 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15795 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15796 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15797 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15798 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15799 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15801 /* Unmute Stereo Mixer 15 */
15802 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15803 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15804 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15805 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15807 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15808 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15809 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15810 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15811 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15812 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15813 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15814 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15815 /* hp used DAC 3 (Front) */
15816 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15817 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15821 static struct hda_verb alc861_asus_init_verbs[] = {
15823 * Unmute ADC0 and set the default input to mic-in
15825 /* port-A for surround (rear panel)
15826 * according to codec#0 this is the HP jack
15828 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
15829 /* route front PCM to HP */
15830 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
15831 /* port-B for mic-in (rear panel) with vref */
15832 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15833 /* port-C for line-in (rear panel) */
15834 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15835 /* port-D for Front */
15836 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15837 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15838 /* port-E for HP out (front panel) */
15839 /* this has to be set to VREF80 */
15840 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15841 /* route front PCM to HP */
15842 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15843 /* port-F for mic-in (front panel) with vref */
15844 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15845 /* port-G for CLFE (rear panel) */
15846 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15847 /* port-H for side (rear panel) */
15848 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15850 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15851 /* route front mic to ADC1*/
15852 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15853 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15854 /* Unmute DAC0~3 & spdif out*/
15855 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15856 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15857 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15858 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15859 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15860 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15861 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15862 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15863 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15864 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15866 /* Unmute Stereo Mixer 15 */
15867 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15868 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15869 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15870 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15872 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15873 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15874 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15875 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15876 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15877 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15878 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15879 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15880 /* hp used DAC 3 (Front) */
15881 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15882 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15886 /* additional init verbs for ASUS laptops */
15887 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
15888 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
15889 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
15894 * generic initialization of ADC, input mixers and output mixers
15896 static struct hda_verb alc861_auto_init_verbs[] = {
15898 * Unmute ADC0 and set the default input to mic-in
15900 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
15901 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15903 /* Unmute DAC0~3 & spdif out*/
15904 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15905 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15906 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15907 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15908 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15910 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15911 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15912 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15913 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15914 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15916 /* Unmute Stereo Mixer 15 */
15917 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15918 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15919 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15920 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
15922 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15923 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15924 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15925 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15926 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15927 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15928 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15929 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15931 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15932 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15933 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15934 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15935 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15936 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15937 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15938 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15940 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
15945 static struct hda_verb alc861_toshiba_init_verbs[] = {
15946 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15951 /* toggle speaker-output according to the hp-jack state */
15952 static void alc861_toshiba_automute(struct hda_codec *codec)
15954 unsigned int present = snd_hda_jack_detect(codec, 0x0f);
15956 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
15957 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
15958 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
15959 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
15962 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
15965 if ((res >> 26) == ALC880_HP_EVENT)
15966 alc861_toshiba_automute(codec);
15969 /* pcm configuration: identical with ALC880 */
15970 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
15971 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
15972 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
15973 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
15976 #define ALC861_DIGOUT_NID 0x07
15978 static struct hda_channel_mode alc861_8ch_modes[1] = {
15982 static hda_nid_t alc861_dac_nids[4] = {
15983 /* front, surround, clfe, side */
15984 0x03, 0x06, 0x05, 0x04
15987 static hda_nid_t alc660_dac_nids[3] = {
15988 /* front, clfe, surround */
15992 static hda_nid_t alc861_adc_nids[1] = {
15997 static struct hda_input_mux alc861_capture_source = {
16001 { "Front Mic", 0x3 },
16008 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
16010 struct alc_spec *spec = codec->spec;
16011 hda_nid_t mix, srcs[5];
16014 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
16016 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
16019 for (i = 0; i < num; i++) {
16021 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
16022 if (type != AC_WID_AUD_OUT)
16024 for (j = 0; j < spec->multiout.num_dacs; j++)
16025 if (spec->multiout.dac_nids[j] == srcs[i])
16027 if (j >= spec->multiout.num_dacs)
16033 /* fill in the dac_nids table from the parsed pin configuration */
16034 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
16035 const struct auto_pin_cfg *cfg)
16037 struct alc_spec *spec = codec->spec;
16039 hda_nid_t nid, dac;
16041 spec->multiout.dac_nids = spec->private_dac_nids;
16042 for (i = 0; i < cfg->line_outs; i++) {
16043 nid = cfg->line_out_pins[i];
16044 dac = alc861_look_for_dac(codec, nid);
16047 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
16052 static int __alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
16053 hda_nid_t nid, int idx, unsigned int chs)
16055 return __add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx, idx,
16056 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
16059 #define alc861_create_out_sw(codec, pfx, nid, chs) \
16060 __alc861_create_out_sw(codec, pfx, nid, 0, chs)
16062 /* add playback controls from the parsed DAC table */
16063 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
16064 const struct auto_pin_cfg *cfg)
16066 struct alc_spec *spec = codec->spec;
16067 static const char * const chname[4] = {
16068 "Front", "Surround", NULL /*CLFE*/, "Side"
16070 const char *pfx = alc_get_line_out_pfx(cfg, true);
16074 for (i = 0; i < cfg->line_outs; i++) {
16075 nid = spec->multiout.dac_nids[i];
16078 if (!pfx && i == 2) {
16080 err = alc861_create_out_sw(codec, "Center", nid, 1);
16083 err = alc861_create_out_sw(codec, "LFE", nid, 2);
16087 const char *name = pfx;
16093 err = __alc861_create_out_sw(codec, name, nid, index, 3);
16101 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
16103 struct alc_spec *spec = codec->spec;
16110 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
16111 nid = alc861_look_for_dac(codec, pin);
16113 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
16116 spec->multiout.hp_nid = nid;
16122 /* create playback/capture controls for input pins */
16123 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
16124 const struct auto_pin_cfg *cfg)
16126 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
16129 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
16131 int pin_type, hda_nid_t dac)
16133 hda_nid_t mix, srcs[5];
16136 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
16138 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16140 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
16142 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
16145 for (i = 0; i < num; i++) {
16147 if (srcs[i] == dac || srcs[i] == 0x15)
16148 mute = AMP_IN_UNMUTE(i);
16150 mute = AMP_IN_MUTE(i);
16151 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16156 static void alc861_auto_init_multi_out(struct hda_codec *codec)
16158 struct alc_spec *spec = codec->spec;
16161 for (i = 0; i < spec->autocfg.line_outs; i++) {
16162 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16163 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16165 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
16166 spec->multiout.dac_nids[i]);
16170 static void alc861_auto_init_hp_out(struct hda_codec *codec)
16172 struct alc_spec *spec = codec->spec;
16174 if (spec->autocfg.hp_outs)
16175 alc861_auto_set_output_and_unmute(codec,
16176 spec->autocfg.hp_pins[0],
16178 spec->multiout.hp_nid);
16179 if (spec->autocfg.speaker_outs)
16180 alc861_auto_set_output_and_unmute(codec,
16181 spec->autocfg.speaker_pins[0],
16183 spec->multiout.dac_nids[0]);
16186 static void alc861_auto_init_analog_input(struct hda_codec *codec)
16188 struct alc_spec *spec = codec->spec;
16189 struct auto_pin_cfg *cfg = &spec->autocfg;
16192 for (i = 0; i < cfg->num_inputs; i++) {
16193 hda_nid_t nid = cfg->inputs[i].pin;
16194 if (nid >= 0x0c && nid <= 0x11)
16195 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
16199 /* parse the BIOS configuration and set up the alc_spec */
16200 /* return 1 if successful, 0 if the proper config is not found,
16201 * or a negative error code
16203 static int alc861_parse_auto_config(struct hda_codec *codec)
16205 struct alc_spec *spec = codec->spec;
16207 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
16209 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16213 if (!spec->autocfg.line_outs)
16214 return 0; /* can't find valid BIOS pin config */
16216 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
16219 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
16222 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
16225 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
16229 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16231 alc_auto_parse_digital(codec);
16233 if (spec->kctls.list)
16234 add_mixer(spec, spec->kctls.list);
16236 add_verb(spec, alc861_auto_init_verbs);
16238 spec->num_mux_defs = 1;
16239 spec->input_mux = &spec->private_imux[0];
16241 spec->adc_nids = alc861_adc_nids;
16242 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
16243 set_capture_mixer(codec);
16245 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0);
16250 /* additional initialization for auto-configuration model */
16251 static void alc861_auto_init(struct hda_codec *codec)
16253 struct alc_spec *spec = codec->spec;
16254 alc861_auto_init_multi_out(codec);
16255 alc861_auto_init_hp_out(codec);
16256 alc861_auto_init_analog_input(codec);
16257 alc_auto_init_digital(codec);
16258 if (spec->unsol_event)
16259 alc_inithook(codec);
16262 #ifdef CONFIG_SND_HDA_POWER_SAVE
16263 static struct hda_amp_list alc861_loopbacks[] = {
16264 { 0x15, HDA_INPUT, 0 },
16265 { 0x15, HDA_INPUT, 1 },
16266 { 0x15, HDA_INPUT, 2 },
16267 { 0x15, HDA_INPUT, 3 },
16274 * configuration and preset
16276 static const char * const alc861_models[ALC861_MODEL_LAST] = {
16277 [ALC861_3ST] = "3stack",
16278 [ALC660_3ST] = "3stack-660",
16279 [ALC861_3ST_DIG] = "3stack-dig",
16280 [ALC861_6ST_DIG] = "6stack-dig",
16281 [ALC861_UNIWILL_M31] = "uniwill-m31",
16282 [ALC861_TOSHIBA] = "toshiba",
16283 [ALC861_ASUS] = "asus",
16284 [ALC861_ASUS_LAPTOP] = "asus-laptop",
16285 [ALC861_AUTO] = "auto",
16288 static struct snd_pci_quirk alc861_cfg_tbl[] = {
16289 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
16290 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
16291 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
16292 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
16293 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
16294 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
16295 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
16296 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
16297 * Any other models that need this preset?
16299 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
16300 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
16301 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
16302 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
16303 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
16304 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
16305 /* FIXME: the below seems conflict */
16306 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
16307 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
16308 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
16312 static struct alc_config_preset alc861_presets[] = {
16314 .mixers = { alc861_3ST_mixer },
16315 .init_verbs = { alc861_threestack_init_verbs },
16316 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16317 .dac_nids = alc861_dac_nids,
16318 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
16319 .channel_mode = alc861_threestack_modes,
16321 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16322 .adc_nids = alc861_adc_nids,
16323 .input_mux = &alc861_capture_source,
16325 [ALC861_3ST_DIG] = {
16326 .mixers = { alc861_base_mixer },
16327 .init_verbs = { alc861_threestack_init_verbs },
16328 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16329 .dac_nids = alc861_dac_nids,
16330 .dig_out_nid = ALC861_DIGOUT_NID,
16331 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
16332 .channel_mode = alc861_threestack_modes,
16334 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16335 .adc_nids = alc861_adc_nids,
16336 .input_mux = &alc861_capture_source,
16338 [ALC861_6ST_DIG] = {
16339 .mixers = { alc861_base_mixer },
16340 .init_verbs = { alc861_base_init_verbs },
16341 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16342 .dac_nids = alc861_dac_nids,
16343 .dig_out_nid = ALC861_DIGOUT_NID,
16344 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
16345 .channel_mode = alc861_8ch_modes,
16346 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16347 .adc_nids = alc861_adc_nids,
16348 .input_mux = &alc861_capture_source,
16351 .mixers = { alc861_3ST_mixer },
16352 .init_verbs = { alc861_threestack_init_verbs },
16353 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
16354 .dac_nids = alc660_dac_nids,
16355 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
16356 .channel_mode = alc861_threestack_modes,
16358 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16359 .adc_nids = alc861_adc_nids,
16360 .input_mux = &alc861_capture_source,
16362 [ALC861_UNIWILL_M31] = {
16363 .mixers = { alc861_uniwill_m31_mixer },
16364 .init_verbs = { alc861_uniwill_m31_init_verbs },
16365 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16366 .dac_nids = alc861_dac_nids,
16367 .dig_out_nid = ALC861_DIGOUT_NID,
16368 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
16369 .channel_mode = alc861_uniwill_m31_modes,
16371 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16372 .adc_nids = alc861_adc_nids,
16373 .input_mux = &alc861_capture_source,
16375 [ALC861_TOSHIBA] = {
16376 .mixers = { alc861_toshiba_mixer },
16377 .init_verbs = { alc861_base_init_verbs,
16378 alc861_toshiba_init_verbs },
16379 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16380 .dac_nids = alc861_dac_nids,
16381 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
16382 .channel_mode = alc883_3ST_2ch_modes,
16383 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16384 .adc_nids = alc861_adc_nids,
16385 .input_mux = &alc861_capture_source,
16386 .unsol_event = alc861_toshiba_unsol_event,
16387 .init_hook = alc861_toshiba_automute,
16390 .mixers = { alc861_asus_mixer },
16391 .init_verbs = { alc861_asus_init_verbs },
16392 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16393 .dac_nids = alc861_dac_nids,
16394 .dig_out_nid = ALC861_DIGOUT_NID,
16395 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
16396 .channel_mode = alc861_asus_modes,
16399 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16400 .adc_nids = alc861_adc_nids,
16401 .input_mux = &alc861_capture_source,
16403 [ALC861_ASUS_LAPTOP] = {
16404 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
16405 .init_verbs = { alc861_asus_init_verbs,
16406 alc861_asus_laptop_init_verbs },
16407 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16408 .dac_nids = alc861_dac_nids,
16409 .dig_out_nid = ALC861_DIGOUT_NID,
16410 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
16411 .channel_mode = alc883_3ST_2ch_modes,
16413 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16414 .adc_nids = alc861_adc_nids,
16415 .input_mux = &alc861_capture_source,
16419 /* Pin config fixes */
16421 PINFIX_FSC_AMILO_PI1505,
16424 static const struct alc_fixup alc861_fixups[] = {
16425 [PINFIX_FSC_AMILO_PI1505] = {
16426 .type = ALC_FIXUP_PINS,
16427 .v.pins = (const struct alc_pincfg[]) {
16428 { 0x0b, 0x0221101f }, /* HP */
16429 { 0x0f, 0x90170310 }, /* speaker */
16435 static struct snd_pci_quirk alc861_fixup_tbl[] = {
16436 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
16440 static int patch_alc861(struct hda_codec *codec)
16442 struct alc_spec *spec;
16446 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16450 codec->spec = spec;
16452 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
16456 if (board_config < 0) {
16457 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
16459 board_config = ALC861_AUTO;
16462 if (board_config == ALC861_AUTO) {
16463 alc_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
16464 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
16467 if (board_config == ALC861_AUTO) {
16468 /* automatic parse from the BIOS config */
16469 err = alc861_parse_auto_config(codec);
16475 "hda_codec: Cannot set up configuration "
16476 "from BIOS. Using base mode...\n");
16477 board_config = ALC861_3ST_DIG;
16481 err = snd_hda_attach_beep_device(codec, 0x23);
16487 if (board_config != ALC861_AUTO)
16488 setup_preset(codec, &alc861_presets[board_config]);
16490 spec->stream_analog_playback = &alc861_pcm_analog_playback;
16491 spec->stream_analog_capture = &alc861_pcm_analog_capture;
16493 spec->stream_digital_playback = &alc861_pcm_digital_playback;
16494 spec->stream_digital_capture = &alc861_pcm_digital_capture;
16496 if (!spec->cap_mixer)
16497 set_capture_mixer(codec);
16498 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
16500 spec->vmaster_nid = 0x03;
16502 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
16504 codec->patch_ops = alc_patch_ops;
16505 if (board_config == ALC861_AUTO) {
16506 spec->init_hook = alc861_auto_init;
16507 #ifdef CONFIG_SND_HDA_POWER_SAVE
16508 spec->power_hook = alc_power_eapd;
16511 #ifdef CONFIG_SND_HDA_POWER_SAVE
16512 if (!spec->loopback.amplist)
16513 spec->loopback.amplist = alc861_loopbacks;
16520 * ALC861-VD support
16524 * In addition, an independent DAC
16526 #define ALC861VD_DIGOUT_NID 0x06
16528 static hda_nid_t alc861vd_dac_nids[4] = {
16529 /* front, surr, clfe, side surr */
16530 0x02, 0x03, 0x04, 0x05
16533 /* dac_nids for ALC660vd are in a different order - according to
16534 * Realtek's driver.
16535 * This should probably result in a different mixer for 6stack models
16536 * of ALC660vd codecs, but for now there is only 3stack mixer
16537 * - and it is the same as in 861vd.
16538 * adc_nids in ALC660vd are (is) the same as in 861vd
16540 static hda_nid_t alc660vd_dac_nids[3] = {
16541 /* front, rear, clfe, rear_surr */
16545 static hda_nid_t alc861vd_adc_nids[1] = {
16550 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
16553 /* FIXME: should be a matrix-type input source selection */
16554 static struct hda_input_mux alc861vd_capture_source = {
16558 { "Front Mic", 0x1 },
16564 static struct hda_input_mux alc861vd_dallas_capture_source = {
16568 { "Internal Mic", 0x1 },
16572 static struct hda_input_mux alc861vd_hp_capture_source = {
16575 { "Front Mic", 0x0 },
16576 { "ATAPI Mic", 0x1 },
16583 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
16590 static struct hda_verb alc861vd_6stack_ch6_init[] = {
16591 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16592 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16593 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16594 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16601 static struct hda_verb alc861vd_6stack_ch8_init[] = {
16602 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16603 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16604 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16605 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16609 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
16610 { 6, alc861vd_6stack_ch6_init },
16611 { 8, alc861vd_6stack_ch8_init },
16614 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
16616 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16617 .name = "Channel Mode",
16618 .info = alc_ch_mode_info,
16619 .get = alc_ch_mode_get,
16620 .put = alc_ch_mode_put,
16625 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16626 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16628 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
16629 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16630 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16632 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16633 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
16635 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
16637 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
16639 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
16640 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
16642 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
16643 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
16645 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16647 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
16648 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16649 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16651 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
16652 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16653 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16655 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16656 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16658 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16659 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16664 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
16665 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16666 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16668 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16670 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
16671 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16672 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16674 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
16675 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16676 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16678 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16679 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16681 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16682 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16687 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
16688 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16689 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
16690 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16692 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16694 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
16695 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16696 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16698 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
16699 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16700 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16702 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16703 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16708 /* Pin assignment: Speaker=0x14, HP = 0x15,
16709 * Mic=0x18, Internal Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
16711 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
16712 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16713 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
16714 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16715 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
16716 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
16717 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16718 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16719 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
16720 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16721 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16725 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
16726 * Front Mic=0x18, ATAPI Mic = 0x19,
16728 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
16729 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16730 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16731 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16732 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
16733 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16734 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16735 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16736 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16742 * generic initialization of ADC, input mixers and output mixers
16744 static struct hda_verb alc861vd_volume_init_verbs[] = {
16746 * Unmute ADC0 and set the default input to mic-in
16748 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16749 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16751 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
16752 * the analog-loopback mixer widget
16754 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16755 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16756 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16757 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16758 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16759 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16761 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
16762 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16763 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16764 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
16765 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
16768 * Set up output mixers (0x02 - 0x05)
16770 /* set vol=0 to output mixers */
16771 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16772 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16773 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16774 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16776 /* set up input amps for analog loopback */
16777 /* Amp Indices: DAC = 0, mixer = 1 */
16778 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16779 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16780 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16781 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16782 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16783 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16784 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16785 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16791 * 3-stack pin configuration:
16792 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
16794 static struct hda_verb alc861vd_3stack_init_verbs[] = {
16796 * Set pin mode and muting
16798 /* set front pin widgets 0x14 for output */
16799 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16800 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16801 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
16803 /* Mic (rear) pin: input vref at 80% */
16804 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16805 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16806 /* Front Mic pin: input vref at 80% */
16807 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16808 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16809 /* Line In pin: input */
16810 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16811 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16812 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16813 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16814 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16815 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16816 /* CD pin widget for input */
16817 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16823 * 6-stack pin configuration:
16825 static struct hda_verb alc861vd_6stack_init_verbs[] = {
16827 * Set pin mode and muting
16829 /* set front pin widgets 0x14 for output */
16830 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16831 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16832 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
16834 /* Rear Pin: output 1 (0x0d) */
16835 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16836 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16837 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
16838 /* CLFE Pin: output 2 (0x0e) */
16839 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16840 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16841 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
16842 /* Side Pin: output 3 (0x0f) */
16843 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16844 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16845 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
16847 /* Mic (rear) pin: input vref at 80% */
16848 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16849 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16850 /* Front Mic pin: input vref at 80% */
16851 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16852 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16853 /* Line In pin: input */
16854 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16855 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16856 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16857 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16858 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16859 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16860 /* CD pin widget for input */
16861 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16866 static struct hda_verb alc861vd_eapd_verbs[] = {
16867 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16871 static struct hda_verb alc660vd_eapd_verbs[] = {
16872 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16873 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16877 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
16878 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16879 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16880 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
16881 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16882 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16886 static void alc861vd_lenovo_setup(struct hda_codec *codec)
16888 struct alc_spec *spec = codec->spec;
16889 spec->autocfg.hp_pins[0] = 0x1b;
16890 spec->autocfg.speaker_pins[0] = 0x14;
16893 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
16895 alc_automute_amp(codec);
16896 alc88x_simple_mic_automute(codec);
16899 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
16902 switch (res >> 26) {
16903 case ALC880_MIC_EVENT:
16904 alc88x_simple_mic_automute(codec);
16907 alc_automute_amp_unsol_event(codec, res);
16912 static struct hda_verb alc861vd_dallas_verbs[] = {
16913 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16914 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16915 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16916 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16918 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16919 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16920 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16921 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16922 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16923 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16924 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16925 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16927 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16928 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16929 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16930 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16931 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16932 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16933 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16934 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16936 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
16937 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16938 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
16939 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16940 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16941 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16942 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16943 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16945 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16946 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16947 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16948 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16950 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16951 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16952 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16957 /* toggle speaker-output according to the hp-jack state */
16958 static void alc861vd_dallas_setup(struct hda_codec *codec)
16960 struct alc_spec *spec = codec->spec;
16962 spec->autocfg.hp_pins[0] = 0x15;
16963 spec->autocfg.speaker_pins[0] = 0x14;
16966 #ifdef CONFIG_SND_HDA_POWER_SAVE
16967 #define alc861vd_loopbacks alc880_loopbacks
16970 /* pcm configuration: identical with ALC880 */
16971 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
16972 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
16973 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
16974 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
16977 * configuration and preset
16979 static const char * const alc861vd_models[ALC861VD_MODEL_LAST] = {
16980 [ALC660VD_3ST] = "3stack-660",
16981 [ALC660VD_3ST_DIG] = "3stack-660-digout",
16982 [ALC660VD_ASUS_V1S] = "asus-v1s",
16983 [ALC861VD_3ST] = "3stack",
16984 [ALC861VD_3ST_DIG] = "3stack-digout",
16985 [ALC861VD_6ST_DIG] = "6stack-digout",
16986 [ALC861VD_LENOVO] = "lenovo",
16987 [ALC861VD_DALLAS] = "dallas",
16988 [ALC861VD_HP] = "hp",
16989 [ALC861VD_AUTO] = "auto",
16992 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
16993 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
16994 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
16995 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
16996 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
16997 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
16998 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
16999 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
17000 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
17001 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
17002 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
17003 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
17004 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
17005 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
17006 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
17007 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
17011 static struct alc_config_preset alc861vd_presets[] = {
17013 .mixers = { alc861vd_3st_mixer },
17014 .init_verbs = { alc861vd_volume_init_verbs,
17015 alc861vd_3stack_init_verbs },
17016 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
17017 .dac_nids = alc660vd_dac_nids,
17018 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17019 .channel_mode = alc861vd_3stack_2ch_modes,
17020 .input_mux = &alc861vd_capture_source,
17022 [ALC660VD_3ST_DIG] = {
17023 .mixers = { alc861vd_3st_mixer },
17024 .init_verbs = { alc861vd_volume_init_verbs,
17025 alc861vd_3stack_init_verbs },
17026 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
17027 .dac_nids = alc660vd_dac_nids,
17028 .dig_out_nid = ALC861VD_DIGOUT_NID,
17029 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17030 .channel_mode = alc861vd_3stack_2ch_modes,
17031 .input_mux = &alc861vd_capture_source,
17034 .mixers = { alc861vd_3st_mixer },
17035 .init_verbs = { alc861vd_volume_init_verbs,
17036 alc861vd_3stack_init_verbs },
17037 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
17038 .dac_nids = alc861vd_dac_nids,
17039 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17040 .channel_mode = alc861vd_3stack_2ch_modes,
17041 .input_mux = &alc861vd_capture_source,
17043 [ALC861VD_3ST_DIG] = {
17044 .mixers = { alc861vd_3st_mixer },
17045 .init_verbs = { alc861vd_volume_init_verbs,
17046 alc861vd_3stack_init_verbs },
17047 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
17048 .dac_nids = alc861vd_dac_nids,
17049 .dig_out_nid = ALC861VD_DIGOUT_NID,
17050 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17051 .channel_mode = alc861vd_3stack_2ch_modes,
17052 .input_mux = &alc861vd_capture_source,
17054 [ALC861VD_6ST_DIG] = {
17055 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
17056 .init_verbs = { alc861vd_volume_init_verbs,
17057 alc861vd_6stack_init_verbs },
17058 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
17059 .dac_nids = alc861vd_dac_nids,
17060 .dig_out_nid = ALC861VD_DIGOUT_NID,
17061 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
17062 .channel_mode = alc861vd_6stack_modes,
17063 .input_mux = &alc861vd_capture_source,
17065 [ALC861VD_LENOVO] = {
17066 .mixers = { alc861vd_lenovo_mixer },
17067 .init_verbs = { alc861vd_volume_init_verbs,
17068 alc861vd_3stack_init_verbs,
17069 alc861vd_eapd_verbs,
17070 alc861vd_lenovo_unsol_verbs },
17071 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
17072 .dac_nids = alc660vd_dac_nids,
17073 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17074 .channel_mode = alc861vd_3stack_2ch_modes,
17075 .input_mux = &alc861vd_capture_source,
17076 .unsol_event = alc861vd_lenovo_unsol_event,
17077 .setup = alc861vd_lenovo_setup,
17078 .init_hook = alc861vd_lenovo_init_hook,
17080 [ALC861VD_DALLAS] = {
17081 .mixers = { alc861vd_dallas_mixer },
17082 .init_verbs = { alc861vd_dallas_verbs },
17083 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
17084 .dac_nids = alc861vd_dac_nids,
17085 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17086 .channel_mode = alc861vd_3stack_2ch_modes,
17087 .input_mux = &alc861vd_dallas_capture_source,
17088 .unsol_event = alc_automute_amp_unsol_event,
17089 .setup = alc861vd_dallas_setup,
17090 .init_hook = alc_automute_amp,
17093 .mixers = { alc861vd_hp_mixer },
17094 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
17095 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
17096 .dac_nids = alc861vd_dac_nids,
17097 .dig_out_nid = ALC861VD_DIGOUT_NID,
17098 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17099 .channel_mode = alc861vd_3stack_2ch_modes,
17100 .input_mux = &alc861vd_hp_capture_source,
17101 .unsol_event = alc_automute_amp_unsol_event,
17102 .setup = alc861vd_dallas_setup,
17103 .init_hook = alc_automute_amp,
17105 [ALC660VD_ASUS_V1S] = {
17106 .mixers = { alc861vd_lenovo_mixer },
17107 .init_verbs = { alc861vd_volume_init_verbs,
17108 alc861vd_3stack_init_verbs,
17109 alc861vd_eapd_verbs,
17110 alc861vd_lenovo_unsol_verbs },
17111 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
17112 .dac_nids = alc660vd_dac_nids,
17113 .dig_out_nid = ALC861VD_DIGOUT_NID,
17114 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17115 .channel_mode = alc861vd_3stack_2ch_modes,
17116 .input_mux = &alc861vd_capture_source,
17117 .unsol_event = alc861vd_lenovo_unsol_event,
17118 .setup = alc861vd_lenovo_setup,
17119 .init_hook = alc861vd_lenovo_init_hook,
17124 * BIOS auto configuration
17126 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
17127 const struct auto_pin_cfg *cfg)
17129 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x22, 0);
17133 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
17134 hda_nid_t nid, int pin_type, int dac_idx)
17136 alc_set_pin_output(codec, nid, pin_type);
17139 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
17141 struct alc_spec *spec = codec->spec;
17144 for (i = 0; i <= HDA_SIDE; i++) {
17145 hda_nid_t nid = spec->autocfg.line_out_pins[i];
17146 int pin_type = get_pin_type(spec->autocfg.line_out_type);
17148 alc861vd_auto_set_output_and_unmute(codec, nid,
17154 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
17156 struct alc_spec *spec = codec->spec;
17159 pin = spec->autocfg.hp_pins[0];
17160 if (pin) /* connect to front and use dac 0 */
17161 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
17162 pin = spec->autocfg.speaker_pins[0];
17164 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
17167 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
17169 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
17171 struct alc_spec *spec = codec->spec;
17172 struct auto_pin_cfg *cfg = &spec->autocfg;
17175 for (i = 0; i < cfg->num_inputs; i++) {
17176 hda_nid_t nid = cfg->inputs[i].pin;
17177 if (alc_is_input_pin(codec, nid)) {
17178 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
17179 if (nid != ALC861VD_PIN_CD_NID &&
17180 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
17181 snd_hda_codec_write(codec, nid, 0,
17182 AC_VERB_SET_AMP_GAIN_MUTE,
17188 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
17190 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
17191 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
17193 /* add playback controls from the parsed DAC table */
17194 /* Based on ALC880 version. But ALC861VD has separate,
17195 * different NIDs for mute/unmute switch and volume control */
17196 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
17197 const struct auto_pin_cfg *cfg)
17199 static const char * const chname[4] = {
17200 "Front", "Surround", "CLFE", "Side"
17202 const char *pfx = alc_get_line_out_pfx(cfg, true);
17203 hda_nid_t nid_v, nid_s;
17206 for (i = 0; i < cfg->line_outs; i++) {
17207 if (!spec->multiout.dac_nids[i])
17209 nid_v = alc861vd_idx_to_mixer_vol(
17211 spec->multiout.dac_nids[i]));
17212 nid_s = alc861vd_idx_to_mixer_switch(
17214 spec->multiout.dac_nids[i]));
17216 if (!pfx && i == 2) {
17218 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
17220 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
17224 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
17226 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
17230 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
17232 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
17236 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
17238 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
17243 const char *name = pfx;
17249 err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
17251 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
17255 err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
17257 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
17266 /* add playback controls for speaker and HP outputs */
17267 /* Based on ALC880 version. But ALC861VD has separate,
17268 * different NIDs for mute/unmute switch and volume control */
17269 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
17270 hda_nid_t pin, const char *pfx)
17272 hda_nid_t nid_v, nid_s;
17278 if (alc880_is_fixed_pin(pin)) {
17279 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
17280 /* specify the DAC as the extra output */
17281 if (!spec->multiout.hp_nid)
17282 spec->multiout.hp_nid = nid_v;
17284 spec->multiout.extra_out_nid[0] = nid_v;
17285 /* control HP volume/switch on the output mixer amp */
17286 nid_v = alc861vd_idx_to_mixer_vol(
17287 alc880_fixed_pin_idx(pin));
17288 nid_s = alc861vd_idx_to_mixer_switch(
17289 alc880_fixed_pin_idx(pin));
17291 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
17292 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
17295 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
17296 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
17299 } else if (alc880_is_multi_pin(pin)) {
17300 /* set manual connection */
17301 /* we have only a switch on HP-out PIN */
17302 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17303 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17310 /* parse the BIOS configuration and set up the alc_spec
17311 * return 1 if successful, 0 if the proper config is not found,
17312 * or a negative error code
17313 * Based on ALC880 version - had to change it to override
17314 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
17315 static int alc861vd_parse_auto_config(struct hda_codec *codec)
17317 struct alc_spec *spec = codec->spec;
17319 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
17321 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17325 if (!spec->autocfg.line_outs)
17326 return 0; /* can't find valid BIOS pin config */
17328 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
17331 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
17334 err = alc861vd_auto_create_extra_out(spec,
17335 spec->autocfg.speaker_pins[0],
17339 err = alc861vd_auto_create_extra_out(spec,
17340 spec->autocfg.hp_pins[0],
17344 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
17348 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
17350 alc_auto_parse_digital(codec);
17352 if (spec->kctls.list)
17353 add_mixer(spec, spec->kctls.list);
17355 add_verb(spec, alc861vd_volume_init_verbs);
17357 spec->num_mux_defs = 1;
17358 spec->input_mux = &spec->private_imux[0];
17360 err = alc_auto_add_mic_boost(codec);
17364 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
17369 /* additional initialization for auto-configuration model */
17370 static void alc861vd_auto_init(struct hda_codec *codec)
17372 struct alc_spec *spec = codec->spec;
17373 alc861vd_auto_init_multi_out(codec);
17374 alc861vd_auto_init_hp_out(codec);
17375 alc861vd_auto_init_analog_input(codec);
17376 alc861vd_auto_init_input_src(codec);
17377 alc_auto_init_digital(codec);
17378 if (spec->unsol_event)
17379 alc_inithook(codec);
17383 ALC660VD_FIX_ASUS_GPIO1
17387 static const struct alc_fixup alc861vd_fixups[] = {
17388 [ALC660VD_FIX_ASUS_GPIO1] = {
17389 .type = ALC_FIXUP_VERBS,
17390 .v.verbs = (const struct hda_verb[]) {
17391 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
17392 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
17393 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
17399 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
17400 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
17404 static int patch_alc861vd(struct hda_codec *codec)
17406 struct alc_spec *spec;
17407 int err, board_config;
17409 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
17413 codec->spec = spec;
17415 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
17419 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
17420 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
17422 board_config = ALC861VD_AUTO;
17425 if (board_config == ALC861VD_AUTO) {
17426 alc_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
17427 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
17430 if (board_config == ALC861VD_AUTO) {
17431 /* automatic parse from the BIOS config */
17432 err = alc861vd_parse_auto_config(codec);
17438 "hda_codec: Cannot set up configuration "
17439 "from BIOS. Using base mode...\n");
17440 board_config = ALC861VD_3ST;
17444 err = snd_hda_attach_beep_device(codec, 0x23);
17450 if (board_config != ALC861VD_AUTO)
17451 setup_preset(codec, &alc861vd_presets[board_config]);
17453 if (codec->vendor_id == 0x10ec0660) {
17454 /* always turn on EAPD */
17455 add_verb(spec, alc660vd_eapd_verbs);
17458 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
17459 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
17461 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
17462 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
17464 if (!spec->adc_nids) {
17465 spec->adc_nids = alc861vd_adc_nids;
17466 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
17468 if (!spec->capsrc_nids)
17469 spec->capsrc_nids = alc861vd_capsrc_nids;
17471 set_capture_mixer(codec);
17472 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
17474 spec->vmaster_nid = 0x02;
17476 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
17478 codec->patch_ops = alc_patch_ops;
17480 if (board_config == ALC861VD_AUTO)
17481 spec->init_hook = alc861vd_auto_init;
17482 #ifdef CONFIG_SND_HDA_POWER_SAVE
17483 if (!spec->loopback.amplist)
17484 spec->loopback.amplist = alc861vd_loopbacks;
17493 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
17494 * configuration. Each pin widget can choose any input DACs and a mixer.
17495 * Each ADC is connected from a mixer of all inputs. This makes possible
17496 * 6-channel independent captures.
17498 * In addition, an independent DAC for the multi-playback (not used in this
17501 #define ALC662_DIGOUT_NID 0x06
17502 #define ALC662_DIGIN_NID 0x0a
17504 static hda_nid_t alc662_dac_nids[4] = {
17505 /* front, rear, clfe, rear_surr */
17509 static hda_nid_t alc272_dac_nids[2] = {
17513 static hda_nid_t alc662_adc_nids[2] = {
17518 static hda_nid_t alc272_adc_nids[1] = {
17523 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
17524 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
17528 /* FIXME: should be a matrix-type input source selection */
17529 static struct hda_input_mux alc662_capture_source = {
17533 { "Front Mic", 0x1 },
17539 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
17547 static struct hda_input_mux alc663_capture_source = {
17551 { "Front Mic", 0x1 },
17556 #if 0 /* set to 1 for testing other input sources below */
17557 static struct hda_input_mux alc272_nc10_capture_source = {
17560 { "Autoselect Mic", 0x0 },
17561 { "Internal Mic", 0x1 },
17562 { "In-0x02", 0x2 },
17563 { "In-0x03", 0x3 },
17564 { "In-0x04", 0x4 },
17565 { "In-0x05", 0x5 },
17566 { "In-0x06", 0x6 },
17567 { "In-0x07", 0x7 },
17568 { "In-0x08", 0x8 },
17569 { "In-0x09", 0x9 },
17570 { "In-0x0a", 0x0a },
17571 { "In-0x0b", 0x0b },
17572 { "In-0x0c", 0x0c },
17573 { "In-0x0d", 0x0d },
17574 { "In-0x0e", 0x0e },
17575 { "In-0x0f", 0x0f },
17583 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
17590 static struct hda_verb alc662_3ST_ch2_init[] = {
17591 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
17592 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
17593 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
17594 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
17601 static struct hda_verb alc662_3ST_ch6_init[] = {
17602 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17603 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
17604 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
17605 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17606 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
17607 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
17611 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
17612 { 2, alc662_3ST_ch2_init },
17613 { 6, alc662_3ST_ch6_init },
17619 static struct hda_verb alc662_sixstack_ch6_init[] = {
17620 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
17621 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
17622 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17629 static struct hda_verb alc662_sixstack_ch8_init[] = {
17630 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17631 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17632 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17636 static struct hda_channel_mode alc662_5stack_modes[2] = {
17637 { 2, alc662_sixstack_ch6_init },
17638 { 6, alc662_sixstack_ch8_init },
17641 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
17642 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
17645 static struct snd_kcontrol_new alc662_base_mixer[] = {
17646 /* output mixer control */
17647 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
17648 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17649 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
17650 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
17651 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17652 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17653 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
17654 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
17655 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17657 /*Input mixer control */
17658 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
17659 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
17660 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
17661 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
17662 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
17663 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
17664 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
17665 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
17669 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
17670 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17671 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17672 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17673 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
17674 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
17675 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17676 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17677 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17678 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17679 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17680 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17684 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
17685 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17686 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17687 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17688 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
17689 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17690 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17691 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
17692 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
17693 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17694 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
17695 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
17696 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17697 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17698 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17699 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17700 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17701 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17705 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
17706 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17707 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
17708 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17709 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
17710 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17711 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17712 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17713 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17714 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17718 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
17719 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17720 ALC262_HIPPO_MASTER_SWITCH,
17722 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
17723 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17724 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17726 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
17727 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17728 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17732 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
17733 ALC262_HIPPO_MASTER_SWITCH,
17734 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17735 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17736 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17737 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17738 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
17739 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17740 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17741 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17742 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17746 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
17747 .ops = &snd_hda_bind_vol,
17749 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
17750 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
17755 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
17756 .ops = &snd_hda_bind_sw,
17758 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17759 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17764 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
17765 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17766 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
17767 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17768 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17772 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
17773 .ops = &snd_hda_bind_sw,
17775 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17776 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17777 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17782 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
17783 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17784 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
17785 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17786 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17787 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17788 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17793 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
17794 .ops = &snd_hda_bind_sw,
17796 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17797 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17798 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
17803 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
17804 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17805 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
17806 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17807 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17808 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17809 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17813 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
17814 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17815 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17816 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17817 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17818 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17819 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17820 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17824 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
17825 .ops = &snd_hda_bind_vol,
17827 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
17828 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
17833 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
17834 .ops = &snd_hda_bind_sw,
17836 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17837 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
17842 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
17843 HDA_BIND_VOL("Master Playback Volume",
17844 &alc663_asus_two_bind_master_vol),
17845 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
17846 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17847 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17848 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17849 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17853 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
17854 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17855 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
17856 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17857 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17858 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17859 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17863 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
17864 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17865 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17866 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17867 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17868 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17870 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17871 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17872 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17873 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17877 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
17878 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17879 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17880 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17882 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17883 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17884 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17885 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17886 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17887 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17891 static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
17892 .ops = &snd_hda_bind_sw,
17894 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17895 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17896 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
17897 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
17898 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17903 static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
17904 .ops = &snd_hda_bind_sw,
17906 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17907 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
17912 static struct snd_kcontrol_new alc663_mode7_mixer[] = {
17913 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17914 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17915 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
17916 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17917 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17918 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17919 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17920 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17921 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17925 static struct snd_kcontrol_new alc663_mode8_mixer[] = {
17926 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17927 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17928 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
17929 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17930 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17931 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17932 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17937 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
17939 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
17940 .name = "Channel Mode",
17941 .info = alc_ch_mode_info,
17942 .get = alc_ch_mode_get,
17943 .put = alc_ch_mode_put,
17948 static struct hda_verb alc662_init_verbs[] = {
17949 /* ADC: mute amp left and right */
17950 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17951 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
17953 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17954 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17955 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17956 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17957 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17958 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17960 /* Front Pin: output 0 (0x0c) */
17961 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17962 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17964 /* Rear Pin: output 1 (0x0d) */
17965 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17966 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17968 /* CLFE Pin: output 2 (0x0e) */
17969 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17970 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17972 /* Mic (rear) pin: input vref at 80% */
17973 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
17974 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17975 /* Front Mic pin: input vref at 80% */
17976 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
17977 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17978 /* Line In pin: input */
17979 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17980 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17981 /* Line-2 In: Headphone output (output 0 - 0x0c) */
17982 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17983 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17984 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
17985 /* CD pin widget for input */
17986 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17988 /* FIXME: use matrix-type input source selection */
17989 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
17991 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17992 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17994 /* always trun on EAPD */
17995 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
17996 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
18001 static struct hda_verb alc663_init_verbs[] = {
18002 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
18003 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18004 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
18005 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18006 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
18007 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
18011 static struct hda_verb alc272_init_verbs[] = {
18012 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18013 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
18014 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
18015 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18016 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
18017 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18018 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
18019 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
18023 static struct hda_verb alc662_sue_init_verbs[] = {
18024 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
18025 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
18029 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
18030 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18031 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18035 /* Set Unsolicited Event*/
18036 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
18037 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
18038 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18042 static struct hda_verb alc663_m51va_init_verbs[] = {
18043 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18044 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18045 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18046 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18047 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18048 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18049 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18050 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18051 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18055 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
18056 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18057 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18058 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18059 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18060 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
18061 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18062 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18066 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
18067 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18068 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18069 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18070 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
18071 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18072 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
18073 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18074 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18078 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
18079 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18080 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18081 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18082 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18083 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
18084 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18085 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18089 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
18090 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18091 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18092 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18093 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
18094 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18095 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18096 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
18097 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18098 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
18099 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18100 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18101 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18105 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
18106 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18107 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18108 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18109 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18110 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18111 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18112 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18113 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18114 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
18115 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18116 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18117 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18121 static struct hda_verb alc663_g71v_init_verbs[] = {
18122 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18123 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
18124 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
18126 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18127 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18128 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
18130 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
18131 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
18132 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
18136 static struct hda_verb alc663_g50v_init_verbs[] = {
18137 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18138 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18139 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
18141 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18142 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18146 static struct hda_verb alc662_ecs_init_verbs[] = {
18147 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
18148 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18149 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18150 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18154 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
18155 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18156 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18157 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18158 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18159 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18160 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18161 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18162 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18163 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18164 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18165 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18169 static struct hda_verb alc272_dell_init_verbs[] = {
18170 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18171 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18172 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18173 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18174 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18175 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18176 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18177 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18178 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18179 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18180 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18184 static struct hda_verb alc663_mode7_init_verbs[] = {
18185 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18186 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18187 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
18188 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18189 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18190 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18191 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
18192 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18193 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18194 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18195 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18196 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18197 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18198 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18199 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18203 static struct hda_verb alc663_mode8_init_verbs[] = {
18204 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18205 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18206 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18207 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
18208 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18209 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
18210 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18211 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18212 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18213 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18214 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18215 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18216 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18217 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18218 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18219 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18223 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
18224 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
18225 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
18229 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
18230 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
18231 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
18235 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
18237 unsigned int present;
18238 unsigned char bits;
18240 present = snd_hda_jack_detect(codec, 0x14);
18241 bits = present ? HDA_AMP_MUTE : 0;
18243 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
18244 HDA_AMP_MUTE, bits);
18247 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
18249 unsigned int present;
18250 unsigned char bits;
18252 present = snd_hda_jack_detect(codec, 0x1b);
18253 bits = present ? HDA_AMP_MUTE : 0;
18255 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
18256 HDA_AMP_MUTE, bits);
18257 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18258 HDA_AMP_MUTE, bits);
18261 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
18264 if ((res >> 26) == ALC880_HP_EVENT)
18265 alc662_lenovo_101e_all_automute(codec);
18266 if ((res >> 26) == ALC880_FRONT_EVENT)
18267 alc662_lenovo_101e_ispeaker_automute(codec);
18270 /* unsolicited event for HP jack sensing */
18271 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
18274 if ((res >> 26) == ALC880_MIC_EVENT)
18275 alc_mic_automute(codec);
18277 alc262_hippo_unsol_event(codec, res);
18280 static void alc662_eeepc_setup(struct hda_codec *codec)
18282 struct alc_spec *spec = codec->spec;
18284 alc262_hippo1_setup(codec);
18285 spec->ext_mic.pin = 0x18;
18286 spec->ext_mic.mux_idx = 0;
18287 spec->int_mic.pin = 0x19;
18288 spec->int_mic.mux_idx = 1;
18289 spec->auto_mic = 1;
18292 static void alc662_eeepc_inithook(struct hda_codec *codec)
18294 alc262_hippo_automute(codec);
18295 alc_mic_automute(codec);
18298 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
18300 struct alc_spec *spec = codec->spec;
18302 spec->autocfg.hp_pins[0] = 0x14;
18303 spec->autocfg.speaker_pins[0] = 0x1b;
18306 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
18308 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
18310 unsigned int present;
18311 unsigned char bits;
18313 present = snd_hda_jack_detect(codec, 0x21);
18314 bits = present ? HDA_AMP_MUTE : 0;
18315 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18316 HDA_AMP_MUTE, bits);
18317 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18318 HDA_AMP_MUTE, bits);
18321 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
18323 unsigned int present;
18324 unsigned char bits;
18326 present = snd_hda_jack_detect(codec, 0x21);
18327 bits = present ? HDA_AMP_MUTE : 0;
18328 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18329 HDA_AMP_MUTE, bits);
18330 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18331 HDA_AMP_MUTE, bits);
18332 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
18333 HDA_AMP_MUTE, bits);
18334 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
18335 HDA_AMP_MUTE, bits);
18338 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
18340 unsigned int present;
18341 unsigned char bits;
18343 present = snd_hda_jack_detect(codec, 0x15);
18344 bits = present ? HDA_AMP_MUTE : 0;
18345 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18346 HDA_AMP_MUTE, bits);
18347 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18348 HDA_AMP_MUTE, bits);
18349 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
18350 HDA_AMP_MUTE, bits);
18351 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
18352 HDA_AMP_MUTE, bits);
18355 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
18357 unsigned int present;
18358 unsigned char bits;
18360 present = snd_hda_jack_detect(codec, 0x1b);
18361 bits = present ? 0 : PIN_OUT;
18362 snd_hda_codec_write(codec, 0x14, 0,
18363 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
18366 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
18368 unsigned int present1, present2;
18370 present1 = snd_hda_jack_detect(codec, 0x21);
18371 present2 = snd_hda_jack_detect(codec, 0x15);
18373 if (present1 || present2) {
18374 snd_hda_codec_write_cache(codec, 0x14, 0,
18375 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18377 snd_hda_codec_write_cache(codec, 0x14, 0,
18378 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18382 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
18384 unsigned int present1, present2;
18386 present1 = snd_hda_jack_detect(codec, 0x1b);
18387 present2 = snd_hda_jack_detect(codec, 0x15);
18389 if (present1 || present2) {
18390 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18391 HDA_AMP_MUTE, HDA_AMP_MUTE);
18392 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18393 HDA_AMP_MUTE, HDA_AMP_MUTE);
18395 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18397 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18402 static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
18404 unsigned int present1, present2;
18406 present1 = snd_hda_codec_read(codec, 0x1b, 0,
18407 AC_VERB_GET_PIN_SENSE, 0)
18408 & AC_PINSENSE_PRESENCE;
18409 present2 = snd_hda_codec_read(codec, 0x21, 0,
18410 AC_VERB_GET_PIN_SENSE, 0)
18411 & AC_PINSENSE_PRESENCE;
18413 if (present1 || present2) {
18414 snd_hda_codec_write_cache(codec, 0x14, 0,
18415 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18416 snd_hda_codec_write_cache(codec, 0x17, 0,
18417 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18419 snd_hda_codec_write_cache(codec, 0x14, 0,
18420 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18421 snd_hda_codec_write_cache(codec, 0x17, 0,
18422 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18426 static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
18428 unsigned int present1, present2;
18430 present1 = snd_hda_codec_read(codec, 0x21, 0,
18431 AC_VERB_GET_PIN_SENSE, 0)
18432 & AC_PINSENSE_PRESENCE;
18433 present2 = snd_hda_codec_read(codec, 0x15, 0,
18434 AC_VERB_GET_PIN_SENSE, 0)
18435 & AC_PINSENSE_PRESENCE;
18437 if (present1 || present2) {
18438 snd_hda_codec_write_cache(codec, 0x14, 0,
18439 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18440 snd_hda_codec_write_cache(codec, 0x17, 0,
18441 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18443 snd_hda_codec_write_cache(codec, 0x14, 0,
18444 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18445 snd_hda_codec_write_cache(codec, 0x17, 0,
18446 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18450 static void alc663_m51va_unsol_event(struct hda_codec *codec,
18453 switch (res >> 26) {
18454 case ALC880_HP_EVENT:
18455 alc663_m51va_speaker_automute(codec);
18457 case ALC880_MIC_EVENT:
18458 alc_mic_automute(codec);
18463 static void alc663_m51va_setup(struct hda_codec *codec)
18465 struct alc_spec *spec = codec->spec;
18466 spec->ext_mic.pin = 0x18;
18467 spec->ext_mic.mux_idx = 0;
18468 spec->int_mic.pin = 0x12;
18469 spec->int_mic.mux_idx = 9;
18470 spec->auto_mic = 1;
18473 static void alc663_m51va_inithook(struct hda_codec *codec)
18475 alc663_m51va_speaker_automute(codec);
18476 alc_mic_automute(codec);
18479 /* ***************** Mode1 ******************************/
18480 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
18482 static void alc663_mode1_setup(struct hda_codec *codec)
18484 struct alc_spec *spec = codec->spec;
18485 spec->ext_mic.pin = 0x18;
18486 spec->ext_mic.mux_idx = 0;
18487 spec->int_mic.pin = 0x19;
18488 spec->int_mic.mux_idx = 1;
18489 spec->auto_mic = 1;
18492 #define alc663_mode1_inithook alc663_m51va_inithook
18494 /* ***************** Mode2 ******************************/
18495 static void alc662_mode2_unsol_event(struct hda_codec *codec,
18498 switch (res >> 26) {
18499 case ALC880_HP_EVENT:
18500 alc662_f5z_speaker_automute(codec);
18502 case ALC880_MIC_EVENT:
18503 alc_mic_automute(codec);
18508 #define alc662_mode2_setup alc663_mode1_setup
18510 static void alc662_mode2_inithook(struct hda_codec *codec)
18512 alc662_f5z_speaker_automute(codec);
18513 alc_mic_automute(codec);
18515 /* ***************** Mode3 ******************************/
18516 static void alc663_mode3_unsol_event(struct hda_codec *codec,
18519 switch (res >> 26) {
18520 case ALC880_HP_EVENT:
18521 alc663_two_hp_m1_speaker_automute(codec);
18523 case ALC880_MIC_EVENT:
18524 alc_mic_automute(codec);
18529 #define alc663_mode3_setup alc663_mode1_setup
18531 static void alc663_mode3_inithook(struct hda_codec *codec)
18533 alc663_two_hp_m1_speaker_automute(codec);
18534 alc_mic_automute(codec);
18536 /* ***************** Mode4 ******************************/
18537 static void alc663_mode4_unsol_event(struct hda_codec *codec,
18540 switch (res >> 26) {
18541 case ALC880_HP_EVENT:
18542 alc663_21jd_two_speaker_automute(codec);
18544 case ALC880_MIC_EVENT:
18545 alc_mic_automute(codec);
18550 #define alc663_mode4_setup alc663_mode1_setup
18552 static void alc663_mode4_inithook(struct hda_codec *codec)
18554 alc663_21jd_two_speaker_automute(codec);
18555 alc_mic_automute(codec);
18557 /* ***************** Mode5 ******************************/
18558 static void alc663_mode5_unsol_event(struct hda_codec *codec,
18561 switch (res >> 26) {
18562 case ALC880_HP_EVENT:
18563 alc663_15jd_two_speaker_automute(codec);
18565 case ALC880_MIC_EVENT:
18566 alc_mic_automute(codec);
18571 #define alc663_mode5_setup alc663_mode1_setup
18573 static void alc663_mode5_inithook(struct hda_codec *codec)
18575 alc663_15jd_two_speaker_automute(codec);
18576 alc_mic_automute(codec);
18578 /* ***************** Mode6 ******************************/
18579 static void alc663_mode6_unsol_event(struct hda_codec *codec,
18582 switch (res >> 26) {
18583 case ALC880_HP_EVENT:
18584 alc663_two_hp_m2_speaker_automute(codec);
18586 case ALC880_MIC_EVENT:
18587 alc_mic_automute(codec);
18592 #define alc663_mode6_setup alc663_mode1_setup
18594 static void alc663_mode6_inithook(struct hda_codec *codec)
18596 alc663_two_hp_m2_speaker_automute(codec);
18597 alc_mic_automute(codec);
18600 /* ***************** Mode7 ******************************/
18601 static void alc663_mode7_unsol_event(struct hda_codec *codec,
18604 switch (res >> 26) {
18605 case ALC880_HP_EVENT:
18606 alc663_two_hp_m7_speaker_automute(codec);
18608 case ALC880_MIC_EVENT:
18609 alc_mic_automute(codec);
18614 #define alc663_mode7_setup alc663_mode1_setup
18616 static void alc663_mode7_inithook(struct hda_codec *codec)
18618 alc663_two_hp_m7_speaker_automute(codec);
18619 alc_mic_automute(codec);
18622 /* ***************** Mode8 ******************************/
18623 static void alc663_mode8_unsol_event(struct hda_codec *codec,
18626 switch (res >> 26) {
18627 case ALC880_HP_EVENT:
18628 alc663_two_hp_m8_speaker_automute(codec);
18630 case ALC880_MIC_EVENT:
18631 alc_mic_automute(codec);
18636 #define alc663_mode8_setup alc663_m51va_setup
18638 static void alc663_mode8_inithook(struct hda_codec *codec)
18640 alc663_two_hp_m8_speaker_automute(codec);
18641 alc_mic_automute(codec);
18644 static void alc663_g71v_hp_automute(struct hda_codec *codec)
18646 unsigned int present;
18647 unsigned char bits;
18649 present = snd_hda_jack_detect(codec, 0x21);
18650 bits = present ? HDA_AMP_MUTE : 0;
18651 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
18652 HDA_AMP_MUTE, bits);
18653 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18654 HDA_AMP_MUTE, bits);
18657 static void alc663_g71v_front_automute(struct hda_codec *codec)
18659 unsigned int present;
18660 unsigned char bits;
18662 present = snd_hda_jack_detect(codec, 0x15);
18663 bits = present ? HDA_AMP_MUTE : 0;
18664 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18665 HDA_AMP_MUTE, bits);
18668 static void alc663_g71v_unsol_event(struct hda_codec *codec,
18671 switch (res >> 26) {
18672 case ALC880_HP_EVENT:
18673 alc663_g71v_hp_automute(codec);
18675 case ALC880_FRONT_EVENT:
18676 alc663_g71v_front_automute(codec);
18678 case ALC880_MIC_EVENT:
18679 alc_mic_automute(codec);
18684 #define alc663_g71v_setup alc663_m51va_setup
18686 static void alc663_g71v_inithook(struct hda_codec *codec)
18688 alc663_g71v_front_automute(codec);
18689 alc663_g71v_hp_automute(codec);
18690 alc_mic_automute(codec);
18693 static void alc663_g50v_unsol_event(struct hda_codec *codec,
18696 switch (res >> 26) {
18697 case ALC880_HP_EVENT:
18698 alc663_m51va_speaker_automute(codec);
18700 case ALC880_MIC_EVENT:
18701 alc_mic_automute(codec);
18706 #define alc663_g50v_setup alc663_m51va_setup
18708 static void alc663_g50v_inithook(struct hda_codec *codec)
18710 alc663_m51va_speaker_automute(codec);
18711 alc_mic_automute(codec);
18714 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
18715 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
18716 ALC262_HIPPO_MASTER_SWITCH,
18718 HDA_CODEC_VOLUME("Mic/LineIn Boost Volume", 0x18, 0, HDA_INPUT),
18719 HDA_CODEC_VOLUME("Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
18720 HDA_CODEC_MUTE("Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
18722 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
18723 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
18724 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
18728 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
18729 /* Master Playback automatically created from Speaker and Headphone */
18730 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
18731 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
18732 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
18733 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
18735 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
18736 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
18737 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
18739 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
18740 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
18741 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
18745 #ifdef CONFIG_SND_HDA_POWER_SAVE
18746 #define alc662_loopbacks alc880_loopbacks
18750 /* pcm configuration: identical with ALC880 */
18751 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
18752 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
18753 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
18754 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
18757 * configuration and preset
18759 static const char * const alc662_models[ALC662_MODEL_LAST] = {
18760 [ALC662_3ST_2ch_DIG] = "3stack-dig",
18761 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
18762 [ALC662_3ST_6ch] = "3stack-6ch",
18763 [ALC662_5ST_DIG] = "6stack-dig",
18764 [ALC662_LENOVO_101E] = "lenovo-101e",
18765 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
18766 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
18767 [ALC662_ECS] = "ecs",
18768 [ALC663_ASUS_M51VA] = "m51va",
18769 [ALC663_ASUS_G71V] = "g71v",
18770 [ALC663_ASUS_H13] = "h13",
18771 [ALC663_ASUS_G50V] = "g50v",
18772 [ALC663_ASUS_MODE1] = "asus-mode1",
18773 [ALC662_ASUS_MODE2] = "asus-mode2",
18774 [ALC663_ASUS_MODE3] = "asus-mode3",
18775 [ALC663_ASUS_MODE4] = "asus-mode4",
18776 [ALC663_ASUS_MODE5] = "asus-mode5",
18777 [ALC663_ASUS_MODE6] = "asus-mode6",
18778 [ALC663_ASUS_MODE7] = "asus-mode7",
18779 [ALC663_ASUS_MODE8] = "asus-mode8",
18780 [ALC272_DELL] = "dell",
18781 [ALC272_DELL_ZM1] = "dell-zm1",
18782 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
18783 [ALC662_AUTO] = "auto",
18786 static struct snd_pci_quirk alc662_cfg_tbl[] = {
18787 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
18788 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
18789 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
18790 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
18791 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
18792 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1),
18793 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
18794 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
18795 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
18796 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
18797 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
18798 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
18799 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
18800 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
18801 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
18802 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
18803 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
18804 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
18805 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
18806 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
18807 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
18808 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
18809 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
18810 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
18811 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
18812 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
18813 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
18814 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
18815 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
18816 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
18817 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
18818 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
18819 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
18820 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
18821 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
18822 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
18823 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
18824 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
18825 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
18826 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
18827 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
18828 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1),
18829 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
18830 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
18831 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
18832 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
18833 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
18834 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
18835 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
18836 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
18837 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
18838 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
18839 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
18840 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
18841 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
18842 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
18843 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
18844 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
18845 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
18846 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
18847 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
18848 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
18849 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
18850 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
18851 ALC662_3ST_6ch_DIG),
18852 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO),
18853 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
18854 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
18855 ALC662_3ST_6ch_DIG),
18856 SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13),
18857 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
18858 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
18859 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
18860 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
18861 ALC662_3ST_6ch_DIG),
18862 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
18864 SND_PCI_QUIRK(0x1991, 0x5628, "Ordissimo EVE", ALC662_LENOVO_101E),
18868 static struct alc_config_preset alc662_presets[] = {
18869 [ALC662_3ST_2ch_DIG] = {
18870 .mixers = { alc662_3ST_2ch_mixer },
18871 .init_verbs = { alc662_init_verbs },
18872 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18873 .dac_nids = alc662_dac_nids,
18874 .dig_out_nid = ALC662_DIGOUT_NID,
18875 .dig_in_nid = ALC662_DIGIN_NID,
18876 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18877 .channel_mode = alc662_3ST_2ch_modes,
18878 .input_mux = &alc662_capture_source,
18880 [ALC662_3ST_6ch_DIG] = {
18881 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18882 .init_verbs = { alc662_init_verbs },
18883 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18884 .dac_nids = alc662_dac_nids,
18885 .dig_out_nid = ALC662_DIGOUT_NID,
18886 .dig_in_nid = ALC662_DIGIN_NID,
18887 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18888 .channel_mode = alc662_3ST_6ch_modes,
18890 .input_mux = &alc662_capture_source,
18892 [ALC662_3ST_6ch] = {
18893 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18894 .init_verbs = { alc662_init_verbs },
18895 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18896 .dac_nids = alc662_dac_nids,
18897 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18898 .channel_mode = alc662_3ST_6ch_modes,
18900 .input_mux = &alc662_capture_source,
18902 [ALC662_5ST_DIG] = {
18903 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
18904 .init_verbs = { alc662_init_verbs },
18905 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18906 .dac_nids = alc662_dac_nids,
18907 .dig_out_nid = ALC662_DIGOUT_NID,
18908 .dig_in_nid = ALC662_DIGIN_NID,
18909 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
18910 .channel_mode = alc662_5stack_modes,
18911 .input_mux = &alc662_capture_source,
18913 [ALC662_LENOVO_101E] = {
18914 .mixers = { alc662_lenovo_101e_mixer },
18915 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
18916 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18917 .dac_nids = alc662_dac_nids,
18918 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18919 .channel_mode = alc662_3ST_2ch_modes,
18920 .input_mux = &alc662_lenovo_101e_capture_source,
18921 .unsol_event = alc662_lenovo_101e_unsol_event,
18922 .init_hook = alc662_lenovo_101e_all_automute,
18924 [ALC662_ASUS_EEEPC_P701] = {
18925 .mixers = { alc662_eeepc_p701_mixer },
18926 .init_verbs = { alc662_init_verbs,
18927 alc662_eeepc_sue_init_verbs },
18928 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18929 .dac_nids = alc662_dac_nids,
18930 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18931 .channel_mode = alc662_3ST_2ch_modes,
18932 .unsol_event = alc662_eeepc_unsol_event,
18933 .setup = alc662_eeepc_setup,
18934 .init_hook = alc662_eeepc_inithook,
18936 [ALC662_ASUS_EEEPC_EP20] = {
18937 .mixers = { alc662_eeepc_ep20_mixer,
18938 alc662_chmode_mixer },
18939 .init_verbs = { alc662_init_verbs,
18940 alc662_eeepc_ep20_sue_init_verbs },
18941 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18942 .dac_nids = alc662_dac_nids,
18943 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18944 .channel_mode = alc662_3ST_6ch_modes,
18945 .input_mux = &alc662_lenovo_101e_capture_source,
18946 .unsol_event = alc662_eeepc_unsol_event,
18947 .setup = alc662_eeepc_ep20_setup,
18948 .init_hook = alc662_eeepc_ep20_inithook,
18951 .mixers = { alc662_ecs_mixer },
18952 .init_verbs = { alc662_init_verbs,
18953 alc662_ecs_init_verbs },
18954 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18955 .dac_nids = alc662_dac_nids,
18956 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18957 .channel_mode = alc662_3ST_2ch_modes,
18958 .unsol_event = alc662_eeepc_unsol_event,
18959 .setup = alc662_eeepc_setup,
18960 .init_hook = alc662_eeepc_inithook,
18962 [ALC663_ASUS_M51VA] = {
18963 .mixers = { alc663_m51va_mixer },
18964 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
18965 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18966 .dac_nids = alc662_dac_nids,
18967 .dig_out_nid = ALC662_DIGOUT_NID,
18968 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18969 .channel_mode = alc662_3ST_2ch_modes,
18970 .unsol_event = alc663_m51va_unsol_event,
18971 .setup = alc663_m51va_setup,
18972 .init_hook = alc663_m51va_inithook,
18974 [ALC663_ASUS_G71V] = {
18975 .mixers = { alc663_g71v_mixer },
18976 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
18977 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18978 .dac_nids = alc662_dac_nids,
18979 .dig_out_nid = ALC662_DIGOUT_NID,
18980 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18981 .channel_mode = alc662_3ST_2ch_modes,
18982 .unsol_event = alc663_g71v_unsol_event,
18983 .setup = alc663_g71v_setup,
18984 .init_hook = alc663_g71v_inithook,
18986 [ALC663_ASUS_H13] = {
18987 .mixers = { alc663_m51va_mixer },
18988 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
18989 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18990 .dac_nids = alc662_dac_nids,
18991 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18992 .channel_mode = alc662_3ST_2ch_modes,
18993 .unsol_event = alc663_m51va_unsol_event,
18994 .init_hook = alc663_m51va_inithook,
18996 [ALC663_ASUS_G50V] = {
18997 .mixers = { alc663_g50v_mixer },
18998 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
18999 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
19000 .dac_nids = alc662_dac_nids,
19001 .dig_out_nid = ALC662_DIGOUT_NID,
19002 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
19003 .channel_mode = alc662_3ST_6ch_modes,
19004 .input_mux = &alc663_capture_source,
19005 .unsol_event = alc663_g50v_unsol_event,
19006 .setup = alc663_g50v_setup,
19007 .init_hook = alc663_g50v_inithook,
19009 [ALC663_ASUS_MODE1] = {
19010 .mixers = { alc663_m51va_mixer },
19011 .cap_mixer = alc662_auto_capture_mixer,
19012 .init_verbs = { alc662_init_verbs,
19013 alc663_21jd_amic_init_verbs },
19014 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
19016 .dac_nids = alc662_dac_nids,
19017 .dig_out_nid = ALC662_DIGOUT_NID,
19018 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19019 .channel_mode = alc662_3ST_2ch_modes,
19020 .unsol_event = alc663_mode1_unsol_event,
19021 .setup = alc663_mode1_setup,
19022 .init_hook = alc663_mode1_inithook,
19024 [ALC662_ASUS_MODE2] = {
19025 .mixers = { alc662_1bjd_mixer },
19026 .cap_mixer = alc662_auto_capture_mixer,
19027 .init_verbs = { alc662_init_verbs,
19028 alc662_1bjd_amic_init_verbs },
19029 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
19030 .dac_nids = alc662_dac_nids,
19031 .dig_out_nid = ALC662_DIGOUT_NID,
19032 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19033 .channel_mode = alc662_3ST_2ch_modes,
19034 .unsol_event = alc662_mode2_unsol_event,
19035 .setup = alc662_mode2_setup,
19036 .init_hook = alc662_mode2_inithook,
19038 [ALC663_ASUS_MODE3] = {
19039 .mixers = { alc663_two_hp_m1_mixer },
19040 .cap_mixer = alc662_auto_capture_mixer,
19041 .init_verbs = { alc662_init_verbs,
19042 alc663_two_hp_amic_m1_init_verbs },
19043 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
19045 .dac_nids = alc662_dac_nids,
19046 .dig_out_nid = ALC662_DIGOUT_NID,
19047 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19048 .channel_mode = alc662_3ST_2ch_modes,
19049 .unsol_event = alc663_mode3_unsol_event,
19050 .setup = alc663_mode3_setup,
19051 .init_hook = alc663_mode3_inithook,
19053 [ALC663_ASUS_MODE4] = {
19054 .mixers = { alc663_asus_21jd_clfe_mixer },
19055 .cap_mixer = alc662_auto_capture_mixer,
19056 .init_verbs = { alc662_init_verbs,
19057 alc663_21jd_amic_init_verbs},
19058 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
19060 .dac_nids = alc662_dac_nids,
19061 .dig_out_nid = ALC662_DIGOUT_NID,
19062 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19063 .channel_mode = alc662_3ST_2ch_modes,
19064 .unsol_event = alc663_mode4_unsol_event,
19065 .setup = alc663_mode4_setup,
19066 .init_hook = alc663_mode4_inithook,
19068 [ALC663_ASUS_MODE5] = {
19069 .mixers = { alc663_asus_15jd_clfe_mixer },
19070 .cap_mixer = alc662_auto_capture_mixer,
19071 .init_verbs = { alc662_init_verbs,
19072 alc663_15jd_amic_init_verbs },
19073 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
19075 .dac_nids = alc662_dac_nids,
19076 .dig_out_nid = ALC662_DIGOUT_NID,
19077 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19078 .channel_mode = alc662_3ST_2ch_modes,
19079 .unsol_event = alc663_mode5_unsol_event,
19080 .setup = alc663_mode5_setup,
19081 .init_hook = alc663_mode5_inithook,
19083 [ALC663_ASUS_MODE6] = {
19084 .mixers = { alc663_two_hp_m2_mixer },
19085 .cap_mixer = alc662_auto_capture_mixer,
19086 .init_verbs = { alc662_init_verbs,
19087 alc663_two_hp_amic_m2_init_verbs },
19088 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
19090 .dac_nids = alc662_dac_nids,
19091 .dig_out_nid = ALC662_DIGOUT_NID,
19092 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19093 .channel_mode = alc662_3ST_2ch_modes,
19094 .unsol_event = alc663_mode6_unsol_event,
19095 .setup = alc663_mode6_setup,
19096 .init_hook = alc663_mode6_inithook,
19098 [ALC663_ASUS_MODE7] = {
19099 .mixers = { alc663_mode7_mixer },
19100 .cap_mixer = alc662_auto_capture_mixer,
19101 .init_verbs = { alc662_init_verbs,
19102 alc663_mode7_init_verbs },
19103 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
19105 .dac_nids = alc662_dac_nids,
19106 .dig_out_nid = ALC662_DIGOUT_NID,
19107 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19108 .channel_mode = alc662_3ST_2ch_modes,
19109 .unsol_event = alc663_mode7_unsol_event,
19110 .setup = alc663_mode7_setup,
19111 .init_hook = alc663_mode7_inithook,
19113 [ALC663_ASUS_MODE8] = {
19114 .mixers = { alc663_mode8_mixer },
19115 .cap_mixer = alc662_auto_capture_mixer,
19116 .init_verbs = { alc662_init_verbs,
19117 alc663_mode8_init_verbs },
19118 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
19120 .dac_nids = alc662_dac_nids,
19121 .dig_out_nid = ALC662_DIGOUT_NID,
19122 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19123 .channel_mode = alc662_3ST_2ch_modes,
19124 .unsol_event = alc663_mode8_unsol_event,
19125 .setup = alc663_mode8_setup,
19126 .init_hook = alc663_mode8_inithook,
19129 .mixers = { alc663_m51va_mixer },
19130 .cap_mixer = alc272_auto_capture_mixer,
19131 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
19132 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
19133 .dac_nids = alc662_dac_nids,
19134 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19135 .adc_nids = alc272_adc_nids,
19136 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
19137 .capsrc_nids = alc272_capsrc_nids,
19138 .channel_mode = alc662_3ST_2ch_modes,
19139 .unsol_event = alc663_m51va_unsol_event,
19140 .setup = alc663_m51va_setup,
19141 .init_hook = alc663_m51va_inithook,
19143 [ALC272_DELL_ZM1] = {
19144 .mixers = { alc663_m51va_mixer },
19145 .cap_mixer = alc662_auto_capture_mixer,
19146 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
19147 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
19148 .dac_nids = alc662_dac_nids,
19149 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19150 .adc_nids = alc662_adc_nids,
19152 .capsrc_nids = alc662_capsrc_nids,
19153 .channel_mode = alc662_3ST_2ch_modes,
19154 .unsol_event = alc663_m51va_unsol_event,
19155 .setup = alc663_m51va_setup,
19156 .init_hook = alc663_m51va_inithook,
19158 [ALC272_SAMSUNG_NC10] = {
19159 .mixers = { alc272_nc10_mixer },
19160 .init_verbs = { alc662_init_verbs,
19161 alc663_21jd_amic_init_verbs },
19162 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
19163 .dac_nids = alc272_dac_nids,
19164 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19165 .channel_mode = alc662_3ST_2ch_modes,
19166 /*.input_mux = &alc272_nc10_capture_source,*/
19167 .unsol_event = alc663_mode4_unsol_event,
19168 .setup = alc663_mode4_setup,
19169 .init_hook = alc663_mode4_inithook,
19175 * BIOS auto configuration
19178 /* convert from MIX nid to DAC */
19179 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
19183 else if (nid >= 0x0c && nid <= 0x0e)
19184 return nid - 0x0c + 0x02;
19185 else if (nid == 0x26) /* ALC887-VD has this DAC too */
19191 /* get MIX nid connected to the given pin targeted to DAC */
19192 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
19198 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
19199 for (i = 0; i < num; i++) {
19200 if (alc662_mix_to_dac(mix[i]) == dac)
19206 /* look for an empty DAC slot */
19207 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
19209 struct alc_spec *spec = codec->spec;
19213 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
19216 for (i = 0; i < num; i++) {
19217 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
19220 for (j = 0; j < spec->multiout.num_dacs; j++)
19221 if (spec->multiout.dac_nids[j] == nid)
19223 if (j >= spec->multiout.num_dacs)
19229 /* fill in the dac_nids table from the parsed pin configuration */
19230 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
19231 const struct auto_pin_cfg *cfg)
19233 struct alc_spec *spec = codec->spec;
19237 spec->multiout.dac_nids = spec->private_dac_nids;
19238 for (i = 0; i < cfg->line_outs; i++) {
19239 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
19242 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
19247 static inline int __alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
19248 hda_nid_t nid, int idx, unsigned int chs)
19250 return __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, idx,
19251 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
19254 static inline int __alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
19255 hda_nid_t nid, int idx, unsigned int chs)
19257 return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, idx,
19258 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
19261 #define alc662_add_vol_ctl(spec, pfx, nid, chs) \
19262 __alc662_add_vol_ctl(spec, pfx, nid, 0, chs)
19263 #define alc662_add_sw_ctl(spec, pfx, nid, chs) \
19264 __alc662_add_sw_ctl(spec, pfx, nid, 0, chs)
19265 #define alc662_add_stereo_vol(spec, pfx, nid) \
19266 alc662_add_vol_ctl(spec, pfx, nid, 3)
19267 #define alc662_add_stereo_sw(spec, pfx, nid) \
19268 alc662_add_sw_ctl(spec, pfx, nid, 3)
19270 /* add playback controls from the parsed DAC table */
19271 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
19272 const struct auto_pin_cfg *cfg)
19274 struct alc_spec *spec = codec->spec;
19275 static const char * const chname[4] = {
19276 "Front", "Surround", NULL /*CLFE*/, "Side"
19278 const char *pfx = alc_get_line_out_pfx(cfg, true);
19279 hda_nid_t nid, mix;
19282 for (i = 0; i < cfg->line_outs; i++) {
19283 nid = spec->multiout.dac_nids[i];
19286 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
19289 if (!pfx && i == 2) {
19291 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
19294 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
19297 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
19300 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
19304 const char *name = pfx;
19310 err = __alc662_add_vol_ctl(spec, name, nid, index, 3);
19313 err = __alc662_add_sw_ctl(spec, name, mix, index, 3);
19321 /* add playback controls for speaker and HP outputs */
19322 /* return DAC nid if any new DAC is assigned */
19323 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
19326 struct alc_spec *spec = codec->spec;
19327 hda_nid_t nid, mix;
19332 nid = alc662_look_for_dac(codec, pin);
19334 /* the corresponding DAC is already occupied */
19335 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
19336 return 0; /* no way */
19337 /* create a switch only */
19338 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
19339 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
19342 mix = alc662_dac_to_mix(codec, pin, nid);
19345 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
19348 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
19354 /* create playback/capture controls for input pins */
19355 #define alc662_auto_create_input_ctls \
19356 alc882_auto_create_input_ctls
19358 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
19359 hda_nid_t nid, int pin_type,
19363 hda_nid_t srcs[HDA_MAX_CONNECTIONS];
19365 alc_set_pin_output(codec, nid, pin_type);
19366 /* need the manual connection? */
19367 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
19370 for (i = 0; i < num; i++) {
19371 if (alc662_mix_to_dac(srcs[i]) != dac)
19373 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
19378 static void alc662_auto_init_multi_out(struct hda_codec *codec)
19380 struct alc_spec *spec = codec->spec;
19381 int pin_type = get_pin_type(spec->autocfg.line_out_type);
19384 for (i = 0; i <= HDA_SIDE; i++) {
19385 hda_nid_t nid = spec->autocfg.line_out_pins[i];
19387 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
19388 spec->multiout.dac_nids[i]);
19392 static void alc662_auto_init_hp_out(struct hda_codec *codec)
19394 struct alc_spec *spec = codec->spec;
19397 pin = spec->autocfg.hp_pins[0];
19399 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
19400 spec->multiout.hp_nid);
19401 pin = spec->autocfg.speaker_pins[0];
19403 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
19404 spec->multiout.extra_out_nid[0]);
19407 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
19409 static void alc662_auto_init_analog_input(struct hda_codec *codec)
19411 struct alc_spec *spec = codec->spec;
19412 struct auto_pin_cfg *cfg = &spec->autocfg;
19415 for (i = 0; i < cfg->num_inputs; i++) {
19416 hda_nid_t nid = cfg->inputs[i].pin;
19417 if (alc_is_input_pin(codec, nid)) {
19418 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
19419 if (nid != ALC662_PIN_CD_NID &&
19420 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
19421 snd_hda_codec_write(codec, nid, 0,
19422 AC_VERB_SET_AMP_GAIN_MUTE,
19428 #define alc662_auto_init_input_src alc882_auto_init_input_src
19430 static int alc662_parse_auto_config(struct hda_codec *codec)
19432 struct alc_spec *spec = codec->spec;
19434 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
19436 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
19440 if (!spec->autocfg.line_outs)
19441 return 0; /* can't find valid BIOS pin config */
19443 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
19446 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
19449 err = alc662_auto_create_extra_out(codec,
19450 spec->autocfg.speaker_pins[0],
19455 spec->multiout.extra_out_nid[0] = err;
19456 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
19461 spec->multiout.hp_nid = err;
19462 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
19466 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
19468 alc_auto_parse_digital(codec);
19470 if (spec->kctls.list)
19471 add_mixer(spec, spec->kctls.list);
19473 spec->num_mux_defs = 1;
19474 spec->input_mux = &spec->private_imux[0];
19476 add_verb(spec, alc662_init_verbs);
19477 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
19478 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
19479 add_verb(spec, alc663_init_verbs);
19481 if (codec->vendor_id == 0x10ec0272)
19482 add_verb(spec, alc272_init_verbs);
19484 err = alc_auto_add_mic_boost(codec);
19488 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
19489 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
19490 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21);
19492 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
19497 /* additional initialization for auto-configuration model */
19498 static void alc662_auto_init(struct hda_codec *codec)
19500 struct alc_spec *spec = codec->spec;
19501 alc662_auto_init_multi_out(codec);
19502 alc662_auto_init_hp_out(codec);
19503 alc662_auto_init_analog_input(codec);
19504 alc662_auto_init_input_src(codec);
19505 alc_auto_init_digital(codec);
19506 if (spec->unsol_event)
19507 alc_inithook(codec);
19510 static void alc272_fixup_mario(struct hda_codec *codec,
19511 const struct alc_fixup *fix, int action)
19513 if (action != ALC_FIXUP_ACT_PROBE)
19515 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
19516 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
19517 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
19518 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
19519 (0 << AC_AMPCAP_MUTE_SHIFT)))
19520 printk(KERN_WARNING
19521 "hda_codec: failed to override amp caps for NID 0x2\n");
19525 ALC662_FIXUP_ASPIRE,
19526 ALC662_FIXUP_IDEAPAD,
19527 ALC272_FIXUP_MARIO,
19528 ALC662_FIXUP_CZC_P10T,
19531 static const struct alc_fixup alc662_fixups[] = {
19532 [ALC662_FIXUP_ASPIRE] = {
19533 .type = ALC_FIXUP_PINS,
19534 .v.pins = (const struct alc_pincfg[]) {
19535 { 0x15, 0x99130112 }, /* subwoofer */
19539 [ALC662_FIXUP_IDEAPAD] = {
19540 .type = ALC_FIXUP_PINS,
19541 .v.pins = (const struct alc_pincfg[]) {
19542 { 0x17, 0x99130112 }, /* subwoofer */
19546 [ALC272_FIXUP_MARIO] = {
19547 .type = ALC_FIXUP_FUNC,
19548 .v.func = alc272_fixup_mario,
19550 [ALC662_FIXUP_CZC_P10T] = {
19551 .type = ALC_FIXUP_VERBS,
19552 .v.verbs = (const struct hda_verb[]) {
19553 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
19559 static struct snd_pci_quirk alc662_fixup_tbl[] = {
19560 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
19561 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
19562 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
19563 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
19564 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
19565 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
19569 static const struct alc_model_fixup alc662_fixup_models[] = {
19570 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
19575 static int patch_alc662(struct hda_codec *codec)
19577 struct alc_spec *spec;
19578 int err, board_config;
19581 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
19585 codec->spec = spec;
19587 alc_auto_parse_customize_define(codec);
19589 alc_fix_pll_init(codec, 0x20, 0x04, 15);
19591 coef = alc_read_coef_idx(codec, 0);
19592 if (coef == 0x8020 || coef == 0x8011)
19593 alc_codec_rename(codec, "ALC661");
19594 else if (coef & (1 << 14) &&
19595 codec->bus->pci->subsystem_vendor == 0x1025 &&
19596 spec->cdefine.platform_type == 1)
19597 alc_codec_rename(codec, "ALC272X");
19598 else if (coef == 0x4011)
19599 alc_codec_rename(codec, "ALC656");
19601 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
19604 if (board_config < 0) {
19605 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
19607 board_config = ALC662_AUTO;
19610 if (board_config == ALC662_AUTO) {
19611 alc_pick_fixup(codec, alc662_fixup_models,
19612 alc662_fixup_tbl, alc662_fixups);
19613 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
19614 /* automatic parse from the BIOS config */
19615 err = alc662_parse_auto_config(codec);
19621 "hda_codec: Cannot set up configuration "
19622 "from BIOS. Using base mode...\n");
19623 board_config = ALC662_3ST_2ch_DIG;
19627 if (has_cdefine_beep(codec)) {
19628 err = snd_hda_attach_beep_device(codec, 0x1);
19635 if (board_config != ALC662_AUTO)
19636 setup_preset(codec, &alc662_presets[board_config]);
19638 spec->stream_analog_playback = &alc662_pcm_analog_playback;
19639 spec->stream_analog_capture = &alc662_pcm_analog_capture;
19641 spec->stream_digital_playback = &alc662_pcm_digital_playback;
19642 spec->stream_digital_capture = &alc662_pcm_digital_capture;
19644 if (!spec->adc_nids) {
19645 spec->adc_nids = alc662_adc_nids;
19646 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
19648 if (!spec->capsrc_nids)
19649 spec->capsrc_nids = alc662_capsrc_nids;
19651 if (!spec->cap_mixer)
19652 set_capture_mixer(codec);
19654 if (has_cdefine_beep(codec)) {
19655 switch (codec->vendor_id) {
19657 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
19662 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
19665 set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
19669 spec->vmaster_nid = 0x02;
19671 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
19673 codec->patch_ops = alc_patch_ops;
19674 if (board_config == ALC662_AUTO)
19675 spec->init_hook = alc662_auto_init;
19677 alc_init_jacks(codec);
19679 #ifdef CONFIG_SND_HDA_POWER_SAVE
19680 if (!spec->loopback.amplist)
19681 spec->loopback.amplist = alc662_loopbacks;
19687 static int patch_alc888(struct hda_codec *codec)
19689 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
19690 kfree(codec->chip_name);
19691 if (codec->vendor_id == 0x10ec0887)
19692 codec->chip_name = kstrdup("ALC887-VD", GFP_KERNEL);
19694 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
19695 if (!codec->chip_name) {
19699 return patch_alc662(codec);
19701 return patch_alc882(codec);
19707 #define ALC680_DIGIN_NID ALC880_DIGIN_NID
19708 #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID
19709 #define alc680_modes alc260_modes
19711 static hda_nid_t alc680_dac_nids[3] = {
19712 /* Lout1, Lout2, hp */
19716 static hda_nid_t alc680_adc_nids[3] = {
19718 /* DMIC, MIC, Line-in*/
19723 * Analog capture ADC cgange
19725 static void alc680_rec_autoswitch(struct hda_codec *codec)
19727 struct alc_spec *spec = codec->spec;
19728 struct auto_pin_cfg *cfg = &spec->autocfg;
19730 int type_found = AUTO_PIN_LAST;
19734 for (i = 0; i < cfg->num_inputs; i++) {
19735 nid = cfg->inputs[i].pin;
19736 if (!(snd_hda_query_pin_caps(codec, nid) &
19737 AC_PINCAP_PRES_DETECT))
19739 if (snd_hda_jack_detect(codec, nid)) {
19740 if (cfg->inputs[i].type < type_found) {
19741 type_found = cfg->inputs[i].type;
19749 snd_hda_get_connections(codec, pin_found, &nid, 1);
19751 if (nid != spec->cur_adc)
19752 __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1);
19753 spec->cur_adc = nid;
19754 snd_hda_codec_setup_stream(codec, nid, spec->cur_adc_stream_tag, 0,
19755 spec->cur_adc_format);
19758 static int alc680_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
19759 struct hda_codec *codec,
19760 unsigned int stream_tag,
19761 unsigned int format,
19762 struct snd_pcm_substream *substream)
19764 struct alc_spec *spec = codec->spec;
19766 spec->cur_adc = 0x07;
19767 spec->cur_adc_stream_tag = stream_tag;
19768 spec->cur_adc_format = format;
19770 alc680_rec_autoswitch(codec);
19774 static int alc680_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
19775 struct hda_codec *codec,
19776 struct snd_pcm_substream *substream)
19778 snd_hda_codec_cleanup_stream(codec, 0x07);
19779 snd_hda_codec_cleanup_stream(codec, 0x08);
19780 snd_hda_codec_cleanup_stream(codec, 0x09);
19784 static struct hda_pcm_stream alc680_pcm_analog_auto_capture = {
19785 .substreams = 1, /* can be overridden */
19788 /* NID is set in alc_build_pcms */
19790 .prepare = alc680_capture_pcm_prepare,
19791 .cleanup = alc680_capture_pcm_cleanup
19795 static struct snd_kcontrol_new alc680_base_mixer[] = {
19796 /* output mixer control */
19797 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
19798 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
19799 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT),
19800 HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT),
19801 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x12, 0, HDA_INPUT),
19802 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
19803 HDA_CODEC_VOLUME("Line In Boost Volume", 0x19, 0, HDA_INPUT),
19807 static struct hda_bind_ctls alc680_bind_cap_vol = {
19808 .ops = &snd_hda_bind_vol,
19810 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT),
19811 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
19812 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
19817 static struct hda_bind_ctls alc680_bind_cap_switch = {
19818 .ops = &snd_hda_bind_sw,
19820 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT),
19821 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
19822 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
19827 static struct snd_kcontrol_new alc680_master_capture_mixer[] = {
19828 HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol),
19829 HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch),
19834 * generic initialization of ADC, input mixers and output mixers
19836 static struct hda_verb alc680_init_verbs[] = {
19837 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19838 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19839 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19841 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
19842 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
19843 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
19844 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
19845 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
19846 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
19848 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19849 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19850 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19851 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19852 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19854 {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
19855 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
19856 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
19861 /* toggle speaker-output according to the hp-jack state */
19862 static void alc680_base_setup(struct hda_codec *codec)
19864 struct alc_spec *spec = codec->spec;
19866 spec->autocfg.hp_pins[0] = 0x16;
19867 spec->autocfg.speaker_pins[0] = 0x14;
19868 spec->autocfg.speaker_pins[1] = 0x15;
19869 spec->autocfg.num_inputs = 2;
19870 spec->autocfg.inputs[0].pin = 0x18;
19871 spec->autocfg.inputs[0].type = AUTO_PIN_MIC;
19872 spec->autocfg.inputs[1].pin = 0x19;
19873 spec->autocfg.inputs[1].type = AUTO_PIN_LINE_IN;
19876 static void alc680_unsol_event(struct hda_codec *codec,
19879 if ((res >> 26) == ALC880_HP_EVENT)
19880 alc_automute_amp(codec);
19881 if ((res >> 26) == ALC880_MIC_EVENT)
19882 alc680_rec_autoswitch(codec);
19885 static void alc680_inithook(struct hda_codec *codec)
19887 alc_automute_amp(codec);
19888 alc680_rec_autoswitch(codec);
19891 /* create input playback/capture controls for the given pin */
19892 static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
19893 const char *ctlname, int idx)
19911 if (spec->multiout.dac_nids[0] != dac &&
19912 spec->multiout.dac_nids[1] != dac) {
19913 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
19914 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
19919 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
19920 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
19924 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
19930 /* add playback controls from the parsed DAC table */
19931 static int alc680_auto_create_multi_out_ctls(struct alc_spec *spec,
19932 const struct auto_pin_cfg *cfg)
19937 spec->multiout.dac_nids = spec->private_dac_nids;
19939 nid = cfg->line_out_pins[0];
19942 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
19946 err = alc680_new_analog_output(spec, nid, name, 0);
19951 nid = cfg->speaker_pins[0];
19953 err = alc680_new_analog_output(spec, nid, "Speaker", 0);
19957 nid = cfg->hp_pins[0];
19959 err = alc680_new_analog_output(spec, nid, "Headphone", 0);
19967 static void alc680_auto_set_output_and_unmute(struct hda_codec *codec,
19968 hda_nid_t nid, int pin_type)
19970 alc_set_pin_output(codec, nid, pin_type);
19973 static void alc680_auto_init_multi_out(struct hda_codec *codec)
19975 struct alc_spec *spec = codec->spec;
19976 hda_nid_t nid = spec->autocfg.line_out_pins[0];
19978 int pin_type = get_pin_type(spec->autocfg.line_out_type);
19979 alc680_auto_set_output_and_unmute(codec, nid, pin_type);
19983 static void alc680_auto_init_hp_out(struct hda_codec *codec)
19985 struct alc_spec *spec = codec->spec;
19988 pin = spec->autocfg.hp_pins[0];
19990 alc680_auto_set_output_and_unmute(codec, pin, PIN_HP);
19991 pin = spec->autocfg.speaker_pins[0];
19993 alc680_auto_set_output_and_unmute(codec, pin, PIN_OUT);
19996 /* pcm configuration: identical with ALC880 */
19997 #define alc680_pcm_analog_playback alc880_pcm_analog_playback
19998 #define alc680_pcm_analog_capture alc880_pcm_analog_capture
19999 #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
20000 #define alc680_pcm_digital_playback alc880_pcm_digital_playback
20001 #define alc680_pcm_digital_capture alc880_pcm_digital_capture
20004 * BIOS auto configuration
20006 static int alc680_parse_auto_config(struct hda_codec *codec)
20008 struct alc_spec *spec = codec->spec;
20010 static hda_nid_t alc680_ignore[] = { 0 };
20012 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
20017 if (!spec->autocfg.line_outs) {
20018 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
20019 spec->multiout.max_channels = 2;
20020 spec->no_analog = 1;
20023 return 0; /* can't find valid BIOS pin config */
20025 err = alc680_auto_create_multi_out_ctls(spec, &spec->autocfg);
20029 spec->multiout.max_channels = 2;
20032 /* digital only support output */
20033 alc_auto_parse_digital(codec);
20034 if (spec->kctls.list)
20035 add_mixer(spec, spec->kctls.list);
20037 add_verb(spec, alc680_init_verbs);
20039 err = alc_auto_add_mic_boost(codec);
20046 #define alc680_auto_init_analog_input alc882_auto_init_analog_input
20048 /* init callback for auto-configuration model -- overriding the default init */
20049 static void alc680_auto_init(struct hda_codec *codec)
20051 struct alc_spec *spec = codec->spec;
20052 alc680_auto_init_multi_out(codec);
20053 alc680_auto_init_hp_out(codec);
20054 alc680_auto_init_analog_input(codec);
20055 alc_auto_init_digital(codec);
20056 if (spec->unsol_event)
20057 alc_inithook(codec);
20061 * configuration and preset
20063 static const char * const alc680_models[ALC680_MODEL_LAST] = {
20064 [ALC680_BASE] = "base",
20065 [ALC680_AUTO] = "auto",
20068 static struct snd_pci_quirk alc680_cfg_tbl[] = {
20069 SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE),
20073 static struct alc_config_preset alc680_presets[] = {
20075 .mixers = { alc680_base_mixer },
20076 .cap_mixer = alc680_master_capture_mixer,
20077 .init_verbs = { alc680_init_verbs },
20078 .num_dacs = ARRAY_SIZE(alc680_dac_nids),
20079 .dac_nids = alc680_dac_nids,
20080 .dig_out_nid = ALC680_DIGOUT_NID,
20081 .num_channel_mode = ARRAY_SIZE(alc680_modes),
20082 .channel_mode = alc680_modes,
20083 .unsol_event = alc680_unsol_event,
20084 .setup = alc680_base_setup,
20085 .init_hook = alc680_inithook,
20090 static int patch_alc680(struct hda_codec *codec)
20092 struct alc_spec *spec;
20096 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
20100 codec->spec = spec;
20102 board_config = snd_hda_check_board_config(codec, ALC680_MODEL_LAST,
20106 if (board_config < 0 || board_config >= ALC680_MODEL_LAST) {
20107 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
20109 board_config = ALC680_AUTO;
20112 if (board_config == ALC680_AUTO) {
20113 /* automatic parse from the BIOS config */
20114 err = alc680_parse_auto_config(codec);
20120 "hda_codec: Cannot set up configuration "
20121 "from BIOS. Using base mode...\n");
20122 board_config = ALC680_BASE;
20126 if (board_config != ALC680_AUTO)
20127 setup_preset(codec, &alc680_presets[board_config]);
20129 spec->stream_analog_playback = &alc680_pcm_analog_playback;
20130 spec->stream_analog_capture = &alc680_pcm_analog_auto_capture;
20131 spec->stream_digital_playback = &alc680_pcm_digital_playback;
20132 spec->stream_digital_capture = &alc680_pcm_digital_capture;
20134 if (!spec->adc_nids) {
20135 spec->adc_nids = alc680_adc_nids;
20136 spec->num_adc_nids = ARRAY_SIZE(alc680_adc_nids);
20139 if (!spec->cap_mixer)
20140 set_capture_mixer(codec);
20142 spec->vmaster_nid = 0x02;
20144 codec->patch_ops = alc_patch_ops;
20145 if (board_config == ALC680_AUTO)
20146 spec->init_hook = alc680_auto_init;
20154 static struct hda_codec_preset snd_hda_preset_realtek[] = {
20155 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
20156 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
20157 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
20158 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
20159 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
20160 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
20161 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
20162 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
20163 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
20164 .patch = patch_alc861 },
20165 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
20166 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
20167 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
20168 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
20169 .patch = patch_alc882 },
20170 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
20171 .patch = patch_alc662 },
20172 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
20173 { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
20174 { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
20175 { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 },
20176 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
20177 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
20178 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
20179 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
20180 .patch = patch_alc882 },
20181 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
20182 .patch = patch_alc882 },
20183 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
20184 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc888 },
20185 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
20186 .patch = patch_alc882 },
20187 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
20188 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
20189 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
20190 {} /* terminator */
20193 MODULE_ALIAS("snd-hda-codec-id:10ec*");
20195 MODULE_LICENSE("GPL");
20196 MODULE_DESCRIPTION("Realtek HD-audio codec");
20198 static struct hda_codec_preset_list realtek_list = {
20199 .preset = snd_hda_preset_realtek,
20200 .owner = THIS_MODULE,
20203 static int __init patch_realtek_init(void)
20205 return snd_hda_add_codec_preset(&realtek_list);
20208 static void __exit patch_realtek_exit(void)
20210 snd_hda_delete_codec_preset(&realtek_list);
20213 module_init(patch_realtek_init)
20214 module_exit(patch_realtek_exit)