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),
9936 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
9937 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
9938 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
9939 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
9940 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
9941 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
9942 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
9943 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
9944 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
9945 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
9946 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
9947 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
9948 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
9949 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
9950 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
9951 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
9952 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
9953 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
9954 SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG),
9955 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
9956 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
9957 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
9958 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
9959 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
9960 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
9961 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
9962 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
9963 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
9964 SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG),
9965 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
9966 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
9968 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
9969 SND_PCI_QUIRK(0x1558, 0x0571, "Clevo laptop M570U", ALC883_3ST_6ch_DIG),
9970 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
9971 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
9972 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
9973 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
9974 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
9975 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
9976 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
9977 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9978 ALC883_FUJITSU_PI2515),
9979 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9980 ALC888_FUJITSU_XA3530),
9981 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
9982 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9983 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9984 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9985 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
9986 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
9987 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
9988 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
9990 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
9991 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
9992 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
9993 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
9994 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
9995 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
9996 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG),
10001 /* codec SSID table for Intel Mac */
10002 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
10003 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
10004 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
10005 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
10006 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
10007 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
10008 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
10009 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
10010 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31),
10011 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_ASUS_A7M),
10012 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3),
10013 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21),
10014 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
10015 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
10016 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
10017 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
10018 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
10019 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5),
10020 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
10021 * so apparently no perfect solution yet
10023 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
10024 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
10025 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3),
10026 {} /* terminator */
10029 static struct alc_config_preset alc882_presets[] = {
10030 [ALC882_3ST_DIG] = {
10031 .mixers = { alc882_base_mixer },
10032 .init_verbs = { alc882_base_init_verbs,
10033 alc882_adc1_init_verbs },
10034 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10035 .dac_nids = alc882_dac_nids,
10036 .dig_out_nid = ALC882_DIGOUT_NID,
10037 .dig_in_nid = ALC882_DIGIN_NID,
10038 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
10039 .channel_mode = alc882_ch_modes,
10041 .input_mux = &alc882_capture_source,
10043 [ALC882_6ST_DIG] = {
10044 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
10045 .init_verbs = { alc882_base_init_verbs,
10046 alc882_adc1_init_verbs },
10047 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10048 .dac_nids = alc882_dac_nids,
10049 .dig_out_nid = ALC882_DIGOUT_NID,
10050 .dig_in_nid = ALC882_DIGIN_NID,
10051 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
10052 .channel_mode = alc882_sixstack_modes,
10053 .input_mux = &alc882_capture_source,
10056 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
10057 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10058 alc882_eapd_verbs },
10059 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10060 .dac_nids = alc882_dac_nids,
10061 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
10062 .channel_mode = alc882_sixstack_modes,
10063 .input_mux = &alc882_capture_source,
10066 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
10067 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10068 alc882_eapd_verbs, alc880_gpio1_init_verbs },
10069 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10070 .dac_nids = alc882_dac_nids,
10071 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
10072 .channel_mode = alc880_threestack_modes,
10074 .input_mux = &alc882_capture_source,
10075 .dig_out_nid = ALC882_DIGOUT_NID,
10078 .mixers = { alc885_mba21_mixer },
10079 .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs },
10081 .dac_nids = alc882_dac_nids,
10082 .channel_mode = alc885_mba21_ch_modes,
10083 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
10084 .input_mux = &alc882_capture_source,
10085 .unsol_event = alc_automute_amp_unsol_event,
10086 .setup = alc885_mba21_setup,
10087 .init_hook = alc_automute_amp,
10090 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
10091 .init_verbs = { alc885_mbp3_init_verbs,
10092 alc880_gpio1_init_verbs },
10094 .dac_nids = alc882_dac_nids,
10096 .channel_mode = alc885_mbp_4ch_modes,
10097 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
10098 .input_mux = &alc882_capture_source,
10099 .dig_out_nid = ALC882_DIGOUT_NID,
10100 .dig_in_nid = ALC882_DIGIN_NID,
10101 .unsol_event = alc_automute_amp_unsol_event,
10102 .setup = alc885_mbp3_setup,
10103 .init_hook = alc_automute_amp,
10106 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
10107 .init_verbs = { alc885_mb5_init_verbs,
10108 alc880_gpio1_init_verbs },
10109 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10110 .dac_nids = alc882_dac_nids,
10111 .channel_mode = alc885_mb5_6ch_modes,
10112 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
10113 .input_mux = &mb5_capture_source,
10114 .dig_out_nid = ALC882_DIGOUT_NID,
10115 .dig_in_nid = ALC882_DIGIN_NID,
10116 .unsol_event = alc_automute_amp_unsol_event,
10117 .setup = alc885_mb5_setup,
10118 .init_hook = alc_automute_amp,
10120 [ALC885_MACMINI3] = {
10121 .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer },
10122 .init_verbs = { alc885_macmini3_init_verbs,
10123 alc880_gpio1_init_verbs },
10124 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10125 .dac_nids = alc882_dac_nids,
10126 .channel_mode = alc885_macmini3_6ch_modes,
10127 .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes),
10128 .input_mux = &macmini3_capture_source,
10129 .dig_out_nid = ALC882_DIGOUT_NID,
10130 .dig_in_nid = ALC882_DIGIN_NID,
10131 .unsol_event = alc_automute_amp_unsol_event,
10132 .setup = alc885_macmini3_setup,
10133 .init_hook = alc_automute_amp,
10135 [ALC885_MACPRO] = {
10136 .mixers = { alc882_macpro_mixer },
10137 .init_verbs = { alc882_macpro_init_verbs },
10138 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10139 .dac_nids = alc882_dac_nids,
10140 .dig_out_nid = ALC882_DIGOUT_NID,
10141 .dig_in_nid = ALC882_DIGIN_NID,
10142 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
10143 .channel_mode = alc882_ch_modes,
10144 .input_mux = &alc882_capture_source,
10145 .init_hook = alc885_macpro_init_hook,
10147 [ALC885_IMAC24] = {
10148 .mixers = { alc885_imac24_mixer },
10149 .init_verbs = { alc885_imac24_init_verbs },
10150 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10151 .dac_nids = alc882_dac_nids,
10152 .dig_out_nid = ALC882_DIGOUT_NID,
10153 .dig_in_nid = ALC882_DIGIN_NID,
10154 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
10155 .channel_mode = alc882_ch_modes,
10156 .input_mux = &alc882_capture_source,
10157 .unsol_event = alc_automute_amp_unsol_event,
10158 .setup = alc885_imac24_setup,
10159 .init_hook = alc885_imac24_init_hook,
10161 [ALC885_IMAC91] = {
10162 .mixers = {alc885_imac91_mixer},
10163 .init_verbs = { alc885_imac91_init_verbs,
10164 alc880_gpio1_init_verbs },
10165 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10166 .dac_nids = alc882_dac_nids,
10167 .channel_mode = alc885_mba21_ch_modes,
10168 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
10169 .input_mux = &alc889A_imac91_capture_source,
10170 .dig_out_nid = ALC882_DIGOUT_NID,
10171 .dig_in_nid = ALC882_DIGIN_NID,
10172 .unsol_event = alc_automute_amp_unsol_event,
10173 .setup = alc885_imac91_setup,
10174 .init_hook = alc_automute_amp,
10177 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
10178 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10179 alc880_gpio3_init_verbs, alc882_targa_verbs},
10180 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10181 .dac_nids = alc882_dac_nids,
10182 .dig_out_nid = ALC882_DIGOUT_NID,
10183 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
10184 .adc_nids = alc882_adc_nids,
10185 .capsrc_nids = alc882_capsrc_nids,
10186 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
10187 .channel_mode = alc882_3ST_6ch_modes,
10189 .input_mux = &alc882_capture_source,
10190 .unsol_event = alc882_targa_unsol_event,
10191 .setup = alc882_targa_setup,
10192 .init_hook = alc882_targa_automute,
10194 [ALC882_ASUS_A7J] = {
10195 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
10196 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10197 alc882_asus_a7j_verbs},
10198 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10199 .dac_nids = alc882_dac_nids,
10200 .dig_out_nid = ALC882_DIGOUT_NID,
10201 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
10202 .adc_nids = alc882_adc_nids,
10203 .capsrc_nids = alc882_capsrc_nids,
10204 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
10205 .channel_mode = alc882_3ST_6ch_modes,
10207 .input_mux = &alc882_capture_source,
10209 [ALC882_ASUS_A7M] = {
10210 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
10211 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10212 alc882_eapd_verbs, alc880_gpio1_init_verbs,
10213 alc882_asus_a7m_verbs },
10214 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10215 .dac_nids = alc882_dac_nids,
10216 .dig_out_nid = ALC882_DIGOUT_NID,
10217 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
10218 .channel_mode = alc880_threestack_modes,
10220 .input_mux = &alc882_capture_source,
10222 [ALC883_3ST_2ch_DIG] = {
10223 .mixers = { alc883_3ST_2ch_mixer },
10224 .init_verbs = { alc883_init_verbs },
10225 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10226 .dac_nids = alc883_dac_nids,
10227 .dig_out_nid = ALC883_DIGOUT_NID,
10228 .dig_in_nid = ALC883_DIGIN_NID,
10229 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10230 .channel_mode = alc883_3ST_2ch_modes,
10231 .input_mux = &alc883_capture_source,
10233 [ALC883_3ST_6ch_DIG] = {
10234 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10235 .init_verbs = { alc883_init_verbs },
10236 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10237 .dac_nids = alc883_dac_nids,
10238 .dig_out_nid = ALC883_DIGOUT_NID,
10239 .dig_in_nid = ALC883_DIGIN_NID,
10240 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10241 .channel_mode = alc883_3ST_6ch_modes,
10243 .input_mux = &alc883_capture_source,
10245 [ALC883_3ST_6ch] = {
10246 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10247 .init_verbs = { alc883_init_verbs },
10248 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10249 .dac_nids = alc883_dac_nids,
10250 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10251 .channel_mode = alc883_3ST_6ch_modes,
10253 .input_mux = &alc883_capture_source,
10255 [ALC883_3ST_6ch_INTEL] = {
10256 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
10257 .init_verbs = { alc883_init_verbs },
10258 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10259 .dac_nids = alc883_dac_nids,
10260 .dig_out_nid = ALC883_DIGOUT_NID,
10261 .dig_in_nid = ALC883_DIGIN_NID,
10262 .slave_dig_outs = alc883_slave_dig_outs,
10263 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
10264 .channel_mode = alc883_3ST_6ch_intel_modes,
10266 .input_mux = &alc883_3stack_6ch_intel,
10268 [ALC889A_INTEL] = {
10269 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
10270 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
10271 alc_hp15_unsol_verbs },
10272 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10273 .dac_nids = alc883_dac_nids,
10274 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10275 .adc_nids = alc889_adc_nids,
10276 .dig_out_nid = ALC883_DIGOUT_NID,
10277 .dig_in_nid = ALC883_DIGIN_NID,
10278 .slave_dig_outs = alc883_slave_dig_outs,
10279 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
10280 .channel_mode = alc889_8ch_intel_modes,
10281 .capsrc_nids = alc889_capsrc_nids,
10282 .input_mux = &alc889_capture_source,
10283 .setup = alc889_automute_setup,
10284 .init_hook = alc_automute_amp,
10285 .unsol_event = alc_automute_amp_unsol_event,
10289 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
10290 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
10291 alc889_eapd_verbs, alc_hp15_unsol_verbs},
10292 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10293 .dac_nids = alc883_dac_nids,
10294 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10295 .adc_nids = alc889_adc_nids,
10296 .dig_out_nid = ALC883_DIGOUT_NID,
10297 .dig_in_nid = ALC883_DIGIN_NID,
10298 .slave_dig_outs = alc883_slave_dig_outs,
10299 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
10300 .channel_mode = alc889_8ch_intel_modes,
10301 .capsrc_nids = alc889_capsrc_nids,
10302 .input_mux = &alc889_capture_source,
10303 .setup = alc889_automute_setup,
10304 .init_hook = alc889_intel_init_hook,
10305 .unsol_event = alc_automute_amp_unsol_event,
10308 [ALC883_6ST_DIG] = {
10309 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10310 .init_verbs = { alc883_init_verbs },
10311 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10312 .dac_nids = alc883_dac_nids,
10313 .dig_out_nid = ALC883_DIGOUT_NID,
10314 .dig_in_nid = ALC883_DIGIN_NID,
10315 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10316 .channel_mode = alc883_sixstack_modes,
10317 .input_mux = &alc883_capture_source,
10319 [ALC883_TARGA_DIG] = {
10320 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
10321 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10322 alc883_targa_verbs},
10323 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10324 .dac_nids = alc883_dac_nids,
10325 .dig_out_nid = ALC883_DIGOUT_NID,
10326 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10327 .channel_mode = alc883_3ST_6ch_modes,
10329 .input_mux = &alc883_capture_source,
10330 .unsol_event = alc883_targa_unsol_event,
10331 .setup = alc882_targa_setup,
10332 .init_hook = alc882_targa_automute,
10334 [ALC883_TARGA_2ch_DIG] = {
10335 .mixers = { alc883_targa_2ch_mixer},
10336 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10337 alc883_targa_verbs},
10338 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10339 .dac_nids = alc883_dac_nids,
10340 .adc_nids = alc883_adc_nids_alt,
10341 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10342 .capsrc_nids = alc883_capsrc_nids,
10343 .dig_out_nid = ALC883_DIGOUT_NID,
10344 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10345 .channel_mode = alc883_3ST_2ch_modes,
10346 .input_mux = &alc883_capture_source,
10347 .unsol_event = alc883_targa_unsol_event,
10348 .setup = alc882_targa_setup,
10349 .init_hook = alc882_targa_automute,
10351 [ALC883_TARGA_8ch_DIG] = {
10352 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
10353 alc883_chmode_mixer },
10354 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10355 alc883_targa_verbs },
10356 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10357 .dac_nids = alc883_dac_nids,
10358 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10359 .adc_nids = alc883_adc_nids_rev,
10360 .capsrc_nids = alc883_capsrc_nids_rev,
10361 .dig_out_nid = ALC883_DIGOUT_NID,
10362 .dig_in_nid = ALC883_DIGIN_NID,
10363 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
10364 .channel_mode = alc883_4ST_8ch_modes,
10366 .input_mux = &alc883_capture_source,
10367 .unsol_event = alc883_targa_unsol_event,
10368 .setup = alc882_targa_setup,
10369 .init_hook = alc882_targa_automute,
10372 .mixers = { alc883_base_mixer },
10373 /* On TravelMate laptops, GPIO 0 enables the internal speaker
10374 * and the headphone jack. Turn this on and rely on the
10375 * standard mute methods whenever the user wants to turn
10376 * these outputs off.
10378 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
10379 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10380 .dac_nids = alc883_dac_nids,
10381 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10382 .channel_mode = alc883_3ST_2ch_modes,
10383 .input_mux = &alc883_capture_source,
10385 [ALC883_ACER_ASPIRE] = {
10386 .mixers = { alc883_acer_aspire_mixer },
10387 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
10388 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10389 .dac_nids = alc883_dac_nids,
10390 .dig_out_nid = ALC883_DIGOUT_NID,
10391 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10392 .channel_mode = alc883_3ST_2ch_modes,
10393 .input_mux = &alc883_capture_source,
10394 .unsol_event = alc_automute_amp_unsol_event,
10395 .setup = alc883_acer_aspire_setup,
10396 .init_hook = alc_automute_amp,
10398 [ALC888_ACER_ASPIRE_4930G] = {
10399 .mixers = { alc888_acer_aspire_4930g_mixer,
10400 alc883_chmode_mixer },
10401 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10402 alc888_acer_aspire_4930g_verbs },
10403 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10404 .dac_nids = alc883_dac_nids,
10405 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10406 .adc_nids = alc883_adc_nids_rev,
10407 .capsrc_nids = alc883_capsrc_nids_rev,
10408 .dig_out_nid = ALC883_DIGOUT_NID,
10409 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10410 .channel_mode = alc883_3ST_6ch_modes,
10412 .const_channel_count = 6,
10414 ARRAY_SIZE(alc888_2_capture_sources),
10415 .input_mux = alc888_2_capture_sources,
10416 .unsol_event = alc_automute_amp_unsol_event,
10417 .setup = alc888_acer_aspire_4930g_setup,
10418 .init_hook = alc_automute_amp,
10420 [ALC888_ACER_ASPIRE_6530G] = {
10421 .mixers = { alc888_acer_aspire_6530_mixer },
10422 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10423 alc888_acer_aspire_6530g_verbs },
10424 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10425 .dac_nids = alc883_dac_nids,
10426 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10427 .adc_nids = alc883_adc_nids_rev,
10428 .capsrc_nids = alc883_capsrc_nids_rev,
10429 .dig_out_nid = ALC883_DIGOUT_NID,
10430 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10431 .channel_mode = alc883_3ST_2ch_modes,
10433 ARRAY_SIZE(alc888_2_capture_sources),
10434 .input_mux = alc888_acer_aspire_6530_sources,
10435 .unsol_event = alc_automute_amp_unsol_event,
10436 .setup = alc888_acer_aspire_6530g_setup,
10437 .init_hook = alc_automute_amp,
10439 [ALC888_ACER_ASPIRE_8930G] = {
10440 .mixers = { alc889_acer_aspire_8930g_mixer,
10441 alc883_chmode_mixer },
10442 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10443 alc889_acer_aspire_8930g_verbs,
10444 alc889_eapd_verbs},
10445 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10446 .dac_nids = alc883_dac_nids,
10447 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10448 .adc_nids = alc889_adc_nids,
10449 .capsrc_nids = alc889_capsrc_nids,
10450 .dig_out_nid = ALC883_DIGOUT_NID,
10451 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10452 .channel_mode = alc883_3ST_6ch_modes,
10454 .const_channel_count = 6,
10456 ARRAY_SIZE(alc889_capture_sources),
10457 .input_mux = alc889_capture_sources,
10458 .unsol_event = alc_automute_amp_unsol_event,
10459 .setup = alc889_acer_aspire_8930g_setup,
10460 .init_hook = alc_automute_amp,
10461 #ifdef CONFIG_SND_HDA_POWER_SAVE
10462 .power_hook = alc_power_eapd,
10465 [ALC888_ACER_ASPIRE_7730G] = {
10466 .mixers = { alc883_3ST_6ch_mixer,
10467 alc883_chmode_mixer },
10468 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10469 alc888_acer_aspire_7730G_verbs },
10470 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10471 .dac_nids = alc883_dac_nids,
10472 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10473 .adc_nids = alc883_adc_nids_rev,
10474 .capsrc_nids = alc883_capsrc_nids_rev,
10475 .dig_out_nid = ALC883_DIGOUT_NID,
10476 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10477 .channel_mode = alc883_3ST_6ch_modes,
10479 .const_channel_count = 6,
10480 .input_mux = &alc883_capture_source,
10481 .unsol_event = alc_automute_amp_unsol_event,
10482 .setup = alc888_acer_aspire_7730g_setup,
10483 .init_hook = alc_automute_amp,
10485 [ALC883_MEDION] = {
10486 .mixers = { alc883_fivestack_mixer,
10487 alc883_chmode_mixer },
10488 .init_verbs = { alc883_init_verbs,
10489 alc883_medion_eapd_verbs },
10490 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10491 .dac_nids = alc883_dac_nids,
10492 .adc_nids = alc883_adc_nids_alt,
10493 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10494 .capsrc_nids = alc883_capsrc_nids,
10495 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10496 .channel_mode = alc883_sixstack_modes,
10497 .input_mux = &alc883_capture_source,
10499 [ALC883_MEDION_WIM2160] = {
10500 .mixers = { alc883_medion_wim2160_mixer },
10501 .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs },
10502 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10503 .dac_nids = alc883_dac_nids,
10504 .dig_out_nid = ALC883_DIGOUT_NID,
10505 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10506 .adc_nids = alc883_adc_nids,
10507 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10508 .channel_mode = alc883_3ST_2ch_modes,
10509 .input_mux = &alc883_capture_source,
10510 .unsol_event = alc_automute_amp_unsol_event,
10511 .setup = alc883_medion_wim2160_setup,
10512 .init_hook = alc_automute_amp,
10514 [ALC883_LAPTOP_EAPD] = {
10515 .mixers = { alc883_base_mixer },
10516 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
10517 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10518 .dac_nids = alc883_dac_nids,
10519 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10520 .channel_mode = alc883_3ST_2ch_modes,
10521 .input_mux = &alc883_capture_source,
10523 [ALC883_CLEVO_M540R] = {
10524 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10525 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
10526 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10527 .dac_nids = alc883_dac_nids,
10528 .dig_out_nid = ALC883_DIGOUT_NID,
10529 .dig_in_nid = ALC883_DIGIN_NID,
10530 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
10531 .channel_mode = alc883_3ST_6ch_clevo_modes,
10533 .input_mux = &alc883_capture_source,
10534 /* This machine has the hardware HP auto-muting, thus
10535 * we need no software mute via unsol event
10538 [ALC883_CLEVO_M720] = {
10539 .mixers = { alc883_clevo_m720_mixer },
10540 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
10541 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10542 .dac_nids = alc883_dac_nids,
10543 .dig_out_nid = ALC883_DIGOUT_NID,
10544 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10545 .channel_mode = alc883_3ST_2ch_modes,
10546 .input_mux = &alc883_capture_source,
10547 .unsol_event = alc883_clevo_m720_unsol_event,
10548 .setup = alc883_clevo_m720_setup,
10549 .init_hook = alc883_clevo_m720_init_hook,
10551 [ALC883_LENOVO_101E_2ch] = {
10552 .mixers = { alc883_lenovo_101e_2ch_mixer},
10553 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
10554 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10555 .dac_nids = alc883_dac_nids,
10556 .adc_nids = alc883_adc_nids_alt,
10557 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10558 .capsrc_nids = alc883_capsrc_nids,
10559 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10560 .channel_mode = alc883_3ST_2ch_modes,
10561 .input_mux = &alc883_lenovo_101e_capture_source,
10562 .unsol_event = alc883_lenovo_101e_unsol_event,
10563 .init_hook = alc883_lenovo_101e_all_automute,
10565 [ALC883_LENOVO_NB0763] = {
10566 .mixers = { alc883_lenovo_nb0763_mixer },
10567 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
10568 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10569 .dac_nids = alc883_dac_nids,
10570 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10571 .channel_mode = alc883_3ST_2ch_modes,
10573 .input_mux = &alc883_lenovo_nb0763_capture_source,
10574 .unsol_event = alc_automute_amp_unsol_event,
10575 .setup = alc883_lenovo_nb0763_setup,
10576 .init_hook = alc_automute_amp,
10578 [ALC888_LENOVO_MS7195_DIG] = {
10579 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10580 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
10581 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10582 .dac_nids = alc883_dac_nids,
10583 .dig_out_nid = ALC883_DIGOUT_NID,
10584 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10585 .channel_mode = alc883_3ST_6ch_modes,
10587 .input_mux = &alc883_capture_source,
10588 .unsol_event = alc883_lenovo_ms7195_unsol_event,
10589 .init_hook = alc888_lenovo_ms7195_front_automute,
10591 [ALC883_HAIER_W66] = {
10592 .mixers = { alc883_targa_2ch_mixer},
10593 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
10594 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10595 .dac_nids = alc883_dac_nids,
10596 .dig_out_nid = ALC883_DIGOUT_NID,
10597 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10598 .channel_mode = alc883_3ST_2ch_modes,
10599 .input_mux = &alc883_capture_source,
10600 .unsol_event = alc_automute_amp_unsol_event,
10601 .setup = alc883_haier_w66_setup,
10602 .init_hook = alc_automute_amp,
10604 [ALC888_3ST_HP] = {
10605 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10606 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
10607 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10608 .dac_nids = alc883_dac_nids,
10609 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
10610 .channel_mode = alc888_3st_hp_modes,
10612 .input_mux = &alc883_capture_source,
10613 .unsol_event = alc_automute_amp_unsol_event,
10614 .setup = alc888_3st_hp_setup,
10615 .init_hook = alc_automute_amp,
10617 [ALC888_6ST_DELL] = {
10618 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10619 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
10620 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10621 .dac_nids = alc883_dac_nids,
10622 .dig_out_nid = ALC883_DIGOUT_NID,
10623 .dig_in_nid = ALC883_DIGIN_NID,
10624 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10625 .channel_mode = alc883_sixstack_modes,
10626 .input_mux = &alc883_capture_source,
10627 .unsol_event = alc_automute_amp_unsol_event,
10628 .setup = alc888_6st_dell_setup,
10629 .init_hook = alc_automute_amp,
10632 .mixers = { alc883_mitac_mixer },
10633 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
10634 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10635 .dac_nids = alc883_dac_nids,
10636 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10637 .channel_mode = alc883_3ST_2ch_modes,
10638 .input_mux = &alc883_capture_source,
10639 .unsol_event = alc_automute_amp_unsol_event,
10640 .setup = alc883_mitac_setup,
10641 .init_hook = alc_automute_amp,
10643 [ALC883_FUJITSU_PI2515] = {
10644 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
10645 .init_verbs = { alc883_init_verbs,
10646 alc883_2ch_fujitsu_pi2515_verbs},
10647 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10648 .dac_nids = alc883_dac_nids,
10649 .dig_out_nid = ALC883_DIGOUT_NID,
10650 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10651 .channel_mode = alc883_3ST_2ch_modes,
10652 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10653 .unsol_event = alc_automute_amp_unsol_event,
10654 .setup = alc883_2ch_fujitsu_pi2515_setup,
10655 .init_hook = alc_automute_amp,
10657 [ALC888_FUJITSU_XA3530] = {
10658 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
10659 .init_verbs = { alc883_init_verbs,
10660 alc888_fujitsu_xa3530_verbs },
10661 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10662 .dac_nids = alc883_dac_nids,
10663 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10664 .adc_nids = alc883_adc_nids_rev,
10665 .capsrc_nids = alc883_capsrc_nids_rev,
10666 .dig_out_nid = ALC883_DIGOUT_NID,
10667 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
10668 .channel_mode = alc888_4ST_8ch_intel_modes,
10670 ARRAY_SIZE(alc888_2_capture_sources),
10671 .input_mux = alc888_2_capture_sources,
10672 .unsol_event = alc_automute_amp_unsol_event,
10673 .setup = alc888_fujitsu_xa3530_setup,
10674 .init_hook = alc_automute_amp,
10676 [ALC888_LENOVO_SKY] = {
10677 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
10678 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
10679 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10680 .dac_nids = alc883_dac_nids,
10681 .dig_out_nid = ALC883_DIGOUT_NID,
10682 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10683 .channel_mode = alc883_sixstack_modes,
10685 .input_mux = &alc883_lenovo_sky_capture_source,
10686 .unsol_event = alc_automute_amp_unsol_event,
10687 .setup = alc888_lenovo_sky_setup,
10688 .init_hook = alc_automute_amp,
10690 [ALC888_ASUS_M90V] = {
10691 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10692 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
10693 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10694 .dac_nids = alc883_dac_nids,
10695 .dig_out_nid = ALC883_DIGOUT_NID,
10696 .dig_in_nid = ALC883_DIGIN_NID,
10697 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10698 .channel_mode = alc883_3ST_6ch_modes,
10700 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10701 .unsol_event = alc_sku_unsol_event,
10702 .setup = alc883_mode2_setup,
10703 .init_hook = alc_inithook,
10705 [ALC888_ASUS_EEE1601] = {
10706 .mixers = { alc883_asus_eee1601_mixer },
10707 .cap_mixer = alc883_asus_eee1601_cap_mixer,
10708 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
10709 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10710 .dac_nids = alc883_dac_nids,
10711 .dig_out_nid = ALC883_DIGOUT_NID,
10712 .dig_in_nid = ALC883_DIGIN_NID,
10713 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10714 .channel_mode = alc883_3ST_2ch_modes,
10716 .input_mux = &alc883_asus_eee1601_capture_source,
10717 .unsol_event = alc_sku_unsol_event,
10718 .init_hook = alc883_eee1601_inithook,
10720 [ALC1200_ASUS_P5Q] = {
10721 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10722 .init_verbs = { alc883_init_verbs },
10723 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10724 .dac_nids = alc883_dac_nids,
10725 .dig_out_nid = ALC1200_DIGOUT_NID,
10726 .dig_in_nid = ALC883_DIGIN_NID,
10727 .slave_dig_outs = alc1200_slave_dig_outs,
10728 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10729 .channel_mode = alc883_sixstack_modes,
10730 .input_mux = &alc883_capture_source,
10733 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
10734 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
10735 alc880_gpio1_init_verbs },
10736 .adc_nids = alc883_adc_nids,
10737 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10738 .capsrc_nids = alc883_capsrc_nids,
10739 .dac_nids = alc883_dac_nids,
10740 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10741 .channel_mode = alc889A_mb31_6ch_modes,
10742 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
10743 .input_mux = &alc889A_mb31_capture_source,
10744 .dig_out_nid = ALC883_DIGOUT_NID,
10745 .unsol_event = alc889A_mb31_unsol_event,
10746 .init_hook = alc889A_mb31_automute,
10748 [ALC883_SONY_VAIO_TT] = {
10749 .mixers = { alc883_vaiott_mixer },
10750 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
10751 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10752 .dac_nids = alc883_dac_nids,
10753 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10754 .channel_mode = alc883_3ST_2ch_modes,
10755 .input_mux = &alc883_capture_source,
10756 .unsol_event = alc_automute_amp_unsol_event,
10757 .setup = alc883_vaiott_setup,
10758 .init_hook = alc_automute_amp,
10767 PINFIX_ABIT_AW9D_MAX,
10768 PINFIX_LENOVO_Y530,
10770 PINFIX_ACER_ASPIRE_7736,
10771 PINFIX_GIGABYTE_880GM,
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,
10803 [PINFIX_GIGABYTE_880GM] = {
10804 .type = ALC_FIXUP_PINS,
10805 .v.pins = (const struct alc_pincfg[]) {
10806 { 0x14, 0x1114410 }, /* set as speaker */
10812 static struct snd_pci_quirk alc882_fixup_tbl[] = {
10813 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210),
10814 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", PINFIX_LENOVO_Y530),
10815 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
10816 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", PINFIX_ACER_ASPIRE_7736),
10817 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte", PINFIX_GIGABYTE_880GM),
10822 * BIOS auto configuration
10824 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
10825 const struct auto_pin_cfg *cfg)
10827 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
10830 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
10831 hda_nid_t nid, int pin_type,
10836 /* set as output */
10837 alc_set_pin_output(codec, nid, pin_type);
10841 else if (dac >= 0x02 && dac <= 0x05)
10845 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
10848 static void alc882_auto_init_multi_out(struct hda_codec *codec)
10850 struct alc_spec *spec = codec->spec;
10853 for (i = 0; i <= HDA_SIDE; i++) {
10854 hda_nid_t nid = spec->autocfg.line_out_pins[i];
10855 int pin_type = get_pin_type(spec->autocfg.line_out_type);
10857 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
10858 spec->multiout.dac_nids[i]);
10862 static void alc882_auto_init_hp_out(struct hda_codec *codec)
10864 struct alc_spec *spec = codec->spec;
10865 hda_nid_t pin, dac;
10868 if (spec->autocfg.line_out_type != AUTO_PIN_HP_OUT) {
10869 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
10870 pin = spec->autocfg.hp_pins[i];
10873 dac = spec->multiout.hp_nid;
10875 dac = spec->multiout.dac_nids[0]; /* to front */
10876 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac);
10880 if (spec->autocfg.line_out_type != AUTO_PIN_SPEAKER_OUT) {
10881 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
10882 pin = spec->autocfg.speaker_pins[i];
10885 dac = spec->multiout.extra_out_nid[0];
10887 dac = spec->multiout.dac_nids[0]; /* to front */
10888 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac);
10893 static void alc882_auto_init_analog_input(struct hda_codec *codec)
10895 struct alc_spec *spec = codec->spec;
10896 struct auto_pin_cfg *cfg = &spec->autocfg;
10899 for (i = 0; i < cfg->num_inputs; i++) {
10900 hda_nid_t nid = cfg->inputs[i].pin;
10901 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
10902 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
10903 snd_hda_codec_write(codec, nid, 0,
10904 AC_VERB_SET_AMP_GAIN_MUTE,
10909 static void alc882_auto_init_input_src(struct hda_codec *codec)
10911 struct alc_spec *spec = codec->spec;
10914 for (c = 0; c < spec->num_adc_nids; c++) {
10915 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
10916 hda_nid_t nid = spec->capsrc_nids[c];
10917 unsigned int mux_idx;
10918 const struct hda_input_mux *imux;
10919 int conns, mute, idx, item;
10921 conns = snd_hda_get_connections(codec, nid, conn_list,
10922 ARRAY_SIZE(conn_list));
10925 mux_idx = c >= spec->num_mux_defs ? 0 : c;
10926 imux = &spec->input_mux[mux_idx];
10927 if (!imux->num_items && mux_idx > 0)
10928 imux = &spec->input_mux[0];
10929 for (idx = 0; idx < conns; idx++) {
10930 /* if the current connection is the selected one,
10931 * unmute it as default - otherwise mute it
10933 mute = AMP_IN_MUTE(idx);
10934 for (item = 0; item < imux->num_items; item++) {
10935 if (imux->items[item].index == idx) {
10936 if (spec->cur_mux[c] == item)
10937 mute = AMP_IN_UNMUTE(idx);
10941 /* check if we have a selector or mixer
10942 * we could check for the widget type instead, but
10943 * just check for Amp-In presence (in case of mixer
10944 * without amp-in there is something wrong, this
10945 * function shouldn't be used or capsrc nid is wrong)
10947 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
10948 snd_hda_codec_write(codec, nid, 0,
10949 AC_VERB_SET_AMP_GAIN_MUTE,
10951 else if (mute != AMP_IN_MUTE(idx))
10952 snd_hda_codec_write(codec, nid, 0,
10953 AC_VERB_SET_CONNECT_SEL,
10959 /* add mic boosts if needed */
10960 static int alc_auto_add_mic_boost(struct hda_codec *codec)
10962 struct alc_spec *spec = codec->spec;
10963 struct auto_pin_cfg *cfg = &spec->autocfg;
10967 const char *prev_label = NULL;
10969 for (i = 0; i < cfg->num_inputs; i++) {
10970 if (cfg->inputs[i].type > AUTO_PIN_MIC)
10972 nid = cfg->inputs[i].pin;
10973 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) {
10975 char boost_label[32];
10977 label = hda_get_autocfg_input_label(codec, cfg, i);
10978 if (prev_label && !strcmp(label, prev_label))
10982 prev_label = label;
10984 snprintf(boost_label, sizeof(boost_label),
10985 "%s Boost Volume", label);
10986 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10987 boost_label, type_idx,
10988 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10996 /* almost identical with ALC880 parser... */
10997 static int alc882_parse_auto_config(struct hda_codec *codec)
10999 struct alc_spec *spec = codec->spec;
11000 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
11003 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11007 if (!spec->autocfg.line_outs)
11008 return 0; /* can't find valid BIOS pin config */
11010 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
11013 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
11016 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
11020 err = alc880_auto_create_extra_out(spec,
11021 spec->autocfg.speaker_pins[0],
11025 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
11029 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11031 alc_auto_parse_digital(codec);
11033 if (spec->kctls.list)
11034 add_mixer(spec, spec->kctls.list);
11036 add_verb(spec, alc883_auto_init_verbs);
11037 /* if ADC 0x07 is available, initialize it, too */
11038 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
11039 add_verb(spec, alc882_adc1_init_verbs);
11041 spec->num_mux_defs = 1;
11042 spec->input_mux = &spec->private_imux[0];
11044 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
11046 err = alc_auto_add_mic_boost(codec);
11050 return 1; /* config found */
11053 /* additional initialization for auto-configuration model */
11054 static void alc882_auto_init(struct hda_codec *codec)
11056 struct alc_spec *spec = codec->spec;
11057 alc882_auto_init_multi_out(codec);
11058 alc882_auto_init_hp_out(codec);
11059 alc882_auto_init_analog_input(codec);
11060 alc882_auto_init_input_src(codec);
11061 alc_auto_init_digital(codec);
11062 if (spec->unsol_event)
11063 alc_inithook(codec);
11066 static int patch_alc882(struct hda_codec *codec)
11068 struct alc_spec *spec;
11069 int err, board_config;
11071 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11075 codec->spec = spec;
11077 switch (codec->vendor_id) {
11082 /* ALC883 and variants */
11083 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11087 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
11091 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
11092 board_config = snd_hda_check_board_codec_sid_config(codec,
11093 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
11095 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
11096 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
11098 board_config = ALC882_AUTO;
11101 if (board_config == ALC882_AUTO) {
11102 alc_pick_fixup(codec, NULL, alc882_fixup_tbl, alc882_fixups);
11103 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
11106 alc_auto_parse_customize_define(codec);
11108 if (board_config == ALC882_AUTO) {
11109 /* automatic parse from the BIOS config */
11110 err = alc882_parse_auto_config(codec);
11116 "hda_codec: Cannot set up configuration "
11117 "from BIOS. Using base mode...\n");
11118 board_config = ALC882_3ST_DIG;
11122 if (has_cdefine_beep(codec)) {
11123 err = snd_hda_attach_beep_device(codec, 0x1);
11130 if (board_config != ALC882_AUTO)
11131 setup_preset(codec, &alc882_presets[board_config]);
11133 spec->stream_analog_playback = &alc882_pcm_analog_playback;
11134 spec->stream_analog_capture = &alc882_pcm_analog_capture;
11135 /* FIXME: setup DAC5 */
11136 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
11137 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
11139 spec->stream_digital_playback = &alc882_pcm_digital_playback;
11140 spec->stream_digital_capture = &alc882_pcm_digital_capture;
11142 if (!spec->adc_nids && spec->input_mux) {
11144 spec->num_adc_nids = 0;
11145 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
11146 const struct hda_input_mux *imux = spec->input_mux;
11148 hda_nid_t items[16];
11149 hda_nid_t nid = alc882_adc_nids[i];
11150 unsigned int wcap = get_wcaps(codec, nid);
11152 wcap = get_wcaps_type(wcap);
11153 if (wcap != AC_WID_AUD_IN)
11155 spec->private_adc_nids[spec->num_adc_nids] = nid;
11156 err = snd_hda_get_connections(codec, nid, &cap, 1);
11159 err = snd_hda_get_connections(codec, cap, items,
11160 ARRAY_SIZE(items));
11163 for (j = 0; j < imux->num_items; j++)
11164 if (imux->items[j].index >= err)
11166 if (j < imux->num_items)
11168 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
11169 spec->num_adc_nids++;
11171 spec->adc_nids = spec->private_adc_nids;
11172 spec->capsrc_nids = spec->private_capsrc_nids;
11175 set_capture_mixer(codec);
11177 if (has_cdefine_beep(codec))
11178 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11180 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
11182 spec->vmaster_nid = 0x0c;
11184 codec->patch_ops = alc_patch_ops;
11185 if (board_config == ALC882_AUTO)
11186 spec->init_hook = alc882_auto_init;
11188 alc_init_jacks(codec);
11189 #ifdef CONFIG_SND_HDA_POWER_SAVE
11190 if (!spec->loopback.amplist)
11191 spec->loopback.amplist = alc882_loopbacks;
11202 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
11203 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
11205 #define alc262_dac_nids alc260_dac_nids
11206 #define alc262_adc_nids alc882_adc_nids
11207 #define alc262_adc_nids_alt alc882_adc_nids_alt
11208 #define alc262_capsrc_nids alc882_capsrc_nids
11209 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
11211 #define alc262_modes alc260_modes
11212 #define alc262_capture_source alc882_capture_source
11214 static hda_nid_t alc262_dmic_adc_nids[1] = {
11219 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
11221 static struct snd_kcontrol_new alc262_base_mixer[] = {
11222 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11223 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11224 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11225 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11226 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11227 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11228 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11229 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11230 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11231 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11232 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11233 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11234 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
11235 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11236 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
11237 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
11241 /* update HP, line and mono-out pins according to the master switch */
11242 static void alc262_hp_master_update(struct hda_codec *codec)
11244 struct alc_spec *spec = codec->spec;
11245 int val = spec->master_sw;
11247 /* HP & line-out */
11248 snd_hda_codec_write_cache(codec, 0x1b, 0,
11249 AC_VERB_SET_PIN_WIDGET_CONTROL,
11251 snd_hda_codec_write_cache(codec, 0x15, 0,
11252 AC_VERB_SET_PIN_WIDGET_CONTROL,
11254 /* mono (speaker) depending on the HP jack sense */
11255 val = val && !spec->jack_present;
11256 snd_hda_codec_write_cache(codec, 0x16, 0,
11257 AC_VERB_SET_PIN_WIDGET_CONTROL,
11258 val ? PIN_OUT : 0);
11261 static void alc262_hp_bpc_automute(struct hda_codec *codec)
11263 struct alc_spec *spec = codec->spec;
11265 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
11266 alc262_hp_master_update(codec);
11269 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
11271 if ((res >> 26) != ALC880_HP_EVENT)
11273 alc262_hp_bpc_automute(codec);
11276 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
11278 struct alc_spec *spec = codec->spec;
11280 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11281 alc262_hp_master_update(codec);
11284 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
11287 if ((res >> 26) != ALC880_HP_EVENT)
11289 alc262_hp_wildwest_automute(codec);
11292 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
11294 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
11295 struct snd_ctl_elem_value *ucontrol)
11297 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11298 struct alc_spec *spec = codec->spec;
11299 int val = !!*ucontrol->value.integer.value;
11301 if (val == spec->master_sw)
11303 spec->master_sw = val;
11304 alc262_hp_master_update(codec);
11308 #define ALC262_HP_MASTER_SWITCH \
11310 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
11311 .name = "Master Playback Switch", \
11312 .info = snd_ctl_boolean_mono_info, \
11313 .get = alc262_hp_master_sw_get, \
11314 .put = alc262_hp_master_sw_put, \
11317 .iface = NID_MAPPING, \
11318 .name = "Master Playback Switch", \
11319 .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \
11323 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
11324 ALC262_HP_MASTER_SWITCH,
11325 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11326 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11327 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11328 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
11330 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
11332 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11333 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11334 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11335 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11336 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11337 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11338 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11339 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11340 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11341 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11342 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
11343 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
11347 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
11348 ALC262_HP_MASTER_SWITCH,
11349 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11350 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11351 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11352 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11353 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
11355 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
11357 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
11358 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
11359 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x1a, 0, HDA_INPUT),
11360 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
11361 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
11362 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11363 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11367 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
11368 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11369 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11370 HDA_CODEC_VOLUME("Rear Mic Boost Volume", 0x18, 0, HDA_INPUT),
11374 /* mute/unmute internal speaker according to the hp jack and mute state */
11375 static void alc262_hp_t5735_setup(struct hda_codec *codec)
11377 struct alc_spec *spec = codec->spec;
11379 spec->autocfg.hp_pins[0] = 0x15;
11380 spec->autocfg.speaker_pins[0] = 0x14;
11383 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
11384 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11385 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11386 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11387 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11388 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11389 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11390 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11394 static struct hda_verb alc262_hp_t5735_verbs[] = {
11395 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11396 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11398 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11402 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
11403 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11404 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11405 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
11406 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
11407 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
11408 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
11412 static struct hda_verb alc262_hp_rp5700_verbs[] = {
11413 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11414 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11415 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11416 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11417 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11418 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11419 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11420 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11421 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
11422 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
11426 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
11433 /* bind hp and internal speaker mute (with plug check) as master switch */
11434 static void alc262_hippo_master_update(struct hda_codec *codec)
11436 struct alc_spec *spec = codec->spec;
11437 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11438 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
11439 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
11443 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
11444 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
11445 HDA_AMP_MUTE, mute);
11446 /* mute internal speaker per jack sense */
11447 if (spec->jack_present)
11448 mute = HDA_AMP_MUTE;
11450 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
11451 HDA_AMP_MUTE, mute);
11452 if (speaker_nid && speaker_nid != line_nid)
11453 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
11454 HDA_AMP_MUTE, mute);
11457 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
11459 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
11460 struct snd_ctl_elem_value *ucontrol)
11462 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11463 struct alc_spec *spec = codec->spec;
11464 int val = !!*ucontrol->value.integer.value;
11466 if (val == spec->master_sw)
11468 spec->master_sw = val;
11469 alc262_hippo_master_update(codec);
11473 #define ALC262_HIPPO_MASTER_SWITCH \
11475 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
11476 .name = "Master Playback Switch", \
11477 .info = snd_ctl_boolean_mono_info, \
11478 .get = alc262_hippo_master_sw_get, \
11479 .put = alc262_hippo_master_sw_put, \
11482 .iface = NID_MAPPING, \
11483 .name = "Master Playback Switch", \
11484 .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \
11485 (SUBDEV_SPEAKER(0) << 16), \
11488 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
11489 ALC262_HIPPO_MASTER_SWITCH,
11490 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11491 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11492 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11493 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11494 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11495 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11496 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11497 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11498 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11499 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11500 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11501 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11505 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
11506 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11507 ALC262_HIPPO_MASTER_SWITCH,
11508 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11509 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11510 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11511 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11512 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11513 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11514 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11515 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11516 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11517 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11521 /* mute/unmute internal speaker according to the hp jack and mute state */
11522 static void alc262_hippo_automute(struct hda_codec *codec)
11524 struct alc_spec *spec = codec->spec;
11525 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11527 spec->jack_present = snd_hda_jack_detect(codec, hp_nid);
11528 alc262_hippo_master_update(codec);
11531 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
11533 if ((res >> 26) != ALC880_HP_EVENT)
11535 alc262_hippo_automute(codec);
11538 static void alc262_hippo_setup(struct hda_codec *codec)
11540 struct alc_spec *spec = codec->spec;
11542 spec->autocfg.hp_pins[0] = 0x15;
11543 spec->autocfg.speaker_pins[0] = 0x14;
11546 static void alc262_hippo1_setup(struct hda_codec *codec)
11548 struct alc_spec *spec = codec->spec;
11550 spec->autocfg.hp_pins[0] = 0x1b;
11551 spec->autocfg.speaker_pins[0] = 0x14;
11555 static struct snd_kcontrol_new alc262_sony_mixer[] = {
11556 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11557 ALC262_HIPPO_MASTER_SWITCH,
11558 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11559 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11560 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11561 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11565 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
11566 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11567 ALC262_HIPPO_MASTER_SWITCH,
11568 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11569 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11570 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11571 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11572 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11576 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
11577 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11578 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11579 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
11580 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
11581 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11582 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11583 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11584 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11585 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11586 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11587 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11588 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11592 static struct hda_verb alc262_tyan_verbs[] = {
11593 /* Headphone automute */
11594 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11595 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11596 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11598 /* P11 AUX_IN, white 4-pin connector */
11599 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11600 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
11601 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
11602 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
11607 /* unsolicited event for HP jack sensing */
11608 static void alc262_tyan_setup(struct hda_codec *codec)
11610 struct alc_spec *spec = codec->spec;
11612 spec->autocfg.hp_pins[0] = 0x1b;
11613 spec->autocfg.speaker_pins[0] = 0x15;
11617 #define alc262_capture_mixer alc882_capture_mixer
11618 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
11621 * generic initialization of ADC, input mixers and output mixers
11623 static struct hda_verb alc262_init_verbs[] = {
11625 * Unmute ADC0-2 and set the default input to mic-in
11627 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11628 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11629 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11630 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11631 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11632 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11634 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11636 * Note: PASD motherboards uses the Line In 2 as the input for
11637 * front panel mic (mic 2)
11639 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11640 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11641 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11642 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11643 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11644 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11647 * Set up output mixers (0x0c - 0x0e)
11649 /* set vol=0 to output mixers */
11650 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11651 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11652 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11653 /* set up input amps for analog loopback */
11654 /* Amp Indices: DAC = 0, mixer = 1 */
11655 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11656 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11657 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11658 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11659 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11660 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11662 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11663 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11664 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11665 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11666 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11667 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11669 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11670 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11671 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11672 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11673 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11675 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11676 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11678 /* FIXME: use matrix-type input source selection */
11679 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11680 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11681 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11682 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11683 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11684 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11686 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11687 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11688 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11689 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11691 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11692 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11693 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11694 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11699 static struct hda_verb alc262_eapd_verbs[] = {
11700 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11701 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11705 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
11706 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11707 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11708 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11710 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11711 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11715 static struct hda_verb alc262_sony_unsol_verbs[] = {
11716 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11717 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11718 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
11720 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11721 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11725 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
11726 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11727 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11728 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11729 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11730 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11734 static struct hda_verb alc262_toshiba_s06_verbs[] = {
11735 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11736 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11737 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11738 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11739 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
11740 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11741 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11742 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11746 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
11748 struct alc_spec *spec = codec->spec;
11750 spec->autocfg.hp_pins[0] = 0x15;
11751 spec->autocfg.speaker_pins[0] = 0x14;
11752 spec->ext_mic.pin = 0x18;
11753 spec->ext_mic.mux_idx = 0;
11754 spec->int_mic.pin = 0x12;
11755 spec->int_mic.mux_idx = 9;
11756 spec->auto_mic = 1;
11762 * 0x16 = internal speaker
11763 * 0x18 = external mic
11766 static struct snd_kcontrol_new alc262_nec_mixer[] = {
11767 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
11768 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
11770 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11771 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11772 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11774 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11775 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11779 static struct hda_verb alc262_nec_verbs[] = {
11780 /* Unmute Speaker */
11781 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11784 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11785 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11787 /* External mic to headphone */
11788 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11789 /* External mic to speaker */
11790 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11796 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
11797 * 0x1b = port replicator headphone out
11800 #define ALC_HP_EVENT 0x37
11802 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
11803 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11804 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11805 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11806 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11810 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
11811 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11812 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11816 static struct hda_verb alc262_lenovo_3000_init_verbs[] = {
11817 /* Front Mic pin: input vref at 50% */
11818 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
11819 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11823 static struct hda_input_mux alc262_fujitsu_capture_source = {
11827 { "Internal Mic", 0x1 },
11832 static struct hda_input_mux alc262_HP_capture_source = {
11836 { "Front Mic", 0x1 },
11843 static struct hda_input_mux alc262_HP_D7000_capture_source = {
11847 { "Front Mic", 0x2 },
11853 /* mute/unmute internal speaker according to the hp jacks and mute state */
11854 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
11856 struct alc_spec *spec = codec->spec;
11859 if (force || !spec->sense_updated) {
11860 spec->jack_present = snd_hda_jack_detect(codec, 0x14) ||
11861 snd_hda_jack_detect(codec, 0x1b);
11862 spec->sense_updated = 1;
11864 /* unmute internal speaker only if both HPs are unplugged and
11865 * master switch is on
11867 if (spec->jack_present)
11868 mute = HDA_AMP_MUTE;
11870 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11871 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11872 HDA_AMP_MUTE, mute);
11875 /* unsolicited event for HP jack sensing */
11876 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
11879 if ((res >> 26) != ALC_HP_EVENT)
11881 alc262_fujitsu_automute(codec, 1);
11884 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
11886 alc262_fujitsu_automute(codec, 1);
11889 /* bind volumes of both NID 0x0c and 0x0d */
11890 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
11891 .ops = &snd_hda_bind_vol,
11893 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
11894 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
11899 /* mute/unmute internal speaker according to the hp jack and mute state */
11900 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
11902 struct alc_spec *spec = codec->spec;
11905 if (force || !spec->sense_updated) {
11906 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
11907 spec->sense_updated = 1;
11909 if (spec->jack_present) {
11910 /* mute internal speaker */
11911 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11912 HDA_AMP_MUTE, HDA_AMP_MUTE);
11913 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11914 HDA_AMP_MUTE, HDA_AMP_MUTE);
11916 /* unmute internal speaker if necessary */
11917 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
11918 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11919 HDA_AMP_MUTE, mute);
11920 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11921 HDA_AMP_MUTE, mute);
11925 /* unsolicited event for HP jack sensing */
11926 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
11929 if ((res >> 26) != ALC_HP_EVENT)
11931 alc262_lenovo_3000_automute(codec, 1);
11934 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
11935 int dir, int idx, long *valp)
11939 for (i = 0; i < 2; i++, valp++)
11940 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
11942 *valp ? 0 : HDA_AMP_MUTE);
11946 /* bind hp and internal speaker mute (with plug check) */
11947 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
11948 struct snd_ctl_elem_value *ucontrol)
11950 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11951 long *valp = ucontrol->value.integer.value;
11954 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
11955 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11957 alc262_fujitsu_automute(codec, 0);
11961 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
11962 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11964 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11965 .name = "Master Playback Switch",
11966 .subdevice = HDA_SUBDEV_AMP_FLAG,
11967 .info = snd_hda_mixer_amp_switch_info,
11968 .get = snd_hda_mixer_amp_switch_get,
11969 .put = alc262_fujitsu_master_sw_put,
11970 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11973 .iface = NID_MAPPING,
11974 .name = "Master Playback Switch",
11975 .private_value = 0x1b,
11977 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11978 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11979 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11980 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11981 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11982 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
11983 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11984 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11988 /* bind hp and internal speaker mute (with plug check) */
11989 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
11990 struct snd_ctl_elem_value *ucontrol)
11992 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11993 long *valp = ucontrol->value.integer.value;
11996 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11998 alc262_lenovo_3000_automute(codec, 0);
12002 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
12003 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
12005 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12006 .name = "Master Playback Switch",
12007 .subdevice = HDA_SUBDEV_AMP_FLAG,
12008 .info = snd_hda_mixer_amp_switch_info,
12009 .get = snd_hda_mixer_amp_switch_get,
12010 .put = alc262_lenovo_3000_master_sw_put,
12011 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
12013 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12014 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
12015 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
12016 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12017 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12018 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
12019 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12020 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12024 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
12025 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
12026 ALC262_HIPPO_MASTER_SWITCH,
12027 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12028 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12029 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
12030 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12031 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12032 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
12036 /* additional init verbs for Benq laptops */
12037 static struct hda_verb alc262_EAPD_verbs[] = {
12038 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
12039 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
12043 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
12044 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12045 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12047 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
12048 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
12052 /* Samsung Q1 Ultra Vista model setup */
12053 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
12054 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
12055 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
12056 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12057 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12058 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT),
12059 HDA_CODEC_VOLUME("Headphone Mic Boost Volume", 0x15, 0, HDA_INPUT),
12063 static struct hda_verb alc262_ultra_verbs[] = {
12065 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12066 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12067 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12069 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12070 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12071 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12072 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12074 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12075 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12076 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12077 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12078 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12080 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12081 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12082 /* ADC, choose mic */
12083 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12084 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12085 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12086 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12087 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12088 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12089 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12090 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
12091 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
12092 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
12096 /* mute/unmute internal speaker according to the hp jack and mute state */
12097 static void alc262_ultra_automute(struct hda_codec *codec)
12099 struct alc_spec *spec = codec->spec;
12103 /* auto-mute only when HP is used as HP */
12104 if (!spec->cur_mux[0]) {
12105 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
12106 if (spec->jack_present)
12107 mute = HDA_AMP_MUTE;
12109 /* mute/unmute internal speaker */
12110 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
12111 HDA_AMP_MUTE, mute);
12112 /* mute/unmute HP */
12113 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12114 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
12117 /* unsolicited event for HP jack sensing */
12118 static void alc262_ultra_unsol_event(struct hda_codec *codec,
12121 if ((res >> 26) != ALC880_HP_EVENT)
12123 alc262_ultra_automute(codec);
12126 static struct hda_input_mux alc262_ultra_capture_source = {
12130 { "Headphone", 0x7 },
12134 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
12135 struct snd_ctl_elem_value *ucontrol)
12137 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12138 struct alc_spec *spec = codec->spec;
12141 ret = alc_mux_enum_put(kcontrol, ucontrol);
12144 /* reprogram the HP pin as mic or HP according to the input source */
12145 snd_hda_codec_write_cache(codec, 0x15, 0,
12146 AC_VERB_SET_PIN_WIDGET_CONTROL,
12147 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
12148 alc262_ultra_automute(codec); /* mute/unmute HP */
12152 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
12153 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
12154 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
12156 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12157 .name = "Capture Source",
12158 .info = alc_mux_enum_info,
12159 .get = alc_mux_enum_get,
12160 .put = alc262_ultra_mux_enum_put,
12163 .iface = NID_MAPPING,
12164 .name = "Capture Source",
12165 .private_value = 0x15,
12170 /* We use two mixers depending on the output pin; 0x16 is a mono output
12171 * and thus it's bound with a different mixer.
12172 * This function returns which mixer amp should be used.
12174 static int alc262_check_volbit(hda_nid_t nid)
12178 else if (nid == 0x16)
12184 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
12185 const char *pfx, int *vbits, int idx)
12190 vbit = alc262_check_volbit(nid);
12193 if (*vbits & vbit) /* a volume control for this mixer already there */
12197 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
12199 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
12200 return __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, idx, val);
12203 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
12204 const char *pfx, int idx)
12211 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
12213 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
12214 return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, idx, val);
12217 /* add playback controls from the parsed DAC table */
12218 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
12219 const struct auto_pin_cfg *cfg)
12225 spec->multiout.num_dacs = 1; /* only use one dac */
12226 spec->multiout.dac_nids = spec->private_dac_nids;
12227 spec->multiout.dac_nids[0] = 2;
12229 pfx = alc_get_line_out_pfx(cfg, true);
12232 for (i = 0; i < 2; i++) {
12233 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[i], pfx, i);
12236 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) {
12237 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[i],
12242 if (cfg->line_out_type != AUTO_PIN_HP_OUT) {
12243 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[i],
12250 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
12251 alc262_check_volbit(cfg->speaker_pins[0]) |
12252 alc262_check_volbit(cfg->hp_pins[0]);
12253 if (vbits == 1 || vbits == 2)
12254 pfx = "Master"; /* only one mixer is used */
12256 for (i = 0; i < 2; i++) {
12257 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[i], pfx,
12261 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) {
12262 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[i],
12263 "Speaker", &vbits, i);
12267 if (cfg->line_out_type != AUTO_PIN_HP_OUT) {
12268 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[i],
12269 "Headphone", &vbits, i);
12277 #define alc262_auto_create_input_ctls \
12278 alc882_auto_create_input_ctls
12281 * generic initialization of ADC, input mixers and output mixers
12283 static struct hda_verb alc262_volume_init_verbs[] = {
12285 * Unmute ADC0-2 and set the default input to mic-in
12287 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12288 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12289 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12290 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12291 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12292 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12294 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12296 * Note: PASD motherboards uses the Line In 2 as the input for
12297 * front panel mic (mic 2)
12299 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12300 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12301 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12302 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12303 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12304 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12307 * Set up output mixers (0x0c - 0x0f)
12309 /* set vol=0 to output mixers */
12310 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12311 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12312 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12314 /* set up input amps for analog loopback */
12315 /* Amp Indices: DAC = 0, mixer = 1 */
12316 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12317 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12318 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12319 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12320 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12321 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12323 /* FIXME: use matrix-type input source selection */
12324 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12325 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12326 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12327 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12328 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12329 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12331 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12332 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12333 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12334 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12336 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12337 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12338 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12339 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12344 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
12346 * Unmute ADC0-2 and set the default input to mic-in
12348 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12349 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12350 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12351 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12352 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12353 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12355 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12357 * Note: PASD motherboards uses the Line In 2 as the input for
12358 * front panel mic (mic 2)
12360 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12361 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12362 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12363 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12364 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12365 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12366 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12367 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
12370 * Set up output mixers (0x0c - 0x0e)
12372 /* set vol=0 to output mixers */
12373 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12374 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12375 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12377 /* set up input amps for analog loopback */
12378 /* Amp Indices: DAC = 0, mixer = 1 */
12379 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12380 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12381 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12382 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12383 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12384 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12386 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12387 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12388 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12390 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12391 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12393 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12394 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12396 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12397 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12398 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12399 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12400 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12402 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12403 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12404 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12405 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12406 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12407 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12410 /* FIXME: use matrix-type input source selection */
12411 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
12412 /* Input mixer1: only unmute Mic */
12413 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12414 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12415 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12416 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12417 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12418 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12419 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12420 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12421 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12423 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12424 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12425 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12426 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12427 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12428 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12429 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12430 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12431 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12433 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12434 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12435 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12436 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12437 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12438 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12439 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12440 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12441 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12443 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12448 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
12450 * Unmute ADC0-2 and set the default input to mic-in
12452 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12453 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12454 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12455 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12456 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12457 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12459 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12461 * Note: PASD motherboards uses the Line In 2 as the input for front
12462 * panel mic (mic 2)
12464 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12465 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12466 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12467 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12468 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12469 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12470 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12471 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
12472 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
12474 * Set up output mixers (0x0c - 0x0e)
12476 /* set vol=0 to output mixers */
12477 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12478 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12479 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12481 /* set up input amps for analog loopback */
12482 /* Amp Indices: DAC = 0, mixer = 1 */
12483 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12484 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12485 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12486 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12487 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12488 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12491 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
12492 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
12493 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
12494 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
12495 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
12496 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
12497 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
12499 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12500 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12502 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12503 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12505 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
12506 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12507 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12508 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
12509 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12510 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12512 /* FIXME: use matrix-type input source selection */
12513 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12514 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12515 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
12516 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
12517 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
12518 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
12519 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
12520 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12521 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
12523 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12524 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
12525 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
12526 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
12527 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
12528 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12529 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
12531 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12532 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
12533 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
12534 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
12535 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
12536 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12537 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
12539 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12544 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
12546 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
12547 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12548 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
12550 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
12551 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
12552 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
12553 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
12555 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
12556 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12557 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12568 static const struct alc_fixup alc262_fixups[] = {
12569 [PINFIX_FSC_H270] = {
12570 .type = ALC_FIXUP_PINS,
12571 .v.pins = (const struct alc_pincfg[]) {
12572 { 0x14, 0x99130110 }, /* speaker */
12573 { 0x15, 0x0221142f }, /* front HP */
12574 { 0x1b, 0x0121141f }, /* rear HP */
12580 static struct snd_pci_quirk alc262_fixup_tbl[] = {
12581 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", PINFIX_FSC_H270),
12586 #ifdef CONFIG_SND_HDA_POWER_SAVE
12587 #define alc262_loopbacks alc880_loopbacks
12590 /* pcm configuration: identical with ALC880 */
12591 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
12592 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
12593 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
12594 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
12597 * BIOS auto configuration
12599 static int alc262_parse_auto_config(struct hda_codec *codec)
12601 struct alc_spec *spec = codec->spec;
12603 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
12605 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12609 if (!spec->autocfg.line_outs) {
12610 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12611 spec->multiout.max_channels = 2;
12612 spec->no_analog = 1;
12615 return 0; /* can't find valid BIOS pin config */
12617 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
12620 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
12624 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12627 alc_auto_parse_digital(codec);
12629 if (spec->kctls.list)
12630 add_mixer(spec, spec->kctls.list);
12632 add_verb(spec, alc262_volume_init_verbs);
12633 spec->num_mux_defs = 1;
12634 spec->input_mux = &spec->private_imux[0];
12636 err = alc_auto_add_mic_boost(codec);
12640 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
12645 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
12646 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
12647 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
12648 #define alc262_auto_init_input_src alc882_auto_init_input_src
12651 /* init callback for auto-configuration model -- overriding the default init */
12652 static void alc262_auto_init(struct hda_codec *codec)
12654 struct alc_spec *spec = codec->spec;
12655 alc262_auto_init_multi_out(codec);
12656 alc262_auto_init_hp_out(codec);
12657 alc262_auto_init_analog_input(codec);
12658 alc262_auto_init_input_src(codec);
12659 alc_auto_init_digital(codec);
12660 if (spec->unsol_event)
12661 alc_inithook(codec);
12665 * configuration and preset
12667 static const char * const alc262_models[ALC262_MODEL_LAST] = {
12668 [ALC262_BASIC] = "basic",
12669 [ALC262_HIPPO] = "hippo",
12670 [ALC262_HIPPO_1] = "hippo_1",
12671 [ALC262_FUJITSU] = "fujitsu",
12672 [ALC262_HP_BPC] = "hp-bpc",
12673 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
12674 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
12675 [ALC262_HP_RP5700] = "hp-rp5700",
12676 [ALC262_BENQ_ED8] = "benq",
12677 [ALC262_BENQ_T31] = "benq-t31",
12678 [ALC262_SONY_ASSAMD] = "sony-assamd",
12679 [ALC262_TOSHIBA_S06] = "toshiba-s06",
12680 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
12681 [ALC262_ULTRA] = "ultra",
12682 [ALC262_LENOVO_3000] = "lenovo-3000",
12683 [ALC262_NEC] = "nec",
12684 [ALC262_TYAN] = "tyan",
12685 [ALC262_AUTO] = "auto",
12688 static struct snd_pci_quirk alc262_cfg_tbl[] = {
12689 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
12690 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
12691 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
12693 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
12695 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1500, "HP z series",
12697 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
12699 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
12700 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
12701 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
12702 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
12703 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
12704 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
12705 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
12706 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
12707 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
12708 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
12709 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
12710 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
12711 ALC262_HP_TC_T5735),
12712 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
12713 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12714 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
12715 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12716 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
12717 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
12718 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
12719 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
12720 #if 0 /* disable the quirk since model=auto works better in recent versions */
12721 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
12722 ALC262_SONY_ASSAMD),
12724 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
12725 ALC262_TOSHIBA_RX1),
12726 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
12727 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
12728 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
12729 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
12730 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
12732 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
12733 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
12734 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
12735 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
12736 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
12740 static struct alc_config_preset alc262_presets[] = {
12742 .mixers = { alc262_base_mixer },
12743 .init_verbs = { alc262_init_verbs },
12744 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12745 .dac_nids = alc262_dac_nids,
12747 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12748 .channel_mode = alc262_modes,
12749 .input_mux = &alc262_capture_source,
12752 .mixers = { alc262_hippo_mixer },
12753 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
12754 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12755 .dac_nids = alc262_dac_nids,
12757 .dig_out_nid = ALC262_DIGOUT_NID,
12758 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12759 .channel_mode = alc262_modes,
12760 .input_mux = &alc262_capture_source,
12761 .unsol_event = alc262_hippo_unsol_event,
12762 .setup = alc262_hippo_setup,
12763 .init_hook = alc262_hippo_automute,
12765 [ALC262_HIPPO_1] = {
12766 .mixers = { alc262_hippo1_mixer },
12767 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
12768 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12769 .dac_nids = alc262_dac_nids,
12771 .dig_out_nid = ALC262_DIGOUT_NID,
12772 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12773 .channel_mode = alc262_modes,
12774 .input_mux = &alc262_capture_source,
12775 .unsol_event = alc262_hippo_unsol_event,
12776 .setup = alc262_hippo1_setup,
12777 .init_hook = alc262_hippo_automute,
12779 [ALC262_FUJITSU] = {
12780 .mixers = { alc262_fujitsu_mixer },
12781 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12782 alc262_fujitsu_unsol_verbs },
12783 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12784 .dac_nids = alc262_dac_nids,
12786 .dig_out_nid = ALC262_DIGOUT_NID,
12787 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12788 .channel_mode = alc262_modes,
12789 .input_mux = &alc262_fujitsu_capture_source,
12790 .unsol_event = alc262_fujitsu_unsol_event,
12791 .init_hook = alc262_fujitsu_init_hook,
12793 [ALC262_HP_BPC] = {
12794 .mixers = { alc262_HP_BPC_mixer },
12795 .init_verbs = { alc262_HP_BPC_init_verbs },
12796 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12797 .dac_nids = alc262_dac_nids,
12799 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12800 .channel_mode = alc262_modes,
12801 .input_mux = &alc262_HP_capture_source,
12802 .unsol_event = alc262_hp_bpc_unsol_event,
12803 .init_hook = alc262_hp_bpc_automute,
12805 [ALC262_HP_BPC_D7000_WF] = {
12806 .mixers = { alc262_HP_BPC_WildWest_mixer },
12807 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12808 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12809 .dac_nids = alc262_dac_nids,
12811 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12812 .channel_mode = alc262_modes,
12813 .input_mux = &alc262_HP_D7000_capture_source,
12814 .unsol_event = alc262_hp_wildwest_unsol_event,
12815 .init_hook = alc262_hp_wildwest_automute,
12817 [ALC262_HP_BPC_D7000_WL] = {
12818 .mixers = { alc262_HP_BPC_WildWest_mixer,
12819 alc262_HP_BPC_WildWest_option_mixer },
12820 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12821 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12822 .dac_nids = alc262_dac_nids,
12824 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12825 .channel_mode = alc262_modes,
12826 .input_mux = &alc262_HP_D7000_capture_source,
12827 .unsol_event = alc262_hp_wildwest_unsol_event,
12828 .init_hook = alc262_hp_wildwest_automute,
12830 [ALC262_HP_TC_T5735] = {
12831 .mixers = { alc262_hp_t5735_mixer },
12832 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
12833 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12834 .dac_nids = alc262_dac_nids,
12836 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12837 .channel_mode = alc262_modes,
12838 .input_mux = &alc262_capture_source,
12839 .unsol_event = alc_sku_unsol_event,
12840 .setup = alc262_hp_t5735_setup,
12841 .init_hook = alc_inithook,
12843 [ALC262_HP_RP5700] = {
12844 .mixers = { alc262_hp_rp5700_mixer },
12845 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
12846 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12847 .dac_nids = alc262_dac_nids,
12848 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12849 .channel_mode = alc262_modes,
12850 .input_mux = &alc262_hp_rp5700_capture_source,
12852 [ALC262_BENQ_ED8] = {
12853 .mixers = { alc262_base_mixer },
12854 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
12855 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12856 .dac_nids = alc262_dac_nids,
12858 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12859 .channel_mode = alc262_modes,
12860 .input_mux = &alc262_capture_source,
12862 [ALC262_SONY_ASSAMD] = {
12863 .mixers = { alc262_sony_mixer },
12864 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
12865 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12866 .dac_nids = alc262_dac_nids,
12868 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12869 .channel_mode = alc262_modes,
12870 .input_mux = &alc262_capture_source,
12871 .unsol_event = alc262_hippo_unsol_event,
12872 .setup = alc262_hippo_setup,
12873 .init_hook = alc262_hippo_automute,
12875 [ALC262_BENQ_T31] = {
12876 .mixers = { alc262_benq_t31_mixer },
12877 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
12878 alc_hp15_unsol_verbs },
12879 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12880 .dac_nids = alc262_dac_nids,
12882 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12883 .channel_mode = alc262_modes,
12884 .input_mux = &alc262_capture_source,
12885 .unsol_event = alc262_hippo_unsol_event,
12886 .setup = alc262_hippo_setup,
12887 .init_hook = alc262_hippo_automute,
12890 .mixers = { alc262_ultra_mixer },
12891 .cap_mixer = alc262_ultra_capture_mixer,
12892 .init_verbs = { alc262_ultra_verbs },
12893 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12894 .dac_nids = alc262_dac_nids,
12895 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12896 .channel_mode = alc262_modes,
12897 .input_mux = &alc262_ultra_capture_source,
12898 .adc_nids = alc262_adc_nids, /* ADC0 */
12899 .capsrc_nids = alc262_capsrc_nids,
12900 .num_adc_nids = 1, /* single ADC */
12901 .unsol_event = alc262_ultra_unsol_event,
12902 .init_hook = alc262_ultra_automute,
12904 [ALC262_LENOVO_3000] = {
12905 .mixers = { alc262_lenovo_3000_mixer },
12906 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12907 alc262_lenovo_3000_unsol_verbs,
12908 alc262_lenovo_3000_init_verbs },
12909 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12910 .dac_nids = alc262_dac_nids,
12912 .dig_out_nid = ALC262_DIGOUT_NID,
12913 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12914 .channel_mode = alc262_modes,
12915 .input_mux = &alc262_fujitsu_capture_source,
12916 .unsol_event = alc262_lenovo_3000_unsol_event,
12919 .mixers = { alc262_nec_mixer },
12920 .init_verbs = { alc262_nec_verbs },
12921 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12922 .dac_nids = alc262_dac_nids,
12924 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12925 .channel_mode = alc262_modes,
12926 .input_mux = &alc262_capture_source,
12928 [ALC262_TOSHIBA_S06] = {
12929 .mixers = { alc262_toshiba_s06_mixer },
12930 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
12931 alc262_eapd_verbs },
12932 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12933 .capsrc_nids = alc262_dmic_capsrc_nids,
12934 .dac_nids = alc262_dac_nids,
12935 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
12936 .num_adc_nids = 1, /* single ADC */
12937 .dig_out_nid = ALC262_DIGOUT_NID,
12938 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12939 .channel_mode = alc262_modes,
12940 .unsol_event = alc_sku_unsol_event,
12941 .setup = alc262_toshiba_s06_setup,
12942 .init_hook = alc_inithook,
12944 [ALC262_TOSHIBA_RX1] = {
12945 .mixers = { alc262_toshiba_rx1_mixer },
12946 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
12947 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12948 .dac_nids = alc262_dac_nids,
12950 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12951 .channel_mode = alc262_modes,
12952 .input_mux = &alc262_capture_source,
12953 .unsol_event = alc262_hippo_unsol_event,
12954 .setup = alc262_hippo_setup,
12955 .init_hook = alc262_hippo_automute,
12958 .mixers = { alc262_tyan_mixer },
12959 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
12960 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12961 .dac_nids = alc262_dac_nids,
12963 .dig_out_nid = ALC262_DIGOUT_NID,
12964 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12965 .channel_mode = alc262_modes,
12966 .input_mux = &alc262_capture_source,
12967 .unsol_event = alc_automute_amp_unsol_event,
12968 .setup = alc262_tyan_setup,
12969 .init_hook = alc_automute_amp,
12973 static int patch_alc262(struct hda_codec *codec)
12975 struct alc_spec *spec;
12979 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12983 codec->spec = spec;
12985 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
12990 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12991 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
12992 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12993 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
12996 alc_auto_parse_customize_define(codec);
12998 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
13000 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
13004 if (board_config < 0) {
13005 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13007 board_config = ALC262_AUTO;
13010 if (board_config == ALC262_AUTO) {
13011 alc_pick_fixup(codec, NULL, alc262_fixup_tbl, alc262_fixups);
13012 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
13015 if (board_config == ALC262_AUTO) {
13016 /* automatic parse from the BIOS config */
13017 err = alc262_parse_auto_config(codec);
13023 "hda_codec: Cannot set up configuration "
13024 "from BIOS. Using base mode...\n");
13025 board_config = ALC262_BASIC;
13029 if (!spec->no_analog && has_cdefine_beep(codec)) {
13030 err = snd_hda_attach_beep_device(codec, 0x1);
13037 if (board_config != ALC262_AUTO)
13038 setup_preset(codec, &alc262_presets[board_config]);
13040 spec->stream_analog_playback = &alc262_pcm_analog_playback;
13041 spec->stream_analog_capture = &alc262_pcm_analog_capture;
13043 spec->stream_digital_playback = &alc262_pcm_digital_playback;
13044 spec->stream_digital_capture = &alc262_pcm_digital_capture;
13046 if (!spec->adc_nids && spec->input_mux) {
13048 /* check whether the digital-mic has to be supported */
13049 for (i = 0; i < spec->input_mux->num_items; i++) {
13050 if (spec->input_mux->items[i].index >= 9)
13053 if (i < spec->input_mux->num_items) {
13054 /* use only ADC0 */
13055 spec->adc_nids = alc262_dmic_adc_nids;
13056 spec->num_adc_nids = 1;
13057 spec->capsrc_nids = alc262_dmic_capsrc_nids;
13059 /* all analog inputs */
13060 /* check whether NID 0x07 is valid */
13061 unsigned int wcap = get_wcaps(codec, 0x07);
13064 wcap = get_wcaps_type(wcap);
13065 if (wcap != AC_WID_AUD_IN) {
13066 spec->adc_nids = alc262_adc_nids_alt;
13067 spec->num_adc_nids =
13068 ARRAY_SIZE(alc262_adc_nids_alt);
13069 spec->capsrc_nids = alc262_capsrc_nids_alt;
13071 spec->adc_nids = alc262_adc_nids;
13072 spec->num_adc_nids =
13073 ARRAY_SIZE(alc262_adc_nids);
13074 spec->capsrc_nids = alc262_capsrc_nids;
13078 if (!spec->cap_mixer && !spec->no_analog)
13079 set_capture_mixer(codec);
13080 if (!spec->no_analog && has_cdefine_beep(codec))
13081 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
13083 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
13085 spec->vmaster_nid = 0x0c;
13087 codec->patch_ops = alc_patch_ops;
13088 if (board_config == ALC262_AUTO)
13089 spec->init_hook = alc262_auto_init;
13091 alc_init_jacks(codec);
13092 #ifdef CONFIG_SND_HDA_POWER_SAVE
13093 if (!spec->loopback.amplist)
13094 spec->loopback.amplist = alc262_loopbacks;
13101 * ALC268 channel source setting (2 channel)
13103 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
13104 #define alc268_modes alc260_modes
13106 static hda_nid_t alc268_dac_nids[2] = {
13111 static hda_nid_t alc268_adc_nids[2] = {
13116 static hda_nid_t alc268_adc_nids_alt[1] = {
13121 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
13123 static struct snd_kcontrol_new alc268_base_mixer[] = {
13124 /* output mixer control */
13125 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13126 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13127 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13128 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13129 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13130 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
13131 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
13135 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
13136 /* output mixer control */
13137 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13138 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13139 ALC262_HIPPO_MASTER_SWITCH,
13140 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13141 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
13142 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
13146 /* bind Beep switches of both NID 0x0f and 0x10 */
13147 static struct hda_bind_ctls alc268_bind_beep_sw = {
13148 .ops = &snd_hda_bind_sw,
13150 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
13151 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
13156 static struct snd_kcontrol_new alc268_beep_mixer[] = {
13157 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
13158 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
13162 static struct hda_verb alc268_eapd_verbs[] = {
13163 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13164 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13168 /* Toshiba specific */
13169 static struct hda_verb alc268_toshiba_verbs[] = {
13170 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13174 /* Acer specific */
13175 /* bind volumes of both NID 0x02 and 0x03 */
13176 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
13177 .ops = &snd_hda_bind_vol,
13179 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
13180 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
13185 /* mute/unmute internal speaker according to the hp jack and mute state */
13186 static void alc268_acer_automute(struct hda_codec *codec, int force)
13188 struct alc_spec *spec = codec->spec;
13191 if (force || !spec->sense_updated) {
13192 spec->jack_present = snd_hda_jack_detect(codec, 0x14);
13193 spec->sense_updated = 1;
13195 if (spec->jack_present)
13196 mute = HDA_AMP_MUTE; /* mute internal speaker */
13197 else /* unmute internal speaker if necessary */
13198 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
13199 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
13200 HDA_AMP_MUTE, mute);
13204 /* bind hp and internal speaker mute (with plug check) */
13205 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
13206 struct snd_ctl_elem_value *ucontrol)
13208 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
13209 long *valp = ucontrol->value.integer.value;
13212 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
13214 alc268_acer_automute(codec, 0);
13218 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
13219 /* output mixer control */
13220 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13222 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13223 .name = "Master Playback Switch",
13224 .subdevice = HDA_SUBDEV_AMP_FLAG,
13225 .info = snd_hda_mixer_amp_switch_info,
13226 .get = snd_hda_mixer_amp_switch_get,
13227 .put = alc268_acer_master_sw_put,
13228 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13230 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
13234 static struct snd_kcontrol_new alc268_acer_mixer[] = {
13235 /* output mixer control */
13236 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13238 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13239 .name = "Master Playback Switch",
13240 .subdevice = HDA_SUBDEV_AMP_FLAG,
13241 .info = snd_hda_mixer_amp_switch_info,
13242 .get = snd_hda_mixer_amp_switch_get,
13243 .put = alc268_acer_master_sw_put,
13244 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13246 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13247 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
13248 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
13252 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
13253 /* output mixer control */
13254 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13256 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13257 .name = "Master Playback Switch",
13258 .subdevice = HDA_SUBDEV_AMP_FLAG,
13259 .info = snd_hda_mixer_amp_switch_info,
13260 .get = snd_hda_mixer_amp_switch_get,
13261 .put = alc268_acer_master_sw_put,
13262 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13264 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13265 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
13269 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
13270 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13271 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13272 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13273 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13274 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
13275 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
13279 static struct hda_verb alc268_acer_verbs[] = {
13280 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
13281 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13282 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13283 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13284 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13285 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13286 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13290 /* unsolicited event for HP jack sensing */
13291 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
13292 #define alc268_toshiba_setup alc262_hippo_setup
13293 #define alc268_toshiba_automute alc262_hippo_automute
13295 static void alc268_acer_unsol_event(struct hda_codec *codec,
13298 if ((res >> 26) != ALC880_HP_EVENT)
13300 alc268_acer_automute(codec, 1);
13303 static void alc268_acer_init_hook(struct hda_codec *codec)
13305 alc268_acer_automute(codec, 1);
13308 /* toggle speaker-output according to the hp-jack state */
13309 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
13311 unsigned int present;
13312 unsigned char bits;
13314 present = snd_hda_jack_detect(codec, 0x15);
13315 bits = present ? HDA_AMP_MUTE : 0;
13316 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
13317 HDA_AMP_MUTE, bits);
13318 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
13319 HDA_AMP_MUTE, bits);
13322 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
13325 switch (res >> 26) {
13326 case ALC880_HP_EVENT:
13327 alc268_aspire_one_speaker_automute(codec);
13329 case ALC880_MIC_EVENT:
13330 alc_mic_automute(codec);
13335 static void alc268_acer_lc_setup(struct hda_codec *codec)
13337 struct alc_spec *spec = codec->spec;
13338 spec->ext_mic.pin = 0x18;
13339 spec->ext_mic.mux_idx = 0;
13340 spec->int_mic.pin = 0x12;
13341 spec->int_mic.mux_idx = 6;
13342 spec->auto_mic = 1;
13345 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
13347 alc268_aspire_one_speaker_automute(codec);
13348 alc_mic_automute(codec);
13351 static struct snd_kcontrol_new alc268_dell_mixer[] = {
13352 /* output mixer control */
13353 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13354 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13355 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13356 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13357 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13358 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
13362 static struct hda_verb alc268_dell_verbs[] = {
13363 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13364 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13365 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13366 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
13370 /* mute/unmute internal speaker according to the hp jack and mute state */
13371 static void alc268_dell_setup(struct hda_codec *codec)
13373 struct alc_spec *spec = codec->spec;
13375 spec->autocfg.hp_pins[0] = 0x15;
13376 spec->autocfg.speaker_pins[0] = 0x14;
13377 spec->ext_mic.pin = 0x18;
13378 spec->ext_mic.mux_idx = 0;
13379 spec->int_mic.pin = 0x19;
13380 spec->int_mic.mux_idx = 1;
13381 spec->auto_mic = 1;
13384 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
13385 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13386 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13387 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13388 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13389 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13390 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
13391 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13392 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
13396 static struct hda_verb alc267_quanta_il1_verbs[] = {
13397 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13398 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
13402 static void alc267_quanta_il1_setup(struct hda_codec *codec)
13404 struct alc_spec *spec = codec->spec;
13405 spec->autocfg.hp_pins[0] = 0x15;
13406 spec->autocfg.speaker_pins[0] = 0x14;
13407 spec->ext_mic.pin = 0x18;
13408 spec->ext_mic.mux_idx = 0;
13409 spec->int_mic.pin = 0x19;
13410 spec->int_mic.mux_idx = 1;
13411 spec->auto_mic = 1;
13415 * generic initialization of ADC, input mixers and output mixers
13417 static struct hda_verb alc268_base_init_verbs[] = {
13418 /* Unmute DAC0-1 and set vol = 0 */
13419 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13420 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13423 * Set up output mixers (0x0c - 0x0e)
13425 /* set vol=0 to output mixers */
13426 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13427 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
13429 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13430 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13432 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
13433 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
13434 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
13435 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13436 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13437 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13438 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13439 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13441 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13442 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13443 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13444 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13445 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13447 /* set PCBEEP vol = 0, mute connections */
13448 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13449 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13450 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13452 /* Unmute Selector 23h,24h and set the default input to mic-in */
13454 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
13455 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13456 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
13457 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13463 * generic initialization of ADC, input mixers and output mixers
13465 static struct hda_verb alc268_volume_init_verbs[] = {
13466 /* set output DAC */
13467 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13468 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13470 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13471 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13472 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13473 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13474 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13476 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13477 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13478 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13480 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13481 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13483 /* set PCBEEP vol = 0, mute connections */
13484 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13485 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13486 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13491 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
13492 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13493 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13497 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
13498 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13499 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13504 static struct snd_kcontrol_new alc268_capture_mixer[] = {
13505 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13506 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13507 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
13508 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
13513 static struct hda_input_mux alc268_capture_source = {
13517 { "Front Mic", 0x1 },
13523 static struct hda_input_mux alc268_acer_capture_source = {
13527 { "Internal Mic", 0x1 },
13532 static struct hda_input_mux alc268_acer_dmic_capture_source = {
13536 { "Internal Mic", 0x6 },
13541 #ifdef CONFIG_SND_DEBUG
13542 static struct snd_kcontrol_new alc268_test_mixer[] = {
13543 /* Volume widgets */
13544 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13545 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13546 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
13547 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
13548 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
13549 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
13550 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
13551 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
13552 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
13553 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
13554 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
13555 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
13556 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
13557 /* The below appears problematic on some hardwares */
13558 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
13559 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13560 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
13561 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
13562 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
13564 /* Modes for retasking pin widgets */
13565 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
13566 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
13567 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
13568 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
13570 /* Controls for GPIO pins, assuming they are configured as outputs */
13571 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
13572 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
13573 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
13574 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
13576 /* Switches to allow the digital SPDIF output pin to be enabled.
13577 * The ALC268 does not have an SPDIF input.
13579 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
13581 /* A switch allowing EAPD to be enabled. Some laptops seem to use
13582 * this output to turn on an external amplifier.
13584 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
13585 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
13591 /* create input playback/capture controls for the given pin */
13592 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
13593 const char *ctlname, int idx)
13604 case 0x1a: /* ALC259/269 only */
13605 case 0x1b: /* ALC259/269 only */
13606 case 0x21: /* ALC269vb has this pin, too */
13610 snd_printd(KERN_WARNING "hda_codec: "
13611 "ignoring pin 0x%x as unknown\n", nid);
13614 if (spec->multiout.dac_nids[0] != dac &&
13615 spec->multiout.dac_nids[1] != dac) {
13616 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
13617 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
13621 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
13625 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
13626 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
13628 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
13629 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
13635 /* add playback controls from the parsed DAC table */
13636 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
13637 const struct auto_pin_cfg *cfg)
13642 spec->multiout.dac_nids = spec->private_dac_nids;
13644 nid = cfg->line_out_pins[0];
13647 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
13651 err = alc268_new_analog_output(spec, nid, name, 0);
13656 nid = cfg->speaker_pins[0];
13658 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
13659 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
13663 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
13667 nid = cfg->hp_pins[0];
13669 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
13674 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
13676 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
13677 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
13684 /* create playback/capture controls for input pins */
13685 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
13686 const struct auto_pin_cfg *cfg)
13688 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
13691 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
13692 hda_nid_t nid, int pin_type)
13696 alc_set_pin_output(codec, nid, pin_type);
13697 if (nid == 0x14 || nid == 0x16)
13701 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
13704 static void alc268_auto_init_multi_out(struct hda_codec *codec)
13706 struct alc_spec *spec = codec->spec;
13709 for (i = 0; i < spec->autocfg.line_outs; i++) {
13710 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13711 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13712 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
13716 static void alc268_auto_init_hp_out(struct hda_codec *codec)
13718 struct alc_spec *spec = codec->spec;
13722 for (i = 0; i < spec->autocfg.hp_outs; i++) {
13723 pin = spec->autocfg.hp_pins[i];
13724 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
13726 for (i = 0; i < spec->autocfg.speaker_outs; i++) {
13727 pin = spec->autocfg.speaker_pins[i];
13728 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
13730 if (spec->autocfg.mono_out_pin)
13731 snd_hda_codec_write(codec, spec->autocfg.mono_out_pin, 0,
13732 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
13735 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
13737 struct alc_spec *spec = codec->spec;
13738 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
13739 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
13740 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
13741 unsigned int dac_vol1, dac_vol2;
13743 if (line_nid == 0x1d || speaker_nid == 0x1d) {
13744 snd_hda_codec_write(codec, speaker_nid, 0,
13745 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
13746 /* mute mixer inputs from 0x1d */
13747 snd_hda_codec_write(codec, 0x0f, 0,
13748 AC_VERB_SET_AMP_GAIN_MUTE,
13750 snd_hda_codec_write(codec, 0x10, 0,
13751 AC_VERB_SET_AMP_GAIN_MUTE,
13754 /* unmute mixer inputs from 0x1d */
13755 snd_hda_codec_write(codec, 0x0f, 0,
13756 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13757 snd_hda_codec_write(codec, 0x10, 0,
13758 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13761 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
13762 if (line_nid == 0x14)
13763 dac_vol2 = AMP_OUT_ZERO;
13764 else if (line_nid == 0x15)
13765 dac_vol1 = AMP_OUT_ZERO;
13766 if (hp_nid == 0x14)
13767 dac_vol2 = AMP_OUT_ZERO;
13768 else if (hp_nid == 0x15)
13769 dac_vol1 = AMP_OUT_ZERO;
13770 if (line_nid != 0x16 || hp_nid != 0x16 ||
13771 spec->autocfg.line_out_pins[1] != 0x16 ||
13772 spec->autocfg.line_out_pins[2] != 0x16)
13773 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
13775 snd_hda_codec_write(codec, 0x02, 0,
13776 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
13777 snd_hda_codec_write(codec, 0x03, 0,
13778 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
13781 /* pcm configuration: identical with ALC880 */
13782 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
13783 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
13784 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
13785 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
13788 * BIOS auto configuration
13790 static int alc268_parse_auto_config(struct hda_codec *codec)
13792 struct alc_spec *spec = codec->spec;
13794 static hda_nid_t alc268_ignore[] = { 0 };
13796 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13800 if (!spec->autocfg.line_outs) {
13801 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
13802 spec->multiout.max_channels = 2;
13803 spec->no_analog = 1;
13806 return 0; /* can't find valid BIOS pin config */
13808 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
13811 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
13815 spec->multiout.max_channels = 2;
13818 /* digital only support output */
13819 alc_auto_parse_digital(codec);
13820 if (spec->kctls.list)
13821 add_mixer(spec, spec->kctls.list);
13823 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
13824 add_mixer(spec, alc268_beep_mixer);
13826 add_verb(spec, alc268_volume_init_verbs);
13827 spec->num_mux_defs = 2;
13828 spec->input_mux = &spec->private_imux[0];
13830 err = alc_auto_add_mic_boost(codec);
13834 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
13839 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
13841 /* init callback for auto-configuration model -- overriding the default init */
13842 static void alc268_auto_init(struct hda_codec *codec)
13844 struct alc_spec *spec = codec->spec;
13845 alc268_auto_init_multi_out(codec);
13846 alc268_auto_init_hp_out(codec);
13847 alc268_auto_init_mono_speaker_out(codec);
13848 alc268_auto_init_analog_input(codec);
13849 alc_auto_init_digital(codec);
13850 if (spec->unsol_event)
13851 alc_inithook(codec);
13855 * configuration and preset
13857 static const char * const alc268_models[ALC268_MODEL_LAST] = {
13858 [ALC267_QUANTA_IL1] = "quanta-il1",
13859 [ALC268_3ST] = "3stack",
13860 [ALC268_TOSHIBA] = "toshiba",
13861 [ALC268_ACER] = "acer",
13862 [ALC268_ACER_DMIC] = "acer-dmic",
13863 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
13864 [ALC268_DELL] = "dell",
13865 [ALC268_ZEPTO] = "zepto",
13866 #ifdef CONFIG_SND_DEBUG
13867 [ALC268_TEST] = "test",
13869 [ALC268_AUTO] = "auto",
13872 static struct snd_pci_quirk alc268_cfg_tbl[] = {
13873 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
13874 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
13875 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
13876 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
13877 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
13878 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
13879 ALC268_ACER_ASPIRE_ONE),
13880 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
13881 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
13882 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
13883 /* almost compatible with toshiba but with optional digital outs;
13884 * auto-probing seems working fine
13886 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
13888 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
13889 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
13890 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
13891 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
13892 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
13896 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
13897 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
13898 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
13899 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
13900 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
13905 static struct alc_config_preset alc268_presets[] = {
13906 [ALC267_QUANTA_IL1] = {
13907 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
13908 alc268_capture_nosrc_mixer },
13909 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13910 alc267_quanta_il1_verbs },
13911 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13912 .dac_nids = alc268_dac_nids,
13913 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13914 .adc_nids = alc268_adc_nids_alt,
13916 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13917 .channel_mode = alc268_modes,
13918 .unsol_event = alc_sku_unsol_event,
13919 .setup = alc267_quanta_il1_setup,
13920 .init_hook = alc_inithook,
13923 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13924 alc268_beep_mixer },
13925 .init_verbs = { alc268_base_init_verbs },
13926 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13927 .dac_nids = alc268_dac_nids,
13928 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13929 .adc_nids = alc268_adc_nids_alt,
13930 .capsrc_nids = alc268_capsrc_nids,
13932 .dig_out_nid = ALC268_DIGOUT_NID,
13933 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13934 .channel_mode = alc268_modes,
13935 .input_mux = &alc268_capture_source,
13937 [ALC268_TOSHIBA] = {
13938 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
13939 alc268_beep_mixer },
13940 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13941 alc268_toshiba_verbs },
13942 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13943 .dac_nids = alc268_dac_nids,
13944 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13945 .adc_nids = alc268_adc_nids_alt,
13946 .capsrc_nids = alc268_capsrc_nids,
13948 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13949 .channel_mode = alc268_modes,
13950 .input_mux = &alc268_capture_source,
13951 .unsol_event = alc268_toshiba_unsol_event,
13952 .setup = alc268_toshiba_setup,
13953 .init_hook = alc268_toshiba_automute,
13956 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
13957 alc268_beep_mixer },
13958 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13959 alc268_acer_verbs },
13960 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13961 .dac_nids = alc268_dac_nids,
13962 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13963 .adc_nids = alc268_adc_nids_alt,
13964 .capsrc_nids = alc268_capsrc_nids,
13966 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13967 .channel_mode = alc268_modes,
13968 .input_mux = &alc268_acer_capture_source,
13969 .unsol_event = alc268_acer_unsol_event,
13970 .init_hook = alc268_acer_init_hook,
13972 [ALC268_ACER_DMIC] = {
13973 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
13974 alc268_beep_mixer },
13975 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13976 alc268_acer_verbs },
13977 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13978 .dac_nids = alc268_dac_nids,
13979 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13980 .adc_nids = alc268_adc_nids_alt,
13981 .capsrc_nids = alc268_capsrc_nids,
13983 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13984 .channel_mode = alc268_modes,
13985 .input_mux = &alc268_acer_dmic_capture_source,
13986 .unsol_event = alc268_acer_unsol_event,
13987 .init_hook = alc268_acer_init_hook,
13989 [ALC268_ACER_ASPIRE_ONE] = {
13990 .mixers = { alc268_acer_aspire_one_mixer,
13992 alc268_capture_nosrc_mixer },
13993 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13994 alc268_acer_aspire_one_verbs },
13995 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13996 .dac_nids = alc268_dac_nids,
13997 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13998 .adc_nids = alc268_adc_nids_alt,
13999 .capsrc_nids = alc268_capsrc_nids,
14001 .num_channel_mode = ARRAY_SIZE(alc268_modes),
14002 .channel_mode = alc268_modes,
14003 .unsol_event = alc268_acer_lc_unsol_event,
14004 .setup = alc268_acer_lc_setup,
14005 .init_hook = alc268_acer_lc_init_hook,
14008 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
14009 alc268_capture_nosrc_mixer },
14010 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
14011 alc268_dell_verbs },
14012 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
14013 .dac_nids = alc268_dac_nids,
14014 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
14015 .adc_nids = alc268_adc_nids_alt,
14016 .capsrc_nids = alc268_capsrc_nids,
14018 .num_channel_mode = ARRAY_SIZE(alc268_modes),
14019 .channel_mode = alc268_modes,
14020 .unsol_event = alc_sku_unsol_event,
14021 .setup = alc268_dell_setup,
14022 .init_hook = alc_inithook,
14025 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
14026 alc268_beep_mixer },
14027 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
14028 alc268_toshiba_verbs },
14029 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
14030 .dac_nids = alc268_dac_nids,
14031 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
14032 .adc_nids = alc268_adc_nids_alt,
14033 .capsrc_nids = alc268_capsrc_nids,
14035 .dig_out_nid = ALC268_DIGOUT_NID,
14036 .num_channel_mode = ARRAY_SIZE(alc268_modes),
14037 .channel_mode = alc268_modes,
14038 .input_mux = &alc268_capture_source,
14039 .setup = alc268_toshiba_setup,
14040 .init_hook = alc268_toshiba_automute,
14042 #ifdef CONFIG_SND_DEBUG
14044 .mixers = { alc268_test_mixer, alc268_capture_mixer },
14045 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
14046 alc268_volume_init_verbs },
14047 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
14048 .dac_nids = alc268_dac_nids,
14049 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
14050 .adc_nids = alc268_adc_nids_alt,
14051 .capsrc_nids = alc268_capsrc_nids,
14053 .dig_out_nid = ALC268_DIGOUT_NID,
14054 .num_channel_mode = ARRAY_SIZE(alc268_modes),
14055 .channel_mode = alc268_modes,
14056 .input_mux = &alc268_capture_source,
14061 static int patch_alc268(struct hda_codec *codec)
14063 struct alc_spec *spec;
14065 int i, has_beep, err;
14067 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14071 codec->spec = spec;
14073 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
14077 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
14078 board_config = snd_hda_check_board_codec_sid_config(codec,
14079 ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
14081 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
14082 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14084 board_config = ALC268_AUTO;
14087 if (board_config == ALC268_AUTO) {
14088 /* automatic parse from the BIOS config */
14089 err = alc268_parse_auto_config(codec);
14095 "hda_codec: Cannot set up configuration "
14096 "from BIOS. Using base mode...\n");
14097 board_config = ALC268_3ST;
14101 if (board_config != ALC268_AUTO)
14102 setup_preset(codec, &alc268_presets[board_config]);
14104 spec->stream_analog_playback = &alc268_pcm_analog_playback;
14105 spec->stream_analog_capture = &alc268_pcm_analog_capture;
14106 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
14108 spec->stream_digital_playback = &alc268_pcm_digital_playback;
14111 for (i = 0; i < spec->num_mixers; i++) {
14112 if (spec->mixers[i] == alc268_beep_mixer) {
14119 err = snd_hda_attach_beep_device(codec, 0x1);
14124 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
14125 /* override the amp caps for beep generator */
14126 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
14127 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
14128 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
14129 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
14130 (0 << AC_AMPCAP_MUTE_SHIFT));
14133 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
14134 /* check whether NID 0x07 is valid */
14135 unsigned int wcap = get_wcaps(codec, 0x07);
14138 spec->capsrc_nids = alc268_capsrc_nids;
14140 wcap = get_wcaps_type(wcap);
14141 if (spec->auto_mic ||
14142 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
14143 spec->adc_nids = alc268_adc_nids_alt;
14144 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
14145 if (spec->auto_mic)
14146 fixup_automic_adc(codec);
14147 if (spec->auto_mic || spec->input_mux->num_items == 1)
14148 add_mixer(spec, alc268_capture_nosrc_mixer);
14150 add_mixer(spec, alc268_capture_alt_mixer);
14152 spec->adc_nids = alc268_adc_nids;
14153 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
14154 add_mixer(spec, alc268_capture_mixer);
14156 /* set default input source */
14157 for (i = 0; i < spec->num_adc_nids; i++)
14158 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
14159 0, AC_VERB_SET_CONNECT_SEL,
14160 i < spec->num_mux_defs ?
14161 spec->input_mux[i].items[0].index :
14162 spec->input_mux->items[0].index);
14165 spec->vmaster_nid = 0x02;
14167 codec->patch_ops = alc_patch_ops;
14168 if (board_config == ALC268_AUTO)
14169 spec->init_hook = alc268_auto_init;
14171 alc_init_jacks(codec);
14177 * ALC269 channel source setting (2 channel)
14179 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
14181 #define alc269_dac_nids alc260_dac_nids
14183 static hda_nid_t alc269_adc_nids[1] = {
14188 static hda_nid_t alc269_capsrc_nids[1] = {
14192 static hda_nid_t alc269vb_adc_nids[1] = {
14197 static hda_nid_t alc269vb_capsrc_nids[1] = {
14201 static hda_nid_t alc269_adc_candidates[] = {
14202 0x08, 0x09, 0x07, 0x11,
14205 #define alc269_modes alc260_modes
14206 #define alc269_capture_source alc880_lg_lw_capture_source
14208 static struct snd_kcontrol_new alc269_base_mixer[] = {
14209 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14210 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14211 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14212 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14213 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14214 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14215 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14216 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
14217 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
14218 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
14219 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14220 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
14224 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
14225 /* output mixer control */
14226 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
14228 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14229 .name = "Master Playback Switch",
14230 .subdevice = HDA_SUBDEV_AMP_FLAG,
14231 .info = snd_hda_mixer_amp_switch_info,
14232 .get = snd_hda_mixer_amp_switch_get,
14233 .put = alc268_acer_master_sw_put,
14234 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14236 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14237 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14238 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14239 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
14240 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
14241 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
14245 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
14246 /* output mixer control */
14247 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
14249 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14250 .name = "Master Playback Switch",
14251 .subdevice = HDA_SUBDEV_AMP_FLAG,
14252 .info = snd_hda_mixer_amp_switch_info,
14253 .get = snd_hda_mixer_amp_switch_get,
14254 .put = alc268_acer_master_sw_put,
14255 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14257 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14258 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14259 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14260 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
14261 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
14262 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
14263 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
14264 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
14265 HDA_CODEC_VOLUME("Dock Mic Boost Volume", 0x1b, 0, HDA_INPUT),
14269 static struct snd_kcontrol_new alc269_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", 0x15, 0x0, HDA_OUTPUT),
14273 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14277 static struct snd_kcontrol_new alc269vb_laptop_mixer[] = {
14278 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14279 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14280 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
14281 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14285 static struct snd_kcontrol_new alc269_asus_mixer[] = {
14286 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14287 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x0, HDA_INPUT),
14291 /* capture mixer elements */
14292 static struct snd_kcontrol_new alc269_laptop_analog_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),
14296 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
14300 static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = {
14301 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
14302 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
14303 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14307 static struct snd_kcontrol_new alc269vb_laptop_analog_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),
14311 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
14315 static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = {
14316 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
14317 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
14318 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14323 #define alc269_fujitsu_mixer alc269_laptop_mixer
14325 static struct hda_verb alc269_quanta_fl1_verbs[] = {
14326 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14327 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14328 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14329 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
14330 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14331 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14335 static struct hda_verb alc269_lifebook_verbs[] = {
14336 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14337 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
14338 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14339 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14340 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
14341 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14342 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14343 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
14344 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14345 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14349 /* toggle speaker-output according to the hp-jack state */
14350 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
14352 unsigned int present;
14353 unsigned char bits;
14355 present = snd_hda_jack_detect(codec, 0x15);
14356 bits = present ? HDA_AMP_MUTE : 0;
14357 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14358 HDA_AMP_MUTE, bits);
14359 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14360 HDA_AMP_MUTE, bits);
14362 snd_hda_codec_write(codec, 0x20, 0,
14363 AC_VERB_SET_COEF_INDEX, 0x0c);
14364 snd_hda_codec_write(codec, 0x20, 0,
14365 AC_VERB_SET_PROC_COEF, 0x680);
14367 snd_hda_codec_write(codec, 0x20, 0,
14368 AC_VERB_SET_COEF_INDEX, 0x0c);
14369 snd_hda_codec_write(codec, 0x20, 0,
14370 AC_VERB_SET_PROC_COEF, 0x480);
14373 /* toggle speaker-output according to the hp-jacks state */
14374 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
14376 unsigned int present;
14377 unsigned char bits;
14379 /* Check laptop headphone socket */
14380 present = snd_hda_jack_detect(codec, 0x15);
14382 /* Check port replicator headphone socket */
14383 present |= snd_hda_jack_detect(codec, 0x1a);
14385 bits = present ? HDA_AMP_MUTE : 0;
14386 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14387 HDA_AMP_MUTE, bits);
14388 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14389 HDA_AMP_MUTE, bits);
14391 snd_hda_codec_write(codec, 0x20, 0,
14392 AC_VERB_SET_COEF_INDEX, 0x0c);
14393 snd_hda_codec_write(codec, 0x20, 0,
14394 AC_VERB_SET_PROC_COEF, 0x680);
14396 snd_hda_codec_write(codec, 0x20, 0,
14397 AC_VERB_SET_COEF_INDEX, 0x0c);
14398 snd_hda_codec_write(codec, 0x20, 0,
14399 AC_VERB_SET_PROC_COEF, 0x480);
14402 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
14404 unsigned int present_laptop;
14405 unsigned int present_dock;
14407 present_laptop = snd_hda_jack_detect(codec, 0x18);
14408 present_dock = snd_hda_jack_detect(codec, 0x1b);
14410 /* Laptop mic port overrides dock mic port, design decision */
14412 snd_hda_codec_write(codec, 0x23, 0,
14413 AC_VERB_SET_CONNECT_SEL, 0x3);
14414 if (present_laptop)
14415 snd_hda_codec_write(codec, 0x23, 0,
14416 AC_VERB_SET_CONNECT_SEL, 0x0);
14417 if (!present_dock && !present_laptop)
14418 snd_hda_codec_write(codec, 0x23, 0,
14419 AC_VERB_SET_CONNECT_SEL, 0x1);
14422 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
14425 switch (res >> 26) {
14426 case ALC880_HP_EVENT:
14427 alc269_quanta_fl1_speaker_automute(codec);
14429 case ALC880_MIC_EVENT:
14430 alc_mic_automute(codec);
14435 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
14438 if ((res >> 26) == ALC880_HP_EVENT)
14439 alc269_lifebook_speaker_automute(codec);
14440 if ((res >> 26) == ALC880_MIC_EVENT)
14441 alc269_lifebook_mic_autoswitch(codec);
14444 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
14446 struct alc_spec *spec = codec->spec;
14447 spec->autocfg.hp_pins[0] = 0x15;
14448 spec->autocfg.speaker_pins[0] = 0x14;
14449 spec->ext_mic.pin = 0x18;
14450 spec->ext_mic.mux_idx = 0;
14451 spec->int_mic.pin = 0x19;
14452 spec->int_mic.mux_idx = 1;
14453 spec->auto_mic = 1;
14456 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
14458 alc269_quanta_fl1_speaker_automute(codec);
14459 alc_mic_automute(codec);
14462 static void alc269_lifebook_init_hook(struct hda_codec *codec)
14464 alc269_lifebook_speaker_automute(codec);
14465 alc269_lifebook_mic_autoswitch(codec);
14468 static struct hda_verb alc269_laptop_dmic_init_verbs[] = {
14469 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14470 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
14471 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14472 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14473 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14474 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14475 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14479 static struct hda_verb alc269_laptop_amic_init_verbs[] = {
14480 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14481 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
14482 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14483 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
14484 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14485 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14489 static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = {
14490 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
14491 {0x22, AC_VERB_SET_CONNECT_SEL, 0x06},
14492 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14493 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14494 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14495 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14496 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14500 static struct hda_verb alc269vb_laptop_amic_init_verbs[] = {
14501 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
14502 {0x22, AC_VERB_SET_CONNECT_SEL, 0x01},
14503 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14504 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14505 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14506 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14507 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14511 static struct hda_verb alc271_acer_dmic_verbs[] = {
14512 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
14513 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
14514 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14515 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14516 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14517 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14518 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00},
14519 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14520 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14521 {0x22, AC_VERB_SET_CONNECT_SEL, 6},
14525 /* toggle speaker-output according to the hp-jack state */
14526 static void alc269_speaker_automute(struct hda_codec *codec)
14528 struct alc_spec *spec = codec->spec;
14529 unsigned int nid = spec->autocfg.hp_pins[0];
14530 unsigned int present;
14531 unsigned char bits;
14533 present = snd_hda_jack_detect(codec, nid);
14534 bits = present ? HDA_AMP_MUTE : 0;
14535 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14536 HDA_AMP_MUTE, bits);
14537 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14538 HDA_AMP_MUTE, bits);
14539 alc_report_jack(codec, nid);
14542 /* unsolicited event for HP jack sensing */
14543 static void alc269_laptop_unsol_event(struct hda_codec *codec,
14546 switch (res >> 26) {
14547 case ALC880_HP_EVENT:
14548 alc269_speaker_automute(codec);
14550 case ALC880_MIC_EVENT:
14551 alc_mic_automute(codec);
14556 static void alc269_laptop_amic_setup(struct hda_codec *codec)
14558 struct alc_spec *spec = codec->spec;
14559 spec->autocfg.hp_pins[0] = 0x15;
14560 spec->autocfg.speaker_pins[0] = 0x14;
14561 spec->ext_mic.pin = 0x18;
14562 spec->ext_mic.mux_idx = 0;
14563 spec->int_mic.pin = 0x19;
14564 spec->int_mic.mux_idx = 1;
14565 spec->auto_mic = 1;
14568 static void alc269_laptop_dmic_setup(struct hda_codec *codec)
14570 struct alc_spec *spec = codec->spec;
14571 spec->autocfg.hp_pins[0] = 0x15;
14572 spec->autocfg.speaker_pins[0] = 0x14;
14573 spec->ext_mic.pin = 0x18;
14574 spec->ext_mic.mux_idx = 0;
14575 spec->int_mic.pin = 0x12;
14576 spec->int_mic.mux_idx = 5;
14577 spec->auto_mic = 1;
14580 static void alc269vb_laptop_amic_setup(struct hda_codec *codec)
14582 struct alc_spec *spec = codec->spec;
14583 spec->autocfg.hp_pins[0] = 0x21;
14584 spec->autocfg.speaker_pins[0] = 0x14;
14585 spec->ext_mic.pin = 0x18;
14586 spec->ext_mic.mux_idx = 0;
14587 spec->int_mic.pin = 0x19;
14588 spec->int_mic.mux_idx = 1;
14589 spec->auto_mic = 1;
14592 static void alc269vb_laptop_dmic_setup(struct hda_codec *codec)
14594 struct alc_spec *spec = codec->spec;
14595 spec->autocfg.hp_pins[0] = 0x21;
14596 spec->autocfg.speaker_pins[0] = 0x14;
14597 spec->ext_mic.pin = 0x18;
14598 spec->ext_mic.mux_idx = 0;
14599 spec->int_mic.pin = 0x12;
14600 spec->int_mic.mux_idx = 6;
14601 spec->auto_mic = 1;
14604 static void alc269_laptop_inithook(struct hda_codec *codec)
14606 alc269_speaker_automute(codec);
14607 alc_mic_automute(codec);
14611 * generic initialization of ADC, input mixers and output mixers
14613 static struct hda_verb alc269_init_verbs[] = {
14615 * Unmute ADC0 and set the default input to mic-in
14617 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14620 * Set up output mixers (0x02 - 0x03)
14622 /* set vol=0 to output mixers */
14623 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14624 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14626 /* set up input amps for analog loopback */
14627 /* Amp Indices: DAC = 0, mixer = 1 */
14628 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14629 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14630 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14631 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14632 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14633 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14635 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14636 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14637 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14638 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14639 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14640 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14641 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14643 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14644 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14646 /* FIXME: use Mux-type input source selection */
14647 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14648 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14649 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
14652 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14656 static struct hda_verb alc269vb_init_verbs[] = {
14658 * Unmute ADC0 and set the default input to mic-in
14660 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14663 * Set up output mixers (0x02 - 0x03)
14665 /* set vol=0 to output mixers */
14666 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14667 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14669 /* set up input amps for analog loopback */
14670 /* Amp Indices: DAC = 0, mixer = 1 */
14671 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14672 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14673 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14674 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14675 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14676 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14678 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14679 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14680 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14681 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14682 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14683 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14684 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14686 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14687 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14689 /* FIXME: use Mux-type input source selection */
14690 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14691 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14692 {0x22, AC_VERB_SET_CONNECT_SEL, 0x00},
14695 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14699 #define alc269_auto_create_multi_out_ctls \
14700 alc268_auto_create_multi_out_ctls
14701 #define alc269_auto_create_input_ctls \
14702 alc268_auto_create_input_ctls
14704 #ifdef CONFIG_SND_HDA_POWER_SAVE
14705 #define alc269_loopbacks alc880_loopbacks
14708 /* pcm configuration: identical with ALC880 */
14709 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
14710 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
14711 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
14712 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
14714 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
14718 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14719 /* NID is set in alc_build_pcms */
14721 .open = alc880_playback_pcm_open,
14722 .prepare = alc880_playback_pcm_prepare,
14723 .cleanup = alc880_playback_pcm_cleanup
14727 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
14731 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14732 /* NID is set in alc_build_pcms */
14735 #ifdef CONFIG_SND_HDA_POWER_SAVE
14736 static int alc269_mic2_for_mute_led(struct hda_codec *codec)
14738 switch (codec->subsystem_id) {
14745 static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid)
14747 /* update mute-LED according to the speaker mute state */
14748 if (nid == 0x01 || nid == 0x14) {
14750 if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) &
14755 /* mic2 vref pin is used for mute LED control */
14756 snd_hda_codec_update_cache(codec, 0x19, 0,
14757 AC_VERB_SET_PIN_WIDGET_CONTROL,
14760 return alc_check_power_status(codec, nid);
14762 #endif /* CONFIG_SND_HDA_POWER_SAVE */
14764 static int alc275_setup_dual_adc(struct hda_codec *codec)
14766 struct alc_spec *spec = codec->spec;
14768 if (codec->vendor_id != 0x10ec0275 || !spec->auto_mic)
14770 if ((spec->ext_mic.pin >= 0x18 && spec->int_mic.pin <= 0x13) ||
14771 (spec->ext_mic.pin <= 0x12 && spec->int_mic.pin >= 0x18)) {
14772 if (spec->ext_mic.pin <= 0x12) {
14773 spec->private_adc_nids[0] = 0x08;
14774 spec->private_adc_nids[1] = 0x11;
14775 spec->private_capsrc_nids[0] = 0x23;
14776 spec->private_capsrc_nids[1] = 0x22;
14778 spec->private_adc_nids[0] = 0x11;
14779 spec->private_adc_nids[1] = 0x08;
14780 spec->private_capsrc_nids[0] = 0x22;
14781 spec->private_capsrc_nids[1] = 0x23;
14783 spec->adc_nids = spec->private_adc_nids;
14784 spec->capsrc_nids = spec->private_capsrc_nids;
14785 spec->num_adc_nids = 2;
14786 spec->dual_adc_switch = 1;
14787 snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n",
14788 spec->adc_nids[0], spec->adc_nids[1]);
14794 /* different alc269-variants */
14796 ALC269_TYPE_NORMAL,
14797 ALC269_TYPE_ALC258,
14798 ALC269_TYPE_ALC259,
14799 ALC269_TYPE_ALC269VB,
14800 ALC269_TYPE_ALC270,
14801 ALC269_TYPE_ALC271X,
14805 * BIOS auto configuration
14807 static int alc269_parse_auto_config(struct hda_codec *codec)
14809 struct alc_spec *spec = codec->spec;
14811 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
14813 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14818 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
14821 if (spec->codec_variant == ALC269_TYPE_NORMAL)
14822 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
14824 err = alc_auto_create_input_ctls(codec, &spec->autocfg, 0,
14829 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14831 alc_auto_parse_digital(codec);
14833 if (spec->kctls.list)
14834 add_mixer(spec, spec->kctls.list);
14836 if (spec->codec_variant != ALC269_TYPE_NORMAL) {
14837 add_verb(spec, alc269vb_init_verbs);
14838 alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21);
14840 add_verb(spec, alc269_init_verbs);
14841 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
14844 spec->num_mux_defs = 1;
14845 spec->input_mux = &spec->private_imux[0];
14847 if (!alc275_setup_dual_adc(codec))
14848 fillup_priv_adc_nids(codec, alc269_adc_candidates,
14849 sizeof(alc269_adc_candidates));
14851 /* set default input source */
14852 if (!spec->dual_adc_switch)
14853 select_or_unmute_capsrc(codec, spec->capsrc_nids[0],
14854 spec->input_mux->items[0].index);
14856 err = alc_auto_add_mic_boost(codec);
14860 if (!spec->cap_mixer && !spec->no_analog)
14861 set_capture_mixer(codec);
14866 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
14867 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
14868 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
14871 /* init callback for auto-configuration model -- overriding the default init */
14872 static void alc269_auto_init(struct hda_codec *codec)
14874 struct alc_spec *spec = codec->spec;
14875 alc269_auto_init_multi_out(codec);
14876 alc269_auto_init_hp_out(codec);
14877 alc269_auto_init_analog_input(codec);
14878 alc_auto_init_digital(codec);
14879 if (spec->unsol_event)
14880 alc_inithook(codec);
14883 #ifdef SND_HDA_NEEDS_RESUME
14884 static void alc269_toggle_power_output(struct hda_codec *codec, int power_up)
14886 int val = alc_read_coef_idx(codec, 0x04);
14891 alc_write_coef_idx(codec, 0x04, val);
14894 #ifdef CONFIG_SND_HDA_POWER_SAVE
14895 static int alc269_suspend(struct hda_codec *codec, pm_message_t state)
14897 struct alc_spec *spec = codec->spec;
14899 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017)
14900 alc269_toggle_power_output(codec, 0);
14901 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
14902 alc269_toggle_power_output(codec, 0);
14907 if (spec && spec->power_hook)
14908 spec->power_hook(codec);
14911 #endif /* CONFIG_SND_HDA_POWER_SAVE */
14913 static int alc269_resume(struct hda_codec *codec)
14915 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
14916 alc269_toggle_power_output(codec, 0);
14920 codec->patch_ops.init(codec);
14922 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) {
14923 alc269_toggle_power_output(codec, 1);
14927 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018)
14928 alc269_toggle_power_output(codec, 1);
14930 snd_hda_codec_resume_amp(codec);
14931 snd_hda_codec_resume_cache(codec);
14932 hda_call_check_power_status(codec, 0x01);
14935 #endif /* SND_HDA_NEEDS_RESUME */
14937 static void alc269_fixup_hweq(struct hda_codec *codec,
14938 const struct alc_fixup *fix, int action)
14942 if (action != ALC_FIXUP_ACT_INIT)
14944 coef = alc_read_coef_idx(codec, 0x1e);
14945 alc_write_coef_idx(codec, 0x1e, coef | 0x80);
14949 ALC269_FIXUP_SONY_VAIO,
14950 ALC275_FIXUP_SONY_VAIO_GPIO2,
14951 ALC269_FIXUP_DELL_M101Z,
14952 ALC269_FIXUP_SKU_IGNORE,
14953 ALC269_FIXUP_ASUS_G73JW,
14954 ALC269_FIXUP_LENOVO_EAPD,
14955 ALC275_FIXUP_SONY_HWEQ,
14958 static const struct alc_fixup alc269_fixups[] = {
14959 [ALC269_FIXUP_SONY_VAIO] = {
14960 .type = ALC_FIXUP_VERBS,
14961 .v.verbs = (const struct hda_verb[]) {
14962 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD},
14966 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
14967 .type = ALC_FIXUP_VERBS,
14968 .v.verbs = (const struct hda_verb[]) {
14969 {0x01, AC_VERB_SET_GPIO_MASK, 0x04},
14970 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04},
14971 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
14975 .chain_id = ALC269_FIXUP_SONY_VAIO
14977 [ALC269_FIXUP_DELL_M101Z] = {
14978 .type = ALC_FIXUP_VERBS,
14979 .v.verbs = (const struct hda_verb[]) {
14980 /* Enables internal speaker */
14981 {0x20, AC_VERB_SET_COEF_INDEX, 13},
14982 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
14986 [ALC269_FIXUP_SKU_IGNORE] = {
14987 .type = ALC_FIXUP_SKU,
14988 .v.sku = ALC_FIXUP_SKU_IGNORE,
14990 [ALC269_FIXUP_ASUS_G73JW] = {
14991 .type = ALC_FIXUP_PINS,
14992 .v.pins = (const struct alc_pincfg[]) {
14993 { 0x17, 0x99130111 }, /* subwoofer */
14997 [ALC269_FIXUP_LENOVO_EAPD] = {
14998 .type = ALC_FIXUP_VERBS,
14999 .v.verbs = (const struct hda_verb[]) {
15000 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
15004 [ALC275_FIXUP_SONY_HWEQ] = {
15005 .type = ALC_FIXUP_FUNC,
15006 .v.func = alc269_fixup_hweq,
15008 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
15012 static struct snd_pci_quirk alc269_fixup_tbl[] = {
15013 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
15014 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
15015 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
15016 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
15017 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
15018 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
15019 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
15020 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
15021 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
15022 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
15023 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
15024 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
15030 * configuration and preset
15032 static const char * const alc269_models[ALC269_MODEL_LAST] = {
15033 [ALC269_BASIC] = "basic",
15034 [ALC269_QUANTA_FL1] = "quanta",
15035 [ALC269_AMIC] = "laptop-amic",
15036 [ALC269_DMIC] = "laptop-dmic",
15037 [ALC269_FUJITSU] = "fujitsu",
15038 [ALC269_LIFEBOOK] = "lifebook",
15039 [ALC269_AUTO] = "auto",
15042 static struct snd_pci_quirk alc269_cfg_tbl[] = {
15043 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
15044 SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER),
15045 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
15047 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC),
15048 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC),
15049 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC),
15050 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC),
15051 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC),
15052 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC),
15053 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC),
15054 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC),
15055 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC),
15056 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269VB_AMIC),
15057 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC),
15058 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC),
15059 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC),
15060 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC),
15061 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC),
15062 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC),
15063 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC),
15064 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC),
15065 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC),
15066 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC),
15067 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC),
15068 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC),
15069 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC),
15070 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC),
15071 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC),
15072 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC),
15073 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC),
15074 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC),
15075 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC),
15076 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC),
15077 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC),
15078 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC),
15079 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC),
15080 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC),
15081 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC),
15082 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC),
15083 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
15085 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
15087 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC),
15088 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC),
15089 SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO),
15090 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
15091 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC),
15092 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
15093 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC),
15094 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC),
15095 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC),
15096 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC),
15100 static struct alc_config_preset alc269_presets[] = {
15102 .mixers = { alc269_base_mixer },
15103 .init_verbs = { alc269_init_verbs },
15104 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15105 .dac_nids = alc269_dac_nids,
15107 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15108 .channel_mode = alc269_modes,
15109 .input_mux = &alc269_capture_source,
15111 [ALC269_QUANTA_FL1] = {
15112 .mixers = { alc269_quanta_fl1_mixer },
15113 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
15114 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15115 .dac_nids = alc269_dac_nids,
15117 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15118 .channel_mode = alc269_modes,
15119 .input_mux = &alc269_capture_source,
15120 .unsol_event = alc269_quanta_fl1_unsol_event,
15121 .setup = alc269_quanta_fl1_setup,
15122 .init_hook = alc269_quanta_fl1_init_hook,
15125 .mixers = { alc269_laptop_mixer },
15126 .cap_mixer = alc269_laptop_analog_capture_mixer,
15127 .init_verbs = { alc269_init_verbs,
15128 alc269_laptop_amic_init_verbs },
15129 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15130 .dac_nids = alc269_dac_nids,
15132 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15133 .channel_mode = alc269_modes,
15134 .unsol_event = alc269_laptop_unsol_event,
15135 .setup = alc269_laptop_amic_setup,
15136 .init_hook = alc269_laptop_inithook,
15139 .mixers = { alc269_laptop_mixer },
15140 .cap_mixer = alc269_laptop_digital_capture_mixer,
15141 .init_verbs = { alc269_init_verbs,
15142 alc269_laptop_dmic_init_verbs },
15143 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15144 .dac_nids = alc269_dac_nids,
15146 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15147 .channel_mode = alc269_modes,
15148 .unsol_event = alc269_laptop_unsol_event,
15149 .setup = alc269_laptop_dmic_setup,
15150 .init_hook = alc269_laptop_inithook,
15152 [ALC269VB_AMIC] = {
15153 .mixers = { alc269vb_laptop_mixer },
15154 .cap_mixer = alc269vb_laptop_analog_capture_mixer,
15155 .init_verbs = { alc269vb_init_verbs,
15156 alc269vb_laptop_amic_init_verbs },
15157 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15158 .dac_nids = alc269_dac_nids,
15160 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15161 .channel_mode = alc269_modes,
15162 .unsol_event = alc269_laptop_unsol_event,
15163 .setup = alc269vb_laptop_amic_setup,
15164 .init_hook = alc269_laptop_inithook,
15166 [ALC269VB_DMIC] = {
15167 .mixers = { alc269vb_laptop_mixer },
15168 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
15169 .init_verbs = { alc269vb_init_verbs,
15170 alc269vb_laptop_dmic_init_verbs },
15171 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15172 .dac_nids = alc269_dac_nids,
15174 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15175 .channel_mode = alc269_modes,
15176 .unsol_event = alc269_laptop_unsol_event,
15177 .setup = alc269vb_laptop_dmic_setup,
15178 .init_hook = alc269_laptop_inithook,
15180 [ALC269_FUJITSU] = {
15181 .mixers = { alc269_fujitsu_mixer },
15182 .cap_mixer = alc269_laptop_digital_capture_mixer,
15183 .init_verbs = { alc269_init_verbs,
15184 alc269_laptop_dmic_init_verbs },
15185 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15186 .dac_nids = alc269_dac_nids,
15188 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15189 .channel_mode = alc269_modes,
15190 .unsol_event = alc269_laptop_unsol_event,
15191 .setup = alc269_laptop_dmic_setup,
15192 .init_hook = alc269_laptop_inithook,
15194 [ALC269_LIFEBOOK] = {
15195 .mixers = { alc269_lifebook_mixer },
15196 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
15197 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15198 .dac_nids = alc269_dac_nids,
15200 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15201 .channel_mode = alc269_modes,
15202 .input_mux = &alc269_capture_source,
15203 .unsol_event = alc269_lifebook_unsol_event,
15204 .init_hook = alc269_lifebook_init_hook,
15207 .mixers = { alc269_asus_mixer },
15208 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
15209 .init_verbs = { alc269_init_verbs, alc271_acer_dmic_verbs },
15210 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15211 .dac_nids = alc269_dac_nids,
15212 .adc_nids = alc262_dmic_adc_nids,
15213 .num_adc_nids = ARRAY_SIZE(alc262_dmic_adc_nids),
15214 .capsrc_nids = alc262_dmic_capsrc_nids,
15215 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15216 .channel_mode = alc269_modes,
15217 .input_mux = &alc269_capture_source,
15218 .dig_out_nid = ALC880_DIGOUT_NID,
15219 .unsol_event = alc_sku_unsol_event,
15220 .setup = alc269vb_laptop_dmic_setup,
15221 .init_hook = alc_inithook,
15225 static int alc269_fill_coef(struct hda_codec *codec)
15229 if ((alc_read_coef_idx(codec, 0) & 0x00ff) < 0x015) {
15230 alc_write_coef_idx(codec, 0xf, 0x960b);
15231 alc_write_coef_idx(codec, 0xe, 0x8817);
15234 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x016) {
15235 alc_write_coef_idx(codec, 0xf, 0x960b);
15236 alc_write_coef_idx(codec, 0xe, 0x8814);
15239 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) {
15240 val = alc_read_coef_idx(codec, 0x04);
15241 /* Power up output pin */
15242 alc_write_coef_idx(codec, 0x04, val | (1<<11));
15245 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
15246 val = alc_read_coef_idx(codec, 0xd);
15247 if ((val & 0x0c00) >> 10 != 0x1) {
15248 /* Capless ramp up clock control */
15249 alc_write_coef_idx(codec, 0xd, val | 1<<10);
15251 val = alc_read_coef_idx(codec, 0x17);
15252 if ((val & 0x01c0) >> 6 != 0x4) {
15253 /* Class D power on reset */
15254 alc_write_coef_idx(codec, 0x17, val | 1<<7);
15260 static int patch_alc269(struct hda_codec *codec)
15262 struct alc_spec *spec;
15263 int board_config, coef;
15266 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15270 codec->spec = spec;
15272 alc_auto_parse_customize_define(codec);
15274 if (codec->vendor_id == 0x10ec0269) {
15275 coef = alc_read_coef_idx(codec, 0);
15276 if ((coef & 0x00f0) == 0x0010) {
15277 if (codec->bus->pci->subsystem_vendor == 0x1025 &&
15278 spec->cdefine.platform_type == 1) {
15279 alc_codec_rename(codec, "ALC271X");
15280 spec->codec_variant = ALC269_TYPE_ALC271X;
15281 } else if ((coef & 0xf000) == 0x1000) {
15282 spec->codec_variant = ALC269_TYPE_ALC270;
15283 } else if ((coef & 0xf000) == 0x2000) {
15284 alc_codec_rename(codec, "ALC259");
15285 spec->codec_variant = ALC269_TYPE_ALC259;
15286 } else if ((coef & 0xf000) == 0x3000) {
15287 alc_codec_rename(codec, "ALC258");
15288 spec->codec_variant = ALC269_TYPE_ALC258;
15290 alc_codec_rename(codec, "ALC269VB");
15291 spec->codec_variant = ALC269_TYPE_ALC269VB;
15294 alc_fix_pll_init(codec, 0x20, 0x04, 15);
15295 alc269_fill_coef(codec);
15298 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
15302 if (board_config < 0) {
15303 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15305 board_config = ALC269_AUTO;
15308 if (board_config == ALC269_AUTO) {
15309 alc_pick_fixup(codec, NULL, alc269_fixup_tbl, alc269_fixups);
15310 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
15313 if (board_config == ALC269_AUTO) {
15314 /* automatic parse from the BIOS config */
15315 err = alc269_parse_auto_config(codec);
15321 "hda_codec: Cannot set up configuration "
15322 "from BIOS. Using base mode...\n");
15323 board_config = ALC269_BASIC;
15327 if (has_cdefine_beep(codec)) {
15328 err = snd_hda_attach_beep_device(codec, 0x1);
15335 if (board_config != ALC269_AUTO)
15336 setup_preset(codec, &alc269_presets[board_config]);
15338 if (board_config == ALC269_QUANTA_FL1) {
15339 /* Due to a hardware problem on Lenovo Ideadpad, we need to
15340 * fix the sample rate of analog I/O to 44.1kHz
15342 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
15343 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
15344 } else if (spec->dual_adc_switch) {
15345 spec->stream_analog_playback = &alc269_pcm_analog_playback;
15346 /* switch ADC dynamically */
15347 spec->stream_analog_capture = &dualmic_pcm_analog_capture;
15349 spec->stream_analog_playback = &alc269_pcm_analog_playback;
15350 spec->stream_analog_capture = &alc269_pcm_analog_capture;
15352 spec->stream_digital_playback = &alc269_pcm_digital_playback;
15353 spec->stream_digital_capture = &alc269_pcm_digital_capture;
15355 if (!spec->adc_nids) { /* wasn't filled automatically? use default */
15356 if (spec->codec_variant == ALC269_TYPE_NORMAL) {
15357 spec->adc_nids = alc269_adc_nids;
15358 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
15359 spec->capsrc_nids = alc269_capsrc_nids;
15361 spec->adc_nids = alc269vb_adc_nids;
15362 spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids);
15363 spec->capsrc_nids = alc269vb_capsrc_nids;
15367 if (!spec->cap_mixer)
15368 set_capture_mixer(codec);
15369 if (has_cdefine_beep(codec))
15370 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
15372 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
15374 spec->vmaster_nid = 0x02;
15376 codec->patch_ops = alc_patch_ops;
15377 #ifdef CONFIG_SND_HDA_POWER_SAVE
15378 codec->patch_ops.suspend = alc269_suspend;
15380 #ifdef SND_HDA_NEEDS_RESUME
15381 codec->patch_ops.resume = alc269_resume;
15383 if (board_config == ALC269_AUTO)
15384 spec->init_hook = alc269_auto_init;
15386 alc_init_jacks(codec);
15387 #ifdef CONFIG_SND_HDA_POWER_SAVE
15388 if (!spec->loopback.amplist)
15389 spec->loopback.amplist = alc269_loopbacks;
15390 if (alc269_mic2_for_mute_led(codec))
15391 codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps;
15398 * ALC861 channel source setting (2/6 channel selection for 3-stack)
15402 * set the path ways for 2 channel output
15403 * need to set the codec line out and mic 1 pin widgets to inputs
15405 static struct hda_verb alc861_threestack_ch2_init[] = {
15406 /* set pin widget 1Ah (line in) for input */
15407 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15408 /* set pin widget 18h (mic1/2) for input, for mic also enable
15411 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15413 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
15415 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15416 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
15422 * need to set the codec line out and mic 1 pin widgets to outputs
15424 static struct hda_verb alc861_threestack_ch6_init[] = {
15425 /* set pin widget 1Ah (line in) for output (Back Surround)*/
15426 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15427 /* set pin widget 18h (mic1) for output (CLFE)*/
15428 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15430 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
15431 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
15433 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
15435 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15436 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
15441 static struct hda_channel_mode alc861_threestack_modes[2] = {
15442 { 2, alc861_threestack_ch2_init },
15443 { 6, alc861_threestack_ch6_init },
15445 /* Set mic1 as input and unmute the mixer */
15446 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
15447 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15448 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15451 /* Set mic1 as output and mute mixer */
15452 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
15453 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15454 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15458 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
15459 { 2, alc861_uniwill_m31_ch2_init },
15460 { 4, alc861_uniwill_m31_ch4_init },
15463 /* Set mic1 and line-in as input and unmute the mixer */
15464 static struct hda_verb alc861_asus_ch2_init[] = {
15465 /* set pin widget 1Ah (line in) for input */
15466 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15467 /* set pin widget 18h (mic1/2) for input, for mic also enable
15470 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15472 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
15474 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15475 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
15479 /* Set mic1 nad line-in as output and mute mixer */
15480 static struct hda_verb alc861_asus_ch6_init[] = {
15481 /* set pin widget 1Ah (line in) for output (Back Surround)*/
15482 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15483 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
15484 /* set pin widget 18h (mic1) for output (CLFE)*/
15485 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15486 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
15487 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
15488 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
15490 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
15492 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15493 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
15498 static struct hda_channel_mode alc861_asus_modes[2] = {
15499 { 2, alc861_asus_ch2_init },
15500 { 6, alc861_asus_ch6_init },
15505 static struct snd_kcontrol_new alc861_base_mixer[] = {
15506 /* output mixer control */
15507 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15508 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15509 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15510 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15511 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
15513 /*Input mixer control */
15514 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15515 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15516 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15517 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15518 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15519 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15520 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15521 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15522 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15523 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
15528 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
15529 /* output mixer control */
15530 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15531 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15532 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15533 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15534 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
15536 /* Input mixer control */
15537 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15538 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15539 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15540 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15541 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15542 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15543 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15544 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15545 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15546 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
15549 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15550 .name = "Channel Mode",
15551 .info = alc_ch_mode_info,
15552 .get = alc_ch_mode_get,
15553 .put = alc_ch_mode_put,
15554 .private_value = ARRAY_SIZE(alc861_threestack_modes),
15559 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
15560 /* output mixer control */
15561 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15562 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15563 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15568 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
15569 /* output mixer control */
15570 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15571 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15572 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15573 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15574 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
15576 /* Input mixer control */
15577 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15578 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15579 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15580 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15581 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15582 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15583 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15584 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15585 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15586 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
15589 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15590 .name = "Channel Mode",
15591 .info = alc_ch_mode_info,
15592 .get = alc_ch_mode_get,
15593 .put = alc_ch_mode_put,
15594 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
15599 static struct snd_kcontrol_new alc861_asus_mixer[] = {
15600 /* output mixer control */
15601 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15602 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15603 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15604 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15605 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
15607 /* Input mixer control */
15608 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15609 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15610 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15611 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15612 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15613 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15614 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15615 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15616 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15617 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
15620 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15621 .name = "Channel Mode",
15622 .info = alc_ch_mode_info,
15623 .get = alc_ch_mode_get,
15624 .put = alc_ch_mode_put,
15625 .private_value = ARRAY_SIZE(alc861_asus_modes),
15630 /* additional mixer */
15631 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
15632 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15633 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15638 * generic initialization of ADC, input mixers and output mixers
15640 static struct hda_verb alc861_base_init_verbs[] = {
15642 * Unmute ADC0 and set the default input to mic-in
15644 /* port-A for surround (rear panel) */
15645 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15646 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
15647 /* port-B for mic-in (rear panel) with vref */
15648 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15649 /* port-C for line-in (rear panel) */
15650 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15651 /* port-D for Front */
15652 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15653 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15654 /* port-E for HP out (front panel) */
15655 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
15656 /* route front PCM to HP */
15657 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15658 /* port-F for mic-in (front panel) with vref */
15659 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15660 /* port-G for CLFE (rear panel) */
15661 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15662 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15663 /* port-H for side (rear panel) */
15664 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15665 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
15667 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15668 /* route front mic to ADC1*/
15669 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15670 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15672 /* Unmute DAC0~3 & spdif out*/
15673 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15674 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15675 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15676 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15677 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15679 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15680 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15681 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15682 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15683 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15685 /* Unmute Stereo Mixer 15 */
15686 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15687 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15688 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15689 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15691 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15692 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15693 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15694 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15695 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15696 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15697 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15698 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15699 /* hp used DAC 3 (Front) */
15700 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15701 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15706 static struct hda_verb alc861_threestack_init_verbs[] = {
15708 * Unmute ADC0 and set the default input to mic-in
15710 /* port-A for surround (rear panel) */
15711 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15712 /* port-B for mic-in (rear panel) with vref */
15713 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15714 /* port-C for line-in (rear panel) */
15715 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15716 /* port-D for Front */
15717 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15718 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15719 /* port-E for HP out (front panel) */
15720 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
15721 /* route front PCM to HP */
15722 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15723 /* port-F for mic-in (front panel) with vref */
15724 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15725 /* port-G for CLFE (rear panel) */
15726 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15727 /* port-H for side (rear panel) */
15728 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15730 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15731 /* route front mic to ADC1*/
15732 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15733 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15734 /* Unmute DAC0~3 & spdif out*/
15735 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15736 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15737 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15738 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15739 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15741 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15742 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15743 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15744 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15745 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15747 /* Unmute Stereo Mixer 15 */
15748 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15749 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15750 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15751 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15753 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15754 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15755 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15756 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15757 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15758 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15759 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15760 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15761 /* hp used DAC 3 (Front) */
15762 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15763 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15767 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
15769 * Unmute ADC0 and set the default input to mic-in
15771 /* port-A for surround (rear panel) */
15772 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15773 /* port-B for mic-in (rear panel) with vref */
15774 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15775 /* port-C for line-in (rear panel) */
15776 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15777 /* port-D for Front */
15778 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15779 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15780 /* port-E for HP out (front panel) */
15781 /* this has to be set to VREF80 */
15782 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15783 /* route front PCM to HP */
15784 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15785 /* port-F for mic-in (front panel) with vref */
15786 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15787 /* port-G for CLFE (rear panel) */
15788 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15789 /* port-H for side (rear panel) */
15790 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15792 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15793 /* route front mic to ADC1*/
15794 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15795 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15796 /* Unmute DAC0~3 & spdif out*/
15797 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15798 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15799 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15800 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15801 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15803 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15804 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15805 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15806 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15807 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15809 /* Unmute Stereo Mixer 15 */
15810 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15811 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15812 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15813 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15815 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15816 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15817 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15818 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15819 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15820 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15821 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15822 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15823 /* hp used DAC 3 (Front) */
15824 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15825 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15829 static struct hda_verb alc861_asus_init_verbs[] = {
15831 * Unmute ADC0 and set the default input to mic-in
15833 /* port-A for surround (rear panel)
15834 * according to codec#0 this is the HP jack
15836 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
15837 /* route front PCM to HP */
15838 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
15839 /* port-B for mic-in (rear panel) with vref */
15840 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15841 /* port-C for line-in (rear panel) */
15842 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15843 /* port-D for Front */
15844 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15845 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15846 /* port-E for HP out (front panel) */
15847 /* this has to be set to VREF80 */
15848 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15849 /* route front PCM to HP */
15850 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15851 /* port-F for mic-in (front panel) with vref */
15852 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15853 /* port-G for CLFE (rear panel) */
15854 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15855 /* port-H for side (rear panel) */
15856 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15858 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15859 /* route front mic to ADC1*/
15860 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15861 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15862 /* Unmute DAC0~3 & spdif out*/
15863 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15864 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15865 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15866 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15867 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15868 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15869 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15870 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15871 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15872 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15874 /* Unmute Stereo Mixer 15 */
15875 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15876 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15877 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15878 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15880 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15881 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15882 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15883 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15884 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15885 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15886 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15887 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15888 /* hp used DAC 3 (Front) */
15889 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15890 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15894 /* additional init verbs for ASUS laptops */
15895 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
15896 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
15897 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
15902 * generic initialization of ADC, input mixers and output mixers
15904 static struct hda_verb alc861_auto_init_verbs[] = {
15906 * Unmute ADC0 and set the default input to mic-in
15908 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
15909 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15911 /* Unmute DAC0~3 & spdif out*/
15912 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15913 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15914 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15915 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15916 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15918 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15919 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15920 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15921 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15922 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15924 /* Unmute Stereo Mixer 15 */
15925 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15926 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15927 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15928 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
15930 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15931 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15932 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15933 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15934 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15935 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15936 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15937 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15939 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15940 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15941 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15942 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15943 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15944 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15945 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15946 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15948 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
15953 static struct hda_verb alc861_toshiba_init_verbs[] = {
15954 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15959 /* toggle speaker-output according to the hp-jack state */
15960 static void alc861_toshiba_automute(struct hda_codec *codec)
15962 unsigned int present = snd_hda_jack_detect(codec, 0x0f);
15964 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
15965 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
15966 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
15967 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
15970 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
15973 if ((res >> 26) == ALC880_HP_EVENT)
15974 alc861_toshiba_automute(codec);
15977 /* pcm configuration: identical with ALC880 */
15978 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
15979 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
15980 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
15981 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
15984 #define ALC861_DIGOUT_NID 0x07
15986 static struct hda_channel_mode alc861_8ch_modes[1] = {
15990 static hda_nid_t alc861_dac_nids[4] = {
15991 /* front, surround, clfe, side */
15992 0x03, 0x06, 0x05, 0x04
15995 static hda_nid_t alc660_dac_nids[3] = {
15996 /* front, clfe, surround */
16000 static hda_nid_t alc861_adc_nids[1] = {
16005 static struct hda_input_mux alc861_capture_source = {
16009 { "Front Mic", 0x3 },
16016 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
16018 struct alc_spec *spec = codec->spec;
16019 hda_nid_t mix, srcs[5];
16022 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
16024 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
16027 for (i = 0; i < num; i++) {
16029 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
16030 if (type != AC_WID_AUD_OUT)
16032 for (j = 0; j < spec->multiout.num_dacs; j++)
16033 if (spec->multiout.dac_nids[j] == srcs[i])
16035 if (j >= spec->multiout.num_dacs)
16041 /* fill in the dac_nids table from the parsed pin configuration */
16042 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
16043 const struct auto_pin_cfg *cfg)
16045 struct alc_spec *spec = codec->spec;
16047 hda_nid_t nid, dac;
16049 spec->multiout.dac_nids = spec->private_dac_nids;
16050 for (i = 0; i < cfg->line_outs; i++) {
16051 nid = cfg->line_out_pins[i];
16052 dac = alc861_look_for_dac(codec, nid);
16055 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
16060 static int __alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
16061 hda_nid_t nid, int idx, unsigned int chs)
16063 return __add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx, idx,
16064 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
16067 #define alc861_create_out_sw(codec, pfx, nid, chs) \
16068 __alc861_create_out_sw(codec, pfx, nid, 0, chs)
16070 /* add playback controls from the parsed DAC table */
16071 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
16072 const struct auto_pin_cfg *cfg)
16074 struct alc_spec *spec = codec->spec;
16075 static const char * const chname[4] = {
16076 "Front", "Surround", NULL /*CLFE*/, "Side"
16078 const char *pfx = alc_get_line_out_pfx(cfg, true);
16082 for (i = 0; i < cfg->line_outs; i++) {
16083 nid = spec->multiout.dac_nids[i];
16086 if (!pfx && i == 2) {
16088 err = alc861_create_out_sw(codec, "Center", nid, 1);
16091 err = alc861_create_out_sw(codec, "LFE", nid, 2);
16095 const char *name = pfx;
16101 err = __alc861_create_out_sw(codec, name, nid, index, 3);
16109 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
16111 struct alc_spec *spec = codec->spec;
16118 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
16119 nid = alc861_look_for_dac(codec, pin);
16121 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
16124 spec->multiout.hp_nid = nid;
16130 /* create playback/capture controls for input pins */
16131 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
16132 const struct auto_pin_cfg *cfg)
16134 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
16137 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
16139 int pin_type, hda_nid_t dac)
16141 hda_nid_t mix, srcs[5];
16144 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
16146 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16148 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
16150 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
16153 for (i = 0; i < num; i++) {
16155 if (srcs[i] == dac || srcs[i] == 0x15)
16156 mute = AMP_IN_UNMUTE(i);
16158 mute = AMP_IN_MUTE(i);
16159 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16164 static void alc861_auto_init_multi_out(struct hda_codec *codec)
16166 struct alc_spec *spec = codec->spec;
16169 for (i = 0; i < spec->autocfg.line_outs; i++) {
16170 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16171 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16173 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
16174 spec->multiout.dac_nids[i]);
16178 static void alc861_auto_init_hp_out(struct hda_codec *codec)
16180 struct alc_spec *spec = codec->spec;
16182 if (spec->autocfg.hp_outs)
16183 alc861_auto_set_output_and_unmute(codec,
16184 spec->autocfg.hp_pins[0],
16186 spec->multiout.hp_nid);
16187 if (spec->autocfg.speaker_outs)
16188 alc861_auto_set_output_and_unmute(codec,
16189 spec->autocfg.speaker_pins[0],
16191 spec->multiout.dac_nids[0]);
16194 static void alc861_auto_init_analog_input(struct hda_codec *codec)
16196 struct alc_spec *spec = codec->spec;
16197 struct auto_pin_cfg *cfg = &spec->autocfg;
16200 for (i = 0; i < cfg->num_inputs; i++) {
16201 hda_nid_t nid = cfg->inputs[i].pin;
16202 if (nid >= 0x0c && nid <= 0x11)
16203 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
16207 /* parse the BIOS configuration and set up the alc_spec */
16208 /* return 1 if successful, 0 if the proper config is not found,
16209 * or a negative error code
16211 static int alc861_parse_auto_config(struct hda_codec *codec)
16213 struct alc_spec *spec = codec->spec;
16215 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
16217 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16221 if (!spec->autocfg.line_outs)
16222 return 0; /* can't find valid BIOS pin config */
16224 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
16227 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
16230 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
16233 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
16237 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16239 alc_auto_parse_digital(codec);
16241 if (spec->kctls.list)
16242 add_mixer(spec, spec->kctls.list);
16244 add_verb(spec, alc861_auto_init_verbs);
16246 spec->num_mux_defs = 1;
16247 spec->input_mux = &spec->private_imux[0];
16249 spec->adc_nids = alc861_adc_nids;
16250 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
16251 set_capture_mixer(codec);
16253 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0);
16258 /* additional initialization for auto-configuration model */
16259 static void alc861_auto_init(struct hda_codec *codec)
16261 struct alc_spec *spec = codec->spec;
16262 alc861_auto_init_multi_out(codec);
16263 alc861_auto_init_hp_out(codec);
16264 alc861_auto_init_analog_input(codec);
16265 alc_auto_init_digital(codec);
16266 if (spec->unsol_event)
16267 alc_inithook(codec);
16270 #ifdef CONFIG_SND_HDA_POWER_SAVE
16271 static struct hda_amp_list alc861_loopbacks[] = {
16272 { 0x15, HDA_INPUT, 0 },
16273 { 0x15, HDA_INPUT, 1 },
16274 { 0x15, HDA_INPUT, 2 },
16275 { 0x15, HDA_INPUT, 3 },
16282 * configuration and preset
16284 static const char * const alc861_models[ALC861_MODEL_LAST] = {
16285 [ALC861_3ST] = "3stack",
16286 [ALC660_3ST] = "3stack-660",
16287 [ALC861_3ST_DIG] = "3stack-dig",
16288 [ALC861_6ST_DIG] = "6stack-dig",
16289 [ALC861_UNIWILL_M31] = "uniwill-m31",
16290 [ALC861_TOSHIBA] = "toshiba",
16291 [ALC861_ASUS] = "asus",
16292 [ALC861_ASUS_LAPTOP] = "asus-laptop",
16293 [ALC861_AUTO] = "auto",
16296 static struct snd_pci_quirk alc861_cfg_tbl[] = {
16297 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
16298 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
16299 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
16300 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
16301 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
16302 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
16303 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
16304 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
16305 * Any other models that need this preset?
16307 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
16308 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
16309 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
16310 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
16311 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
16312 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
16313 /* FIXME: the below seems conflict */
16314 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
16315 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
16316 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
16320 static struct alc_config_preset alc861_presets[] = {
16322 .mixers = { alc861_3ST_mixer },
16323 .init_verbs = { alc861_threestack_init_verbs },
16324 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16325 .dac_nids = alc861_dac_nids,
16326 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
16327 .channel_mode = alc861_threestack_modes,
16329 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16330 .adc_nids = alc861_adc_nids,
16331 .input_mux = &alc861_capture_source,
16333 [ALC861_3ST_DIG] = {
16334 .mixers = { alc861_base_mixer },
16335 .init_verbs = { alc861_threestack_init_verbs },
16336 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16337 .dac_nids = alc861_dac_nids,
16338 .dig_out_nid = ALC861_DIGOUT_NID,
16339 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
16340 .channel_mode = alc861_threestack_modes,
16342 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16343 .adc_nids = alc861_adc_nids,
16344 .input_mux = &alc861_capture_source,
16346 [ALC861_6ST_DIG] = {
16347 .mixers = { alc861_base_mixer },
16348 .init_verbs = { alc861_base_init_verbs },
16349 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16350 .dac_nids = alc861_dac_nids,
16351 .dig_out_nid = ALC861_DIGOUT_NID,
16352 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
16353 .channel_mode = alc861_8ch_modes,
16354 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16355 .adc_nids = alc861_adc_nids,
16356 .input_mux = &alc861_capture_source,
16359 .mixers = { alc861_3ST_mixer },
16360 .init_verbs = { alc861_threestack_init_verbs },
16361 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
16362 .dac_nids = alc660_dac_nids,
16363 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
16364 .channel_mode = alc861_threestack_modes,
16366 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16367 .adc_nids = alc861_adc_nids,
16368 .input_mux = &alc861_capture_source,
16370 [ALC861_UNIWILL_M31] = {
16371 .mixers = { alc861_uniwill_m31_mixer },
16372 .init_verbs = { alc861_uniwill_m31_init_verbs },
16373 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16374 .dac_nids = alc861_dac_nids,
16375 .dig_out_nid = ALC861_DIGOUT_NID,
16376 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
16377 .channel_mode = alc861_uniwill_m31_modes,
16379 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16380 .adc_nids = alc861_adc_nids,
16381 .input_mux = &alc861_capture_source,
16383 [ALC861_TOSHIBA] = {
16384 .mixers = { alc861_toshiba_mixer },
16385 .init_verbs = { alc861_base_init_verbs,
16386 alc861_toshiba_init_verbs },
16387 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16388 .dac_nids = alc861_dac_nids,
16389 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
16390 .channel_mode = alc883_3ST_2ch_modes,
16391 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16392 .adc_nids = alc861_adc_nids,
16393 .input_mux = &alc861_capture_source,
16394 .unsol_event = alc861_toshiba_unsol_event,
16395 .init_hook = alc861_toshiba_automute,
16398 .mixers = { alc861_asus_mixer },
16399 .init_verbs = { alc861_asus_init_verbs },
16400 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16401 .dac_nids = alc861_dac_nids,
16402 .dig_out_nid = ALC861_DIGOUT_NID,
16403 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
16404 .channel_mode = alc861_asus_modes,
16407 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16408 .adc_nids = alc861_adc_nids,
16409 .input_mux = &alc861_capture_source,
16411 [ALC861_ASUS_LAPTOP] = {
16412 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
16413 .init_verbs = { alc861_asus_init_verbs,
16414 alc861_asus_laptop_init_verbs },
16415 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16416 .dac_nids = alc861_dac_nids,
16417 .dig_out_nid = ALC861_DIGOUT_NID,
16418 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
16419 .channel_mode = alc883_3ST_2ch_modes,
16421 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16422 .adc_nids = alc861_adc_nids,
16423 .input_mux = &alc861_capture_source,
16427 /* Pin config fixes */
16429 PINFIX_FSC_AMILO_PI1505,
16432 static const struct alc_fixup alc861_fixups[] = {
16433 [PINFIX_FSC_AMILO_PI1505] = {
16434 .type = ALC_FIXUP_PINS,
16435 .v.pins = (const struct alc_pincfg[]) {
16436 { 0x0b, 0x0221101f }, /* HP */
16437 { 0x0f, 0x90170310 }, /* speaker */
16443 static struct snd_pci_quirk alc861_fixup_tbl[] = {
16444 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
16448 static int patch_alc861(struct hda_codec *codec)
16450 struct alc_spec *spec;
16454 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16458 codec->spec = spec;
16460 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
16464 if (board_config < 0) {
16465 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
16467 board_config = ALC861_AUTO;
16470 if (board_config == ALC861_AUTO) {
16471 alc_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
16472 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
16475 if (board_config == ALC861_AUTO) {
16476 /* automatic parse from the BIOS config */
16477 err = alc861_parse_auto_config(codec);
16483 "hda_codec: Cannot set up configuration "
16484 "from BIOS. Using base mode...\n");
16485 board_config = ALC861_3ST_DIG;
16489 err = snd_hda_attach_beep_device(codec, 0x23);
16495 if (board_config != ALC861_AUTO)
16496 setup_preset(codec, &alc861_presets[board_config]);
16498 spec->stream_analog_playback = &alc861_pcm_analog_playback;
16499 spec->stream_analog_capture = &alc861_pcm_analog_capture;
16501 spec->stream_digital_playback = &alc861_pcm_digital_playback;
16502 spec->stream_digital_capture = &alc861_pcm_digital_capture;
16504 if (!spec->cap_mixer)
16505 set_capture_mixer(codec);
16506 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
16508 spec->vmaster_nid = 0x03;
16510 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
16512 codec->patch_ops = alc_patch_ops;
16513 if (board_config == ALC861_AUTO) {
16514 spec->init_hook = alc861_auto_init;
16515 #ifdef CONFIG_SND_HDA_POWER_SAVE
16516 spec->power_hook = alc_power_eapd;
16519 #ifdef CONFIG_SND_HDA_POWER_SAVE
16520 if (!spec->loopback.amplist)
16521 spec->loopback.amplist = alc861_loopbacks;
16528 * ALC861-VD support
16532 * In addition, an independent DAC
16534 #define ALC861VD_DIGOUT_NID 0x06
16536 static hda_nid_t alc861vd_dac_nids[4] = {
16537 /* front, surr, clfe, side surr */
16538 0x02, 0x03, 0x04, 0x05
16541 /* dac_nids for ALC660vd are in a different order - according to
16542 * Realtek's driver.
16543 * This should probably result in a different mixer for 6stack models
16544 * of ALC660vd codecs, but for now there is only 3stack mixer
16545 * - and it is the same as in 861vd.
16546 * adc_nids in ALC660vd are (is) the same as in 861vd
16548 static hda_nid_t alc660vd_dac_nids[3] = {
16549 /* front, rear, clfe, rear_surr */
16553 static hda_nid_t alc861vd_adc_nids[1] = {
16558 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
16561 /* FIXME: should be a matrix-type input source selection */
16562 static struct hda_input_mux alc861vd_capture_source = {
16566 { "Front Mic", 0x1 },
16572 static struct hda_input_mux alc861vd_dallas_capture_source = {
16576 { "Internal Mic", 0x1 },
16580 static struct hda_input_mux alc861vd_hp_capture_source = {
16583 { "Front Mic", 0x0 },
16584 { "ATAPI Mic", 0x1 },
16591 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
16598 static struct hda_verb alc861vd_6stack_ch6_init[] = {
16599 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16600 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16601 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16602 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16609 static struct hda_verb alc861vd_6stack_ch8_init[] = {
16610 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16611 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16612 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16613 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16617 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
16618 { 6, alc861vd_6stack_ch6_init },
16619 { 8, alc861vd_6stack_ch8_init },
16622 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
16624 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16625 .name = "Channel Mode",
16626 .info = alc_ch_mode_info,
16627 .get = alc_ch_mode_get,
16628 .put = alc_ch_mode_put,
16633 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16634 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16636 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
16637 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16638 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16640 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16641 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
16643 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
16645 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
16647 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
16648 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
16650 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
16651 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
16653 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16655 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
16656 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16657 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16659 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
16660 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16661 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16663 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16664 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16666 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16667 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16672 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
16673 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16674 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16676 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16678 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
16679 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16680 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16682 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
16683 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16684 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16686 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16687 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16689 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16690 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16695 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
16696 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16697 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
16698 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16700 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16702 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
16703 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16704 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16706 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
16707 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16708 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16710 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16711 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16716 /* Pin assignment: Speaker=0x14, HP = 0x15,
16717 * Mic=0x18, Internal Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
16719 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
16720 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16721 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
16722 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16723 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
16724 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
16725 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16726 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16727 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
16728 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16729 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16733 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
16734 * Front Mic=0x18, ATAPI Mic = 0x19,
16736 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
16737 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16738 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16739 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16740 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
16741 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16742 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16743 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16744 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16750 * generic initialization of ADC, input mixers and output mixers
16752 static struct hda_verb alc861vd_volume_init_verbs[] = {
16754 * Unmute ADC0 and set the default input to mic-in
16756 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16757 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16759 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
16760 * the analog-loopback mixer widget
16762 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16763 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16764 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16765 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16766 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16767 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16769 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
16770 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16771 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16772 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
16773 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
16776 * Set up output mixers (0x02 - 0x05)
16778 /* set vol=0 to output mixers */
16779 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16780 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16781 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16782 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16784 /* set up input amps for analog loopback */
16785 /* Amp Indices: DAC = 0, mixer = 1 */
16786 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16787 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16788 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16789 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16790 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16791 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16792 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16793 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16799 * 3-stack pin configuration:
16800 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
16802 static struct hda_verb alc861vd_3stack_init_verbs[] = {
16804 * Set pin mode and muting
16806 /* set front pin widgets 0x14 for output */
16807 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16808 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16809 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
16811 /* Mic (rear) pin: input vref at 80% */
16812 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16813 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16814 /* Front Mic pin: input vref at 80% */
16815 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16816 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16817 /* Line In pin: input */
16818 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16819 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16820 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16821 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16822 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16823 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16824 /* CD pin widget for input */
16825 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16831 * 6-stack pin configuration:
16833 static struct hda_verb alc861vd_6stack_init_verbs[] = {
16835 * Set pin mode and muting
16837 /* set front pin widgets 0x14 for output */
16838 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16839 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16840 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
16842 /* Rear Pin: output 1 (0x0d) */
16843 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16844 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16845 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
16846 /* CLFE Pin: output 2 (0x0e) */
16847 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16848 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16849 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
16850 /* Side Pin: output 3 (0x0f) */
16851 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16852 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16853 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
16855 /* Mic (rear) pin: input vref at 80% */
16856 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16857 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16858 /* Front Mic pin: input vref at 80% */
16859 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16860 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16861 /* Line In pin: input */
16862 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16863 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16864 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16865 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16866 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16867 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16868 /* CD pin widget for input */
16869 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16874 static struct hda_verb alc861vd_eapd_verbs[] = {
16875 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16879 static struct hda_verb alc660vd_eapd_verbs[] = {
16880 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16881 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16885 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
16886 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16887 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16888 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
16889 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16890 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16894 static void alc861vd_lenovo_setup(struct hda_codec *codec)
16896 struct alc_spec *spec = codec->spec;
16897 spec->autocfg.hp_pins[0] = 0x1b;
16898 spec->autocfg.speaker_pins[0] = 0x14;
16901 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
16903 alc_automute_amp(codec);
16904 alc88x_simple_mic_automute(codec);
16907 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
16910 switch (res >> 26) {
16911 case ALC880_MIC_EVENT:
16912 alc88x_simple_mic_automute(codec);
16915 alc_automute_amp_unsol_event(codec, res);
16920 static struct hda_verb alc861vd_dallas_verbs[] = {
16921 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16922 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16923 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16924 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16926 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16927 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16928 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16929 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16930 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16931 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16932 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16933 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16935 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16936 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16937 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16938 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16939 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16940 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16941 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16942 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16944 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
16945 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16946 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
16947 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16948 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16949 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16950 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16951 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16953 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16954 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16955 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16956 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16958 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16959 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16960 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16965 /* toggle speaker-output according to the hp-jack state */
16966 static void alc861vd_dallas_setup(struct hda_codec *codec)
16968 struct alc_spec *spec = codec->spec;
16970 spec->autocfg.hp_pins[0] = 0x15;
16971 spec->autocfg.speaker_pins[0] = 0x14;
16974 #ifdef CONFIG_SND_HDA_POWER_SAVE
16975 #define alc861vd_loopbacks alc880_loopbacks
16978 /* pcm configuration: identical with ALC880 */
16979 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
16980 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
16981 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
16982 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
16985 * configuration and preset
16987 static const char * const alc861vd_models[ALC861VD_MODEL_LAST] = {
16988 [ALC660VD_3ST] = "3stack-660",
16989 [ALC660VD_3ST_DIG] = "3stack-660-digout",
16990 [ALC660VD_ASUS_V1S] = "asus-v1s",
16991 [ALC861VD_3ST] = "3stack",
16992 [ALC861VD_3ST_DIG] = "3stack-digout",
16993 [ALC861VD_6ST_DIG] = "6stack-digout",
16994 [ALC861VD_LENOVO] = "lenovo",
16995 [ALC861VD_DALLAS] = "dallas",
16996 [ALC861VD_HP] = "hp",
16997 [ALC861VD_AUTO] = "auto",
17000 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
17001 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
17002 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
17003 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
17004 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
17005 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
17006 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
17007 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
17008 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
17009 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
17010 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
17011 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
17012 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
17013 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
17014 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
17015 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
17019 static struct alc_config_preset alc861vd_presets[] = {
17021 .mixers = { alc861vd_3st_mixer },
17022 .init_verbs = { alc861vd_volume_init_verbs,
17023 alc861vd_3stack_init_verbs },
17024 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
17025 .dac_nids = alc660vd_dac_nids,
17026 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17027 .channel_mode = alc861vd_3stack_2ch_modes,
17028 .input_mux = &alc861vd_capture_source,
17030 [ALC660VD_3ST_DIG] = {
17031 .mixers = { alc861vd_3st_mixer },
17032 .init_verbs = { alc861vd_volume_init_verbs,
17033 alc861vd_3stack_init_verbs },
17034 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
17035 .dac_nids = alc660vd_dac_nids,
17036 .dig_out_nid = ALC861VD_DIGOUT_NID,
17037 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17038 .channel_mode = alc861vd_3stack_2ch_modes,
17039 .input_mux = &alc861vd_capture_source,
17042 .mixers = { alc861vd_3st_mixer },
17043 .init_verbs = { alc861vd_volume_init_verbs,
17044 alc861vd_3stack_init_verbs },
17045 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
17046 .dac_nids = alc861vd_dac_nids,
17047 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17048 .channel_mode = alc861vd_3stack_2ch_modes,
17049 .input_mux = &alc861vd_capture_source,
17051 [ALC861VD_3ST_DIG] = {
17052 .mixers = { alc861vd_3st_mixer },
17053 .init_verbs = { alc861vd_volume_init_verbs,
17054 alc861vd_3stack_init_verbs },
17055 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
17056 .dac_nids = alc861vd_dac_nids,
17057 .dig_out_nid = ALC861VD_DIGOUT_NID,
17058 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17059 .channel_mode = alc861vd_3stack_2ch_modes,
17060 .input_mux = &alc861vd_capture_source,
17062 [ALC861VD_6ST_DIG] = {
17063 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
17064 .init_verbs = { alc861vd_volume_init_verbs,
17065 alc861vd_6stack_init_verbs },
17066 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
17067 .dac_nids = alc861vd_dac_nids,
17068 .dig_out_nid = ALC861VD_DIGOUT_NID,
17069 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
17070 .channel_mode = alc861vd_6stack_modes,
17071 .input_mux = &alc861vd_capture_source,
17073 [ALC861VD_LENOVO] = {
17074 .mixers = { alc861vd_lenovo_mixer },
17075 .init_verbs = { alc861vd_volume_init_verbs,
17076 alc861vd_3stack_init_verbs,
17077 alc861vd_eapd_verbs,
17078 alc861vd_lenovo_unsol_verbs },
17079 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
17080 .dac_nids = alc660vd_dac_nids,
17081 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17082 .channel_mode = alc861vd_3stack_2ch_modes,
17083 .input_mux = &alc861vd_capture_source,
17084 .unsol_event = alc861vd_lenovo_unsol_event,
17085 .setup = alc861vd_lenovo_setup,
17086 .init_hook = alc861vd_lenovo_init_hook,
17088 [ALC861VD_DALLAS] = {
17089 .mixers = { alc861vd_dallas_mixer },
17090 .init_verbs = { alc861vd_dallas_verbs },
17091 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
17092 .dac_nids = alc861vd_dac_nids,
17093 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17094 .channel_mode = alc861vd_3stack_2ch_modes,
17095 .input_mux = &alc861vd_dallas_capture_source,
17096 .unsol_event = alc_automute_amp_unsol_event,
17097 .setup = alc861vd_dallas_setup,
17098 .init_hook = alc_automute_amp,
17101 .mixers = { alc861vd_hp_mixer },
17102 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
17103 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
17104 .dac_nids = alc861vd_dac_nids,
17105 .dig_out_nid = ALC861VD_DIGOUT_NID,
17106 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17107 .channel_mode = alc861vd_3stack_2ch_modes,
17108 .input_mux = &alc861vd_hp_capture_source,
17109 .unsol_event = alc_automute_amp_unsol_event,
17110 .setup = alc861vd_dallas_setup,
17111 .init_hook = alc_automute_amp,
17113 [ALC660VD_ASUS_V1S] = {
17114 .mixers = { alc861vd_lenovo_mixer },
17115 .init_verbs = { alc861vd_volume_init_verbs,
17116 alc861vd_3stack_init_verbs,
17117 alc861vd_eapd_verbs,
17118 alc861vd_lenovo_unsol_verbs },
17119 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
17120 .dac_nids = alc660vd_dac_nids,
17121 .dig_out_nid = ALC861VD_DIGOUT_NID,
17122 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17123 .channel_mode = alc861vd_3stack_2ch_modes,
17124 .input_mux = &alc861vd_capture_source,
17125 .unsol_event = alc861vd_lenovo_unsol_event,
17126 .setup = alc861vd_lenovo_setup,
17127 .init_hook = alc861vd_lenovo_init_hook,
17132 * BIOS auto configuration
17134 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
17135 const struct auto_pin_cfg *cfg)
17137 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x22, 0);
17141 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
17142 hda_nid_t nid, int pin_type, int dac_idx)
17144 alc_set_pin_output(codec, nid, pin_type);
17147 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
17149 struct alc_spec *spec = codec->spec;
17152 for (i = 0; i <= HDA_SIDE; i++) {
17153 hda_nid_t nid = spec->autocfg.line_out_pins[i];
17154 int pin_type = get_pin_type(spec->autocfg.line_out_type);
17156 alc861vd_auto_set_output_and_unmute(codec, nid,
17162 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
17164 struct alc_spec *spec = codec->spec;
17167 pin = spec->autocfg.hp_pins[0];
17168 if (pin) /* connect to front and use dac 0 */
17169 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
17170 pin = spec->autocfg.speaker_pins[0];
17172 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
17175 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
17177 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
17179 struct alc_spec *spec = codec->spec;
17180 struct auto_pin_cfg *cfg = &spec->autocfg;
17183 for (i = 0; i < cfg->num_inputs; i++) {
17184 hda_nid_t nid = cfg->inputs[i].pin;
17185 if (alc_is_input_pin(codec, nid)) {
17186 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
17187 if (nid != ALC861VD_PIN_CD_NID &&
17188 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
17189 snd_hda_codec_write(codec, nid, 0,
17190 AC_VERB_SET_AMP_GAIN_MUTE,
17196 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
17198 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
17199 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
17201 /* add playback controls from the parsed DAC table */
17202 /* Based on ALC880 version. But ALC861VD has separate,
17203 * different NIDs for mute/unmute switch and volume control */
17204 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
17205 const struct auto_pin_cfg *cfg)
17207 static const char * const chname[4] = {
17208 "Front", "Surround", "CLFE", "Side"
17210 const char *pfx = alc_get_line_out_pfx(cfg, true);
17211 hda_nid_t nid_v, nid_s;
17214 for (i = 0; i < cfg->line_outs; i++) {
17215 if (!spec->multiout.dac_nids[i])
17217 nid_v = alc861vd_idx_to_mixer_vol(
17219 spec->multiout.dac_nids[i]));
17220 nid_s = alc861vd_idx_to_mixer_switch(
17222 spec->multiout.dac_nids[i]));
17224 if (!pfx && i == 2) {
17226 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
17228 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
17232 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
17234 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
17238 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
17240 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
17244 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
17246 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
17251 const char *name = pfx;
17257 err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
17259 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
17263 err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
17265 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
17274 /* add playback controls for speaker and HP outputs */
17275 /* Based on ALC880 version. But ALC861VD has separate,
17276 * different NIDs for mute/unmute switch and volume control */
17277 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
17278 hda_nid_t pin, const char *pfx)
17280 hda_nid_t nid_v, nid_s;
17286 if (alc880_is_fixed_pin(pin)) {
17287 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
17288 /* specify the DAC as the extra output */
17289 if (!spec->multiout.hp_nid)
17290 spec->multiout.hp_nid = nid_v;
17292 spec->multiout.extra_out_nid[0] = nid_v;
17293 /* control HP volume/switch on the output mixer amp */
17294 nid_v = alc861vd_idx_to_mixer_vol(
17295 alc880_fixed_pin_idx(pin));
17296 nid_s = alc861vd_idx_to_mixer_switch(
17297 alc880_fixed_pin_idx(pin));
17299 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
17300 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
17303 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
17304 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
17307 } else if (alc880_is_multi_pin(pin)) {
17308 /* set manual connection */
17309 /* we have only a switch on HP-out PIN */
17310 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17311 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17318 /* parse the BIOS configuration and set up the alc_spec
17319 * return 1 if successful, 0 if the proper config is not found,
17320 * or a negative error code
17321 * Based on ALC880 version - had to change it to override
17322 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
17323 static int alc861vd_parse_auto_config(struct hda_codec *codec)
17325 struct alc_spec *spec = codec->spec;
17327 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
17329 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17333 if (!spec->autocfg.line_outs)
17334 return 0; /* can't find valid BIOS pin config */
17336 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
17339 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
17342 err = alc861vd_auto_create_extra_out(spec,
17343 spec->autocfg.speaker_pins[0],
17347 err = alc861vd_auto_create_extra_out(spec,
17348 spec->autocfg.hp_pins[0],
17352 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
17356 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
17358 alc_auto_parse_digital(codec);
17360 if (spec->kctls.list)
17361 add_mixer(spec, spec->kctls.list);
17363 add_verb(spec, alc861vd_volume_init_verbs);
17365 spec->num_mux_defs = 1;
17366 spec->input_mux = &spec->private_imux[0];
17368 err = alc_auto_add_mic_boost(codec);
17372 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
17377 /* additional initialization for auto-configuration model */
17378 static void alc861vd_auto_init(struct hda_codec *codec)
17380 struct alc_spec *spec = codec->spec;
17381 alc861vd_auto_init_multi_out(codec);
17382 alc861vd_auto_init_hp_out(codec);
17383 alc861vd_auto_init_analog_input(codec);
17384 alc861vd_auto_init_input_src(codec);
17385 alc_auto_init_digital(codec);
17386 if (spec->unsol_event)
17387 alc_inithook(codec);
17391 ALC660VD_FIX_ASUS_GPIO1
17395 static const struct alc_fixup alc861vd_fixups[] = {
17396 [ALC660VD_FIX_ASUS_GPIO1] = {
17397 .type = ALC_FIXUP_VERBS,
17398 .v.verbs = (const struct hda_verb[]) {
17399 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
17400 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
17401 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
17407 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
17408 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
17412 static int patch_alc861vd(struct hda_codec *codec)
17414 struct alc_spec *spec;
17415 int err, board_config;
17417 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
17421 codec->spec = spec;
17423 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
17427 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
17428 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
17430 board_config = ALC861VD_AUTO;
17433 if (board_config == ALC861VD_AUTO) {
17434 alc_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
17435 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
17438 if (board_config == ALC861VD_AUTO) {
17439 /* automatic parse from the BIOS config */
17440 err = alc861vd_parse_auto_config(codec);
17446 "hda_codec: Cannot set up configuration "
17447 "from BIOS. Using base mode...\n");
17448 board_config = ALC861VD_3ST;
17452 err = snd_hda_attach_beep_device(codec, 0x23);
17458 if (board_config != ALC861VD_AUTO)
17459 setup_preset(codec, &alc861vd_presets[board_config]);
17461 if (codec->vendor_id == 0x10ec0660) {
17462 /* always turn on EAPD */
17463 add_verb(spec, alc660vd_eapd_verbs);
17466 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
17467 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
17469 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
17470 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
17472 if (!spec->adc_nids) {
17473 spec->adc_nids = alc861vd_adc_nids;
17474 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
17476 if (!spec->capsrc_nids)
17477 spec->capsrc_nids = alc861vd_capsrc_nids;
17479 set_capture_mixer(codec);
17480 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
17482 spec->vmaster_nid = 0x02;
17484 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
17486 codec->patch_ops = alc_patch_ops;
17488 if (board_config == ALC861VD_AUTO)
17489 spec->init_hook = alc861vd_auto_init;
17490 #ifdef CONFIG_SND_HDA_POWER_SAVE
17491 if (!spec->loopback.amplist)
17492 spec->loopback.amplist = alc861vd_loopbacks;
17501 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
17502 * configuration. Each pin widget can choose any input DACs and a mixer.
17503 * Each ADC is connected from a mixer of all inputs. This makes possible
17504 * 6-channel independent captures.
17506 * In addition, an independent DAC for the multi-playback (not used in this
17509 #define ALC662_DIGOUT_NID 0x06
17510 #define ALC662_DIGIN_NID 0x0a
17512 static hda_nid_t alc662_dac_nids[4] = {
17513 /* front, rear, clfe, rear_surr */
17517 static hda_nid_t alc272_dac_nids[2] = {
17521 static hda_nid_t alc662_adc_nids[2] = {
17526 static hda_nid_t alc272_adc_nids[1] = {
17531 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
17532 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
17536 /* FIXME: should be a matrix-type input source selection */
17537 static struct hda_input_mux alc662_capture_source = {
17541 { "Front Mic", 0x1 },
17547 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
17555 static struct hda_input_mux alc663_capture_source = {
17559 { "Front Mic", 0x1 },
17564 #if 0 /* set to 1 for testing other input sources below */
17565 static struct hda_input_mux alc272_nc10_capture_source = {
17568 { "Autoselect Mic", 0x0 },
17569 { "Internal Mic", 0x1 },
17570 { "In-0x02", 0x2 },
17571 { "In-0x03", 0x3 },
17572 { "In-0x04", 0x4 },
17573 { "In-0x05", 0x5 },
17574 { "In-0x06", 0x6 },
17575 { "In-0x07", 0x7 },
17576 { "In-0x08", 0x8 },
17577 { "In-0x09", 0x9 },
17578 { "In-0x0a", 0x0a },
17579 { "In-0x0b", 0x0b },
17580 { "In-0x0c", 0x0c },
17581 { "In-0x0d", 0x0d },
17582 { "In-0x0e", 0x0e },
17583 { "In-0x0f", 0x0f },
17591 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
17598 static struct hda_verb alc662_3ST_ch2_init[] = {
17599 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
17600 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
17601 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
17602 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
17609 static struct hda_verb alc662_3ST_ch6_init[] = {
17610 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17611 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
17612 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
17613 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17614 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
17615 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
17619 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
17620 { 2, alc662_3ST_ch2_init },
17621 { 6, alc662_3ST_ch6_init },
17627 static struct hda_verb alc662_sixstack_ch6_init[] = {
17628 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
17629 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
17630 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17637 static struct hda_verb alc662_sixstack_ch8_init[] = {
17638 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17639 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17640 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17644 static struct hda_channel_mode alc662_5stack_modes[2] = {
17645 { 2, alc662_sixstack_ch6_init },
17646 { 6, alc662_sixstack_ch8_init },
17649 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
17650 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
17653 static struct snd_kcontrol_new alc662_base_mixer[] = {
17654 /* output mixer control */
17655 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
17656 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17657 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
17658 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
17659 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17660 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17661 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
17662 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
17663 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17665 /*Input mixer control */
17666 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
17667 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
17668 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
17669 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
17670 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
17671 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
17672 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
17673 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
17677 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
17678 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17679 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17680 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17681 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
17682 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
17683 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17684 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17685 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17686 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17687 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17688 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17692 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
17693 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17694 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17695 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17696 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
17697 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17698 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17699 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
17700 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
17701 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17702 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
17703 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
17704 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17705 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17706 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17707 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17708 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17709 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17713 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
17714 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17715 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
17716 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17717 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
17718 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17719 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17720 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17721 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17722 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17726 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
17727 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17728 ALC262_HIPPO_MASTER_SWITCH,
17730 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
17731 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17732 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17734 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
17735 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17736 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17740 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
17741 ALC262_HIPPO_MASTER_SWITCH,
17742 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17743 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17744 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17745 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17746 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
17747 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17748 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17749 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17750 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17754 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
17755 .ops = &snd_hda_bind_vol,
17757 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
17758 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
17763 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
17764 .ops = &snd_hda_bind_sw,
17766 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17767 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17772 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
17773 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17774 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
17775 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17776 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17780 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
17781 .ops = &snd_hda_bind_sw,
17783 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17784 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17785 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17790 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
17791 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17792 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
17793 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17794 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17795 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17796 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17801 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
17802 .ops = &snd_hda_bind_sw,
17804 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17805 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17806 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
17811 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
17812 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17813 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
17814 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17815 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17816 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17817 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17821 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
17822 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17823 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17824 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17825 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17826 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17827 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17828 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17832 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
17833 .ops = &snd_hda_bind_vol,
17835 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
17836 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
17841 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
17842 .ops = &snd_hda_bind_sw,
17844 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17845 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
17850 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
17851 HDA_BIND_VOL("Master Playback Volume",
17852 &alc663_asus_two_bind_master_vol),
17853 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
17854 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17855 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17856 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17857 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17861 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
17862 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17863 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
17864 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17865 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17866 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17867 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17871 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
17872 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17873 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17874 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17875 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17876 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17878 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17879 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17880 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17881 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17885 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
17886 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17887 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17888 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17890 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17891 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17892 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17893 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17894 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17895 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17899 static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
17900 .ops = &snd_hda_bind_sw,
17902 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17903 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17904 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
17905 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
17906 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17911 static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
17912 .ops = &snd_hda_bind_sw,
17914 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17915 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
17920 static struct snd_kcontrol_new alc663_mode7_mixer[] = {
17921 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17922 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17923 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
17924 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17925 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17926 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17927 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17928 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17929 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17933 static struct snd_kcontrol_new alc663_mode8_mixer[] = {
17934 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17935 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17936 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
17937 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17938 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17939 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17940 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17945 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
17947 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
17948 .name = "Channel Mode",
17949 .info = alc_ch_mode_info,
17950 .get = alc_ch_mode_get,
17951 .put = alc_ch_mode_put,
17956 static struct hda_verb alc662_init_verbs[] = {
17957 /* ADC: mute amp left and right */
17958 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17959 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
17961 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17962 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17963 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17964 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17965 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17966 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17968 /* Front Pin: output 0 (0x0c) */
17969 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17970 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17972 /* Rear Pin: output 1 (0x0d) */
17973 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17974 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17976 /* CLFE Pin: output 2 (0x0e) */
17977 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17978 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17980 /* Mic (rear) pin: input vref at 80% */
17981 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
17982 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17983 /* Front Mic pin: input vref at 80% */
17984 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
17985 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17986 /* Line In pin: input */
17987 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17988 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17989 /* Line-2 In: Headphone output (output 0 - 0x0c) */
17990 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17991 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17992 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
17993 /* CD pin widget for input */
17994 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17996 /* FIXME: use matrix-type input source selection */
17997 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
17999 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
18000 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
18002 /* always trun on EAPD */
18003 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
18004 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
18009 static struct hda_verb alc663_init_verbs[] = {
18010 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
18011 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18012 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
18013 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18014 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
18015 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
18019 static struct hda_verb alc272_init_verbs[] = {
18020 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18021 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
18022 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
18023 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18024 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
18025 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18026 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
18027 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
18031 static struct hda_verb alc662_sue_init_verbs[] = {
18032 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
18033 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
18037 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
18038 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18039 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18043 /* Set Unsolicited Event*/
18044 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
18045 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
18046 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18050 static struct hda_verb alc663_m51va_init_verbs[] = {
18051 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18052 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18053 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18054 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18055 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18056 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18057 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18058 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18059 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18063 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
18064 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18065 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18066 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18067 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18068 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
18069 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18070 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18074 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
18075 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18076 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18077 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18078 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
18079 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18080 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
18081 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18082 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18086 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
18087 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18088 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18089 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18090 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18091 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
18092 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18093 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18097 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
18098 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18099 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18100 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18101 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
18102 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18103 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18104 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
18105 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18106 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
18107 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18108 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18109 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18113 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
18114 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18115 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18116 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18117 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18118 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18119 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18120 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18121 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18122 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
18123 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18124 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18125 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18129 static struct hda_verb alc663_g71v_init_verbs[] = {
18130 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18131 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
18132 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
18134 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18135 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18136 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
18138 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
18139 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
18140 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
18144 static struct hda_verb alc663_g50v_init_verbs[] = {
18145 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18146 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18147 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
18149 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18150 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18154 static struct hda_verb alc662_ecs_init_verbs[] = {
18155 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
18156 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18157 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18158 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18162 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
18163 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18164 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18165 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18166 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18167 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18168 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18169 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18170 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18171 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18172 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18173 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18177 static struct hda_verb alc272_dell_init_verbs[] = {
18178 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18179 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18180 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18181 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18182 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18183 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18184 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18185 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18186 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18187 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18188 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18192 static struct hda_verb alc663_mode7_init_verbs[] = {
18193 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18194 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18195 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
18196 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18197 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18198 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18199 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
18200 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18201 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18202 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18203 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18204 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18205 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18206 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18207 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18211 static struct hda_verb alc663_mode8_init_verbs[] = {
18212 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18213 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18214 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18215 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
18216 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18217 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
18218 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18219 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18220 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18221 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18222 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18223 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18224 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18225 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18226 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18227 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18231 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
18232 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
18233 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
18237 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
18238 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
18239 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
18243 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
18245 unsigned int present;
18246 unsigned char bits;
18248 present = snd_hda_jack_detect(codec, 0x14);
18249 bits = present ? HDA_AMP_MUTE : 0;
18251 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
18252 HDA_AMP_MUTE, bits);
18255 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
18257 unsigned int present;
18258 unsigned char bits;
18260 present = snd_hda_jack_detect(codec, 0x1b);
18261 bits = present ? HDA_AMP_MUTE : 0;
18263 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
18264 HDA_AMP_MUTE, bits);
18265 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18266 HDA_AMP_MUTE, bits);
18269 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
18272 if ((res >> 26) == ALC880_HP_EVENT)
18273 alc662_lenovo_101e_all_automute(codec);
18274 if ((res >> 26) == ALC880_FRONT_EVENT)
18275 alc662_lenovo_101e_ispeaker_automute(codec);
18278 /* unsolicited event for HP jack sensing */
18279 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
18282 if ((res >> 26) == ALC880_MIC_EVENT)
18283 alc_mic_automute(codec);
18285 alc262_hippo_unsol_event(codec, res);
18288 static void alc662_eeepc_setup(struct hda_codec *codec)
18290 struct alc_spec *spec = codec->spec;
18292 alc262_hippo1_setup(codec);
18293 spec->ext_mic.pin = 0x18;
18294 spec->ext_mic.mux_idx = 0;
18295 spec->int_mic.pin = 0x19;
18296 spec->int_mic.mux_idx = 1;
18297 spec->auto_mic = 1;
18300 static void alc662_eeepc_inithook(struct hda_codec *codec)
18302 alc262_hippo_automute(codec);
18303 alc_mic_automute(codec);
18306 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
18308 struct alc_spec *spec = codec->spec;
18310 spec->autocfg.hp_pins[0] = 0x14;
18311 spec->autocfg.speaker_pins[0] = 0x1b;
18314 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
18316 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
18318 unsigned int present;
18319 unsigned char bits;
18321 present = snd_hda_jack_detect(codec, 0x21);
18322 bits = present ? HDA_AMP_MUTE : 0;
18323 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18324 HDA_AMP_MUTE, bits);
18325 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18326 HDA_AMP_MUTE, bits);
18329 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
18331 unsigned int present;
18332 unsigned char bits;
18334 present = snd_hda_jack_detect(codec, 0x21);
18335 bits = present ? HDA_AMP_MUTE : 0;
18336 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18337 HDA_AMP_MUTE, bits);
18338 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18339 HDA_AMP_MUTE, bits);
18340 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
18341 HDA_AMP_MUTE, bits);
18342 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
18343 HDA_AMP_MUTE, bits);
18346 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
18348 unsigned int present;
18349 unsigned char bits;
18351 present = snd_hda_jack_detect(codec, 0x15);
18352 bits = present ? HDA_AMP_MUTE : 0;
18353 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18354 HDA_AMP_MUTE, bits);
18355 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18356 HDA_AMP_MUTE, bits);
18357 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
18358 HDA_AMP_MUTE, bits);
18359 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
18360 HDA_AMP_MUTE, bits);
18363 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
18365 unsigned int present;
18366 unsigned char bits;
18368 present = snd_hda_jack_detect(codec, 0x1b);
18369 bits = present ? 0 : PIN_OUT;
18370 snd_hda_codec_write(codec, 0x14, 0,
18371 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
18374 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
18376 unsigned int present1, present2;
18378 present1 = snd_hda_jack_detect(codec, 0x21);
18379 present2 = snd_hda_jack_detect(codec, 0x15);
18381 if (present1 || present2) {
18382 snd_hda_codec_write_cache(codec, 0x14, 0,
18383 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18385 snd_hda_codec_write_cache(codec, 0x14, 0,
18386 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18390 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
18392 unsigned int present1, present2;
18394 present1 = snd_hda_jack_detect(codec, 0x1b);
18395 present2 = snd_hda_jack_detect(codec, 0x15);
18397 if (present1 || present2) {
18398 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18399 HDA_AMP_MUTE, HDA_AMP_MUTE);
18400 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18401 HDA_AMP_MUTE, HDA_AMP_MUTE);
18403 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18405 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18410 static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
18412 unsigned int present1, present2;
18414 present1 = snd_hda_codec_read(codec, 0x1b, 0,
18415 AC_VERB_GET_PIN_SENSE, 0)
18416 & AC_PINSENSE_PRESENCE;
18417 present2 = snd_hda_codec_read(codec, 0x21, 0,
18418 AC_VERB_GET_PIN_SENSE, 0)
18419 & AC_PINSENSE_PRESENCE;
18421 if (present1 || present2) {
18422 snd_hda_codec_write_cache(codec, 0x14, 0,
18423 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18424 snd_hda_codec_write_cache(codec, 0x17, 0,
18425 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18427 snd_hda_codec_write_cache(codec, 0x14, 0,
18428 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18429 snd_hda_codec_write_cache(codec, 0x17, 0,
18430 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18434 static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
18436 unsigned int present1, present2;
18438 present1 = snd_hda_codec_read(codec, 0x21, 0,
18439 AC_VERB_GET_PIN_SENSE, 0)
18440 & AC_PINSENSE_PRESENCE;
18441 present2 = snd_hda_codec_read(codec, 0x15, 0,
18442 AC_VERB_GET_PIN_SENSE, 0)
18443 & AC_PINSENSE_PRESENCE;
18445 if (present1 || present2) {
18446 snd_hda_codec_write_cache(codec, 0x14, 0,
18447 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18448 snd_hda_codec_write_cache(codec, 0x17, 0,
18449 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18451 snd_hda_codec_write_cache(codec, 0x14, 0,
18452 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18453 snd_hda_codec_write_cache(codec, 0x17, 0,
18454 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18458 static void alc663_m51va_unsol_event(struct hda_codec *codec,
18461 switch (res >> 26) {
18462 case ALC880_HP_EVENT:
18463 alc663_m51va_speaker_automute(codec);
18465 case ALC880_MIC_EVENT:
18466 alc_mic_automute(codec);
18471 static void alc663_m51va_setup(struct hda_codec *codec)
18473 struct alc_spec *spec = codec->spec;
18474 spec->ext_mic.pin = 0x18;
18475 spec->ext_mic.mux_idx = 0;
18476 spec->int_mic.pin = 0x12;
18477 spec->int_mic.mux_idx = 9;
18478 spec->auto_mic = 1;
18481 static void alc663_m51va_inithook(struct hda_codec *codec)
18483 alc663_m51va_speaker_automute(codec);
18484 alc_mic_automute(codec);
18487 /* ***************** Mode1 ******************************/
18488 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
18490 static void alc663_mode1_setup(struct hda_codec *codec)
18492 struct alc_spec *spec = codec->spec;
18493 spec->ext_mic.pin = 0x18;
18494 spec->ext_mic.mux_idx = 0;
18495 spec->int_mic.pin = 0x19;
18496 spec->int_mic.mux_idx = 1;
18497 spec->auto_mic = 1;
18500 #define alc663_mode1_inithook alc663_m51va_inithook
18502 /* ***************** Mode2 ******************************/
18503 static void alc662_mode2_unsol_event(struct hda_codec *codec,
18506 switch (res >> 26) {
18507 case ALC880_HP_EVENT:
18508 alc662_f5z_speaker_automute(codec);
18510 case ALC880_MIC_EVENT:
18511 alc_mic_automute(codec);
18516 #define alc662_mode2_setup alc663_mode1_setup
18518 static void alc662_mode2_inithook(struct hda_codec *codec)
18520 alc662_f5z_speaker_automute(codec);
18521 alc_mic_automute(codec);
18523 /* ***************** Mode3 ******************************/
18524 static void alc663_mode3_unsol_event(struct hda_codec *codec,
18527 switch (res >> 26) {
18528 case ALC880_HP_EVENT:
18529 alc663_two_hp_m1_speaker_automute(codec);
18531 case ALC880_MIC_EVENT:
18532 alc_mic_automute(codec);
18537 #define alc663_mode3_setup alc663_mode1_setup
18539 static void alc663_mode3_inithook(struct hda_codec *codec)
18541 alc663_two_hp_m1_speaker_automute(codec);
18542 alc_mic_automute(codec);
18544 /* ***************** Mode4 ******************************/
18545 static void alc663_mode4_unsol_event(struct hda_codec *codec,
18548 switch (res >> 26) {
18549 case ALC880_HP_EVENT:
18550 alc663_21jd_two_speaker_automute(codec);
18552 case ALC880_MIC_EVENT:
18553 alc_mic_automute(codec);
18558 #define alc663_mode4_setup alc663_mode1_setup
18560 static void alc663_mode4_inithook(struct hda_codec *codec)
18562 alc663_21jd_two_speaker_automute(codec);
18563 alc_mic_automute(codec);
18565 /* ***************** Mode5 ******************************/
18566 static void alc663_mode5_unsol_event(struct hda_codec *codec,
18569 switch (res >> 26) {
18570 case ALC880_HP_EVENT:
18571 alc663_15jd_two_speaker_automute(codec);
18573 case ALC880_MIC_EVENT:
18574 alc_mic_automute(codec);
18579 #define alc663_mode5_setup alc663_mode1_setup
18581 static void alc663_mode5_inithook(struct hda_codec *codec)
18583 alc663_15jd_two_speaker_automute(codec);
18584 alc_mic_automute(codec);
18586 /* ***************** Mode6 ******************************/
18587 static void alc663_mode6_unsol_event(struct hda_codec *codec,
18590 switch (res >> 26) {
18591 case ALC880_HP_EVENT:
18592 alc663_two_hp_m2_speaker_automute(codec);
18594 case ALC880_MIC_EVENT:
18595 alc_mic_automute(codec);
18600 #define alc663_mode6_setup alc663_mode1_setup
18602 static void alc663_mode6_inithook(struct hda_codec *codec)
18604 alc663_two_hp_m2_speaker_automute(codec);
18605 alc_mic_automute(codec);
18608 /* ***************** Mode7 ******************************/
18609 static void alc663_mode7_unsol_event(struct hda_codec *codec,
18612 switch (res >> 26) {
18613 case ALC880_HP_EVENT:
18614 alc663_two_hp_m7_speaker_automute(codec);
18616 case ALC880_MIC_EVENT:
18617 alc_mic_automute(codec);
18622 #define alc663_mode7_setup alc663_mode1_setup
18624 static void alc663_mode7_inithook(struct hda_codec *codec)
18626 alc663_two_hp_m7_speaker_automute(codec);
18627 alc_mic_automute(codec);
18630 /* ***************** Mode8 ******************************/
18631 static void alc663_mode8_unsol_event(struct hda_codec *codec,
18634 switch (res >> 26) {
18635 case ALC880_HP_EVENT:
18636 alc663_two_hp_m8_speaker_automute(codec);
18638 case ALC880_MIC_EVENT:
18639 alc_mic_automute(codec);
18644 #define alc663_mode8_setup alc663_m51va_setup
18646 static void alc663_mode8_inithook(struct hda_codec *codec)
18648 alc663_two_hp_m8_speaker_automute(codec);
18649 alc_mic_automute(codec);
18652 static void alc663_g71v_hp_automute(struct hda_codec *codec)
18654 unsigned int present;
18655 unsigned char bits;
18657 present = snd_hda_jack_detect(codec, 0x21);
18658 bits = present ? HDA_AMP_MUTE : 0;
18659 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
18660 HDA_AMP_MUTE, bits);
18661 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18662 HDA_AMP_MUTE, bits);
18665 static void alc663_g71v_front_automute(struct hda_codec *codec)
18667 unsigned int present;
18668 unsigned char bits;
18670 present = snd_hda_jack_detect(codec, 0x15);
18671 bits = present ? HDA_AMP_MUTE : 0;
18672 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18673 HDA_AMP_MUTE, bits);
18676 static void alc663_g71v_unsol_event(struct hda_codec *codec,
18679 switch (res >> 26) {
18680 case ALC880_HP_EVENT:
18681 alc663_g71v_hp_automute(codec);
18683 case ALC880_FRONT_EVENT:
18684 alc663_g71v_front_automute(codec);
18686 case ALC880_MIC_EVENT:
18687 alc_mic_automute(codec);
18692 #define alc663_g71v_setup alc663_m51va_setup
18694 static void alc663_g71v_inithook(struct hda_codec *codec)
18696 alc663_g71v_front_automute(codec);
18697 alc663_g71v_hp_automute(codec);
18698 alc_mic_automute(codec);
18701 static void alc663_g50v_unsol_event(struct hda_codec *codec,
18704 switch (res >> 26) {
18705 case ALC880_HP_EVENT:
18706 alc663_m51va_speaker_automute(codec);
18708 case ALC880_MIC_EVENT:
18709 alc_mic_automute(codec);
18714 #define alc663_g50v_setup alc663_m51va_setup
18716 static void alc663_g50v_inithook(struct hda_codec *codec)
18718 alc663_m51va_speaker_automute(codec);
18719 alc_mic_automute(codec);
18722 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
18723 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
18724 ALC262_HIPPO_MASTER_SWITCH,
18726 HDA_CODEC_VOLUME("Mic/LineIn Boost Volume", 0x18, 0, HDA_INPUT),
18727 HDA_CODEC_VOLUME("Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
18728 HDA_CODEC_MUTE("Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
18730 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
18731 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
18732 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
18736 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
18737 /* Master Playback automatically created from Speaker and Headphone */
18738 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
18739 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
18740 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
18741 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
18743 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
18744 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
18745 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
18747 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
18748 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
18749 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
18753 #ifdef CONFIG_SND_HDA_POWER_SAVE
18754 #define alc662_loopbacks alc880_loopbacks
18758 /* pcm configuration: identical with ALC880 */
18759 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
18760 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
18761 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
18762 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
18765 * configuration and preset
18767 static const char * const alc662_models[ALC662_MODEL_LAST] = {
18768 [ALC662_3ST_2ch_DIG] = "3stack-dig",
18769 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
18770 [ALC662_3ST_6ch] = "3stack-6ch",
18771 [ALC662_5ST_DIG] = "6stack-dig",
18772 [ALC662_LENOVO_101E] = "lenovo-101e",
18773 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
18774 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
18775 [ALC662_ECS] = "ecs",
18776 [ALC663_ASUS_M51VA] = "m51va",
18777 [ALC663_ASUS_G71V] = "g71v",
18778 [ALC663_ASUS_H13] = "h13",
18779 [ALC663_ASUS_G50V] = "g50v",
18780 [ALC663_ASUS_MODE1] = "asus-mode1",
18781 [ALC662_ASUS_MODE2] = "asus-mode2",
18782 [ALC663_ASUS_MODE3] = "asus-mode3",
18783 [ALC663_ASUS_MODE4] = "asus-mode4",
18784 [ALC663_ASUS_MODE5] = "asus-mode5",
18785 [ALC663_ASUS_MODE6] = "asus-mode6",
18786 [ALC663_ASUS_MODE7] = "asus-mode7",
18787 [ALC663_ASUS_MODE8] = "asus-mode8",
18788 [ALC272_DELL] = "dell",
18789 [ALC272_DELL_ZM1] = "dell-zm1",
18790 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
18791 [ALC662_AUTO] = "auto",
18794 static struct snd_pci_quirk alc662_cfg_tbl[] = {
18795 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
18796 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
18797 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
18798 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
18799 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
18800 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1),
18801 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
18802 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
18803 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
18804 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
18805 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
18806 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
18807 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
18808 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
18809 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
18810 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
18811 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
18812 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
18813 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
18814 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
18815 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
18816 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
18817 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
18818 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
18819 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
18820 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
18821 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
18822 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
18823 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
18824 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
18825 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
18826 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
18827 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
18828 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
18829 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
18830 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
18831 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
18832 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
18833 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
18834 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
18835 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
18836 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1),
18837 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
18838 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
18839 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
18840 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
18841 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
18842 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
18843 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
18844 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
18845 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
18846 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
18847 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
18848 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
18849 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
18850 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
18851 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
18852 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
18853 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
18854 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
18855 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
18856 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
18857 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
18858 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
18859 ALC662_3ST_6ch_DIG),
18860 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO),
18861 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
18862 SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13),
18863 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
18864 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
18865 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
18866 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
18867 ALC662_3ST_6ch_DIG),
18868 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
18870 SND_PCI_QUIRK(0x1991, 0x5628, "Ordissimo EVE", ALC662_LENOVO_101E),
18874 static struct alc_config_preset alc662_presets[] = {
18875 [ALC662_3ST_2ch_DIG] = {
18876 .mixers = { alc662_3ST_2ch_mixer },
18877 .init_verbs = { alc662_init_verbs },
18878 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18879 .dac_nids = alc662_dac_nids,
18880 .dig_out_nid = ALC662_DIGOUT_NID,
18881 .dig_in_nid = ALC662_DIGIN_NID,
18882 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18883 .channel_mode = alc662_3ST_2ch_modes,
18884 .input_mux = &alc662_capture_source,
18886 [ALC662_3ST_6ch_DIG] = {
18887 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18888 .init_verbs = { alc662_init_verbs },
18889 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18890 .dac_nids = alc662_dac_nids,
18891 .dig_out_nid = ALC662_DIGOUT_NID,
18892 .dig_in_nid = ALC662_DIGIN_NID,
18893 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18894 .channel_mode = alc662_3ST_6ch_modes,
18896 .input_mux = &alc662_capture_source,
18898 [ALC662_3ST_6ch] = {
18899 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18900 .init_verbs = { alc662_init_verbs },
18901 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18902 .dac_nids = alc662_dac_nids,
18903 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18904 .channel_mode = alc662_3ST_6ch_modes,
18906 .input_mux = &alc662_capture_source,
18908 [ALC662_5ST_DIG] = {
18909 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
18910 .init_verbs = { alc662_init_verbs },
18911 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18912 .dac_nids = alc662_dac_nids,
18913 .dig_out_nid = ALC662_DIGOUT_NID,
18914 .dig_in_nid = ALC662_DIGIN_NID,
18915 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
18916 .channel_mode = alc662_5stack_modes,
18917 .input_mux = &alc662_capture_source,
18919 [ALC662_LENOVO_101E] = {
18920 .mixers = { alc662_lenovo_101e_mixer },
18921 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
18922 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18923 .dac_nids = alc662_dac_nids,
18924 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18925 .channel_mode = alc662_3ST_2ch_modes,
18926 .input_mux = &alc662_lenovo_101e_capture_source,
18927 .unsol_event = alc662_lenovo_101e_unsol_event,
18928 .init_hook = alc662_lenovo_101e_all_automute,
18930 [ALC662_ASUS_EEEPC_P701] = {
18931 .mixers = { alc662_eeepc_p701_mixer },
18932 .init_verbs = { alc662_init_verbs,
18933 alc662_eeepc_sue_init_verbs },
18934 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18935 .dac_nids = alc662_dac_nids,
18936 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18937 .channel_mode = alc662_3ST_2ch_modes,
18938 .unsol_event = alc662_eeepc_unsol_event,
18939 .setup = alc662_eeepc_setup,
18940 .init_hook = alc662_eeepc_inithook,
18942 [ALC662_ASUS_EEEPC_EP20] = {
18943 .mixers = { alc662_eeepc_ep20_mixer,
18944 alc662_chmode_mixer },
18945 .init_verbs = { alc662_init_verbs,
18946 alc662_eeepc_ep20_sue_init_verbs },
18947 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18948 .dac_nids = alc662_dac_nids,
18949 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18950 .channel_mode = alc662_3ST_6ch_modes,
18951 .input_mux = &alc662_lenovo_101e_capture_source,
18952 .unsol_event = alc662_eeepc_unsol_event,
18953 .setup = alc662_eeepc_ep20_setup,
18954 .init_hook = alc662_eeepc_ep20_inithook,
18957 .mixers = { alc662_ecs_mixer },
18958 .init_verbs = { alc662_init_verbs,
18959 alc662_ecs_init_verbs },
18960 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18961 .dac_nids = alc662_dac_nids,
18962 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18963 .channel_mode = alc662_3ST_2ch_modes,
18964 .unsol_event = alc662_eeepc_unsol_event,
18965 .setup = alc662_eeepc_setup,
18966 .init_hook = alc662_eeepc_inithook,
18968 [ALC663_ASUS_M51VA] = {
18969 .mixers = { alc663_m51va_mixer },
18970 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
18971 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18972 .dac_nids = alc662_dac_nids,
18973 .dig_out_nid = ALC662_DIGOUT_NID,
18974 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18975 .channel_mode = alc662_3ST_2ch_modes,
18976 .unsol_event = alc663_m51va_unsol_event,
18977 .setup = alc663_m51va_setup,
18978 .init_hook = alc663_m51va_inithook,
18980 [ALC663_ASUS_G71V] = {
18981 .mixers = { alc663_g71v_mixer },
18982 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
18983 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18984 .dac_nids = alc662_dac_nids,
18985 .dig_out_nid = ALC662_DIGOUT_NID,
18986 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18987 .channel_mode = alc662_3ST_2ch_modes,
18988 .unsol_event = alc663_g71v_unsol_event,
18989 .setup = alc663_g71v_setup,
18990 .init_hook = alc663_g71v_inithook,
18992 [ALC663_ASUS_H13] = {
18993 .mixers = { alc663_m51va_mixer },
18994 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
18995 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18996 .dac_nids = alc662_dac_nids,
18997 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18998 .channel_mode = alc662_3ST_2ch_modes,
18999 .unsol_event = alc663_m51va_unsol_event,
19000 .init_hook = alc663_m51va_inithook,
19002 [ALC663_ASUS_G50V] = {
19003 .mixers = { alc663_g50v_mixer },
19004 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
19005 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
19006 .dac_nids = alc662_dac_nids,
19007 .dig_out_nid = ALC662_DIGOUT_NID,
19008 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
19009 .channel_mode = alc662_3ST_6ch_modes,
19010 .input_mux = &alc663_capture_source,
19011 .unsol_event = alc663_g50v_unsol_event,
19012 .setup = alc663_g50v_setup,
19013 .init_hook = alc663_g50v_inithook,
19015 [ALC663_ASUS_MODE1] = {
19016 .mixers = { alc663_m51va_mixer },
19017 .cap_mixer = alc662_auto_capture_mixer,
19018 .init_verbs = { alc662_init_verbs,
19019 alc663_21jd_amic_init_verbs },
19020 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
19022 .dac_nids = alc662_dac_nids,
19023 .dig_out_nid = ALC662_DIGOUT_NID,
19024 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19025 .channel_mode = alc662_3ST_2ch_modes,
19026 .unsol_event = alc663_mode1_unsol_event,
19027 .setup = alc663_mode1_setup,
19028 .init_hook = alc663_mode1_inithook,
19030 [ALC662_ASUS_MODE2] = {
19031 .mixers = { alc662_1bjd_mixer },
19032 .cap_mixer = alc662_auto_capture_mixer,
19033 .init_verbs = { alc662_init_verbs,
19034 alc662_1bjd_amic_init_verbs },
19035 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
19036 .dac_nids = alc662_dac_nids,
19037 .dig_out_nid = ALC662_DIGOUT_NID,
19038 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19039 .channel_mode = alc662_3ST_2ch_modes,
19040 .unsol_event = alc662_mode2_unsol_event,
19041 .setup = alc662_mode2_setup,
19042 .init_hook = alc662_mode2_inithook,
19044 [ALC663_ASUS_MODE3] = {
19045 .mixers = { alc663_two_hp_m1_mixer },
19046 .cap_mixer = alc662_auto_capture_mixer,
19047 .init_verbs = { alc662_init_verbs,
19048 alc663_two_hp_amic_m1_init_verbs },
19049 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
19051 .dac_nids = alc662_dac_nids,
19052 .dig_out_nid = ALC662_DIGOUT_NID,
19053 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19054 .channel_mode = alc662_3ST_2ch_modes,
19055 .unsol_event = alc663_mode3_unsol_event,
19056 .setup = alc663_mode3_setup,
19057 .init_hook = alc663_mode3_inithook,
19059 [ALC663_ASUS_MODE4] = {
19060 .mixers = { alc663_asus_21jd_clfe_mixer },
19061 .cap_mixer = alc662_auto_capture_mixer,
19062 .init_verbs = { alc662_init_verbs,
19063 alc663_21jd_amic_init_verbs},
19064 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
19066 .dac_nids = alc662_dac_nids,
19067 .dig_out_nid = ALC662_DIGOUT_NID,
19068 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19069 .channel_mode = alc662_3ST_2ch_modes,
19070 .unsol_event = alc663_mode4_unsol_event,
19071 .setup = alc663_mode4_setup,
19072 .init_hook = alc663_mode4_inithook,
19074 [ALC663_ASUS_MODE5] = {
19075 .mixers = { alc663_asus_15jd_clfe_mixer },
19076 .cap_mixer = alc662_auto_capture_mixer,
19077 .init_verbs = { alc662_init_verbs,
19078 alc663_15jd_amic_init_verbs },
19079 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
19081 .dac_nids = alc662_dac_nids,
19082 .dig_out_nid = ALC662_DIGOUT_NID,
19083 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19084 .channel_mode = alc662_3ST_2ch_modes,
19085 .unsol_event = alc663_mode5_unsol_event,
19086 .setup = alc663_mode5_setup,
19087 .init_hook = alc663_mode5_inithook,
19089 [ALC663_ASUS_MODE6] = {
19090 .mixers = { alc663_two_hp_m2_mixer },
19091 .cap_mixer = alc662_auto_capture_mixer,
19092 .init_verbs = { alc662_init_verbs,
19093 alc663_two_hp_amic_m2_init_verbs },
19094 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
19096 .dac_nids = alc662_dac_nids,
19097 .dig_out_nid = ALC662_DIGOUT_NID,
19098 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19099 .channel_mode = alc662_3ST_2ch_modes,
19100 .unsol_event = alc663_mode6_unsol_event,
19101 .setup = alc663_mode6_setup,
19102 .init_hook = alc663_mode6_inithook,
19104 [ALC663_ASUS_MODE7] = {
19105 .mixers = { alc663_mode7_mixer },
19106 .cap_mixer = alc662_auto_capture_mixer,
19107 .init_verbs = { alc662_init_verbs,
19108 alc663_mode7_init_verbs },
19109 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
19111 .dac_nids = alc662_dac_nids,
19112 .dig_out_nid = ALC662_DIGOUT_NID,
19113 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19114 .channel_mode = alc662_3ST_2ch_modes,
19115 .unsol_event = alc663_mode7_unsol_event,
19116 .setup = alc663_mode7_setup,
19117 .init_hook = alc663_mode7_inithook,
19119 [ALC663_ASUS_MODE8] = {
19120 .mixers = { alc663_mode8_mixer },
19121 .cap_mixer = alc662_auto_capture_mixer,
19122 .init_verbs = { alc662_init_verbs,
19123 alc663_mode8_init_verbs },
19124 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
19126 .dac_nids = alc662_dac_nids,
19127 .dig_out_nid = ALC662_DIGOUT_NID,
19128 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19129 .channel_mode = alc662_3ST_2ch_modes,
19130 .unsol_event = alc663_mode8_unsol_event,
19131 .setup = alc663_mode8_setup,
19132 .init_hook = alc663_mode8_inithook,
19135 .mixers = { alc663_m51va_mixer },
19136 .cap_mixer = alc272_auto_capture_mixer,
19137 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
19138 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
19139 .dac_nids = alc662_dac_nids,
19140 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19141 .adc_nids = alc272_adc_nids,
19142 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
19143 .capsrc_nids = alc272_capsrc_nids,
19144 .channel_mode = alc662_3ST_2ch_modes,
19145 .unsol_event = alc663_m51va_unsol_event,
19146 .setup = alc663_m51va_setup,
19147 .init_hook = alc663_m51va_inithook,
19149 [ALC272_DELL_ZM1] = {
19150 .mixers = { alc663_m51va_mixer },
19151 .cap_mixer = alc662_auto_capture_mixer,
19152 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
19153 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
19154 .dac_nids = alc662_dac_nids,
19155 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19156 .adc_nids = alc662_adc_nids,
19158 .capsrc_nids = alc662_capsrc_nids,
19159 .channel_mode = alc662_3ST_2ch_modes,
19160 .unsol_event = alc663_m51va_unsol_event,
19161 .setup = alc663_m51va_setup,
19162 .init_hook = alc663_m51va_inithook,
19164 [ALC272_SAMSUNG_NC10] = {
19165 .mixers = { alc272_nc10_mixer },
19166 .init_verbs = { alc662_init_verbs,
19167 alc663_21jd_amic_init_verbs },
19168 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
19169 .dac_nids = alc272_dac_nids,
19170 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19171 .channel_mode = alc662_3ST_2ch_modes,
19172 /*.input_mux = &alc272_nc10_capture_source,*/
19173 .unsol_event = alc663_mode4_unsol_event,
19174 .setup = alc663_mode4_setup,
19175 .init_hook = alc663_mode4_inithook,
19181 * BIOS auto configuration
19184 /* convert from MIX nid to DAC */
19185 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
19189 else if (nid >= 0x0c && nid <= 0x0e)
19190 return nid - 0x0c + 0x02;
19191 else if (nid == 0x26) /* ALC887-VD has this DAC too */
19197 /* get MIX nid connected to the given pin targeted to DAC */
19198 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
19204 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
19205 for (i = 0; i < num; i++) {
19206 if (alc662_mix_to_dac(mix[i]) == dac)
19212 /* look for an empty DAC slot */
19213 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
19215 struct alc_spec *spec = codec->spec;
19219 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
19222 for (i = 0; i < num; i++) {
19223 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
19226 for (j = 0; j < spec->multiout.num_dacs; j++)
19227 if (spec->multiout.dac_nids[j] == nid)
19229 if (j >= spec->multiout.num_dacs)
19235 /* fill in the dac_nids table from the parsed pin configuration */
19236 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
19237 const struct auto_pin_cfg *cfg)
19239 struct alc_spec *spec = codec->spec;
19243 spec->multiout.dac_nids = spec->private_dac_nids;
19244 for (i = 0; i < cfg->line_outs; i++) {
19245 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
19248 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
19253 static inline int __alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
19254 hda_nid_t nid, int idx, unsigned int chs)
19256 return __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, idx,
19257 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
19260 static inline int __alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
19261 hda_nid_t nid, int idx, unsigned int chs)
19263 return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, idx,
19264 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
19267 #define alc662_add_vol_ctl(spec, pfx, nid, chs) \
19268 __alc662_add_vol_ctl(spec, pfx, nid, 0, chs)
19269 #define alc662_add_sw_ctl(spec, pfx, nid, chs) \
19270 __alc662_add_sw_ctl(spec, pfx, nid, 0, chs)
19271 #define alc662_add_stereo_vol(spec, pfx, nid) \
19272 alc662_add_vol_ctl(spec, pfx, nid, 3)
19273 #define alc662_add_stereo_sw(spec, pfx, nid) \
19274 alc662_add_sw_ctl(spec, pfx, nid, 3)
19276 /* add playback controls from the parsed DAC table */
19277 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
19278 const struct auto_pin_cfg *cfg)
19280 struct alc_spec *spec = codec->spec;
19281 static const char * const chname[4] = {
19282 "Front", "Surround", NULL /*CLFE*/, "Side"
19284 const char *pfx = alc_get_line_out_pfx(cfg, true);
19285 hda_nid_t nid, mix;
19288 for (i = 0; i < cfg->line_outs; i++) {
19289 nid = spec->multiout.dac_nids[i];
19292 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
19295 if (!pfx && i == 2) {
19297 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
19300 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
19303 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
19306 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
19310 const char *name = pfx;
19316 err = __alc662_add_vol_ctl(spec, name, nid, index, 3);
19319 err = __alc662_add_sw_ctl(spec, name, mix, index, 3);
19327 /* add playback controls for speaker and HP outputs */
19328 /* return DAC nid if any new DAC is assigned */
19329 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
19332 struct alc_spec *spec = codec->spec;
19333 hda_nid_t nid, mix;
19338 nid = alc662_look_for_dac(codec, pin);
19340 /* the corresponding DAC is already occupied */
19341 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
19342 return 0; /* no way */
19343 /* create a switch only */
19344 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
19345 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
19348 mix = alc662_dac_to_mix(codec, pin, nid);
19351 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
19354 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
19360 /* create playback/capture controls for input pins */
19361 #define alc662_auto_create_input_ctls \
19362 alc882_auto_create_input_ctls
19364 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
19365 hda_nid_t nid, int pin_type,
19369 hda_nid_t srcs[HDA_MAX_CONNECTIONS];
19371 alc_set_pin_output(codec, nid, pin_type);
19372 /* need the manual connection? */
19373 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
19376 for (i = 0; i < num; i++) {
19377 if (alc662_mix_to_dac(srcs[i]) != dac)
19379 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
19384 static void alc662_auto_init_multi_out(struct hda_codec *codec)
19386 struct alc_spec *spec = codec->spec;
19387 int pin_type = get_pin_type(spec->autocfg.line_out_type);
19390 for (i = 0; i <= HDA_SIDE; i++) {
19391 hda_nid_t nid = spec->autocfg.line_out_pins[i];
19393 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
19394 spec->multiout.dac_nids[i]);
19398 static void alc662_auto_init_hp_out(struct hda_codec *codec)
19400 struct alc_spec *spec = codec->spec;
19403 pin = spec->autocfg.hp_pins[0];
19405 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
19406 spec->multiout.hp_nid);
19407 pin = spec->autocfg.speaker_pins[0];
19409 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
19410 spec->multiout.extra_out_nid[0]);
19413 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
19415 static void alc662_auto_init_analog_input(struct hda_codec *codec)
19417 struct alc_spec *spec = codec->spec;
19418 struct auto_pin_cfg *cfg = &spec->autocfg;
19421 for (i = 0; i < cfg->num_inputs; i++) {
19422 hda_nid_t nid = cfg->inputs[i].pin;
19423 if (alc_is_input_pin(codec, nid)) {
19424 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
19425 if (nid != ALC662_PIN_CD_NID &&
19426 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
19427 snd_hda_codec_write(codec, nid, 0,
19428 AC_VERB_SET_AMP_GAIN_MUTE,
19434 #define alc662_auto_init_input_src alc882_auto_init_input_src
19436 static int alc662_parse_auto_config(struct hda_codec *codec)
19438 struct alc_spec *spec = codec->spec;
19440 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
19442 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
19446 if (!spec->autocfg.line_outs)
19447 return 0; /* can't find valid BIOS pin config */
19449 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
19452 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
19455 err = alc662_auto_create_extra_out(codec,
19456 spec->autocfg.speaker_pins[0],
19461 spec->multiout.extra_out_nid[0] = err;
19462 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
19467 spec->multiout.hp_nid = err;
19468 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
19472 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
19474 alc_auto_parse_digital(codec);
19476 if (spec->kctls.list)
19477 add_mixer(spec, spec->kctls.list);
19479 spec->num_mux_defs = 1;
19480 spec->input_mux = &spec->private_imux[0];
19482 add_verb(spec, alc662_init_verbs);
19483 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
19484 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
19485 add_verb(spec, alc663_init_verbs);
19487 if (codec->vendor_id == 0x10ec0272)
19488 add_verb(spec, alc272_init_verbs);
19490 err = alc_auto_add_mic_boost(codec);
19494 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
19495 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
19496 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21);
19498 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
19503 /* additional initialization for auto-configuration model */
19504 static void alc662_auto_init(struct hda_codec *codec)
19506 struct alc_spec *spec = codec->spec;
19507 alc662_auto_init_multi_out(codec);
19508 alc662_auto_init_hp_out(codec);
19509 alc662_auto_init_analog_input(codec);
19510 alc662_auto_init_input_src(codec);
19511 alc_auto_init_digital(codec);
19512 if (spec->unsol_event)
19513 alc_inithook(codec);
19516 static void alc272_fixup_mario(struct hda_codec *codec,
19517 const struct alc_fixup *fix, int action)
19519 if (action != ALC_FIXUP_ACT_PROBE)
19521 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
19522 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
19523 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
19524 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
19525 (0 << AC_AMPCAP_MUTE_SHIFT)))
19526 printk(KERN_WARNING
19527 "hda_codec: failed to override amp caps for NID 0x2\n");
19531 ALC662_FIXUP_ASPIRE,
19532 ALC662_FIXUP_IDEAPAD,
19533 ALC272_FIXUP_MARIO,
19534 ALC662_FIXUP_CZC_P10T,
19535 ALC662_FIXUP_GIGABYTE,
19538 static const struct alc_fixup alc662_fixups[] = {
19539 [ALC662_FIXUP_ASPIRE] = {
19540 .type = ALC_FIXUP_PINS,
19541 .v.pins = (const struct alc_pincfg[]) {
19542 { 0x15, 0x99130112 }, /* subwoofer */
19546 [ALC662_FIXUP_IDEAPAD] = {
19547 .type = ALC_FIXUP_PINS,
19548 .v.pins = (const struct alc_pincfg[]) {
19549 { 0x17, 0x99130112 }, /* subwoofer */
19553 [ALC272_FIXUP_MARIO] = {
19554 .type = ALC_FIXUP_FUNC,
19555 .v.func = alc272_fixup_mario,
19557 [ALC662_FIXUP_CZC_P10T] = {
19558 .type = ALC_FIXUP_VERBS,
19559 .v.verbs = (const struct hda_verb[]) {
19560 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
19564 [ALC662_FIXUP_GIGABYTE] = {
19565 .type = ALC_FIXUP_PINS,
19566 .v.pins = (const struct alc_pincfg[]) {
19567 { 0x14, 0x1114410 }, /* set as speaker */
19573 static struct snd_pci_quirk alc662_fixup_tbl[] = {
19574 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
19575 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
19576 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
19577 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte", ALC662_FIXUP_GIGABYTE),
19578 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
19579 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
19580 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
19584 static const struct alc_model_fixup alc662_fixup_models[] = {
19585 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
19590 static int patch_alc662(struct hda_codec *codec)
19592 struct alc_spec *spec;
19593 int err, board_config;
19596 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
19600 codec->spec = spec;
19602 alc_auto_parse_customize_define(codec);
19604 alc_fix_pll_init(codec, 0x20, 0x04, 15);
19606 coef = alc_read_coef_idx(codec, 0);
19607 if (coef == 0x8020 || coef == 0x8011)
19608 alc_codec_rename(codec, "ALC661");
19609 else if (coef & (1 << 14) &&
19610 codec->bus->pci->subsystem_vendor == 0x1025 &&
19611 spec->cdefine.platform_type == 1)
19612 alc_codec_rename(codec, "ALC272X");
19613 else if (coef == 0x4011)
19614 alc_codec_rename(codec, "ALC656");
19616 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
19619 if (board_config < 0) {
19620 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
19622 board_config = ALC662_AUTO;
19625 if (board_config == ALC662_AUTO) {
19626 alc_pick_fixup(codec, alc662_fixup_models,
19627 alc662_fixup_tbl, alc662_fixups);
19628 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
19629 /* automatic parse from the BIOS config */
19630 err = alc662_parse_auto_config(codec);
19636 "hda_codec: Cannot set up configuration "
19637 "from BIOS. Using base mode...\n");
19638 board_config = ALC662_3ST_2ch_DIG;
19642 if (has_cdefine_beep(codec)) {
19643 err = snd_hda_attach_beep_device(codec, 0x1);
19650 if (board_config != ALC662_AUTO)
19651 setup_preset(codec, &alc662_presets[board_config]);
19653 spec->stream_analog_playback = &alc662_pcm_analog_playback;
19654 spec->stream_analog_capture = &alc662_pcm_analog_capture;
19656 spec->stream_digital_playback = &alc662_pcm_digital_playback;
19657 spec->stream_digital_capture = &alc662_pcm_digital_capture;
19659 if (!spec->adc_nids) {
19660 spec->adc_nids = alc662_adc_nids;
19661 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
19663 if (!spec->capsrc_nids)
19664 spec->capsrc_nids = alc662_capsrc_nids;
19666 if (!spec->cap_mixer)
19667 set_capture_mixer(codec);
19669 if (has_cdefine_beep(codec)) {
19670 switch (codec->vendor_id) {
19672 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
19677 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
19680 set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
19684 spec->vmaster_nid = 0x02;
19686 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
19688 codec->patch_ops = alc_patch_ops;
19689 if (board_config == ALC662_AUTO)
19690 spec->init_hook = alc662_auto_init;
19692 alc_init_jacks(codec);
19694 #ifdef CONFIG_SND_HDA_POWER_SAVE
19695 if (!spec->loopback.amplist)
19696 spec->loopback.amplist = alc662_loopbacks;
19702 static int patch_alc888(struct hda_codec *codec)
19704 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
19705 kfree(codec->chip_name);
19706 if (codec->vendor_id == 0x10ec0887)
19707 codec->chip_name = kstrdup("ALC887-VD", GFP_KERNEL);
19709 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
19710 if (!codec->chip_name) {
19714 return patch_alc662(codec);
19716 return patch_alc882(codec);
19722 #define ALC680_DIGIN_NID ALC880_DIGIN_NID
19723 #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID
19724 #define alc680_modes alc260_modes
19726 static hda_nid_t alc680_dac_nids[3] = {
19727 /* Lout1, Lout2, hp */
19731 static hda_nid_t alc680_adc_nids[3] = {
19733 /* DMIC, MIC, Line-in*/
19738 * Analog capture ADC cgange
19740 static void alc680_rec_autoswitch(struct hda_codec *codec)
19742 struct alc_spec *spec = codec->spec;
19743 struct auto_pin_cfg *cfg = &spec->autocfg;
19745 int type_found = AUTO_PIN_LAST;
19749 for (i = 0; i < cfg->num_inputs; i++) {
19750 nid = cfg->inputs[i].pin;
19751 if (!(snd_hda_query_pin_caps(codec, nid) &
19752 AC_PINCAP_PRES_DETECT))
19754 if (snd_hda_jack_detect(codec, nid)) {
19755 if (cfg->inputs[i].type < type_found) {
19756 type_found = cfg->inputs[i].type;
19764 snd_hda_get_connections(codec, pin_found, &nid, 1);
19766 if (nid != spec->cur_adc)
19767 __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1);
19768 spec->cur_adc = nid;
19769 snd_hda_codec_setup_stream(codec, nid, spec->cur_adc_stream_tag, 0,
19770 spec->cur_adc_format);
19773 static int alc680_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
19774 struct hda_codec *codec,
19775 unsigned int stream_tag,
19776 unsigned int format,
19777 struct snd_pcm_substream *substream)
19779 struct alc_spec *spec = codec->spec;
19781 spec->cur_adc = 0x07;
19782 spec->cur_adc_stream_tag = stream_tag;
19783 spec->cur_adc_format = format;
19785 alc680_rec_autoswitch(codec);
19789 static int alc680_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
19790 struct hda_codec *codec,
19791 struct snd_pcm_substream *substream)
19793 snd_hda_codec_cleanup_stream(codec, 0x07);
19794 snd_hda_codec_cleanup_stream(codec, 0x08);
19795 snd_hda_codec_cleanup_stream(codec, 0x09);
19799 static struct hda_pcm_stream alc680_pcm_analog_auto_capture = {
19800 .substreams = 1, /* can be overridden */
19803 /* NID is set in alc_build_pcms */
19805 .prepare = alc680_capture_pcm_prepare,
19806 .cleanup = alc680_capture_pcm_cleanup
19810 static struct snd_kcontrol_new alc680_base_mixer[] = {
19811 /* output mixer control */
19812 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
19813 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
19814 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT),
19815 HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT),
19816 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x12, 0, HDA_INPUT),
19817 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
19818 HDA_CODEC_VOLUME("Line In Boost Volume", 0x19, 0, HDA_INPUT),
19822 static struct hda_bind_ctls alc680_bind_cap_vol = {
19823 .ops = &snd_hda_bind_vol,
19825 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT),
19826 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
19827 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
19832 static struct hda_bind_ctls alc680_bind_cap_switch = {
19833 .ops = &snd_hda_bind_sw,
19835 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT),
19836 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
19837 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
19842 static struct snd_kcontrol_new alc680_master_capture_mixer[] = {
19843 HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol),
19844 HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch),
19849 * generic initialization of ADC, input mixers and output mixers
19851 static struct hda_verb alc680_init_verbs[] = {
19852 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19853 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19854 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19856 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
19857 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
19858 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
19859 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
19860 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
19861 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
19863 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19864 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19865 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19866 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19867 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19869 {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
19870 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
19871 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
19876 /* toggle speaker-output according to the hp-jack state */
19877 static void alc680_base_setup(struct hda_codec *codec)
19879 struct alc_spec *spec = codec->spec;
19881 spec->autocfg.hp_pins[0] = 0x16;
19882 spec->autocfg.speaker_pins[0] = 0x14;
19883 spec->autocfg.speaker_pins[1] = 0x15;
19884 spec->autocfg.num_inputs = 2;
19885 spec->autocfg.inputs[0].pin = 0x18;
19886 spec->autocfg.inputs[0].type = AUTO_PIN_MIC;
19887 spec->autocfg.inputs[1].pin = 0x19;
19888 spec->autocfg.inputs[1].type = AUTO_PIN_LINE_IN;
19891 static void alc680_unsol_event(struct hda_codec *codec,
19894 if ((res >> 26) == ALC880_HP_EVENT)
19895 alc_automute_amp(codec);
19896 if ((res >> 26) == ALC880_MIC_EVENT)
19897 alc680_rec_autoswitch(codec);
19900 static void alc680_inithook(struct hda_codec *codec)
19902 alc_automute_amp(codec);
19903 alc680_rec_autoswitch(codec);
19906 /* create input playback/capture controls for the given pin */
19907 static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
19908 const char *ctlname, int idx)
19926 if (spec->multiout.dac_nids[0] != dac &&
19927 spec->multiout.dac_nids[1] != dac) {
19928 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
19929 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
19934 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
19935 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
19939 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
19945 /* add playback controls from the parsed DAC table */
19946 static int alc680_auto_create_multi_out_ctls(struct alc_spec *spec,
19947 const struct auto_pin_cfg *cfg)
19952 spec->multiout.dac_nids = spec->private_dac_nids;
19954 nid = cfg->line_out_pins[0];
19957 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
19961 err = alc680_new_analog_output(spec, nid, name, 0);
19966 nid = cfg->speaker_pins[0];
19968 err = alc680_new_analog_output(spec, nid, "Speaker", 0);
19972 nid = cfg->hp_pins[0];
19974 err = alc680_new_analog_output(spec, nid, "Headphone", 0);
19982 static void alc680_auto_set_output_and_unmute(struct hda_codec *codec,
19983 hda_nid_t nid, int pin_type)
19985 alc_set_pin_output(codec, nid, pin_type);
19988 static void alc680_auto_init_multi_out(struct hda_codec *codec)
19990 struct alc_spec *spec = codec->spec;
19991 hda_nid_t nid = spec->autocfg.line_out_pins[0];
19993 int pin_type = get_pin_type(spec->autocfg.line_out_type);
19994 alc680_auto_set_output_and_unmute(codec, nid, pin_type);
19998 static void alc680_auto_init_hp_out(struct hda_codec *codec)
20000 struct alc_spec *spec = codec->spec;
20003 pin = spec->autocfg.hp_pins[0];
20005 alc680_auto_set_output_and_unmute(codec, pin, PIN_HP);
20006 pin = spec->autocfg.speaker_pins[0];
20008 alc680_auto_set_output_and_unmute(codec, pin, PIN_OUT);
20011 /* pcm configuration: identical with ALC880 */
20012 #define alc680_pcm_analog_playback alc880_pcm_analog_playback
20013 #define alc680_pcm_analog_capture alc880_pcm_analog_capture
20014 #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
20015 #define alc680_pcm_digital_playback alc880_pcm_digital_playback
20016 #define alc680_pcm_digital_capture alc880_pcm_digital_capture
20019 * BIOS auto configuration
20021 static int alc680_parse_auto_config(struct hda_codec *codec)
20023 struct alc_spec *spec = codec->spec;
20025 static hda_nid_t alc680_ignore[] = { 0 };
20027 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
20032 if (!spec->autocfg.line_outs) {
20033 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
20034 spec->multiout.max_channels = 2;
20035 spec->no_analog = 1;
20038 return 0; /* can't find valid BIOS pin config */
20040 err = alc680_auto_create_multi_out_ctls(spec, &spec->autocfg);
20044 spec->multiout.max_channels = 2;
20047 /* digital only support output */
20048 alc_auto_parse_digital(codec);
20049 if (spec->kctls.list)
20050 add_mixer(spec, spec->kctls.list);
20052 add_verb(spec, alc680_init_verbs);
20054 err = alc_auto_add_mic_boost(codec);
20061 #define alc680_auto_init_analog_input alc882_auto_init_analog_input
20063 /* init callback for auto-configuration model -- overriding the default init */
20064 static void alc680_auto_init(struct hda_codec *codec)
20066 struct alc_spec *spec = codec->spec;
20067 alc680_auto_init_multi_out(codec);
20068 alc680_auto_init_hp_out(codec);
20069 alc680_auto_init_analog_input(codec);
20070 alc_auto_init_digital(codec);
20071 if (spec->unsol_event)
20072 alc_inithook(codec);
20076 * configuration and preset
20078 static const char * const alc680_models[ALC680_MODEL_LAST] = {
20079 [ALC680_BASE] = "base",
20080 [ALC680_AUTO] = "auto",
20083 static struct snd_pci_quirk alc680_cfg_tbl[] = {
20084 SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE),
20088 static struct alc_config_preset alc680_presets[] = {
20090 .mixers = { alc680_base_mixer },
20091 .cap_mixer = alc680_master_capture_mixer,
20092 .init_verbs = { alc680_init_verbs },
20093 .num_dacs = ARRAY_SIZE(alc680_dac_nids),
20094 .dac_nids = alc680_dac_nids,
20095 .dig_out_nid = ALC680_DIGOUT_NID,
20096 .num_channel_mode = ARRAY_SIZE(alc680_modes),
20097 .channel_mode = alc680_modes,
20098 .unsol_event = alc680_unsol_event,
20099 .setup = alc680_base_setup,
20100 .init_hook = alc680_inithook,
20105 static int patch_alc680(struct hda_codec *codec)
20107 struct alc_spec *spec;
20111 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
20115 codec->spec = spec;
20117 board_config = snd_hda_check_board_config(codec, ALC680_MODEL_LAST,
20121 if (board_config < 0 || board_config >= ALC680_MODEL_LAST) {
20122 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
20124 board_config = ALC680_AUTO;
20127 if (board_config == ALC680_AUTO) {
20128 /* automatic parse from the BIOS config */
20129 err = alc680_parse_auto_config(codec);
20135 "hda_codec: Cannot set up configuration "
20136 "from BIOS. Using base mode...\n");
20137 board_config = ALC680_BASE;
20141 if (board_config != ALC680_AUTO)
20142 setup_preset(codec, &alc680_presets[board_config]);
20144 spec->stream_analog_playback = &alc680_pcm_analog_playback;
20145 spec->stream_analog_capture = &alc680_pcm_analog_auto_capture;
20146 spec->stream_digital_playback = &alc680_pcm_digital_playback;
20147 spec->stream_digital_capture = &alc680_pcm_digital_capture;
20149 if (!spec->adc_nids) {
20150 spec->adc_nids = alc680_adc_nids;
20151 spec->num_adc_nids = ARRAY_SIZE(alc680_adc_nids);
20154 if (!spec->cap_mixer)
20155 set_capture_mixer(codec);
20157 spec->vmaster_nid = 0x02;
20159 codec->patch_ops = alc_patch_ops;
20160 if (board_config == ALC680_AUTO)
20161 spec->init_hook = alc680_auto_init;
20169 static struct hda_codec_preset snd_hda_preset_realtek[] = {
20170 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
20171 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
20172 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
20173 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
20174 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
20175 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
20176 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
20177 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
20178 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
20179 .patch = patch_alc861 },
20180 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
20181 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
20182 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
20183 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
20184 .patch = patch_alc882 },
20185 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
20186 .patch = patch_alc662 },
20187 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
20188 { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
20189 { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
20190 { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 },
20191 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
20192 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
20193 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
20194 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
20195 .patch = patch_alc882 },
20196 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
20197 .patch = patch_alc882 },
20198 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
20199 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc888 },
20200 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
20201 .patch = patch_alc882 },
20202 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
20203 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
20204 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
20205 {} /* terminator */
20208 MODULE_ALIAS("snd-hda-codec-id:10ec*");
20210 MODULE_LICENSE("GPL");
20211 MODULE_DESCRIPTION("Realtek HD-audio codec");
20213 static struct hda_codec_preset_list realtek_list = {
20214 .preset = snd_hda_preset_realtek,
20215 .owner = THIS_MODULE,
20218 static int __init patch_realtek_init(void)
20220 return snd_hda_add_codec_preset(&realtek_list);
20223 static void __exit patch_realtek_exit(void)
20225 snd_hda_delete_codec_preset(&realtek_list);
20228 module_init(patch_realtek_init)
20229 module_exit(patch_realtek_exit)