2 * Universal Interface for Intel High Definition Audio Codec
4 * HD audio interface patch for ALC 260/880/882 codecs
6 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
7 * PeiSen Hou <pshou@realtek.com.tw>
8 * Takashi Iwai <tiwai@suse.de>
9 * Jonathan Woithe <jwoithe@physics.adelaide.edu.au>
11 * This driver is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This driver is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include <linux/init.h>
27 #include <linux/delay.h>
28 #include <linux/slab.h>
29 #include <linux/pci.h>
30 #include <sound/core.h>
31 #include <sound/jack.h>
32 #include "hda_codec.h"
33 #include "hda_local.h"
36 #define ALC880_FRONT_EVENT 0x01
37 #define ALC880_DCVOL_EVENT 0x02
38 #define ALC880_HP_EVENT 0x04
39 #define ALC880_MIC_EVENT 0x08
41 /* ALC880 board config type */
65 #ifdef CONFIG_SND_DEBUG
69 ALC880_MODEL_LAST /* last tag */
83 #ifdef CONFIG_SND_DEBUG
87 ALC260_MODEL_LAST /* last tag */
97 ALC262_HP_BPC_D7000_WL,
98 ALC262_HP_BPC_D7000_WF,
111 ALC262_MODEL_LAST /* last tag */
121 ALC268_ACER_ASPIRE_ONE,
124 #ifdef CONFIG_SND_DEBUG
128 ALC268_MODEL_LAST /* last tag */
143 ALC269_MODEL_LAST /* last tag */
160 /* ALC861-VD models */
182 ALC662_ASUS_EEEPC_P701,
183 ALC662_ASUS_EEEPC_EP20,
225 ALC883_TARGA_2ch_DIG,
226 ALC883_TARGA_8ch_DIG,
229 ALC888_ACER_ASPIRE_4930G,
230 ALC888_ACER_ASPIRE_6530G,
231 ALC888_ACER_ASPIRE_8930G,
232 ALC888_ACER_ASPIRE_7730G,
234 ALC883_MEDION_WIM2160,
236 ALC883_LENOVO_101E_2ch,
237 ALC883_LENOVO_NB0763,
238 ALC888_LENOVO_MS7195_DIG,
246 ALC883_FUJITSU_PI2515,
247 ALC888_FUJITSU_XA3530,
248 ALC883_3ST_6ch_INTEL,
268 #define GPIO_MASK 0x03
270 /* extra amp-initialization sequence types */
279 struct alc_mic_route {
281 unsigned char mux_idx;
282 unsigned char amix_idx;
285 #define MUX_IDX_UNDEF ((unsigned char)-1)
287 struct alc_customize_define {
288 unsigned int sku_cfg;
289 unsigned char port_connectivity;
290 unsigned char check_sum;
291 unsigned char customization;
292 unsigned char external_amp;
293 unsigned int enable_pcbeep:1;
294 unsigned int platform_type:1;
296 unsigned int override:1;
297 unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */
303 /* codec parameterization */
304 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
305 unsigned int num_mixers;
306 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
307 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
309 const struct hda_verb *init_verbs[10]; /* initialization verbs
313 unsigned int num_init_verbs;
315 char stream_name_analog[32]; /* analog PCM stream */
316 struct hda_pcm_stream *stream_analog_playback;
317 struct hda_pcm_stream *stream_analog_capture;
318 struct hda_pcm_stream *stream_analog_alt_playback;
319 struct hda_pcm_stream *stream_analog_alt_capture;
321 char stream_name_digital[32]; /* digital PCM stream */
322 struct hda_pcm_stream *stream_digital_playback;
323 struct hda_pcm_stream *stream_digital_capture;
326 struct hda_multi_out multiout; /* playback set-up
327 * max_channels, dacs must be set
328 * dig_out_nid and hp_nid are optional
330 hda_nid_t alt_dac_nid;
331 hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */
335 unsigned int num_adc_nids;
337 hda_nid_t *capsrc_nids;
338 hda_nid_t dig_in_nid; /* digital-in NID; optional */
340 /* capture setup for dynamic dual-adc switch */
341 unsigned int cur_adc_idx;
343 unsigned int cur_adc_stream_tag;
344 unsigned int cur_adc_format;
347 unsigned int num_mux_defs;
348 const struct hda_input_mux *input_mux;
349 unsigned int cur_mux[3];
350 struct alc_mic_route ext_mic;
351 struct alc_mic_route int_mic;
354 const struct hda_channel_mode *channel_mode;
355 int num_channel_mode;
357 int const_channel_count;
358 int ext_channel_count;
360 /* PCM information */
361 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
363 /* dynamic controls, init_verbs and input_mux */
364 struct auto_pin_cfg autocfg;
365 struct alc_customize_define cdefine;
366 struct snd_array kctls;
367 struct hda_input_mux private_imux[3];
368 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
369 hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS];
370 hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS];
373 void (*init_hook)(struct hda_codec *codec);
374 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
375 #ifdef CONFIG_SND_HDA_POWER_SAVE
376 void (*power_hook)(struct hda_codec *codec);
379 /* for pin sensing */
380 unsigned int sense_updated: 1;
381 unsigned int jack_present: 1;
382 unsigned int master_sw: 1;
383 unsigned int auto_mic:1;
386 unsigned int no_analog :1; /* digital I/O only */
387 unsigned int dual_adc_switch:1; /* switch ADCs (for ALC275) */
389 int codec_variant; /* flag for other variants */
391 /* for virtual master */
392 hda_nid_t vmaster_nid;
393 #ifdef CONFIG_SND_HDA_POWER_SAVE
394 struct hda_loopback_check loopback;
399 unsigned int pll_coef_idx, pll_coef_bit;
403 const struct alc_fixup *fixup_list;
404 const char *fixup_name;
408 * configuration template - to be copied to the spec instance
410 struct alc_config_preset {
411 struct snd_kcontrol_new *mixers[5]; /* should be identical size
414 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
415 const struct hda_verb *init_verbs[5];
416 unsigned int num_dacs;
418 hda_nid_t dig_out_nid; /* optional */
419 hda_nid_t hp_nid; /* optional */
420 hda_nid_t *slave_dig_outs;
421 unsigned int num_adc_nids;
423 hda_nid_t *capsrc_nids;
424 hda_nid_t dig_in_nid;
425 unsigned int num_channel_mode;
426 const struct hda_channel_mode *channel_mode;
428 int const_channel_count;
429 unsigned int num_mux_defs;
430 const struct hda_input_mux *input_mux;
431 void (*unsol_event)(struct hda_codec *, unsigned int);
432 void (*setup)(struct hda_codec *);
433 void (*init_hook)(struct hda_codec *);
434 #ifdef CONFIG_SND_HDA_POWER_SAVE
435 struct hda_amp_list *loopbacks;
436 void (*power_hook)(struct hda_codec *codec);
444 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
445 struct snd_ctl_elem_info *uinfo)
447 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
448 struct alc_spec *spec = codec->spec;
449 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
450 if (mux_idx >= spec->num_mux_defs)
452 if (!spec->input_mux[mux_idx].num_items && mux_idx > 0)
454 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
457 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
458 struct snd_ctl_elem_value *ucontrol)
460 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
461 struct alc_spec *spec = codec->spec;
462 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
464 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
468 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
469 struct snd_ctl_elem_value *ucontrol)
471 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
472 struct alc_spec *spec = codec->spec;
473 const struct hda_input_mux *imux;
474 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
475 unsigned int mux_idx;
476 hda_nid_t nid = spec->capsrc_nids ?
477 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
480 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
481 imux = &spec->input_mux[mux_idx];
482 if (!imux->num_items && mux_idx > 0)
483 imux = &spec->input_mux[0];
485 type = get_wcaps_type(get_wcaps(codec, nid));
486 if (type == AC_WID_AUD_MIX) {
487 /* Matrix-mixer style (e.g. ALC882) */
488 unsigned int *cur_val = &spec->cur_mux[adc_idx];
491 idx = ucontrol->value.enumerated.item[0];
492 if (idx >= imux->num_items)
493 idx = imux->num_items - 1;
496 for (i = 0; i < imux->num_items; i++) {
497 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
498 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
499 imux->items[i].index,
505 /* MUX style (e.g. ALC880) */
506 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
507 &spec->cur_mux[adc_idx]);
512 * channel mode setting
514 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
515 struct snd_ctl_elem_info *uinfo)
517 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
518 struct alc_spec *spec = codec->spec;
519 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
520 spec->num_channel_mode);
523 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
524 struct snd_ctl_elem_value *ucontrol)
526 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
527 struct alc_spec *spec = codec->spec;
528 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
529 spec->num_channel_mode,
530 spec->ext_channel_count);
533 static int alc_ch_mode_put(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 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
539 spec->num_channel_mode,
540 &spec->ext_channel_count);
541 if (err >= 0 && !spec->const_channel_count) {
542 spec->multiout.max_channels = spec->ext_channel_count;
543 if (spec->need_dac_fix)
544 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
550 * Control the mode of pin widget settings via the mixer. "pc" is used
551 * instead of "%" to avoid consequences of accidently treating the % as
552 * being part of a format specifier. Maximum allowed length of a value is
553 * 63 characters plus NULL terminator.
555 * Note: some retasking pin complexes seem to ignore requests for input
556 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
557 * are requested. Therefore order this list so that this behaviour will not
558 * cause problems when mixer clients move through the enum sequentially.
559 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
562 static char *alc_pin_mode_names[] = {
563 "Mic 50pc bias", "Mic 80pc bias",
564 "Line in", "Line out", "Headphone out",
566 static unsigned char alc_pin_mode_values[] = {
567 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
569 /* The control can present all 5 options, or it can limit the options based
570 * in the pin being assumed to be exclusively an input or an output pin. In
571 * addition, "input" pins may or may not process the mic bias option
572 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
573 * accept requests for bias as of chip versions up to March 2006) and/or
574 * wiring in the computer.
576 #define ALC_PIN_DIR_IN 0x00
577 #define ALC_PIN_DIR_OUT 0x01
578 #define ALC_PIN_DIR_INOUT 0x02
579 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
580 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
582 /* Info about the pin modes supported by the different pin direction modes.
583 * For each direction the minimum and maximum values are given.
585 static signed char alc_pin_mode_dir_info[5][2] = {
586 { 0, 2 }, /* ALC_PIN_DIR_IN */
587 { 3, 4 }, /* ALC_PIN_DIR_OUT */
588 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
589 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
590 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
592 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
593 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
594 #define alc_pin_mode_n_items(_dir) \
595 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
597 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
598 struct snd_ctl_elem_info *uinfo)
600 unsigned int item_num = uinfo->value.enumerated.item;
601 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
603 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
605 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
607 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
608 item_num = alc_pin_mode_min(dir);
609 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
613 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
614 struct snd_ctl_elem_value *ucontrol)
617 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
618 hda_nid_t nid = kcontrol->private_value & 0xffff;
619 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
620 long *valp = ucontrol->value.integer.value;
621 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
622 AC_VERB_GET_PIN_WIDGET_CONTROL,
625 /* Find enumerated value for current pinctl setting */
626 i = alc_pin_mode_min(dir);
627 while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl)
629 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
633 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
634 struct snd_ctl_elem_value *ucontrol)
637 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
638 hda_nid_t nid = kcontrol->private_value & 0xffff;
639 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
640 long val = *ucontrol->value.integer.value;
641 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
642 AC_VERB_GET_PIN_WIDGET_CONTROL,
645 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
646 val = alc_pin_mode_min(dir);
648 change = pinctl != alc_pin_mode_values[val];
650 /* Set pin mode to that requested */
651 snd_hda_codec_write_cache(codec, nid, 0,
652 AC_VERB_SET_PIN_WIDGET_CONTROL,
653 alc_pin_mode_values[val]);
655 /* Also enable the retasking pin's input/output as required
656 * for the requested pin mode. Enum values of 2 or less are
659 * Dynamically switching the input/output buffers probably
660 * reduces noise slightly (particularly on input) so we'll
661 * do it. However, having both input and output buffers
662 * enabled simultaneously doesn't seem to be problematic if
663 * this turns out to be necessary in the future.
666 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
667 HDA_AMP_MUTE, HDA_AMP_MUTE);
668 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
671 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
672 HDA_AMP_MUTE, HDA_AMP_MUTE);
673 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
680 #define ALC_PIN_MODE(xname, nid, dir) \
681 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
682 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
683 .info = alc_pin_mode_info, \
684 .get = alc_pin_mode_get, \
685 .put = alc_pin_mode_put, \
686 .private_value = nid | (dir<<16) }
688 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
689 * together using a mask with more than one bit set. This control is
690 * currently used only by the ALC260 test model. At this stage they are not
691 * needed for any "production" models.
693 #ifdef CONFIG_SND_DEBUG
694 #define alc_gpio_data_info snd_ctl_boolean_mono_info
696 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
697 struct snd_ctl_elem_value *ucontrol)
699 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
700 hda_nid_t nid = kcontrol->private_value & 0xffff;
701 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
702 long *valp = ucontrol->value.integer.value;
703 unsigned int val = snd_hda_codec_read(codec, nid, 0,
704 AC_VERB_GET_GPIO_DATA, 0x00);
706 *valp = (val & mask) != 0;
709 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
710 struct snd_ctl_elem_value *ucontrol)
713 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
714 hda_nid_t nid = kcontrol->private_value & 0xffff;
715 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
716 long val = *ucontrol->value.integer.value;
717 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
718 AC_VERB_GET_GPIO_DATA,
721 /* Set/unset the masked GPIO bit(s) as needed */
722 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
727 snd_hda_codec_write_cache(codec, nid, 0,
728 AC_VERB_SET_GPIO_DATA, gpio_data);
732 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
733 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
734 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
735 .info = alc_gpio_data_info, \
736 .get = alc_gpio_data_get, \
737 .put = alc_gpio_data_put, \
738 .private_value = nid | (mask<<16) }
739 #endif /* CONFIG_SND_DEBUG */
741 /* A switch control to allow the enabling of the digital IO pins on the
742 * ALC260. This is incredibly simplistic; the intention of this control is
743 * to provide something in the test model allowing digital outputs to be
744 * identified if present. If models are found which can utilise these
745 * outputs a more complete mixer control can be devised for those models if
748 #ifdef CONFIG_SND_DEBUG
749 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
751 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
752 struct snd_ctl_elem_value *ucontrol)
754 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
755 hda_nid_t nid = kcontrol->private_value & 0xffff;
756 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
757 long *valp = ucontrol->value.integer.value;
758 unsigned int val = snd_hda_codec_read(codec, nid, 0,
759 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
761 *valp = (val & mask) != 0;
764 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
765 struct snd_ctl_elem_value *ucontrol)
768 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
769 hda_nid_t nid = kcontrol->private_value & 0xffff;
770 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
771 long val = *ucontrol->value.integer.value;
772 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
773 AC_VERB_GET_DIGI_CONVERT_1,
776 /* Set/unset the masked control bit(s) as needed */
777 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
782 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
787 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
788 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
789 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
790 .info = alc_spdif_ctrl_info, \
791 .get = alc_spdif_ctrl_get, \
792 .put = alc_spdif_ctrl_put, \
793 .private_value = nid | (mask<<16) }
794 #endif /* CONFIG_SND_DEBUG */
796 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
797 * Again, this is only used in the ALC26x test models to help identify when
798 * the EAPD line must be asserted for features to work.
800 #ifdef CONFIG_SND_DEBUG
801 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
803 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
804 struct snd_ctl_elem_value *ucontrol)
806 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
807 hda_nid_t nid = kcontrol->private_value & 0xffff;
808 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
809 long *valp = ucontrol->value.integer.value;
810 unsigned int val = snd_hda_codec_read(codec, nid, 0,
811 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
813 *valp = (val & mask) != 0;
817 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
818 struct snd_ctl_elem_value *ucontrol)
821 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
822 hda_nid_t nid = kcontrol->private_value & 0xffff;
823 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
824 long val = *ucontrol->value.integer.value;
825 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
826 AC_VERB_GET_EAPD_BTLENABLE,
829 /* Set/unset the masked control bit(s) as needed */
830 change = (!val ? 0 : mask) != (ctrl_data & mask);
835 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
841 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
842 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
843 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
844 .info = alc_eapd_ctrl_info, \
845 .get = alc_eapd_ctrl_get, \
846 .put = alc_eapd_ctrl_put, \
847 .private_value = nid | (mask<<16) }
848 #endif /* CONFIG_SND_DEBUG */
851 * set up the input pin config (depending on the given auto-pin type)
853 static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
856 unsigned int val = PIN_IN;
858 if (auto_pin_type == AUTO_PIN_MIC) {
861 oldval = snd_hda_codec_read(codec, nid, 0,
862 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
863 pincap = snd_hda_query_pin_caps(codec, nid);
864 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
865 /* if the default pin setup is vref50, we give it priority */
866 if ((pincap & AC_PINCAP_VREF_80) && oldval != PIN_VREF50)
868 else if (pincap & AC_PINCAP_VREF_50)
870 else if (pincap & AC_PINCAP_VREF_100)
872 else if (pincap & AC_PINCAP_VREF_GRD)
875 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val);
878 static void alc_fixup_autocfg_pin_nums(struct hda_codec *codec)
880 struct alc_spec *spec = codec->spec;
881 struct auto_pin_cfg *cfg = &spec->autocfg;
883 if (!cfg->line_outs) {
884 while (cfg->line_outs < AUTO_CFG_MAX_OUTS &&
885 cfg->line_out_pins[cfg->line_outs])
888 if (!cfg->speaker_outs) {
889 while (cfg->speaker_outs < AUTO_CFG_MAX_OUTS &&
890 cfg->speaker_pins[cfg->speaker_outs])
894 while (cfg->hp_outs < AUTO_CFG_MAX_OUTS &&
895 cfg->hp_pins[cfg->hp_outs])
902 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
904 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
906 spec->mixers[spec->num_mixers++] = mix;
909 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
911 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
913 spec->init_verbs[spec->num_init_verbs++] = verb;
917 * set up from the preset table
919 static void setup_preset(struct hda_codec *codec,
920 const struct alc_config_preset *preset)
922 struct alc_spec *spec = codec->spec;
925 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
926 add_mixer(spec, preset->mixers[i]);
927 spec->cap_mixer = preset->cap_mixer;
928 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
930 add_verb(spec, preset->init_verbs[i]);
932 spec->channel_mode = preset->channel_mode;
933 spec->num_channel_mode = preset->num_channel_mode;
934 spec->need_dac_fix = preset->need_dac_fix;
935 spec->const_channel_count = preset->const_channel_count;
937 if (preset->const_channel_count)
938 spec->multiout.max_channels = preset->const_channel_count;
940 spec->multiout.max_channels = spec->channel_mode[0].channels;
941 spec->ext_channel_count = spec->channel_mode[0].channels;
943 spec->multiout.num_dacs = preset->num_dacs;
944 spec->multiout.dac_nids = preset->dac_nids;
945 spec->multiout.dig_out_nid = preset->dig_out_nid;
946 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
947 spec->multiout.hp_nid = preset->hp_nid;
949 spec->num_mux_defs = preset->num_mux_defs;
950 if (!spec->num_mux_defs)
951 spec->num_mux_defs = 1;
952 spec->input_mux = preset->input_mux;
954 spec->num_adc_nids = preset->num_adc_nids;
955 spec->adc_nids = preset->adc_nids;
956 spec->capsrc_nids = preset->capsrc_nids;
957 spec->dig_in_nid = preset->dig_in_nid;
959 spec->unsol_event = preset->unsol_event;
960 spec->init_hook = preset->init_hook;
961 #ifdef CONFIG_SND_HDA_POWER_SAVE
962 spec->power_hook = preset->power_hook;
963 spec->loopback.amplist = preset->loopbacks;
967 preset->setup(codec);
969 alc_fixup_autocfg_pin_nums(codec);
972 /* Enable GPIO mask and set output */
973 static struct hda_verb alc_gpio1_init_verbs[] = {
974 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
975 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
976 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
980 static struct hda_verb alc_gpio2_init_verbs[] = {
981 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
982 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
983 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
987 static struct hda_verb alc_gpio3_init_verbs[] = {
988 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
989 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
990 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
995 * Fix hardware PLL issue
996 * On some codecs, the analog PLL gating control must be off while
997 * the default value is 1.
999 static void alc_fix_pll(struct hda_codec *codec)
1001 struct alc_spec *spec = codec->spec;
1006 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
1007 spec->pll_coef_idx);
1008 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
1009 AC_VERB_GET_PROC_COEF, 0);
1010 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
1011 spec->pll_coef_idx);
1012 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
1013 val & ~(1 << spec->pll_coef_bit));
1016 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
1017 unsigned int coef_idx, unsigned int coef_bit)
1019 struct alc_spec *spec = codec->spec;
1020 spec->pll_nid = nid;
1021 spec->pll_coef_idx = coef_idx;
1022 spec->pll_coef_bit = coef_bit;
1026 static int alc_init_jacks(struct hda_codec *codec)
1028 #ifdef CONFIG_SND_HDA_INPUT_JACK
1029 struct alc_spec *spec = codec->spec;
1031 unsigned int hp_nid = spec->autocfg.hp_pins[0];
1032 unsigned int mic_nid = spec->ext_mic.pin;
1035 err = snd_hda_input_jack_add(codec, hp_nid,
1036 SND_JACK_HEADPHONE, NULL);
1039 snd_hda_input_jack_report(codec, hp_nid);
1043 err = snd_hda_input_jack_add(codec, mic_nid,
1044 SND_JACK_MICROPHONE, NULL);
1047 snd_hda_input_jack_report(codec, mic_nid);
1049 #endif /* CONFIG_SND_HDA_INPUT_JACK */
1053 static void alc_automute_speaker(struct hda_codec *codec, int pinctl)
1055 struct alc_spec *spec = codec->spec;
1060 spec->jack_present = 0;
1061 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
1062 nid = spec->autocfg.hp_pins[i];
1065 snd_hda_input_jack_report(codec, nid);
1066 spec->jack_present |= snd_hda_jack_detect(codec, nid);
1069 mute = spec->jack_present ? HDA_AMP_MUTE : 0;
1070 /* Toggle internal speakers muting */
1071 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1072 nid = spec->autocfg.speaker_pins[i];
1076 snd_hda_codec_write(codec, nid, 0,
1077 AC_VERB_SET_PIN_WIDGET_CONTROL,
1078 spec->jack_present ? 0 : PIN_OUT);
1080 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1081 HDA_AMP_MUTE, mute);
1086 static void alc_automute_pin(struct hda_codec *codec)
1088 alc_automute_speaker(codec, 1);
1091 static int get_connection_index(struct hda_codec *codec, hda_nid_t mux,
1094 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
1097 nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn));
1098 for (i = 0; i < nums; i++)
1104 /* switch the current ADC according to the jack state */
1105 static void alc_dual_mic_adc_auto_switch(struct hda_codec *codec)
1107 struct alc_spec *spec = codec->spec;
1108 unsigned int present;
1111 present = snd_hda_jack_detect(codec, spec->ext_mic.pin);
1113 spec->cur_adc_idx = 1;
1115 spec->cur_adc_idx = 0;
1116 new_adc = spec->adc_nids[spec->cur_adc_idx];
1117 if (spec->cur_adc && spec->cur_adc != new_adc) {
1118 /* stream is running, let's swap the current ADC */
1119 __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1);
1120 spec->cur_adc = new_adc;
1121 snd_hda_codec_setup_stream(codec, new_adc,
1122 spec->cur_adc_stream_tag, 0,
1123 spec->cur_adc_format);
1127 static void alc_mic_automute(struct hda_codec *codec)
1129 struct alc_spec *spec = codec->spec;
1130 struct alc_mic_route *dead, *alive;
1131 unsigned int present, type;
1134 if (!spec->auto_mic)
1136 if (!spec->int_mic.pin || !spec->ext_mic.pin)
1138 if (snd_BUG_ON(!spec->adc_nids))
1141 if (spec->dual_adc_switch) {
1142 alc_dual_mic_adc_auto_switch(codec);
1146 cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0];
1148 present = snd_hda_jack_detect(codec, spec->ext_mic.pin);
1150 alive = &spec->ext_mic;
1151 dead = &spec->int_mic;
1153 alive = &spec->int_mic;
1154 dead = &spec->ext_mic;
1157 type = get_wcaps_type(get_wcaps(codec, cap_nid));
1158 if (type == AC_WID_AUD_MIX) {
1159 /* Matrix-mixer style (e.g. ALC882) */
1160 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1163 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1165 HDA_AMP_MUTE, HDA_AMP_MUTE);
1167 /* MUX style (e.g. ALC880) */
1168 snd_hda_codec_write_cache(codec, cap_nid, 0,
1169 AC_VERB_SET_CONNECT_SEL,
1172 snd_hda_input_jack_report(codec, spec->ext_mic.pin);
1174 /* FIXME: analog mixer */
1177 /* unsolicited event for HP jack sensing */
1178 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
1180 if (codec->vendor_id == 0x10ec0880)
1185 case ALC880_HP_EVENT:
1186 alc_automute_pin(codec);
1188 case ALC880_MIC_EVENT:
1189 alc_mic_automute(codec);
1194 static void alc_inithook(struct hda_codec *codec)
1196 alc_automute_pin(codec);
1197 alc_mic_automute(codec);
1200 /* additional initialization for ALC888 variants */
1201 static void alc888_coef_init(struct hda_codec *codec)
1205 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
1206 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1207 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1208 if ((tmp & 0xf0) == 0x20)
1210 snd_hda_codec_read(codec, 0x20, 0,
1211 AC_VERB_SET_PROC_COEF, 0x830);
1214 snd_hda_codec_read(codec, 0x20, 0,
1215 AC_VERB_SET_PROC_COEF, 0x3030);
1218 static void alc889_coef_init(struct hda_codec *codec)
1222 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1223 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1224 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1225 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010);
1228 /* turn on/off EAPD control (only if available) */
1229 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
1231 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
1233 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
1234 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
1238 static void alc_auto_init_amp(struct hda_codec *codec, int type)
1243 case ALC_INIT_GPIO1:
1244 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1246 case ALC_INIT_GPIO2:
1247 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1249 case ALC_INIT_GPIO3:
1250 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1252 case ALC_INIT_DEFAULT:
1253 switch (codec->vendor_id) {
1255 set_eapd(codec, 0x0f, 1);
1256 set_eapd(codec, 0x10, 1);
1269 set_eapd(codec, 0x14, 1);
1270 set_eapd(codec, 0x15, 1);
1273 switch (codec->vendor_id) {
1275 snd_hda_codec_write(codec, 0x1a, 0,
1276 AC_VERB_SET_COEF_INDEX, 7);
1277 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1278 AC_VERB_GET_PROC_COEF, 0);
1279 snd_hda_codec_write(codec, 0x1a, 0,
1280 AC_VERB_SET_COEF_INDEX, 7);
1281 snd_hda_codec_write(codec, 0x1a, 0,
1282 AC_VERB_SET_PROC_COEF,
1292 alc889_coef_init(codec);
1295 alc888_coef_init(codec);
1297 #if 0 /* XXX: This may cause the silent output on speaker on some machines */
1300 snd_hda_codec_write(codec, 0x20, 0,
1301 AC_VERB_SET_COEF_INDEX, 7);
1302 tmp = snd_hda_codec_read(codec, 0x20, 0,
1303 AC_VERB_GET_PROC_COEF, 0);
1304 snd_hda_codec_write(codec, 0x20, 0,
1305 AC_VERB_SET_COEF_INDEX, 7);
1306 snd_hda_codec_write(codec, 0x20, 0,
1307 AC_VERB_SET_PROC_COEF,
1316 static void alc_init_auto_hp(struct hda_codec *codec)
1318 struct alc_spec *spec = codec->spec;
1319 struct auto_pin_cfg *cfg = &spec->autocfg;
1322 if (!cfg->hp_pins[0]) {
1323 if (cfg->line_out_type != AUTO_PIN_HP_OUT)
1327 if (!cfg->speaker_pins[0]) {
1328 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT)
1330 memcpy(cfg->speaker_pins, cfg->line_out_pins,
1331 sizeof(cfg->speaker_pins));
1332 cfg->speaker_outs = cfg->line_outs;
1335 if (!cfg->hp_pins[0]) {
1336 memcpy(cfg->hp_pins, cfg->line_out_pins,
1337 sizeof(cfg->hp_pins));
1338 cfg->hp_outs = cfg->line_outs;
1341 for (i = 0; i < cfg->hp_outs; i++) {
1342 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1344 snd_hda_codec_write_cache(codec, cfg->hp_pins[i], 0,
1345 AC_VERB_SET_UNSOLICITED_ENABLE,
1346 AC_USRSP_EN | ALC880_HP_EVENT);
1348 spec->unsol_event = alc_sku_unsol_event;
1351 static void alc_init_auto_mic(struct hda_codec *codec)
1353 struct alc_spec *spec = codec->spec;
1354 struct auto_pin_cfg *cfg = &spec->autocfg;
1355 hda_nid_t fixed, ext;
1358 /* there must be only two mic inputs exclusively */
1359 for (i = 0; i < cfg->num_inputs; i++)
1360 if (cfg->inputs[i].type >= AUTO_PIN_LINE_IN)
1364 for (i = 0; i < cfg->num_inputs; i++) {
1365 hda_nid_t nid = cfg->inputs[i].pin;
1366 unsigned int defcfg;
1367 defcfg = snd_hda_codec_get_pincfg(codec, nid);
1368 switch (snd_hda_get_input_pin_attr(defcfg)) {
1369 case INPUT_PIN_ATTR_INT:
1371 return; /* already occupied */
1374 case INPUT_PIN_ATTR_UNUSED:
1375 return; /* invalid entry */
1378 return; /* already occupied */
1385 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP))
1386 return; /* no unsol support */
1387 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n",
1389 spec->ext_mic.pin = ext;
1390 spec->int_mic.pin = fixed;
1391 spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1392 spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1394 snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0,
1395 AC_VERB_SET_UNSOLICITED_ENABLE,
1396 AC_USRSP_EN | ALC880_MIC_EVENT);
1397 spec->unsol_event = alc_sku_unsol_event;
1400 /* Could be any non-zero and even value. When used as fixup, tells
1401 * the driver to ignore any present sku defines.
1403 #define ALC_FIXUP_SKU_IGNORE (2)
1405 static int alc_auto_parse_customize_define(struct hda_codec *codec)
1407 unsigned int ass, tmp, i;
1409 struct alc_spec *spec = codec->spec;
1411 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
1413 if (spec->cdefine.fixup) {
1414 ass = spec->cdefine.sku_cfg;
1415 if (ass == ALC_FIXUP_SKU_IGNORE)
1420 ass = codec->subsystem_id & 0xffff;
1421 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
1425 if (codec->vendor_id == 0x10ec0260)
1427 ass = snd_hda_codec_get_pincfg(codec, nid);
1430 printk(KERN_INFO "hda_codec: %s: SKU not ready 0x%08x\n",
1431 codec->chip_name, ass);
1437 for (i = 1; i < 16; i++) {
1441 if (((ass >> 16) & 0xf) != tmp)
1444 spec->cdefine.port_connectivity = ass >> 30;
1445 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
1446 spec->cdefine.check_sum = (ass >> 16) & 0xf;
1447 spec->cdefine.customization = ass >> 8;
1449 spec->cdefine.sku_cfg = ass;
1450 spec->cdefine.external_amp = (ass & 0x38) >> 3;
1451 spec->cdefine.platform_type = (ass & 0x4) >> 2;
1452 spec->cdefine.swap = (ass & 0x2) >> 1;
1453 spec->cdefine.override = ass & 0x1;
1455 snd_printd("SKU: Nid=0x%x sku_cfg=0x%08x\n",
1456 nid, spec->cdefine.sku_cfg);
1457 snd_printd("SKU: port_connectivity=0x%x\n",
1458 spec->cdefine.port_connectivity);
1459 snd_printd("SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
1460 snd_printd("SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
1461 snd_printd("SKU: customization=0x%08x\n", spec->cdefine.customization);
1462 snd_printd("SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
1463 snd_printd("SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
1464 snd_printd("SKU: swap=0x%x\n", spec->cdefine.swap);
1465 snd_printd("SKU: override=0x%x\n", spec->cdefine.override);
1470 /* check subsystem ID and set up device-specific initialization;
1471 * return 1 if initialized, 0 if invalid SSID
1473 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1474 * 31 ~ 16 : Manufacture ID
1476 * 7 ~ 0 : Assembly ID
1477 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1479 static int alc_subsystem_id(struct hda_codec *codec,
1480 hda_nid_t porta, hda_nid_t porte,
1481 hda_nid_t portd, hda_nid_t porti)
1483 unsigned int ass, tmp, i;
1485 struct alc_spec *spec = codec->spec;
1487 if (spec->cdefine.fixup) {
1488 ass = spec->cdefine.sku_cfg;
1489 if (ass == ALC_FIXUP_SKU_IGNORE)
1494 ass = codec->subsystem_id & 0xffff;
1495 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1498 /* invalid SSID, check the special NID pin defcfg instead */
1500 * 31~30 : port connectivity
1503 * 19~16 : Check sum (15:1)
1508 if (codec->vendor_id == 0x10ec0260)
1510 ass = snd_hda_codec_get_pincfg(codec, nid);
1511 snd_printd("realtek: No valid SSID, "
1512 "checking pincfg 0x%08x for NID 0x%x\n",
1516 if ((ass >> 30) != 1) /* no physical connection */
1521 for (i = 1; i < 16; i++) {
1525 if (((ass >> 16) & 0xf) != tmp)
1528 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1529 ass & 0xffff, codec->vendor_id);
1533 * 2 : 0 --> Desktop, 1 --> Laptop
1534 * 3~5 : External Amplifier control
1537 tmp = (ass & 0x38) >> 3; /* external Amp control */
1540 spec->init_amp = ALC_INIT_GPIO1;
1543 spec->init_amp = ALC_INIT_GPIO2;
1546 spec->init_amp = ALC_INIT_GPIO3;
1550 spec->init_amp = ALC_INIT_DEFAULT;
1554 /* is laptop or Desktop and enable the function "Mute internal speaker
1555 * when the external headphone out jack is plugged"
1557 if (!(ass & 0x8000))
1560 * 10~8 : Jack location
1561 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1563 * 15 : 1 --> enable the function "Mute internal speaker
1564 * when the external headphone out jack is plugged"
1566 if (!spec->autocfg.hp_pins[0]) {
1568 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1579 for (i = 0; i < spec->autocfg.line_outs; i++)
1580 if (spec->autocfg.line_out_pins[i] == nid)
1582 spec->autocfg.hp_pins[0] = nid;
1585 alc_init_auto_hp(codec);
1586 alc_init_auto_mic(codec);
1590 static void alc_ssid_check(struct hda_codec *codec,
1591 hda_nid_t porta, hda_nid_t porte,
1592 hda_nid_t portd, hda_nid_t porti)
1594 if (!alc_subsystem_id(codec, porta, porte, portd, porti)) {
1595 struct alc_spec *spec = codec->spec;
1596 snd_printd("realtek: "
1597 "Enable default setup for auto mode as fallback\n");
1598 spec->init_amp = ALC_INIT_DEFAULT;
1599 alc_init_auto_hp(codec);
1600 alc_init_auto_mic(codec);
1605 * Fix-up pin default configurations and add default verbs
1613 struct alc_model_fixup {
1624 const struct alc_pincfg *pins;
1625 const struct hda_verb *verbs;
1626 void (*func)(struct hda_codec *codec,
1627 const struct alc_fixup *fix,
1641 ALC_FIXUP_ACT_PRE_PROBE,
1642 ALC_FIXUP_ACT_PROBE,
1646 static void alc_apply_fixup(struct hda_codec *codec, int action)
1648 struct alc_spec *spec = codec->spec;
1649 int id = spec->fixup_id;
1650 #ifdef CONFIG_SND_DEBUG_VERBOSE
1651 const char *modelname = spec->fixup_name;
1655 if (!spec->fixup_list)
1659 const struct alc_fixup *fix = spec->fixup_list + id;
1660 const struct alc_pincfg *cfg;
1662 switch (fix->type) {
1664 if (action != ALC_FIXUP_ACT_PRE_PROBE || !fix->v.sku)
1666 snd_printdd(KERN_INFO "hda_codec: %s: "
1667 "Apply sku override for %s\n",
1668 codec->chip_name, modelname);
1669 spec->cdefine.sku_cfg = fix->v.sku;
1670 spec->cdefine.fixup = 1;
1672 case ALC_FIXUP_PINS:
1674 if (action != ALC_FIXUP_ACT_PRE_PROBE || !cfg)
1676 snd_printdd(KERN_INFO "hda_codec: %s: "
1677 "Apply pincfg for %s\n",
1678 codec->chip_name, modelname);
1679 for (; cfg->nid; cfg++)
1680 snd_hda_codec_set_pincfg(codec, cfg->nid,
1683 case ALC_FIXUP_VERBS:
1684 if (action != ALC_FIXUP_ACT_PROBE || !fix->v.verbs)
1686 snd_printdd(KERN_INFO "hda_codec: %s: "
1687 "Apply fix-verbs for %s\n",
1688 codec->chip_name, modelname);
1689 add_verb(codec->spec, fix->v.verbs);
1691 case ALC_FIXUP_FUNC:
1694 snd_printdd(KERN_INFO "hda_codec: %s: "
1695 "Apply fix-func for %s\n",
1696 codec->chip_name, modelname);
1697 fix->v.func(codec, fix, action);
1700 snd_printk(KERN_ERR "hda_codec: %s: "
1701 "Invalid fixup type %d\n",
1702 codec->chip_name, fix->type);
1705 if (!fix[id].chained)
1709 id = fix[id].chain_id;
1713 static void alc_pick_fixup(struct hda_codec *codec,
1714 const struct alc_model_fixup *models,
1715 const struct snd_pci_quirk *quirk,
1716 const struct alc_fixup *fixlist)
1718 struct alc_spec *spec = codec->spec;
1720 const char *name = NULL;
1722 if (codec->modelname && models) {
1723 while (models->name) {
1724 if (!strcmp(codec->modelname, models->name)) {
1726 name = models->name;
1733 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1736 #ifdef CONFIG_SND_DEBUG_VERBOSE
1742 spec->fixup_id = id;
1744 spec->fixup_list = fixlist;
1745 spec->fixup_name = name;
1749 static int alc_read_coef_idx(struct hda_codec *codec,
1750 unsigned int coef_idx)
1753 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX,
1755 val = snd_hda_codec_read(codec, 0x20, 0,
1756 AC_VERB_GET_PROC_COEF, 0);
1760 static void alc_write_coef_idx(struct hda_codec *codec, unsigned int coef_idx,
1761 unsigned int coef_val)
1763 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX,
1765 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF,
1769 /* set right pin controls for digital I/O */
1770 static void alc_auto_init_digital(struct hda_codec *codec)
1772 struct alc_spec *spec = codec->spec;
1776 for (i = 0; i < spec->autocfg.dig_outs; i++) {
1777 pin = spec->autocfg.dig_out_pins[i];
1779 snd_hda_codec_write(codec, pin, 0,
1780 AC_VERB_SET_PIN_WIDGET_CONTROL,
1784 pin = spec->autocfg.dig_in_pin;
1786 snd_hda_codec_write(codec, pin, 0,
1787 AC_VERB_SET_PIN_WIDGET_CONTROL,
1791 /* parse digital I/Os and set up NIDs in BIOS auto-parse mode */
1792 static void alc_auto_parse_digital(struct hda_codec *codec)
1794 struct alc_spec *spec = codec->spec;
1798 /* support multiple SPDIFs; the secondary is set up as a slave */
1799 for (i = 0; i < spec->autocfg.dig_outs; i++) {
1800 err = snd_hda_get_connections(codec,
1801 spec->autocfg.dig_out_pins[i],
1806 spec->multiout.dig_out_nid = dig_nid;
1807 spec->dig_out_type = spec->autocfg.dig_out_type[0];
1809 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
1810 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
1812 spec->slave_dig_outs[i - 1] = dig_nid;
1816 if (spec->autocfg.dig_in_pin) {
1817 dig_nid = codec->start_nid;
1818 for (i = 0; i < codec->num_nodes; i++, dig_nid++) {
1819 unsigned int wcaps = get_wcaps(codec, dig_nid);
1820 if (get_wcaps_type(wcaps) != AC_WID_AUD_IN)
1822 if (!(wcaps & AC_WCAP_DIGITAL))
1824 if (!(wcaps & AC_WCAP_CONN_LIST))
1826 err = get_connection_index(codec, dig_nid,
1827 spec->autocfg.dig_in_pin);
1829 spec->dig_in_nid = dig_nid;
1843 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1844 /* Mic-in jack as mic in */
1845 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1846 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1847 /* Line-in jack as Line in */
1848 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1849 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1850 /* Line-Out as Front */
1851 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1858 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1859 /* Mic-in jack as mic in */
1860 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1861 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1862 /* Line-in jack as Surround */
1863 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1864 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1865 /* Line-Out as Front */
1866 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1873 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1874 /* Mic-in jack as CLFE */
1875 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1876 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1877 /* Line-in jack as Surround */
1878 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1879 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1880 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1881 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1888 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1889 /* Mic-in jack as CLFE */
1890 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1891 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1892 /* Line-in jack as Surround */
1893 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1894 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1895 /* Line-Out as Side */
1896 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1900 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1901 { 2, alc888_4ST_ch2_intel_init },
1902 { 4, alc888_4ST_ch4_intel_init },
1903 { 6, alc888_4ST_ch6_intel_init },
1904 { 8, alc888_4ST_ch8_intel_init },
1908 * ALC888 Fujitsu Siemens Amillo xa3530
1911 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1912 /* Front Mic: set to PIN_IN (empty by default) */
1913 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1914 /* Connect Internal HP to Front */
1915 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1916 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1917 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1918 /* Connect Bass HP to Front */
1919 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1920 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1921 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1922 /* Connect Line-Out side jack (SPDIF) to Side */
1923 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1924 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1925 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1926 /* Connect Mic jack to CLFE */
1927 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1928 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1929 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1930 /* Connect Line-in jack to Surround */
1931 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1932 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1933 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1934 /* Connect HP out jack to Front */
1935 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1936 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1937 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1938 /* Enable unsolicited event for HP jack and Line-out jack */
1939 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1940 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1944 static void alc_automute_amp(struct hda_codec *codec)
1946 alc_automute_speaker(codec, 0);
1949 static void alc_automute_amp_unsol_event(struct hda_codec *codec,
1952 if (codec->vendor_id == 0x10ec0880)
1956 if (res == ALC880_HP_EVENT)
1957 alc_automute_amp(codec);
1960 static void alc889_automute_setup(struct hda_codec *codec)
1962 struct alc_spec *spec = codec->spec;
1964 spec->autocfg.hp_pins[0] = 0x15;
1965 spec->autocfg.speaker_pins[0] = 0x14;
1966 spec->autocfg.speaker_pins[1] = 0x16;
1967 spec->autocfg.speaker_pins[2] = 0x17;
1968 spec->autocfg.speaker_pins[3] = 0x19;
1969 spec->autocfg.speaker_pins[4] = 0x1a;
1972 static void alc889_intel_init_hook(struct hda_codec *codec)
1974 alc889_coef_init(codec);
1975 alc_automute_amp(codec);
1978 static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec)
1980 struct alc_spec *spec = codec->spec;
1982 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
1983 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
1984 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
1985 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
1989 * ALC888 Acer Aspire 4930G model
1992 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1993 /* Front Mic: set to PIN_IN (empty by default) */
1994 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1995 /* Unselect Front Mic by default in input mixer 3 */
1996 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1997 /* Enable unsolicited event for HP jack */
1998 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1999 /* Connect Internal HP to front */
2000 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2001 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2002 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
2003 /* Connect HP out to front */
2004 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2005 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2006 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2007 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
2012 * ALC888 Acer Aspire 6530G model
2015 static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
2016 /* Route to built-in subwoofer as well as speakers */
2017 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2018 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2019 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2020 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2021 /* Bias voltage on for external mic port */
2022 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
2023 /* Front Mic: set to PIN_IN (empty by default) */
2024 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2025 /* Unselect Front Mic by default in input mixer 3 */
2026 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
2027 /* Enable unsolicited event for HP jack */
2028 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2029 /* Enable speaker output */
2030 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2031 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2032 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
2033 /* Enable headphone output */
2034 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
2035 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2036 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2037 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
2042 *ALC888 Acer Aspire 7730G model
2045 static struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
2046 /* Bias voltage on for external mic port */
2047 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
2048 /* Front Mic: set to PIN_IN (empty by default) */
2049 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2050 /* Unselect Front Mic by default in input mixer 3 */
2051 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
2052 /* Enable unsolicited event for HP jack */
2053 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2054 /* Enable speaker output */
2055 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2056 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2057 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
2058 /* Enable headphone output */
2059 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
2060 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2061 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2062 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
2063 /*Enable internal subwoofer */
2064 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2065 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2066 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
2067 {0x17, AC_VERB_SET_EAPD_BTLENABLE, 2},
2072 * ALC889 Acer Aspire 8930G model
2075 static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
2076 /* Front Mic: set to PIN_IN (empty by default) */
2077 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2078 /* Unselect Front Mic by default in input mixer 3 */
2079 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
2080 /* Enable unsolicited event for HP jack */
2081 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2082 /* Connect Internal Front to Front */
2083 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2084 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2085 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
2086 /* Connect Internal Rear to Rear */
2087 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2088 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2089 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
2090 /* Connect Internal CLFE to CLFE */
2091 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2092 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2093 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
2094 /* Connect HP out to Front */
2095 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
2096 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2097 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2098 /* Enable all DACs */
2099 /* DAC DISABLE/MUTE 1? */
2100 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
2101 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
2102 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
2103 /* DAC DISABLE/MUTE 2? */
2104 /* some bit here disables the other DACs. Init=0x4900 */
2105 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
2106 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
2108 * This laptop has a stereo digital microphone. The mics are only 1cm apart
2109 * which makes the stereo useless. However, either the mic or the ALC889
2110 * makes the signal become a difference/sum signal instead of standard
2111 * stereo, which is annoying. So instead we flip this bit which makes the
2112 * codec replicate the sum signal to both channels, turning it into a
2115 /* DMIC_CONTROL? Init value = 0x0001 */
2116 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
2117 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
2121 static struct hda_input_mux alc888_2_capture_sources[2] = {
2122 /* Front mic only available on one ADC */
2129 { "Front Mic", 0xb },
2142 static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
2143 /* Interal mic only available on one ADC */
2150 { "Input Mix", 0xa },
2151 { "Internal Mic", 0xb },
2160 { "Input Mix", 0xa },
2165 static struct hda_input_mux alc889_capture_sources[3] = {
2166 /* Digital mic only available on first "ADC" */
2173 { "Front Mic", 0xb },
2174 { "Input Mix", 0xa },
2183 { "Input Mix", 0xa },
2192 { "Input Mix", 0xa },
2197 static struct snd_kcontrol_new alc888_base_mixer[] = {
2198 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2199 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2200 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2201 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2202 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
2204 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2205 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2206 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2207 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2208 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2209 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2210 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2211 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2212 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2213 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2214 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
2215 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2219 static struct snd_kcontrol_new alc888_acer_aspire_4930g_mixer[] = {
2220 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2221 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2222 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2223 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2224 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
2226 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2227 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2228 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2229 HDA_CODEC_VOLUME_MONO("Internal LFE Playback Volume", 0x0f, 1, 0x0, HDA_OUTPUT),
2230 HDA_BIND_MUTE_MONO("Internal LFE Playback Switch", 0x0f, 1, 2, HDA_INPUT),
2231 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2232 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2233 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2234 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2235 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2236 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
2237 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2241 static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = {
2242 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2243 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2244 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2245 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2246 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
2248 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2249 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2250 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2251 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2252 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2253 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2254 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
2255 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2260 static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
2262 struct alc_spec *spec = codec->spec;
2264 spec->autocfg.hp_pins[0] = 0x15;
2265 spec->autocfg.speaker_pins[0] = 0x14;
2266 spec->autocfg.speaker_pins[1] = 0x16;
2267 spec->autocfg.speaker_pins[2] = 0x17;
2270 static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
2272 struct alc_spec *spec = codec->spec;
2274 spec->autocfg.hp_pins[0] = 0x15;
2275 spec->autocfg.speaker_pins[0] = 0x14;
2276 spec->autocfg.speaker_pins[1] = 0x16;
2277 spec->autocfg.speaker_pins[2] = 0x17;
2280 static void alc888_acer_aspire_7730g_setup(struct hda_codec *codec)
2282 struct alc_spec *spec = codec->spec;
2284 spec->autocfg.hp_pins[0] = 0x15;
2285 spec->autocfg.speaker_pins[0] = 0x14;
2286 spec->autocfg.speaker_pins[1] = 0x16;
2287 spec->autocfg.speaker_pins[2] = 0x17;
2290 static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
2292 struct alc_spec *spec = codec->spec;
2294 spec->autocfg.hp_pins[0] = 0x15;
2295 spec->autocfg.speaker_pins[0] = 0x14;
2296 spec->autocfg.speaker_pins[1] = 0x16;
2297 spec->autocfg.speaker_pins[2] = 0x1b;
2301 * ALC880 3-stack model
2303 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
2304 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
2305 * F-Mic = 0x1b, HP = 0x19
2308 static hda_nid_t alc880_dac_nids[4] = {
2309 /* front, rear, clfe, rear_surr */
2310 0x02, 0x05, 0x04, 0x03
2313 static hda_nid_t alc880_adc_nids[3] = {
2318 /* The datasheet says the node 0x07 is connected from inputs,
2319 * but it shows zero connection in the real implementation on some devices.
2320 * Note: this is a 915GAV bug, fixed on 915GLV
2322 static hda_nid_t alc880_adc_nids_alt[2] = {
2327 #define ALC880_DIGOUT_NID 0x06
2328 #define ALC880_DIGIN_NID 0x0a
2330 static struct hda_input_mux alc880_capture_source = {
2334 { "Front Mic", 0x3 },
2340 /* channel source setting (2/6 channel selection for 3-stack) */
2342 static struct hda_verb alc880_threestack_ch2_init[] = {
2343 /* set line-in to input, mute it */
2344 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2345 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2346 /* set mic-in to input vref 80%, mute it */
2347 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2348 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2353 static struct hda_verb alc880_threestack_ch6_init[] = {
2354 /* set line-in to output, unmute it */
2355 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2356 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2357 /* set mic-in to output, unmute it */
2358 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2359 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2363 static struct hda_channel_mode alc880_threestack_modes[2] = {
2364 { 2, alc880_threestack_ch2_init },
2365 { 6, alc880_threestack_ch6_init },
2368 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
2369 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2370 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2371 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2372 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2373 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2374 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2375 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2376 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2377 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2378 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2379 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2380 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2381 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2382 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2383 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
2384 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
2385 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
2387 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2388 .name = "Channel Mode",
2389 .info = alc_ch_mode_info,
2390 .get = alc_ch_mode_get,
2391 .put = alc_ch_mode_put,
2396 /* capture mixer elements */
2397 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
2398 struct snd_ctl_elem_info *uinfo)
2400 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2401 struct alc_spec *spec = codec->spec;
2404 mutex_lock(&codec->control_mutex);
2405 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
2407 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
2408 mutex_unlock(&codec->control_mutex);
2412 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
2413 unsigned int size, unsigned int __user *tlv)
2415 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2416 struct alc_spec *spec = codec->spec;
2419 mutex_lock(&codec->control_mutex);
2420 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
2422 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
2423 mutex_unlock(&codec->control_mutex);
2427 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
2428 struct snd_ctl_elem_value *ucontrol);
2430 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
2431 struct snd_ctl_elem_value *ucontrol,
2434 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2435 struct alc_spec *spec = codec->spec;
2436 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
2439 mutex_lock(&codec->control_mutex);
2440 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
2442 err = func(kcontrol, ucontrol);
2443 mutex_unlock(&codec->control_mutex);
2447 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
2448 struct snd_ctl_elem_value *ucontrol)
2450 return alc_cap_getput_caller(kcontrol, ucontrol,
2451 snd_hda_mixer_amp_volume_get);
2454 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
2455 struct snd_ctl_elem_value *ucontrol)
2457 return alc_cap_getput_caller(kcontrol, ucontrol,
2458 snd_hda_mixer_amp_volume_put);
2461 /* capture mixer elements */
2462 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
2464 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
2465 struct snd_ctl_elem_value *ucontrol)
2467 return alc_cap_getput_caller(kcontrol, ucontrol,
2468 snd_hda_mixer_amp_switch_get);
2471 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
2472 struct snd_ctl_elem_value *ucontrol)
2474 return alc_cap_getput_caller(kcontrol, ucontrol,
2475 snd_hda_mixer_amp_switch_put);
2478 #define _DEFINE_CAPMIX(num) \
2480 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2481 .name = "Capture Switch", \
2482 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
2484 .info = alc_cap_sw_info, \
2485 .get = alc_cap_sw_get, \
2486 .put = alc_cap_sw_put, \
2489 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2490 .name = "Capture Volume", \
2491 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
2492 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
2493 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
2495 .info = alc_cap_vol_info, \
2496 .get = alc_cap_vol_get, \
2497 .put = alc_cap_vol_put, \
2498 .tlv = { .c = alc_cap_vol_tlv }, \
2501 #define _DEFINE_CAPSRC(num) \
2503 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2504 /* .name = "Capture Source", */ \
2505 .name = "Input Source", \
2507 .info = alc_mux_enum_info, \
2508 .get = alc_mux_enum_get, \
2509 .put = alc_mux_enum_put, \
2512 #define DEFINE_CAPMIX(num) \
2513 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2514 _DEFINE_CAPMIX(num), \
2515 _DEFINE_CAPSRC(num), \
2519 #define DEFINE_CAPMIX_NOSRC(num) \
2520 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2521 _DEFINE_CAPMIX(num), \
2525 /* up to three ADCs */
2529 DEFINE_CAPMIX_NOSRC(1);
2530 DEFINE_CAPMIX_NOSRC(2);
2531 DEFINE_CAPMIX_NOSRC(3);
2534 * ALC880 5-stack model
2536 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2538 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2539 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2542 /* additional mixers to alc880_three_stack_mixer */
2543 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2544 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2545 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2549 /* channel source setting (6/8 channel selection for 5-stack) */
2551 static struct hda_verb alc880_fivestack_ch6_init[] = {
2552 /* set line-in to input, mute it */
2553 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2554 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2559 static struct hda_verb alc880_fivestack_ch8_init[] = {
2560 /* set line-in to output, unmute it */
2561 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2562 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2566 static struct hda_channel_mode alc880_fivestack_modes[2] = {
2567 { 6, alc880_fivestack_ch6_init },
2568 { 8, alc880_fivestack_ch8_init },
2573 * ALC880 6-stack model
2575 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2576 * Side = 0x05 (0x0f)
2577 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2578 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2581 static hda_nid_t alc880_6st_dac_nids[4] = {
2582 /* front, rear, clfe, rear_surr */
2583 0x02, 0x03, 0x04, 0x05
2586 static struct hda_input_mux alc880_6stack_capture_source = {
2590 { "Front Mic", 0x1 },
2596 /* fixed 8-channels */
2597 static struct hda_channel_mode alc880_sixstack_modes[1] = {
2601 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2602 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2603 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2604 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2605 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2606 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2607 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2608 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2609 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2610 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2611 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2612 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2613 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2614 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2615 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2616 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2617 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2618 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2619 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2621 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2622 .name = "Channel Mode",
2623 .info = alc_ch_mode_info,
2624 .get = alc_ch_mode_get,
2625 .put = alc_ch_mode_put,
2634 * W810 has rear IO for:
2637 * Center/LFE (DAC 04)
2640 * The system also has a pair of internal speakers, and a headphone jack.
2641 * These are both connected to Line2 on the codec, hence to DAC 02.
2643 * There is a variable resistor to control the speaker or headphone
2644 * volume. This is a hardware-only device without a software API.
2646 * Plugging headphones in will disable the internal speakers. This is
2647 * implemented in hardware, not via the driver using jack sense. In
2648 * a similar fashion, plugging into the rear socket marked "front" will
2649 * disable both the speakers and headphones.
2651 * For input, there's a microphone jack, and an "audio in" jack.
2652 * These may not do anything useful with this driver yet, because I
2653 * haven't setup any initialization verbs for these yet...
2656 static hda_nid_t alc880_w810_dac_nids[3] = {
2657 /* front, rear/surround, clfe */
2661 /* fixed 6 channels */
2662 static struct hda_channel_mode alc880_w810_modes[1] = {
2666 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2667 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2668 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2669 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2670 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2671 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2672 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2673 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2674 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2675 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2676 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2684 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2685 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2689 static hda_nid_t alc880_z71v_dac_nids[1] = {
2692 #define ALC880_Z71V_HP_DAC 0x03
2694 /* fixed 2 channels */
2695 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2699 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2700 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2701 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2702 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2703 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2704 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2705 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2706 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2707 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2713 * ALC880 F1734 model
2715 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2716 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2719 static hda_nid_t alc880_f1734_dac_nids[1] = {
2722 #define ALC880_F1734_HP_DAC 0x02
2724 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2725 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2726 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2727 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2728 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2729 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2730 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2731 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2732 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2736 static struct hda_input_mux alc880_f1734_capture_source = {
2748 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2749 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2750 * Mic = 0x18, Line = 0x1a
2753 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2754 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2756 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2757 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2758 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2759 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2760 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2761 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2762 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2763 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2764 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2765 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2766 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2767 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2768 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2769 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2770 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2772 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2773 .name = "Channel Mode",
2774 .info = alc_ch_mode_info,
2775 .get = alc_ch_mode_get,
2776 .put = alc_ch_mode_put,
2782 * ALC880 ASUS W1V model
2784 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2785 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2786 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2789 /* additional mixers to alc880_asus_mixer */
2790 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2791 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2792 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2797 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2798 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2799 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2800 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2801 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2802 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2803 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2804 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2805 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2806 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2811 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2812 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2813 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2814 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2815 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2816 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2817 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2818 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2819 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2820 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2821 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2822 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2823 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2824 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2825 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2826 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2827 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2829 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2830 .name = "Channel Mode",
2831 .info = alc_ch_mode_info,
2832 .get = alc_ch_mode_get,
2833 .put = alc_ch_mode_put,
2838 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2839 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2840 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2841 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2842 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2843 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2844 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2845 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2846 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2847 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2848 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2852 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2853 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2854 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2855 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2856 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2857 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2858 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2863 * virtual master controls
2867 * slave controls for virtual master
2869 static const char * const alc_slave_vols[] = {
2870 "Front Playback Volume",
2871 "Surround Playback Volume",
2872 "Center Playback Volume",
2873 "LFE Playback Volume",
2874 "Side Playback Volume",
2875 "Headphone Playback Volume",
2876 "Speaker Playback Volume",
2877 "Mono Playback Volume",
2878 "Line-Out Playback Volume",
2879 "PCM Playback Volume",
2883 static const char * const alc_slave_sws[] = {
2884 "Front Playback Switch",
2885 "Surround Playback Switch",
2886 "Center Playback Switch",
2887 "LFE Playback Switch",
2888 "Side Playback Switch",
2889 "Headphone Playback Switch",
2890 "Speaker Playback Switch",
2891 "Mono Playback Switch",
2892 "IEC958 Playback Switch",
2893 "Line-Out Playback Switch",
2894 "PCM Playback Switch",
2899 * build control elements
2902 #define NID_MAPPING (-1)
2904 #define SUBDEV_SPEAKER_ (0 << 6)
2905 #define SUBDEV_HP_ (1 << 6)
2906 #define SUBDEV_LINE_ (2 << 6)
2907 #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f))
2908 #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f))
2909 #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f))
2911 static void alc_free_kctls(struct hda_codec *codec);
2913 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2914 /* additional beep mixers; the actual parameters are overwritten at build */
2915 static struct snd_kcontrol_new alc_beep_mixer[] = {
2916 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2917 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
2922 static int alc_build_controls(struct hda_codec *codec)
2924 struct alc_spec *spec = codec->spec;
2925 struct snd_kcontrol *kctl = NULL;
2926 struct snd_kcontrol_new *knew;
2931 for (i = 0; i < spec->num_mixers; i++) {
2932 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2936 if (spec->cap_mixer) {
2937 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2941 if (spec->multiout.dig_out_nid) {
2942 err = snd_hda_create_spdif_out_ctls(codec,
2943 spec->multiout.dig_out_nid);
2946 if (!spec->no_analog) {
2947 err = snd_hda_create_spdif_share_sw(codec,
2951 spec->multiout.share_spdif = 1;
2954 if (spec->dig_in_nid) {
2955 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2960 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2961 /* create beep controls if needed */
2962 if (spec->beep_amp) {
2963 struct snd_kcontrol_new *knew;
2964 for (knew = alc_beep_mixer; knew->name; knew++) {
2965 struct snd_kcontrol *kctl;
2966 kctl = snd_ctl_new1(knew, codec);
2969 kctl->private_value = spec->beep_amp;
2970 err = snd_hda_ctl_add(codec, 0, kctl);
2977 /* if we have no master control, let's create it */
2978 if (!spec->no_analog &&
2979 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2980 unsigned int vmaster_tlv[4];
2981 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2982 HDA_OUTPUT, vmaster_tlv);
2983 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2984 vmaster_tlv, alc_slave_vols);
2988 if (!spec->no_analog &&
2989 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2990 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2991 NULL, alc_slave_sws);
2996 /* assign Capture Source enums to NID */
2997 if (spec->capsrc_nids || spec->adc_nids) {
2998 kctl = snd_hda_find_mixer_ctl(codec, "Capture Source");
3000 kctl = snd_hda_find_mixer_ctl(codec, "Input Source");
3001 for (i = 0; kctl && i < kctl->count; i++) {
3002 hda_nid_t *nids = spec->capsrc_nids;
3004 nids = spec->adc_nids;
3005 err = snd_hda_add_nid(codec, kctl, i, nids[i]);
3010 if (spec->cap_mixer) {
3011 const char *kname = kctl ? kctl->id.name : NULL;
3012 for (knew = spec->cap_mixer; knew->name; knew++) {
3013 if (kname && strcmp(knew->name, kname) == 0)
3015 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
3016 for (i = 0; kctl && i < kctl->count; i++) {
3017 err = snd_hda_add_nid(codec, kctl, i,
3025 /* other nid->control mapping */
3026 for (i = 0; i < spec->num_mixers; i++) {
3027 for (knew = spec->mixers[i]; knew->name; knew++) {
3028 if (knew->iface != NID_MAPPING)
3030 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
3033 u = knew->subdevice;
3034 for (j = 0; j < 4; j++, u >>= 8) {
3039 case SUBDEV_SPEAKER_:
3040 nid = spec->autocfg.speaker_pins[nid];
3043 nid = spec->autocfg.line_out_pins[nid];
3046 nid = spec->autocfg.hp_pins[nid];
3051 err = snd_hda_add_nid(codec, kctl, 0, nid);
3055 u = knew->private_value;
3056 for (j = 0; j < 4; j++, u >>= 8) {
3060 err = snd_hda_add_nid(codec, kctl, 0, nid);
3067 alc_free_kctls(codec); /* no longer needed */
3074 * initialize the codec volumes, etc
3078 * generic initialization of ADC, input mixers and output mixers
3080 static struct hda_verb alc880_volume_init_verbs[] = {
3082 * Unmute ADC0-2 and set the default input to mic-in
3084 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3085 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3086 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3087 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3088 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3089 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3091 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
3093 * Note: PASD motherboards uses the Line In 2 as the input for front
3096 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
3097 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3098 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3099 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3100 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3101 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3102 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3103 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3106 * Set up output mixers (0x0c - 0x0f)
3108 /* set vol=0 to output mixers */
3109 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3110 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3111 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3112 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3113 /* set up input amps for analog loopback */
3114 /* Amp Indices: DAC = 0, mixer = 1 */
3115 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3116 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3117 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3118 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3119 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3120 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3121 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3122 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3128 * 3-stack pin configuration:
3129 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
3131 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
3133 * preset connection lists of input pins
3134 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
3136 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3137 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3138 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3141 * Set pin mode and muting
3143 /* set front pin widgets 0x14 for output */
3144 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3145 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3146 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3147 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3148 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3149 /* Mic2 (as headphone out) for HP output */
3150 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3151 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3152 /* Line In pin widget for input */
3153 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3154 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3155 /* Line2 (as front mic) pin widget for input and vref at 80% */
3156 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3157 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3158 /* CD pin widget for input */
3159 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3165 * 5-stack pin configuration:
3166 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
3167 * line-in/side = 0x1a, f-mic = 0x1b
3169 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
3171 * preset connection lists of input pins
3172 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
3174 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3175 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
3178 * Set pin mode and muting
3180 /* set pin widgets 0x14-0x17 for output */
3181 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3182 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3183 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3184 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3185 /* unmute pins for output (no gain on this amp) */
3186 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3187 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3188 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3189 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3191 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3192 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3193 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3194 /* Mic2 (as headphone out) for HP output */
3195 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3196 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3197 /* Line In pin widget for input */
3198 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3199 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3200 /* Line2 (as front mic) pin widget for input and vref at 80% */
3201 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3202 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3203 /* CD pin widget for input */
3204 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3210 * W810 pin configuration:
3211 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
3213 static struct hda_verb alc880_pin_w810_init_verbs[] = {
3214 /* hphone/speaker input selector: front DAC */
3215 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
3217 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3218 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3219 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3220 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3221 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3222 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3224 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3225 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3231 * Z71V pin configuration:
3232 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
3234 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
3235 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3236 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3237 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3238 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3240 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3241 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3242 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3243 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3249 * 6-stack pin configuration:
3250 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
3251 * f-mic = 0x19, line = 0x1a, HP = 0x1b
3253 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
3254 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3256 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3257 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3258 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3259 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3260 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3261 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3262 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3263 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3265 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3266 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3267 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3268 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3269 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3270 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3271 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3272 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3273 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3279 * Uniwill pin configuration:
3280 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
3283 static struct hda_verb alc880_uniwill_init_verbs[] = {
3284 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3286 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3287 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3288 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3289 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3290 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3291 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3292 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3293 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3294 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3295 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3296 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3297 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3298 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3299 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3301 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3302 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3303 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3304 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3305 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3306 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3307 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
3308 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
3309 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3311 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3312 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
3319 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
3321 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
3322 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3324 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3325 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3326 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3327 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3328 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3329 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3330 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3331 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3332 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3333 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3334 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3335 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3337 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3338 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3339 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3340 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3341 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3342 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3344 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3345 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
3350 static struct hda_verb alc880_beep_init_verbs[] = {
3351 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
3355 /* auto-toggle front mic */
3356 static void alc88x_simple_mic_automute(struct hda_codec *codec)
3358 unsigned int present;
3361 present = snd_hda_jack_detect(codec, 0x18);
3362 bits = present ? HDA_AMP_MUTE : 0;
3363 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
3366 static void alc880_uniwill_setup(struct hda_codec *codec)
3368 struct alc_spec *spec = codec->spec;
3370 spec->autocfg.hp_pins[0] = 0x14;
3371 spec->autocfg.speaker_pins[0] = 0x15;
3372 spec->autocfg.speaker_pins[0] = 0x16;
3375 static void alc880_uniwill_init_hook(struct hda_codec *codec)
3377 alc_automute_amp(codec);
3378 alc88x_simple_mic_automute(codec);
3381 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
3384 /* Looks like the unsol event is incompatible with the standard
3385 * definition. 4bit tag is placed at 28 bit!
3387 switch (res >> 28) {
3388 case ALC880_MIC_EVENT:
3389 alc88x_simple_mic_automute(codec);
3392 alc_automute_amp_unsol_event(codec, res);
3397 static void alc880_uniwill_p53_setup(struct hda_codec *codec)
3399 struct alc_spec *spec = codec->spec;
3401 spec->autocfg.hp_pins[0] = 0x14;
3402 spec->autocfg.speaker_pins[0] = 0x15;
3405 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
3407 unsigned int present;
3409 present = snd_hda_codec_read(codec, 0x21, 0,
3410 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
3411 present &= HDA_AMP_VOLMASK;
3412 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
3413 HDA_AMP_VOLMASK, present);
3414 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
3415 HDA_AMP_VOLMASK, present);
3418 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
3421 /* Looks like the unsol event is incompatible with the standard
3422 * definition. 4bit tag is placed at 28 bit!
3424 if ((res >> 28) == ALC880_DCVOL_EVENT)
3425 alc880_uniwill_p53_dcvol_automute(codec);
3427 alc_automute_amp_unsol_event(codec, res);
3431 * F1734 pin configuration:
3432 * HP = 0x14, speaker-out = 0x15, mic = 0x18
3434 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
3435 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
3436 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3437 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3438 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3439 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3441 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3442 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3443 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3444 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3446 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3447 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3448 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
3449 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3450 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3451 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3452 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3453 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3454 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3456 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
3457 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
3463 * ASUS pin configuration:
3464 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
3466 static struct hda_verb alc880_pin_asus_init_verbs[] = {
3467 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3468 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3469 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3470 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3472 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3473 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3474 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3475 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3476 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3477 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3478 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3479 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3481 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3482 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3483 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3484 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3485 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3486 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3487 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3488 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3489 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3494 /* Enable GPIO mask and set output */
3495 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
3496 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
3497 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
3499 /* Clevo m520g init */
3500 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
3501 /* headphone output */
3502 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3504 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3505 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3507 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3508 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3510 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3511 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3512 /* Mic1 (rear panel) */
3513 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3514 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3515 /* Mic2 (front panel) */
3516 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3517 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3519 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3520 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3521 /* change to EAPD mode */
3522 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3523 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3528 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
3529 /* change to EAPD mode */
3530 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3531 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3533 /* Headphone output */
3534 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3536 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3537 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
3539 /* Line In pin widget for input */
3540 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3541 /* CD pin widget for input */
3542 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3543 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3544 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3546 /* change to EAPD mode */
3547 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3548 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
3554 * LG m1 express dual
3557 * Rear Line-In/Out (blue): 0x14
3558 * Build-in Mic-In: 0x15
3560 * HP-Out (green): 0x1b
3561 * Mic-In/Out (red): 0x19
3565 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
3566 static hda_nid_t alc880_lg_dac_nids[3] = {
3570 /* seems analog CD is not working */
3571 static struct hda_input_mux alc880_lg_capture_source = {
3576 { "Internal Mic", 0x6 },
3580 /* 2,4,6 channel modes */
3581 static struct hda_verb alc880_lg_ch2_init[] = {
3582 /* set line-in and mic-in to input */
3583 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
3584 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3588 static struct hda_verb alc880_lg_ch4_init[] = {
3589 /* set line-in to out and mic-in to input */
3590 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3591 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3595 static struct hda_verb alc880_lg_ch6_init[] = {
3596 /* set line-in and mic-in to output */
3597 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3598 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3602 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
3603 { 2, alc880_lg_ch2_init },
3604 { 4, alc880_lg_ch4_init },
3605 { 6, alc880_lg_ch6_init },
3608 static struct snd_kcontrol_new alc880_lg_mixer[] = {
3609 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3610 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3611 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3612 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3613 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3614 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3615 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3616 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3617 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3618 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3619 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3620 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3621 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3622 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3624 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3625 .name = "Channel Mode",
3626 .info = alc_ch_mode_info,
3627 .get = alc_ch_mode_get,
3628 .put = alc_ch_mode_put,
3633 static struct hda_verb alc880_lg_init_verbs[] = {
3634 /* set capture source to mic-in */
3635 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3636 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3637 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3638 /* mute all amp mixer inputs */
3639 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3640 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3641 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3642 /* line-in to input */
3643 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3644 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3646 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3647 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3649 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3650 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3651 /* mic-in to input */
3652 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3653 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3654 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3656 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3657 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3658 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3660 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3664 /* toggle speaker-output according to the hp-jack state */
3665 static void alc880_lg_setup(struct hda_codec *codec)
3667 struct alc_spec *spec = codec->spec;
3669 spec->autocfg.hp_pins[0] = 0x1b;
3670 spec->autocfg.speaker_pins[0] = 0x17;
3679 * Built-in Mic-In: 0x19
3685 static struct hda_input_mux alc880_lg_lw_capture_source = {
3689 { "Internal Mic", 0x1 },
3694 #define alc880_lg_lw_modes alc880_threestack_modes
3696 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3697 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3698 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3699 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3700 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3701 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3702 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3703 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3704 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3705 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3706 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3707 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3708 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3709 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
3710 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
3712 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3713 .name = "Channel Mode",
3714 .info = alc_ch_mode_info,
3715 .get = alc_ch_mode_get,
3716 .put = alc_ch_mode_put,
3721 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3722 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3723 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3724 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3726 /* set capture source to mic-in */
3727 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3728 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3729 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3730 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3732 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3733 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3735 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3736 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3737 /* mic-in to input */
3738 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3739 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3741 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3742 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3744 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3748 /* toggle speaker-output according to the hp-jack state */
3749 static void alc880_lg_lw_setup(struct hda_codec *codec)
3751 struct alc_spec *spec = codec->spec;
3753 spec->autocfg.hp_pins[0] = 0x1b;
3754 spec->autocfg.speaker_pins[0] = 0x14;
3757 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3758 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3759 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3760 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3761 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3762 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3763 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3767 static struct hda_input_mux alc880_medion_rim_capture_source = {
3771 { "Internal Mic", 0x1 },
3775 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3776 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3778 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3779 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3781 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3782 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3783 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3784 /* Mic2 (as headphone out) for HP output */
3785 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3786 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3787 /* Internal Speaker */
3788 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3789 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3791 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3792 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3794 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3798 /* toggle speaker-output according to the hp-jack state */
3799 static void alc880_medion_rim_automute(struct hda_codec *codec)
3801 struct alc_spec *spec = codec->spec;
3802 alc_automute_amp(codec);
3804 if (spec->jack_present)
3805 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3807 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3810 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3813 /* Looks like the unsol event is incompatible with the standard
3814 * definition. 4bit tag is placed at 28 bit!
3816 if ((res >> 28) == ALC880_HP_EVENT)
3817 alc880_medion_rim_automute(codec);
3820 static void alc880_medion_rim_setup(struct hda_codec *codec)
3822 struct alc_spec *spec = codec->spec;
3824 spec->autocfg.hp_pins[0] = 0x14;
3825 spec->autocfg.speaker_pins[0] = 0x1b;
3828 #ifdef CONFIG_SND_HDA_POWER_SAVE
3829 static struct hda_amp_list alc880_loopbacks[] = {
3830 { 0x0b, HDA_INPUT, 0 },
3831 { 0x0b, HDA_INPUT, 1 },
3832 { 0x0b, HDA_INPUT, 2 },
3833 { 0x0b, HDA_INPUT, 3 },
3834 { 0x0b, HDA_INPUT, 4 },
3838 static struct hda_amp_list alc880_lg_loopbacks[] = {
3839 { 0x0b, HDA_INPUT, 1 },
3840 { 0x0b, HDA_INPUT, 6 },
3841 { 0x0b, HDA_INPUT, 7 },
3850 static int alc_init(struct hda_codec *codec)
3852 struct alc_spec *spec = codec->spec;
3856 alc_auto_init_amp(codec, spec->init_amp);
3858 for (i = 0; i < spec->num_init_verbs; i++)
3859 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3861 if (spec->init_hook)
3862 spec->init_hook(codec);
3864 alc_apply_fixup(codec, ALC_FIXUP_ACT_INIT);
3866 hda_call_check_power_status(codec, 0x01);
3870 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3872 struct alc_spec *spec = codec->spec;
3874 if (spec->unsol_event)
3875 spec->unsol_event(codec, res);
3878 #ifdef CONFIG_SND_HDA_POWER_SAVE
3879 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3881 struct alc_spec *spec = codec->spec;
3882 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3887 * Analog playback callbacks
3889 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3890 struct hda_codec *codec,
3891 struct snd_pcm_substream *substream)
3893 struct alc_spec *spec = codec->spec;
3894 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3898 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3899 struct hda_codec *codec,
3900 unsigned int stream_tag,
3901 unsigned int format,
3902 struct snd_pcm_substream *substream)
3904 struct alc_spec *spec = codec->spec;
3905 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3906 stream_tag, format, substream);
3909 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3910 struct hda_codec *codec,
3911 struct snd_pcm_substream *substream)
3913 struct alc_spec *spec = codec->spec;
3914 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3920 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3921 struct hda_codec *codec,
3922 struct snd_pcm_substream *substream)
3924 struct alc_spec *spec = codec->spec;
3925 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3928 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3929 struct hda_codec *codec,
3930 unsigned int stream_tag,
3931 unsigned int format,
3932 struct snd_pcm_substream *substream)
3934 struct alc_spec *spec = codec->spec;
3935 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3936 stream_tag, format, substream);
3939 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3940 struct hda_codec *codec,
3941 struct snd_pcm_substream *substream)
3943 struct alc_spec *spec = codec->spec;
3944 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3947 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3948 struct hda_codec *codec,
3949 struct snd_pcm_substream *substream)
3951 struct alc_spec *spec = codec->spec;
3952 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3958 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3959 struct hda_codec *codec,
3960 unsigned int stream_tag,
3961 unsigned int format,
3962 struct snd_pcm_substream *substream)
3964 struct alc_spec *spec = codec->spec;
3966 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3967 stream_tag, 0, format);
3971 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3972 struct hda_codec *codec,
3973 struct snd_pcm_substream *substream)
3975 struct alc_spec *spec = codec->spec;
3977 snd_hda_codec_cleanup_stream(codec,
3978 spec->adc_nids[substream->number + 1]);
3982 /* analog capture with dynamic dual-adc changes */
3983 static int dualmic_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3984 struct hda_codec *codec,
3985 unsigned int stream_tag,
3986 unsigned int format,
3987 struct snd_pcm_substream *substream)
3989 struct alc_spec *spec = codec->spec;
3990 spec->cur_adc = spec->adc_nids[spec->cur_adc_idx];
3991 spec->cur_adc_stream_tag = stream_tag;
3992 spec->cur_adc_format = format;
3993 snd_hda_codec_setup_stream(codec, spec->cur_adc, stream_tag, 0, format);
3997 static int dualmic_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3998 struct hda_codec *codec,
3999 struct snd_pcm_substream *substream)
4001 struct alc_spec *spec = codec->spec;
4002 snd_hda_codec_cleanup_stream(codec, spec->cur_adc);
4007 static struct hda_pcm_stream dualmic_pcm_analog_capture = {
4011 .nid = 0, /* fill later */
4013 .prepare = dualmic_capture_pcm_prepare,
4014 .cleanup = dualmic_capture_pcm_cleanup
4020 static struct hda_pcm_stream alc880_pcm_analog_playback = {
4024 /* NID is set in alc_build_pcms */
4026 .open = alc880_playback_pcm_open,
4027 .prepare = alc880_playback_pcm_prepare,
4028 .cleanup = alc880_playback_pcm_cleanup
4032 static struct hda_pcm_stream alc880_pcm_analog_capture = {
4036 /* NID is set in alc_build_pcms */
4039 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
4043 /* NID is set in alc_build_pcms */
4046 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
4047 .substreams = 2, /* can be overridden */
4050 /* NID is set in alc_build_pcms */
4052 .prepare = alc880_alt_capture_pcm_prepare,
4053 .cleanup = alc880_alt_capture_pcm_cleanup
4057 static struct hda_pcm_stream alc880_pcm_digital_playback = {
4061 /* NID is set in alc_build_pcms */
4063 .open = alc880_dig_playback_pcm_open,
4064 .close = alc880_dig_playback_pcm_close,
4065 .prepare = alc880_dig_playback_pcm_prepare,
4066 .cleanup = alc880_dig_playback_pcm_cleanup
4070 static struct hda_pcm_stream alc880_pcm_digital_capture = {
4074 /* NID is set in alc_build_pcms */
4077 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
4078 static struct hda_pcm_stream alc_pcm_null_stream = {
4084 static int alc_build_pcms(struct hda_codec *codec)
4086 struct alc_spec *spec = codec->spec;
4087 struct hda_pcm *info = spec->pcm_rec;
4090 codec->num_pcms = 1;
4091 codec->pcm_info = info;
4093 if (spec->no_analog)
4096 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
4097 "%s Analog", codec->chip_name);
4098 info->name = spec->stream_name_analog;
4100 if (spec->stream_analog_playback) {
4101 if (snd_BUG_ON(!spec->multiout.dac_nids))
4103 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
4104 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
4106 if (spec->stream_analog_capture) {
4107 if (snd_BUG_ON(!spec->adc_nids))
4109 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
4110 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
4113 if (spec->channel_mode) {
4114 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
4115 for (i = 0; i < spec->num_channel_mode; i++) {
4116 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
4117 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
4123 /* SPDIF for stream index #1 */
4124 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
4125 snprintf(spec->stream_name_digital,
4126 sizeof(spec->stream_name_digital),
4127 "%s Digital", codec->chip_name);
4128 codec->num_pcms = 2;
4129 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
4130 info = spec->pcm_rec + 1;
4131 info->name = spec->stream_name_digital;
4132 if (spec->dig_out_type)
4133 info->pcm_type = spec->dig_out_type;
4135 info->pcm_type = HDA_PCM_TYPE_SPDIF;
4136 if (spec->multiout.dig_out_nid &&
4137 spec->stream_digital_playback) {
4138 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
4139 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
4141 if (spec->dig_in_nid &&
4142 spec->stream_digital_capture) {
4143 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
4144 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
4146 /* FIXME: do we need this for all Realtek codec models? */
4147 codec->spdif_status_reset = 1;
4150 if (spec->no_analog)
4153 /* If the use of more than one ADC is requested for the current
4154 * model, configure a second analog capture-only PCM.
4156 /* Additional Analaog capture for index #2 */
4157 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
4158 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
4159 codec->num_pcms = 3;
4160 info = spec->pcm_rec + 2;
4161 info->name = spec->stream_name_analog;
4162 if (spec->alt_dac_nid) {
4163 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
4164 *spec->stream_analog_alt_playback;
4165 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
4168 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
4169 alc_pcm_null_stream;
4170 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
4172 if (spec->num_adc_nids > 1) {
4173 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
4174 *spec->stream_analog_alt_capture;
4175 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
4177 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
4178 spec->num_adc_nids - 1;
4180 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
4181 alc_pcm_null_stream;
4182 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
4189 static inline void alc_shutup(struct hda_codec *codec)
4191 snd_hda_shutup_pins(codec);
4194 static void alc_free_kctls(struct hda_codec *codec)
4196 struct alc_spec *spec = codec->spec;
4198 if (spec->kctls.list) {
4199 struct snd_kcontrol_new *kctl = spec->kctls.list;
4201 for (i = 0; i < spec->kctls.used; i++)
4202 kfree(kctl[i].name);
4204 snd_array_free(&spec->kctls);
4207 static void alc_free(struct hda_codec *codec)
4209 struct alc_spec *spec = codec->spec;
4215 snd_hda_input_jack_free(codec);
4216 alc_free_kctls(codec);
4218 snd_hda_detach_beep_device(codec);
4221 #ifdef CONFIG_SND_HDA_POWER_SAVE
4222 static void alc_power_eapd(struct hda_codec *codec)
4224 /* We currently only handle front, HP */
4225 switch (codec->vendor_id) {
4227 set_eapd(codec, 0x0f, 0);
4228 set_eapd(codec, 0x10, 0);
4241 set_eapd(codec, 0x14, 0);
4242 set_eapd(codec, 0x15, 0);
4247 static int alc_suspend(struct hda_codec *codec, pm_message_t state)
4249 struct alc_spec *spec = codec->spec;
4251 if (spec && spec->power_hook)
4252 spec->power_hook(codec);
4257 #ifdef SND_HDA_NEEDS_RESUME
4258 static int alc_resume(struct hda_codec *codec)
4260 codec->patch_ops.init(codec);
4261 snd_hda_codec_resume_amp(codec);
4262 snd_hda_codec_resume_cache(codec);
4263 hda_call_check_power_status(codec, 0x01);
4270 static struct hda_codec_ops alc_patch_ops = {
4271 .build_controls = alc_build_controls,
4272 .build_pcms = alc_build_pcms,
4275 .unsol_event = alc_unsol_event,
4276 #ifdef SND_HDA_NEEDS_RESUME
4277 .resume = alc_resume,
4279 #ifdef CONFIG_SND_HDA_POWER_SAVE
4280 .suspend = alc_suspend,
4281 .check_power_status = alc_check_power_status,
4283 .reboot_notify = alc_shutup,
4286 /* replace the codec chip_name with the given string */
4287 static int alc_codec_rename(struct hda_codec *codec, const char *name)
4289 kfree(codec->chip_name);
4290 codec->chip_name = kstrdup(name, GFP_KERNEL);
4291 if (!codec->chip_name) {
4299 * Test configuration for debugging
4301 * Almost all inputs/outputs are enabled. I/O pins can be configured via
4304 #ifdef CONFIG_SND_DEBUG
4305 static hda_nid_t alc880_test_dac_nids[4] = {
4306 0x02, 0x03, 0x04, 0x05
4309 static struct hda_input_mux alc880_test_capture_source = {
4318 { "Surround", 0x6 },
4322 static struct hda_channel_mode alc880_test_modes[4] = {
4329 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
4330 struct snd_ctl_elem_info *uinfo)
4332 static char *texts[] = {
4333 "N/A", "Line Out", "HP Out",
4334 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
4336 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
4338 uinfo->value.enumerated.items = 8;
4339 if (uinfo->value.enumerated.item >= 8)
4340 uinfo->value.enumerated.item = 7;
4341 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
4345 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
4346 struct snd_ctl_elem_value *ucontrol)
4348 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4349 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4350 unsigned int pin_ctl, item = 0;
4352 pin_ctl = snd_hda_codec_read(codec, nid, 0,
4353 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
4354 if (pin_ctl & AC_PINCTL_OUT_EN) {
4355 if (pin_ctl & AC_PINCTL_HP_EN)
4359 } else if (pin_ctl & AC_PINCTL_IN_EN) {
4360 switch (pin_ctl & AC_PINCTL_VREFEN) {
4361 case AC_PINCTL_VREF_HIZ: item = 3; break;
4362 case AC_PINCTL_VREF_50: item = 4; break;
4363 case AC_PINCTL_VREF_GRD: item = 5; break;
4364 case AC_PINCTL_VREF_80: item = 6; break;
4365 case AC_PINCTL_VREF_100: item = 7; break;
4368 ucontrol->value.enumerated.item[0] = item;
4372 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
4373 struct snd_ctl_elem_value *ucontrol)
4375 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4376 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4377 static unsigned int ctls[] = {
4378 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
4379 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
4380 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
4381 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
4382 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
4383 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
4385 unsigned int old_ctl, new_ctl;
4387 old_ctl = snd_hda_codec_read(codec, nid, 0,
4388 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
4389 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
4390 if (old_ctl != new_ctl) {
4392 snd_hda_codec_write_cache(codec, nid, 0,
4393 AC_VERB_SET_PIN_WIDGET_CONTROL,
4395 val = ucontrol->value.enumerated.item[0] >= 3 ?
4397 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
4404 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
4405 struct snd_ctl_elem_info *uinfo)
4407 static char *texts[] = {
4408 "Front", "Surround", "CLFE", "Side"
4410 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
4412 uinfo->value.enumerated.items = 4;
4413 if (uinfo->value.enumerated.item >= 4)
4414 uinfo->value.enumerated.item = 3;
4415 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
4419 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
4420 struct snd_ctl_elem_value *ucontrol)
4422 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4423 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4426 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
4427 ucontrol->value.enumerated.item[0] = sel & 3;
4431 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
4432 struct snd_ctl_elem_value *ucontrol)
4434 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4435 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4438 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
4439 if (ucontrol->value.enumerated.item[0] != sel) {
4440 sel = ucontrol->value.enumerated.item[0] & 3;
4441 snd_hda_codec_write_cache(codec, nid, 0,
4442 AC_VERB_SET_CONNECT_SEL, sel);
4448 #define PIN_CTL_TEST(xname,nid) { \
4449 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4451 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4452 .info = alc_test_pin_ctl_info, \
4453 .get = alc_test_pin_ctl_get, \
4454 .put = alc_test_pin_ctl_put, \
4455 .private_value = nid \
4458 #define PIN_SRC_TEST(xname,nid) { \
4459 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4461 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4462 .info = alc_test_pin_src_info, \
4463 .get = alc_test_pin_src_get, \
4464 .put = alc_test_pin_src_put, \
4465 .private_value = nid \
4468 static struct snd_kcontrol_new alc880_test_mixer[] = {
4469 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
4470 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
4471 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
4472 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
4473 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
4474 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
4475 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
4476 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
4477 PIN_CTL_TEST("Front Pin Mode", 0x14),
4478 PIN_CTL_TEST("Surround Pin Mode", 0x15),
4479 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
4480 PIN_CTL_TEST("Side Pin Mode", 0x17),
4481 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
4482 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
4483 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
4484 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
4485 PIN_SRC_TEST("In-1 Pin Source", 0x18),
4486 PIN_SRC_TEST("In-2 Pin Source", 0x19),
4487 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
4488 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
4489 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
4490 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
4491 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
4492 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
4493 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
4494 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
4495 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
4496 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
4497 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
4498 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
4500 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4501 .name = "Channel Mode",
4502 .info = alc_ch_mode_info,
4503 .get = alc_ch_mode_get,
4504 .put = alc_ch_mode_put,
4509 static struct hda_verb alc880_test_init_verbs[] = {
4510 /* Unmute inputs of 0x0c - 0x0f */
4511 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4512 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4513 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4514 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4515 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4516 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4517 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4518 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4519 /* Vol output for 0x0c-0x0f */
4520 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4521 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4522 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4523 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4524 /* Set output pins 0x14-0x17 */
4525 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4526 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4527 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4528 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4529 /* Unmute output pins 0x14-0x17 */
4530 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4531 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4532 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4533 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4534 /* Set input pins 0x18-0x1c */
4535 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4536 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4537 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4538 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4539 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4540 /* Mute input pins 0x18-0x1b */
4541 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4542 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4543 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4544 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4546 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4547 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
4548 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4549 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
4550 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4551 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
4552 /* Analog input/passthru */
4553 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4554 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4555 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4556 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4557 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4565 static const char * const alc880_models[ALC880_MODEL_LAST] = {
4566 [ALC880_3ST] = "3stack",
4567 [ALC880_TCL_S700] = "tcl",
4568 [ALC880_3ST_DIG] = "3stack-digout",
4569 [ALC880_CLEVO] = "clevo",
4570 [ALC880_5ST] = "5stack",
4571 [ALC880_5ST_DIG] = "5stack-digout",
4572 [ALC880_W810] = "w810",
4573 [ALC880_Z71V] = "z71v",
4574 [ALC880_6ST] = "6stack",
4575 [ALC880_6ST_DIG] = "6stack-digout",
4576 [ALC880_ASUS] = "asus",
4577 [ALC880_ASUS_W1V] = "asus-w1v",
4578 [ALC880_ASUS_DIG] = "asus-dig",
4579 [ALC880_ASUS_DIG2] = "asus-dig2",
4580 [ALC880_UNIWILL_DIG] = "uniwill",
4581 [ALC880_UNIWILL_P53] = "uniwill-p53",
4582 [ALC880_FUJITSU] = "fujitsu",
4583 [ALC880_F1734] = "F1734",
4585 [ALC880_LG_LW] = "lg-lw",
4586 [ALC880_MEDION_RIM] = "medion",
4587 #ifdef CONFIG_SND_DEBUG
4588 [ALC880_TEST] = "test",
4590 [ALC880_AUTO] = "auto",
4593 static struct snd_pci_quirk alc880_cfg_tbl[] = {
4594 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
4595 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
4596 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
4597 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
4598 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
4599 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
4600 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
4601 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
4602 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
4603 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
4604 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
4605 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
4606 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
4607 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
4608 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
4609 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
4610 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
4611 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
4612 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
4613 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
4614 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
4615 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
4616 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
4617 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
4618 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
4619 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
4620 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
4621 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
4622 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
4623 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
4624 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
4625 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
4626 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
4627 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
4628 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
4629 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
4630 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
4631 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
4632 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
4633 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
4634 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
4635 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
4636 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
4637 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
4638 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
4639 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
4640 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
4641 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
4642 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
4643 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734),
4644 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
4645 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
4646 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
4647 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_LG),
4648 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
4649 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
4650 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
4651 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
4652 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
4653 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
4654 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
4655 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
4656 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
4657 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
4658 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
4659 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
4660 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
4661 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
4662 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
4664 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
4665 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
4666 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
4671 * ALC880 codec presets
4673 static struct alc_config_preset alc880_presets[] = {
4675 .mixers = { alc880_three_stack_mixer },
4676 .init_verbs = { alc880_volume_init_verbs,
4677 alc880_pin_3stack_init_verbs },
4678 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4679 .dac_nids = alc880_dac_nids,
4680 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4681 .channel_mode = alc880_threestack_modes,
4683 .input_mux = &alc880_capture_source,
4685 [ALC880_3ST_DIG] = {
4686 .mixers = { alc880_three_stack_mixer },
4687 .init_verbs = { alc880_volume_init_verbs,
4688 alc880_pin_3stack_init_verbs },
4689 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4690 .dac_nids = alc880_dac_nids,
4691 .dig_out_nid = ALC880_DIGOUT_NID,
4692 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4693 .channel_mode = alc880_threestack_modes,
4695 .input_mux = &alc880_capture_source,
4697 [ALC880_TCL_S700] = {
4698 .mixers = { alc880_tcl_s700_mixer },
4699 .init_verbs = { alc880_volume_init_verbs,
4700 alc880_pin_tcl_S700_init_verbs,
4701 alc880_gpio2_init_verbs },
4702 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4703 .dac_nids = alc880_dac_nids,
4704 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4705 .num_adc_nids = 1, /* single ADC */
4707 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4708 .channel_mode = alc880_2_jack_modes,
4709 .input_mux = &alc880_capture_source,
4712 .mixers = { alc880_three_stack_mixer,
4713 alc880_five_stack_mixer},
4714 .init_verbs = { alc880_volume_init_verbs,
4715 alc880_pin_5stack_init_verbs },
4716 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4717 .dac_nids = alc880_dac_nids,
4718 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4719 .channel_mode = alc880_fivestack_modes,
4720 .input_mux = &alc880_capture_source,
4722 [ALC880_5ST_DIG] = {
4723 .mixers = { alc880_three_stack_mixer,
4724 alc880_five_stack_mixer },
4725 .init_verbs = { alc880_volume_init_verbs,
4726 alc880_pin_5stack_init_verbs },
4727 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4728 .dac_nids = alc880_dac_nids,
4729 .dig_out_nid = ALC880_DIGOUT_NID,
4730 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4731 .channel_mode = alc880_fivestack_modes,
4732 .input_mux = &alc880_capture_source,
4735 .mixers = { alc880_six_stack_mixer },
4736 .init_verbs = { alc880_volume_init_verbs,
4737 alc880_pin_6stack_init_verbs },
4738 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4739 .dac_nids = alc880_6st_dac_nids,
4740 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4741 .channel_mode = alc880_sixstack_modes,
4742 .input_mux = &alc880_6stack_capture_source,
4744 [ALC880_6ST_DIG] = {
4745 .mixers = { alc880_six_stack_mixer },
4746 .init_verbs = { alc880_volume_init_verbs,
4747 alc880_pin_6stack_init_verbs },
4748 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4749 .dac_nids = alc880_6st_dac_nids,
4750 .dig_out_nid = ALC880_DIGOUT_NID,
4751 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4752 .channel_mode = alc880_sixstack_modes,
4753 .input_mux = &alc880_6stack_capture_source,
4756 .mixers = { alc880_w810_base_mixer },
4757 .init_verbs = { alc880_volume_init_verbs,
4758 alc880_pin_w810_init_verbs,
4759 alc880_gpio2_init_verbs },
4760 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
4761 .dac_nids = alc880_w810_dac_nids,
4762 .dig_out_nid = ALC880_DIGOUT_NID,
4763 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4764 .channel_mode = alc880_w810_modes,
4765 .input_mux = &alc880_capture_source,
4768 .mixers = { alc880_z71v_mixer },
4769 .init_verbs = { alc880_volume_init_verbs,
4770 alc880_pin_z71v_init_verbs },
4771 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
4772 .dac_nids = alc880_z71v_dac_nids,
4773 .dig_out_nid = ALC880_DIGOUT_NID,
4775 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4776 .channel_mode = alc880_2_jack_modes,
4777 .input_mux = &alc880_capture_source,
4780 .mixers = { alc880_f1734_mixer },
4781 .init_verbs = { alc880_volume_init_verbs,
4782 alc880_pin_f1734_init_verbs },
4783 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
4784 .dac_nids = alc880_f1734_dac_nids,
4786 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4787 .channel_mode = alc880_2_jack_modes,
4788 .input_mux = &alc880_f1734_capture_source,
4789 .unsol_event = alc880_uniwill_p53_unsol_event,
4790 .setup = alc880_uniwill_p53_setup,
4791 .init_hook = alc_automute_amp,
4794 .mixers = { alc880_asus_mixer },
4795 .init_verbs = { alc880_volume_init_verbs,
4796 alc880_pin_asus_init_verbs,
4797 alc880_gpio1_init_verbs },
4798 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4799 .dac_nids = alc880_asus_dac_nids,
4800 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4801 .channel_mode = alc880_asus_modes,
4803 .input_mux = &alc880_capture_source,
4805 [ALC880_ASUS_DIG] = {
4806 .mixers = { alc880_asus_mixer },
4807 .init_verbs = { alc880_volume_init_verbs,
4808 alc880_pin_asus_init_verbs,
4809 alc880_gpio1_init_verbs },
4810 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4811 .dac_nids = alc880_asus_dac_nids,
4812 .dig_out_nid = ALC880_DIGOUT_NID,
4813 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4814 .channel_mode = alc880_asus_modes,
4816 .input_mux = &alc880_capture_source,
4818 [ALC880_ASUS_DIG2] = {
4819 .mixers = { alc880_asus_mixer },
4820 .init_verbs = { alc880_volume_init_verbs,
4821 alc880_pin_asus_init_verbs,
4822 alc880_gpio2_init_verbs }, /* use GPIO2 */
4823 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4824 .dac_nids = alc880_asus_dac_nids,
4825 .dig_out_nid = ALC880_DIGOUT_NID,
4826 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4827 .channel_mode = alc880_asus_modes,
4829 .input_mux = &alc880_capture_source,
4831 [ALC880_ASUS_W1V] = {
4832 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4833 .init_verbs = { alc880_volume_init_verbs,
4834 alc880_pin_asus_init_verbs,
4835 alc880_gpio1_init_verbs },
4836 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4837 .dac_nids = alc880_asus_dac_nids,
4838 .dig_out_nid = ALC880_DIGOUT_NID,
4839 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4840 .channel_mode = alc880_asus_modes,
4842 .input_mux = &alc880_capture_source,
4844 [ALC880_UNIWILL_DIG] = {
4845 .mixers = { alc880_asus_mixer },
4846 .init_verbs = { alc880_volume_init_verbs,
4847 alc880_pin_asus_init_verbs },
4848 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4849 .dac_nids = alc880_asus_dac_nids,
4850 .dig_out_nid = ALC880_DIGOUT_NID,
4851 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4852 .channel_mode = alc880_asus_modes,
4854 .input_mux = &alc880_capture_source,
4856 [ALC880_UNIWILL] = {
4857 .mixers = { alc880_uniwill_mixer },
4858 .init_verbs = { alc880_volume_init_verbs,
4859 alc880_uniwill_init_verbs },
4860 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4861 .dac_nids = alc880_asus_dac_nids,
4862 .dig_out_nid = ALC880_DIGOUT_NID,
4863 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4864 .channel_mode = alc880_threestack_modes,
4866 .input_mux = &alc880_capture_source,
4867 .unsol_event = alc880_uniwill_unsol_event,
4868 .setup = alc880_uniwill_setup,
4869 .init_hook = alc880_uniwill_init_hook,
4871 [ALC880_UNIWILL_P53] = {
4872 .mixers = { alc880_uniwill_p53_mixer },
4873 .init_verbs = { alc880_volume_init_verbs,
4874 alc880_uniwill_p53_init_verbs },
4875 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4876 .dac_nids = alc880_asus_dac_nids,
4877 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4878 .channel_mode = alc880_threestack_modes,
4879 .input_mux = &alc880_capture_source,
4880 .unsol_event = alc880_uniwill_p53_unsol_event,
4881 .setup = alc880_uniwill_p53_setup,
4882 .init_hook = alc_automute_amp,
4884 [ALC880_FUJITSU] = {
4885 .mixers = { alc880_fujitsu_mixer },
4886 .init_verbs = { alc880_volume_init_verbs,
4887 alc880_uniwill_p53_init_verbs,
4888 alc880_beep_init_verbs },
4889 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4890 .dac_nids = alc880_dac_nids,
4891 .dig_out_nid = ALC880_DIGOUT_NID,
4892 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4893 .channel_mode = alc880_2_jack_modes,
4894 .input_mux = &alc880_capture_source,
4895 .unsol_event = alc880_uniwill_p53_unsol_event,
4896 .setup = alc880_uniwill_p53_setup,
4897 .init_hook = alc_automute_amp,
4900 .mixers = { alc880_three_stack_mixer },
4901 .init_verbs = { alc880_volume_init_verbs,
4902 alc880_pin_clevo_init_verbs },
4903 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4904 .dac_nids = alc880_dac_nids,
4906 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4907 .channel_mode = alc880_threestack_modes,
4909 .input_mux = &alc880_capture_source,
4912 .mixers = { alc880_lg_mixer },
4913 .init_verbs = { alc880_volume_init_verbs,
4914 alc880_lg_init_verbs },
4915 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4916 .dac_nids = alc880_lg_dac_nids,
4917 .dig_out_nid = ALC880_DIGOUT_NID,
4918 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4919 .channel_mode = alc880_lg_ch_modes,
4921 .input_mux = &alc880_lg_capture_source,
4922 .unsol_event = alc_automute_amp_unsol_event,
4923 .setup = alc880_lg_setup,
4924 .init_hook = alc_automute_amp,
4925 #ifdef CONFIG_SND_HDA_POWER_SAVE
4926 .loopbacks = alc880_lg_loopbacks,
4930 .mixers = { alc880_lg_lw_mixer },
4931 .init_verbs = { alc880_volume_init_verbs,
4932 alc880_lg_lw_init_verbs },
4933 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4934 .dac_nids = alc880_dac_nids,
4935 .dig_out_nid = ALC880_DIGOUT_NID,
4936 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4937 .channel_mode = alc880_lg_lw_modes,
4938 .input_mux = &alc880_lg_lw_capture_source,
4939 .unsol_event = alc_automute_amp_unsol_event,
4940 .setup = alc880_lg_lw_setup,
4941 .init_hook = alc_automute_amp,
4943 [ALC880_MEDION_RIM] = {
4944 .mixers = { alc880_medion_rim_mixer },
4945 .init_verbs = { alc880_volume_init_verbs,
4946 alc880_medion_rim_init_verbs,
4947 alc_gpio2_init_verbs },
4948 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4949 .dac_nids = alc880_dac_nids,
4950 .dig_out_nid = ALC880_DIGOUT_NID,
4951 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4952 .channel_mode = alc880_2_jack_modes,
4953 .input_mux = &alc880_medion_rim_capture_source,
4954 .unsol_event = alc880_medion_rim_unsol_event,
4955 .setup = alc880_medion_rim_setup,
4956 .init_hook = alc880_medion_rim_automute,
4958 #ifdef CONFIG_SND_DEBUG
4960 .mixers = { alc880_test_mixer },
4961 .init_verbs = { alc880_test_init_verbs },
4962 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4963 .dac_nids = alc880_test_dac_nids,
4964 .dig_out_nid = ALC880_DIGOUT_NID,
4965 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4966 .channel_mode = alc880_test_modes,
4967 .input_mux = &alc880_test_capture_source,
4973 * Automatic parse of I/O pins from the BIOS configuration
4978 ALC_CTL_WIDGET_MUTE,
4981 static struct snd_kcontrol_new alc880_control_templates[] = {
4982 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4983 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4984 HDA_BIND_MUTE(NULL, 0, 0, 0),
4987 /* add dynamic controls */
4988 static int add_control(struct alc_spec *spec, int type, const char *name,
4989 int cidx, unsigned long val)
4991 struct snd_kcontrol_new *knew;
4993 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4994 knew = snd_array_new(&spec->kctls);
4997 *knew = alc880_control_templates[type];
4998 knew->name = kstrdup(name, GFP_KERNEL);
5002 if (get_amp_nid_(val))
5003 knew->subdevice = HDA_SUBDEV_AMP_FLAG;
5004 knew->private_value = val;
5008 static int add_control_with_pfx(struct alc_spec *spec, int type,
5009 const char *pfx, const char *dir,
5010 const char *sfx, int cidx, unsigned long val)
5013 snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx);
5014 return add_control(spec, type, name, cidx, val);
5017 #define add_pb_vol_ctrl(spec, type, pfx, val) \
5018 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", 0, val)
5019 #define add_pb_sw_ctrl(spec, type, pfx, val) \
5020 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", 0, val)
5021 #define __add_pb_vol_ctrl(spec, type, pfx, cidx, val) \
5022 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", cidx, val)
5023 #define __add_pb_sw_ctrl(spec, type, pfx, cidx, val) \
5024 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", cidx, val)
5026 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
5027 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
5028 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
5029 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
5030 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
5031 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
5032 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
5033 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
5034 #define ALC880_PIN_CD_NID 0x1c
5036 /* fill in the dac_nids table from the parsed pin configuration */
5037 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
5038 const struct auto_pin_cfg *cfg)
5044 memset(assigned, 0, sizeof(assigned));
5045 spec->multiout.dac_nids = spec->private_dac_nids;
5047 /* check the pins hardwired to audio widget */
5048 for (i = 0; i < cfg->line_outs; i++) {
5049 nid = cfg->line_out_pins[i];
5050 if (alc880_is_fixed_pin(nid)) {
5051 int idx = alc880_fixed_pin_idx(nid);
5052 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
5056 /* left pins can be connect to any audio widget */
5057 for (i = 0; i < cfg->line_outs; i++) {
5058 nid = cfg->line_out_pins[i];
5059 if (alc880_is_fixed_pin(nid))
5061 /* search for an empty channel */
5062 for (j = 0; j < cfg->line_outs; j++) {
5064 spec->multiout.dac_nids[i] =
5065 alc880_idx_to_dac(j);
5071 spec->multiout.num_dacs = cfg->line_outs;
5075 static const char *alc_get_line_out_pfx(const struct auto_pin_cfg *cfg,
5078 if (!cfg->hp_outs && !cfg->speaker_outs && can_be_master)
5081 switch (cfg->line_out_type) {
5082 case AUTO_PIN_SPEAKER_OUT:
5084 case AUTO_PIN_HP_OUT:
5087 if (cfg->line_outs == 1)
5094 /* add playback controls from the parsed DAC table */
5095 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
5096 const struct auto_pin_cfg *cfg)
5098 static const char * const chname[4] = {
5099 "Front", "Surround", NULL /*CLFE*/, "Side"
5101 const char *pfx = alc_get_line_out_pfx(cfg, false);
5105 for (i = 0; i < cfg->line_outs; i++) {
5106 if (!spec->multiout.dac_nids[i])
5108 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
5109 if (!pfx && i == 2) {
5111 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
5113 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
5117 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
5119 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
5123 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
5125 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
5129 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
5131 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
5136 const char *name = pfx;
5139 err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
5141 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
5145 err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
5147 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
5156 /* add playback controls for speaker and HP outputs */
5157 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
5166 if (alc880_is_fixed_pin(pin)) {
5167 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
5168 /* specify the DAC as the extra output */
5169 if (!spec->multiout.hp_nid)
5170 spec->multiout.hp_nid = nid;
5172 spec->multiout.extra_out_nid[0] = nid;
5173 /* control HP volume/switch on the output mixer amp */
5174 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
5175 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
5176 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
5179 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
5180 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
5183 } else if (alc880_is_multi_pin(pin)) {
5184 /* set manual connection */
5185 /* we have only a switch on HP-out PIN */
5186 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
5187 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
5194 /* create input playback/capture controls for the given pin */
5195 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
5196 const char *ctlname, int ctlidx,
5197 int idx, hda_nid_t mix_nid)
5201 err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, ctlidx,
5202 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
5205 err = __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, ctlidx,
5206 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
5212 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
5214 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
5215 return (pincap & AC_PINCAP_IN) != 0;
5218 /* create playback/capture controls for input pins */
5219 static int alc_auto_create_input_ctls(struct hda_codec *codec,
5220 const struct auto_pin_cfg *cfg,
5222 hda_nid_t cap1, hda_nid_t cap2)
5224 struct alc_spec *spec = codec->spec;
5225 struct hda_input_mux *imux = &spec->private_imux[0];
5226 int i, err, idx, type_idx = 0;
5227 const char *prev_label = NULL;
5229 for (i = 0; i < cfg->num_inputs; i++) {
5233 pin = cfg->inputs[i].pin;
5234 if (!alc_is_input_pin(codec, pin))
5237 label = hda_get_autocfg_input_label(codec, cfg, i);
5238 if (prev_label && !strcmp(label, prev_label))
5245 idx = get_connection_index(codec, mixer, pin);
5247 err = new_analog_input(spec, pin,
5257 idx = get_connection_index(codec, cap1, pin);
5258 if (idx < 0 && cap2)
5259 idx = get_connection_index(codec, cap2, pin);
5261 snd_hda_add_imux_item(imux, label, idx, NULL);
5266 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
5267 const struct auto_pin_cfg *cfg)
5269 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
5272 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
5273 unsigned int pin_type)
5275 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5278 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
5282 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
5283 hda_nid_t nid, int pin_type,
5286 alc_set_pin_output(codec, nid, pin_type);
5287 /* need the manual connection? */
5288 if (alc880_is_multi_pin(nid)) {
5289 struct alc_spec *spec = codec->spec;
5290 int idx = alc880_multi_pin_idx(nid);
5291 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
5292 AC_VERB_SET_CONNECT_SEL,
5293 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
5297 static int get_pin_type(int line_out_type)
5299 if (line_out_type == AUTO_PIN_HP_OUT)
5305 static void alc880_auto_init_multi_out(struct hda_codec *codec)
5307 struct alc_spec *spec = codec->spec;
5310 for (i = 0; i < spec->autocfg.line_outs; i++) {
5311 hda_nid_t nid = spec->autocfg.line_out_pins[i];
5312 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5313 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
5317 static void alc880_auto_init_extra_out(struct hda_codec *codec)
5319 struct alc_spec *spec = codec->spec;
5322 pin = spec->autocfg.speaker_pins[0];
5323 if (pin) /* connect to front */
5324 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
5325 pin = spec->autocfg.hp_pins[0];
5326 if (pin) /* connect to front */
5327 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
5330 static void alc880_auto_init_analog_input(struct hda_codec *codec)
5332 struct alc_spec *spec = codec->spec;
5333 struct auto_pin_cfg *cfg = &spec->autocfg;
5336 for (i = 0; i < cfg->num_inputs; i++) {
5337 hda_nid_t nid = cfg->inputs[i].pin;
5338 if (alc_is_input_pin(codec, nid)) {
5339 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
5340 if (nid != ALC880_PIN_CD_NID &&
5341 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
5342 snd_hda_codec_write(codec, nid, 0,
5343 AC_VERB_SET_AMP_GAIN_MUTE,
5349 static void alc880_auto_init_input_src(struct hda_codec *codec)
5351 struct alc_spec *spec = codec->spec;
5354 for (c = 0; c < spec->num_adc_nids; c++) {
5355 unsigned int mux_idx;
5356 const struct hda_input_mux *imux;
5357 mux_idx = c >= spec->num_mux_defs ? 0 : c;
5358 imux = &spec->input_mux[mux_idx];
5359 if (!imux->num_items && mux_idx > 0)
5360 imux = &spec->input_mux[0];
5362 snd_hda_codec_write(codec, spec->adc_nids[c], 0,
5363 AC_VERB_SET_CONNECT_SEL,
5364 imux->items[0].index);
5368 /* parse the BIOS configuration and set up the alc_spec */
5369 /* return 1 if successful, 0 if the proper config is not found,
5370 * or a negative error code
5372 static int alc880_parse_auto_config(struct hda_codec *codec)
5374 struct alc_spec *spec = codec->spec;
5376 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
5378 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5382 if (!spec->autocfg.line_outs)
5383 return 0; /* can't find valid BIOS pin config */
5385 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
5388 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
5391 err = alc880_auto_create_extra_out(spec,
5392 spec->autocfg.speaker_pins[0],
5396 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
5400 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
5404 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
5406 alc_auto_parse_digital(codec);
5408 if (spec->kctls.list)
5409 add_mixer(spec, spec->kctls.list);
5411 add_verb(spec, alc880_volume_init_verbs);
5413 spec->num_mux_defs = 1;
5414 spec->input_mux = &spec->private_imux[0];
5416 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
5421 /* additional initialization for auto-configuration model */
5422 static void alc880_auto_init(struct hda_codec *codec)
5424 struct alc_spec *spec = codec->spec;
5425 alc880_auto_init_multi_out(codec);
5426 alc880_auto_init_extra_out(codec);
5427 alc880_auto_init_analog_input(codec);
5428 alc880_auto_init_input_src(codec);
5429 alc_auto_init_digital(codec);
5430 if (spec->unsol_event)
5431 alc_inithook(codec);
5434 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
5435 * one of two digital mic pins, e.g. on ALC272
5437 static void fixup_automic_adc(struct hda_codec *codec)
5439 struct alc_spec *spec = codec->spec;
5442 for (i = 0; i < spec->num_adc_nids; i++) {
5443 hda_nid_t cap = spec->capsrc_nids ?
5444 spec->capsrc_nids[i] : spec->adc_nids[i];
5447 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
5450 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
5453 spec->int_mic.mux_idx = iidx;
5454 spec->ext_mic.mux_idx = eidx;
5455 if (spec->capsrc_nids)
5456 spec->capsrc_nids += i;
5457 spec->adc_nids += i;
5458 spec->num_adc_nids = 1;
5461 snd_printd(KERN_INFO "hda_codec: %s: "
5462 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
5463 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
5464 spec->auto_mic = 0; /* disable auto-mic to be sure */
5467 /* select or unmute the given capsrc route */
5468 static void select_or_unmute_capsrc(struct hda_codec *codec, hda_nid_t cap,
5471 if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) {
5472 snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx,
5475 snd_hda_codec_write_cache(codec, cap, 0,
5476 AC_VERB_SET_CONNECT_SEL, idx);
5480 /* set the default connection to that pin */
5481 static int init_capsrc_for_pin(struct hda_codec *codec, hda_nid_t pin)
5483 struct alc_spec *spec = codec->spec;
5486 for (i = 0; i < spec->num_adc_nids; i++) {
5487 hda_nid_t cap = spec->capsrc_nids ?
5488 spec->capsrc_nids[i] : spec->adc_nids[i];
5491 idx = get_connection_index(codec, cap, pin);
5494 select_or_unmute_capsrc(codec, cap, idx);
5495 return i; /* return the found index */
5497 return -1; /* not found */
5500 /* choose the ADC/MUX containing the input pin and initialize the setup */
5501 static void fixup_single_adc(struct hda_codec *codec)
5503 struct alc_spec *spec = codec->spec;
5504 struct auto_pin_cfg *cfg = &spec->autocfg;
5507 /* search for the input pin; there must be only one */
5508 if (cfg->num_inputs != 1)
5510 i = init_capsrc_for_pin(codec, cfg->inputs[0].pin);
5512 /* use only this ADC */
5513 if (spec->capsrc_nids)
5514 spec->capsrc_nids += i;
5515 spec->adc_nids += i;
5516 spec->num_adc_nids = 1;
5520 /* initialize dual adcs */
5521 static void fixup_dual_adc_switch(struct hda_codec *codec)
5523 struct alc_spec *spec = codec->spec;
5524 init_capsrc_for_pin(codec, spec->ext_mic.pin);
5525 init_capsrc_for_pin(codec, spec->int_mic.pin);
5528 static void set_capture_mixer(struct hda_codec *codec)
5530 struct alc_spec *spec = codec->spec;
5531 static struct snd_kcontrol_new *caps[2][3] = {
5532 { alc_capture_mixer_nosrc1,
5533 alc_capture_mixer_nosrc2,
5534 alc_capture_mixer_nosrc3 },
5535 { alc_capture_mixer1,
5537 alc_capture_mixer3 },
5539 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
5541 int num_adcs = spec->num_adc_nids;
5542 if (spec->dual_adc_switch)
5543 fixup_dual_adc_switch(codec);
5544 else if (spec->auto_mic)
5545 fixup_automic_adc(codec);
5546 else if (spec->input_mux) {
5547 if (spec->input_mux->num_items > 1)
5549 else if (spec->input_mux->num_items == 1)
5550 fixup_single_adc(codec);
5552 if (spec->dual_adc_switch)
5554 spec->cap_mixer = caps[mux][num_adcs - 1];
5558 /* fill adc_nids (and capsrc_nids) containing all active input pins */
5559 static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids,
5562 struct alc_spec *spec = codec->spec;
5563 struct auto_pin_cfg *cfg = &spec->autocfg;
5565 hda_nid_t fallback_adc = 0, fallback_cap = 0;
5567 for (n = 0; n < num_nids; n++) {
5569 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
5573 if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN)
5576 nconns = snd_hda_get_connections(codec, cap, conn,
5580 nconns = snd_hda_get_connections(codec, cap, conn,
5585 if (!fallback_adc) {
5589 for (i = 0; i < cfg->num_inputs; i++) {
5590 hda_nid_t nid = cfg->inputs[i].pin;
5591 for (j = 0; j < nconns; j++) {
5598 if (i >= cfg->num_inputs) {
5599 int num_adcs = spec->num_adc_nids;
5600 spec->private_adc_nids[num_adcs] = adc;
5601 spec->private_capsrc_nids[num_adcs] = cap;
5602 spec->num_adc_nids++;
5603 spec->adc_nids = spec->private_adc_nids;
5605 spec->capsrc_nids = spec->private_capsrc_nids;
5608 if (!spec->num_adc_nids) {
5609 printk(KERN_WARNING "hda_codec: %s: no valid ADC found;"
5610 " using fallback 0x%x\n",
5611 codec->chip_name, fallback_adc);
5612 spec->private_adc_nids[0] = fallback_adc;
5613 spec->adc_nids = spec->private_adc_nids;
5614 if (fallback_adc != fallback_cap) {
5615 spec->private_capsrc_nids[0] = fallback_cap;
5616 spec->capsrc_nids = spec->private_adc_nids;
5621 #ifdef CONFIG_SND_HDA_INPUT_BEEP
5622 #define set_beep_amp(spec, nid, idx, dir) \
5623 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
5625 static struct snd_pci_quirk beep_white_list[] = {
5626 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
5627 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
5628 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
5632 static inline int has_cdefine_beep(struct hda_codec *codec)
5634 struct alc_spec *spec = codec->spec;
5635 const struct snd_pci_quirk *q;
5636 q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list);
5639 return spec->cdefine.enable_pcbeep;
5642 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
5643 #define has_cdefine_beep(codec) 0
5647 * OK, here we have finally the patch for ALC880
5650 static int patch_alc880(struct hda_codec *codec)
5652 struct alc_spec *spec;
5656 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5662 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
5665 if (board_config < 0) {
5666 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
5668 board_config = ALC880_AUTO;
5671 if (board_config == ALC880_AUTO) {
5672 /* automatic parse from the BIOS config */
5673 err = alc880_parse_auto_config(codec);
5679 "hda_codec: Cannot set up configuration "
5680 "from BIOS. Using 3-stack mode...\n");
5681 board_config = ALC880_3ST;
5685 err = snd_hda_attach_beep_device(codec, 0x1);
5691 if (board_config != ALC880_AUTO)
5692 setup_preset(codec, &alc880_presets[board_config]);
5694 spec->stream_analog_playback = &alc880_pcm_analog_playback;
5695 spec->stream_analog_capture = &alc880_pcm_analog_capture;
5696 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
5698 spec->stream_digital_playback = &alc880_pcm_digital_playback;
5699 spec->stream_digital_capture = &alc880_pcm_digital_capture;
5701 if (!spec->adc_nids && spec->input_mux) {
5702 /* check whether NID 0x07 is valid */
5703 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
5705 wcap = get_wcaps_type(wcap);
5706 if (wcap != AC_WID_AUD_IN) {
5707 spec->adc_nids = alc880_adc_nids_alt;
5708 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
5710 spec->adc_nids = alc880_adc_nids;
5711 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
5714 set_capture_mixer(codec);
5715 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
5717 spec->vmaster_nid = 0x0c;
5719 codec->patch_ops = alc_patch_ops;
5720 if (board_config == ALC880_AUTO)
5721 spec->init_hook = alc880_auto_init;
5722 #ifdef CONFIG_SND_HDA_POWER_SAVE
5723 if (!spec->loopback.amplist)
5724 spec->loopback.amplist = alc880_loopbacks;
5735 static hda_nid_t alc260_dac_nids[1] = {
5740 static hda_nid_t alc260_adc_nids[1] = {
5745 static hda_nid_t alc260_adc_nids_alt[1] = {
5750 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
5751 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
5753 static hda_nid_t alc260_dual_adc_nids[2] = {
5758 #define ALC260_DIGOUT_NID 0x03
5759 #define ALC260_DIGIN_NID 0x06
5761 static struct hda_input_mux alc260_capture_source = {
5765 { "Front Mic", 0x1 },
5771 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
5772 * headphone jack and the internal CD lines since these are the only pins at
5773 * which audio can appear. For flexibility, also allow the option of
5774 * recording the mixer output on the second ADC (ADC0 doesn't have a
5775 * connection to the mixer output).
5777 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
5781 { "Mic/Line", 0x0 },
5783 { "Headphone", 0x2 },
5789 { "Mic/Line", 0x0 },
5791 { "Headphone", 0x2 },
5798 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
5799 * the Fujitsu S702x, but jacks are marked differently.
5801 static struct hda_input_mux alc260_acer_capture_sources[2] = {
5808 { "Headphone", 0x5 },
5817 { "Headphone", 0x6 },
5823 /* Maxdata Favorit 100XS */
5824 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
5828 { "Line/Mic", 0x0 },
5835 { "Line/Mic", 0x0 },
5843 * This is just place-holder, so there's something for alc_build_pcms to look
5844 * at when it calculates the maximum number of channels. ALC260 has no mixer
5845 * element which allows changing the channel mode, so the verb list is
5848 static struct hda_channel_mode alc260_modes[1] = {
5853 /* Mixer combinations
5855 * basic: base_output + input + pc_beep + capture
5856 * HP: base_output + input + capture_alt
5857 * HP_3013: hp_3013 + input + capture
5858 * fujitsu: fujitsu + capture
5859 * acer: acer + capture
5862 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
5863 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5864 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5865 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5866 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5867 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5868 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5872 static struct snd_kcontrol_new alc260_input_mixer[] = {
5873 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5874 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5875 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5876 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5877 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5878 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5879 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
5880 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
5884 /* update HP, line and mono out pins according to the master switch */
5885 static void alc260_hp_master_update(struct hda_codec *codec,
5886 hda_nid_t hp, hda_nid_t line,
5889 struct alc_spec *spec = codec->spec;
5890 unsigned int val = spec->master_sw ? PIN_HP : 0;
5891 /* change HP and line-out pins */
5892 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5894 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5896 /* mono (speaker) depending on the HP jack sense */
5897 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5898 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5902 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5903 struct snd_ctl_elem_value *ucontrol)
5905 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5906 struct alc_spec *spec = codec->spec;
5907 *ucontrol->value.integer.value = spec->master_sw;
5911 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
5912 struct snd_ctl_elem_value *ucontrol)
5914 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5915 struct alc_spec *spec = codec->spec;
5916 int val = !!*ucontrol->value.integer.value;
5917 hda_nid_t hp, line, mono;
5919 if (val == spec->master_sw)
5921 spec->master_sw = val;
5922 hp = (kcontrol->private_value >> 16) & 0xff;
5923 line = (kcontrol->private_value >> 8) & 0xff;
5924 mono = kcontrol->private_value & 0xff;
5925 alc260_hp_master_update(codec, hp, line, mono);
5929 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5931 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5932 .name = "Master Playback Switch",
5933 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5934 .info = snd_ctl_boolean_mono_info,
5935 .get = alc260_hp_master_sw_get,
5936 .put = alc260_hp_master_sw_put,
5937 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5939 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5940 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5941 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5942 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5943 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5945 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5949 static struct hda_verb alc260_hp_unsol_verbs[] = {
5950 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5954 static void alc260_hp_automute(struct hda_codec *codec)
5956 struct alc_spec *spec = codec->spec;
5958 spec->jack_present = snd_hda_jack_detect(codec, 0x10);
5959 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5962 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5964 if ((res >> 26) == ALC880_HP_EVENT)
5965 alc260_hp_automute(codec);
5968 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5970 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5971 .name = "Master Playback Switch",
5972 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5973 .info = snd_ctl_boolean_mono_info,
5974 .get = alc260_hp_master_sw_get,
5975 .put = alc260_hp_master_sw_put,
5976 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5978 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5979 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5980 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
5981 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
5982 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5983 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5984 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5985 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
5989 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
5990 .ops = &snd_hda_bind_vol,
5992 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
5993 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
5994 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
5999 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
6000 .ops = &snd_hda_bind_sw,
6002 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
6003 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
6008 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
6009 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
6010 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
6011 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
6012 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
6016 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
6017 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6021 static void alc260_hp_3013_automute(struct hda_codec *codec)
6023 struct alc_spec *spec = codec->spec;
6025 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
6026 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
6029 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
6032 if ((res >> 26) == ALC880_HP_EVENT)
6033 alc260_hp_3013_automute(codec);
6036 static void alc260_hp_3012_automute(struct hda_codec *codec)
6038 unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT;
6040 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6042 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6044 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6048 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
6051 if ((res >> 26) == ALC880_HP_EVENT)
6052 alc260_hp_3012_automute(codec);
6055 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
6056 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
6058 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
6059 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6060 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
6061 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6062 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6063 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6064 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
6065 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
6066 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
6067 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6068 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
6072 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
6073 * versions of the ALC260 don't act on requests to enable mic bias from NID
6074 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
6075 * datasheet doesn't mention this restriction. At this stage it's not clear
6076 * whether this behaviour is intentional or is a hardware bug in chip
6077 * revisions available in early 2006. Therefore for now allow the
6078 * "Headphone Jack Mode" control to span all choices, but if it turns out
6079 * that the lack of mic bias for this NID is intentional we could change the
6080 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6082 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
6083 * don't appear to make the mic bias available from the "line" jack, even
6084 * though the NID used for this jack (0x14) can supply it. The theory is
6085 * that perhaps Acer have included blocking capacitors between the ALC260
6086 * and the output jack. If this turns out to be the case for all such
6087 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
6088 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
6090 * The C20x Tablet series have a mono internal speaker which is controlled
6091 * via the chip's Mono sum widget and pin complex, so include the necessary
6092 * controls for such models. On models without a "mono speaker" the control
6093 * won't do anything.
6095 static struct snd_kcontrol_new alc260_acer_mixer[] = {
6096 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6097 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
6098 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
6099 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
6101 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
6103 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6104 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6105 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6106 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6107 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6108 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
6109 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
6110 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6114 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
6116 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
6117 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6118 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
6119 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
6120 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6121 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6122 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6126 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
6127 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
6129 static struct snd_kcontrol_new alc260_will_mixer[] = {
6130 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6131 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
6132 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6133 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6134 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6135 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
6136 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
6137 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6138 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6139 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6143 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
6144 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
6146 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
6147 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6148 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
6149 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6150 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6151 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6152 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
6153 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
6154 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
6155 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
6156 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6161 * initialization verbs
6163 static struct hda_verb alc260_init_verbs[] = {
6164 /* Line In pin widget for input */
6165 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6166 /* CD pin widget for input */
6167 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6168 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6169 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6170 /* Mic2 (front panel) pin widget for input and vref at 80% */
6171 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6172 /* LINE-2 is used for line-out in rear */
6173 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6174 /* select line-out */
6175 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
6177 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6179 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6181 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6182 /* mute capture amp left and right */
6183 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6184 /* set connection select to line in (default select for this ADC) */
6185 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
6186 /* mute capture amp left and right */
6187 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6188 /* set connection select to line in (default select for this ADC) */
6189 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
6190 /* set vol=0 Line-Out mixer amp left and right */
6191 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6192 /* unmute pin widget amp left and right (no gain on this amp) */
6193 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6194 /* set vol=0 HP mixer amp left and right */
6195 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6196 /* unmute pin widget amp left and right (no gain on this amp) */
6197 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6198 /* set vol=0 Mono mixer amp left and right */
6199 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6200 /* unmute pin widget amp left and right (no gain on this amp) */
6201 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6202 /* unmute LINE-2 out pin */
6203 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6204 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6207 /* mute analog inputs */
6208 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6209 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6210 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6211 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6212 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6213 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6214 /* mute Front out path */
6215 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6216 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6217 /* mute Headphone out path */
6218 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6219 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6220 /* mute Mono out path */
6221 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6222 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6226 #if 0 /* should be identical with alc260_init_verbs? */
6227 static struct hda_verb alc260_hp_init_verbs[] = {
6228 /* Headphone and output */
6229 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
6231 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6232 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6233 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6234 /* Mic2 (front panel) pin widget for input and vref at 80% */
6235 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6236 /* Line In pin widget for input */
6237 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6238 /* Line-2 pin widget for output */
6239 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6240 /* CD pin widget for input */
6241 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6242 /* unmute amp left and right */
6243 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
6244 /* set connection select to line in (default select for this ADC) */
6245 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
6246 /* unmute Line-Out mixer amp left and right (volume = 0) */
6247 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6248 /* mute pin widget amp left and right (no gain on this amp) */
6249 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6250 /* unmute HP mixer amp left and right (volume = 0) */
6251 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6252 /* mute pin widget amp left and right (no gain on this amp) */
6253 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6254 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6257 /* mute analog inputs */
6258 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6259 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6260 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6261 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6262 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6263 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6264 /* Unmute Front out path */
6265 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6266 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6267 /* Unmute Headphone out path */
6268 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6269 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6270 /* Unmute Mono out path */
6271 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6272 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6277 static struct hda_verb alc260_hp_3013_init_verbs[] = {
6278 /* Line out and output */
6279 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6281 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6282 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6283 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6284 /* Mic2 (front panel) pin widget for input and vref at 80% */
6285 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6286 /* Line In pin widget for input */
6287 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6288 /* Headphone pin widget for output */
6289 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
6290 /* CD pin widget for input */
6291 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6292 /* unmute amp left and right */
6293 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
6294 /* set connection select to line in (default select for this ADC) */
6295 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
6296 /* unmute Line-Out mixer amp left and right (volume = 0) */
6297 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6298 /* mute pin widget amp left and right (no gain on this amp) */
6299 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6300 /* unmute HP mixer amp left and right (volume = 0) */
6301 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6302 /* mute pin widget amp left and right (no gain on this amp) */
6303 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6304 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6307 /* mute analog inputs */
6308 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6309 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6310 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6311 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6312 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6313 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6314 /* Unmute Front out path */
6315 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6316 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6317 /* Unmute Headphone out path */
6318 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6319 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6320 /* Unmute Mono out path */
6321 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6322 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6326 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
6327 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
6328 * audio = 0x16, internal speaker = 0x10.
6330 static struct hda_verb alc260_fujitsu_init_verbs[] = {
6331 /* Disable all GPIOs */
6332 {0x01, AC_VERB_SET_GPIO_MASK, 0},
6333 /* Internal speaker is connected to headphone pin */
6334 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6335 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
6336 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6337 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
6338 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6339 /* Ensure all other unused pins are disabled and muted. */
6340 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6341 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6342 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6343 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6344 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6345 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6346 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6347 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6349 /* Disable digital (SPDIF) pins */
6350 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6351 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6353 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
6354 * when acting as an output.
6356 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6358 /* Start with output sum widgets muted and their output gains at min */
6359 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6360 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6361 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6362 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6363 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6364 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6365 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6366 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6367 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6369 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
6370 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6371 /* Unmute Line1 pin widget output buffer since it starts as an output.
6372 * If the pin mode is changed by the user the pin mode control will
6373 * take care of enabling the pin's input/output buffers as needed.
6374 * Therefore there's no need to enable the input buffer at this
6377 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6378 /* Unmute input buffer of pin widget used for Line-in (no equiv
6381 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6383 /* Mute capture amp left and right */
6384 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6385 /* Set ADC connection select to match default mixer setting - line
6388 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6390 /* Do the same for the second ADC: mute capture input amp and
6391 * set ADC connection to line in (on mic1 pin)
6393 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6394 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6396 /* Mute all inputs to mixer widget (even unconnected ones) */
6397 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6398 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6399 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6400 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6401 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6402 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6403 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6404 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6409 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
6410 * similar laptops (adapted from Fujitsu init verbs).
6412 static struct hda_verb alc260_acer_init_verbs[] = {
6413 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
6414 * the headphone jack. Turn this on and rely on the standard mute
6415 * methods whenever the user wants to turn these outputs off.
6417 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6418 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6419 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
6420 /* Internal speaker/Headphone jack is connected to Line-out pin */
6421 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6422 /* Internal microphone/Mic jack is connected to Mic1 pin */
6423 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
6424 /* Line In jack is connected to Line1 pin */
6425 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6426 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
6427 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6428 /* Ensure all other unused pins are disabled and muted. */
6429 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6430 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6431 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6432 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6433 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6434 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6435 /* Disable digital (SPDIF) pins */
6436 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6437 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6439 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6440 * bus when acting as outputs.
6442 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6443 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6445 /* Start with output sum widgets muted and their output gains at min */
6446 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6447 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6448 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6449 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6450 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6451 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6452 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6453 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6454 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6456 /* Unmute Line-out pin widget amp left and right
6457 * (no equiv mixer ctrl)
6459 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6460 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
6461 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6462 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6463 * inputs. If the pin mode is changed by the user the pin mode control
6464 * will take care of enabling the pin's input/output buffers as needed.
6465 * Therefore there's no need to enable the input buffer at this
6468 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6469 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6471 /* Mute capture amp left and right */
6472 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6473 /* Set ADC connection select to match default mixer setting - mic
6476 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6478 /* Do similar with the second ADC: mute capture input amp and
6479 * set ADC connection to mic to match ALSA's default state.
6481 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6482 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6484 /* Mute all inputs to mixer widget (even unconnected ones) */
6485 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6486 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6487 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6488 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6489 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6490 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6491 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6492 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6497 /* Initialisation sequence for Maxdata Favorit 100XS
6498 * (adapted from Acer init verbs).
6500 static struct hda_verb alc260_favorit100_init_verbs[] = {
6501 /* GPIO 0 enables the output jack.
6502 * Turn this on and rely on the standard mute
6503 * methods whenever the user wants to turn these outputs off.
6505 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6506 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6507 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
6508 /* Line/Mic input jack is connected to Mic1 pin */
6509 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
6510 /* Ensure all other unused pins are disabled and muted. */
6511 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6512 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6513 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6514 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6515 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6516 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6517 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6518 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6519 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6520 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6521 /* Disable digital (SPDIF) pins */
6522 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6523 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6525 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6526 * bus when acting as outputs.
6528 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6529 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6531 /* Start with output sum widgets muted and their output gains at min */
6532 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6533 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6534 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6535 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6536 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6537 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6538 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6539 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6540 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6542 /* Unmute Line-out pin widget amp left and right
6543 * (no equiv mixer ctrl)
6545 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6546 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6547 * inputs. If the pin mode is changed by the user the pin mode control
6548 * will take care of enabling the pin's input/output buffers as needed.
6549 * Therefore there's no need to enable the input buffer at this
6552 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6554 /* Mute capture amp left and right */
6555 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6556 /* Set ADC connection select to match default mixer setting - mic
6559 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6561 /* Do similar with the second ADC: mute capture input amp and
6562 * set ADC connection to mic to match ALSA's default state.
6564 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6565 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6567 /* Mute all inputs to mixer widget (even unconnected ones) */
6568 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6569 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6570 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6571 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6572 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6573 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6574 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6575 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6580 static struct hda_verb alc260_will_verbs[] = {
6581 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6582 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
6583 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
6584 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6585 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6586 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
6590 static struct hda_verb alc260_replacer_672v_verbs[] = {
6591 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6592 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6593 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
6595 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6596 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6597 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6599 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6603 /* toggle speaker-output according to the hp-jack state */
6604 static void alc260_replacer_672v_automute(struct hda_codec *codec)
6606 unsigned int present;
6608 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
6609 present = snd_hda_jack_detect(codec, 0x0f);
6611 snd_hda_codec_write_cache(codec, 0x01, 0,
6612 AC_VERB_SET_GPIO_DATA, 1);
6613 snd_hda_codec_write_cache(codec, 0x0f, 0,
6614 AC_VERB_SET_PIN_WIDGET_CONTROL,
6617 snd_hda_codec_write_cache(codec, 0x01, 0,
6618 AC_VERB_SET_GPIO_DATA, 0);
6619 snd_hda_codec_write_cache(codec, 0x0f, 0,
6620 AC_VERB_SET_PIN_WIDGET_CONTROL,
6625 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
6628 if ((res >> 26) == ALC880_HP_EVENT)
6629 alc260_replacer_672v_automute(codec);
6632 static struct hda_verb alc260_hp_dc7600_verbs[] = {
6633 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
6634 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6635 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6636 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6637 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6638 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6639 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6640 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6641 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6642 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6646 /* Test configuration for debugging, modelled after the ALC880 test
6649 #ifdef CONFIG_SND_DEBUG
6650 static hda_nid_t alc260_test_dac_nids[1] = {
6653 static hda_nid_t alc260_test_adc_nids[2] = {
6656 /* For testing the ALC260, each input MUX needs its own definition since
6657 * the signal assignments are different. This assumes that the first ADC
6660 static struct hda_input_mux alc260_test_capture_sources[2] = {
6664 { "MIC1 pin", 0x0 },
6665 { "MIC2 pin", 0x1 },
6666 { "LINE1 pin", 0x2 },
6667 { "LINE2 pin", 0x3 },
6669 { "LINE-OUT pin", 0x5 },
6670 { "HP-OUT pin", 0x6 },
6676 { "MIC1 pin", 0x0 },
6677 { "MIC2 pin", 0x1 },
6678 { "LINE1 pin", 0x2 },
6679 { "LINE2 pin", 0x3 },
6682 { "LINE-OUT pin", 0x6 },
6683 { "HP-OUT pin", 0x7 },
6687 static struct snd_kcontrol_new alc260_test_mixer[] = {
6688 /* Output driver widgets */
6689 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
6690 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
6691 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6692 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
6693 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6694 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
6696 /* Modes for retasking pin widgets
6697 * Note: the ALC260 doesn't seem to act on requests to enable mic
6698 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
6699 * mention this restriction. At this stage it's not clear whether
6700 * this behaviour is intentional or is a hardware bug in chip
6701 * revisions available at least up until early 2006. Therefore for
6702 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
6703 * choices, but if it turns out that the lack of mic bias for these
6704 * NIDs is intentional we could change their modes from
6705 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6707 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
6708 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
6709 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
6710 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
6711 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
6712 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
6714 /* Loopback mixer controls */
6715 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
6716 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
6717 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
6718 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
6719 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
6720 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
6721 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
6722 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
6723 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6724 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6725 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
6726 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
6727 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
6728 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
6730 /* Controls for GPIO pins, assuming they are configured as outputs */
6731 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
6732 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
6733 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
6734 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
6736 /* Switches to allow the digital IO pins to be enabled. The datasheet
6737 * is ambigious as to which NID is which; testing on laptops which
6738 * make this output available should provide clarification.
6740 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
6741 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
6743 /* A switch allowing EAPD to be enabled. Some laptops seem to use
6744 * this output to turn on an external amplifier.
6746 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
6747 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
6751 static struct hda_verb alc260_test_init_verbs[] = {
6752 /* Enable all GPIOs as outputs with an initial value of 0 */
6753 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
6754 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6755 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
6757 /* Enable retasking pins as output, initially without power amp */
6758 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6759 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6760 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6761 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6762 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6763 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6765 /* Disable digital (SPDIF) pins initially, but users can enable
6766 * them via a mixer switch. In the case of SPDIF-out, this initverb
6767 * payload also sets the generation to 0, output to be in "consumer"
6768 * PCM format, copyright asserted, no pre-emphasis and no validity
6771 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6772 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6774 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
6775 * OUT1 sum bus when acting as an output.
6777 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6778 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
6779 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6780 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
6782 /* Start with output sum widgets muted and their output gains at min */
6783 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6784 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6785 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6786 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6787 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6788 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6789 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6790 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6791 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6793 /* Unmute retasking pin widget output buffers since the default
6794 * state appears to be output. As the pin mode is changed by the
6795 * user the pin mode control will take care of enabling the pin's
6796 * input/output buffers as needed.
6798 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6799 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6800 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6801 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6802 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6803 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6804 /* Also unmute the mono-out pin widget */
6805 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6807 /* Mute capture amp left and right */
6808 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6809 /* Set ADC connection select to match default mixer setting (mic1
6812 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6814 /* Do the same for the second ADC: mute capture input amp and
6815 * set ADC connection to mic1 pin
6817 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6818 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6820 /* Mute all inputs to mixer widget (even unconnected ones) */
6821 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6822 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6823 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6824 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6825 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6826 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6827 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6828 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6834 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
6835 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
6837 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
6838 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
6841 * for BIOS auto-configuration
6844 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
6845 const char *pfx, int *vol_bits)
6848 unsigned long vol_val, sw_val;
6851 if (nid >= 0x0f && nid < 0x11) {
6852 nid_vol = nid - 0x7;
6853 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6854 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6855 } else if (nid == 0x11) {
6856 nid_vol = nid - 0x7;
6857 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
6858 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
6859 } else if (nid >= 0x12 && nid <= 0x15) {
6861 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6862 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6866 if (!(*vol_bits & (1 << nid_vol))) {
6867 /* first control for the volume widget */
6868 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val);
6871 *vol_bits |= (1 << nid_vol);
6873 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val);
6879 /* add playback controls from the parsed DAC table */
6880 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6881 const struct auto_pin_cfg *cfg)
6887 spec->multiout.num_dacs = 1;
6888 spec->multiout.dac_nids = spec->private_dac_nids;
6889 spec->multiout.dac_nids[0] = 0x02;
6891 nid = cfg->line_out_pins[0];
6894 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6896 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6900 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6905 nid = cfg->speaker_pins[0];
6907 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6912 nid = cfg->hp_pins[0];
6914 err = alc260_add_playback_controls(spec, nid, "Headphone",
6922 /* create playback/capture controls for input pins */
6923 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6924 const struct auto_pin_cfg *cfg)
6926 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
6929 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6930 hda_nid_t nid, int pin_type,
6933 alc_set_pin_output(codec, nid, pin_type);
6934 /* need the manual connection? */
6936 int idx = nid - 0x12;
6937 snd_hda_codec_write(codec, idx + 0x0b, 0,
6938 AC_VERB_SET_CONNECT_SEL, sel_idx);
6942 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6944 struct alc_spec *spec = codec->spec;
6947 nid = spec->autocfg.line_out_pins[0];
6949 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6950 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6953 nid = spec->autocfg.speaker_pins[0];
6955 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6957 nid = spec->autocfg.hp_pins[0];
6959 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6962 #define ALC260_PIN_CD_NID 0x16
6963 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6965 struct alc_spec *spec = codec->spec;
6966 struct auto_pin_cfg *cfg = &spec->autocfg;
6969 for (i = 0; i < cfg->num_inputs; i++) {
6970 hda_nid_t nid = cfg->inputs[i].pin;
6972 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
6973 if (nid != ALC260_PIN_CD_NID &&
6974 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6975 snd_hda_codec_write(codec, nid, 0,
6976 AC_VERB_SET_AMP_GAIN_MUTE,
6982 #define alc260_auto_init_input_src alc880_auto_init_input_src
6985 * generic initialization of ADC, input mixers and output mixers
6987 static struct hda_verb alc260_volume_init_verbs[] = {
6989 * Unmute ADC0-1 and set the default input to mic-in
6991 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6992 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6993 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6994 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6996 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6998 * Note: PASD motherboards uses the Line In 2 as the input for
6999 * front panel mic (mic 2)
7001 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7002 /* mute analog inputs */
7003 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7004 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7005 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7006 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7007 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7010 * Set up output mixers (0x08 - 0x0a)
7012 /* set vol=0 to output mixers */
7013 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7014 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7015 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7016 /* set up input amps for analog loopback */
7017 /* Amp Indices: DAC = 0, mixer = 1 */
7018 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7019 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7020 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7021 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7022 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7023 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7028 static int alc260_parse_auto_config(struct hda_codec *codec)
7030 struct alc_spec *spec = codec->spec;
7032 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
7034 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
7038 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
7041 if (!spec->kctls.list)
7042 return 0; /* can't find valid BIOS pin config */
7043 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
7047 spec->multiout.max_channels = 2;
7049 if (spec->autocfg.dig_outs)
7050 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
7051 if (spec->kctls.list)
7052 add_mixer(spec, spec->kctls.list);
7054 add_verb(spec, alc260_volume_init_verbs);
7056 spec->num_mux_defs = 1;
7057 spec->input_mux = &spec->private_imux[0];
7059 alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0);
7064 /* additional initialization for auto-configuration model */
7065 static void alc260_auto_init(struct hda_codec *codec)
7067 struct alc_spec *spec = codec->spec;
7068 alc260_auto_init_multi_out(codec);
7069 alc260_auto_init_analog_input(codec);
7070 alc260_auto_init_input_src(codec);
7071 alc_auto_init_digital(codec);
7072 if (spec->unsol_event)
7073 alc_inithook(codec);
7076 #ifdef CONFIG_SND_HDA_POWER_SAVE
7077 static struct hda_amp_list alc260_loopbacks[] = {
7078 { 0x07, HDA_INPUT, 0 },
7079 { 0x07, HDA_INPUT, 1 },
7080 { 0x07, HDA_INPUT, 2 },
7081 { 0x07, HDA_INPUT, 3 },
7082 { 0x07, HDA_INPUT, 4 },
7094 static const struct alc_fixup alc260_fixups[] = {
7095 [PINFIX_HP_DC5750] = {
7096 .type = ALC_FIXUP_PINS,
7097 .v.pins = (const struct alc_pincfg[]) {
7098 { 0x11, 0x90130110 }, /* speaker */
7104 static struct snd_pci_quirk alc260_fixup_tbl[] = {
7105 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", PINFIX_HP_DC5750),
7110 * ALC260 configurations
7112 static const char * const alc260_models[ALC260_MODEL_LAST] = {
7113 [ALC260_BASIC] = "basic",
7115 [ALC260_HP_3013] = "hp-3013",
7116 [ALC260_HP_DC7600] = "hp-dc7600",
7117 [ALC260_FUJITSU_S702X] = "fujitsu",
7118 [ALC260_ACER] = "acer",
7119 [ALC260_WILL] = "will",
7120 [ALC260_REPLACER_672V] = "replacer",
7121 [ALC260_FAVORIT100] = "favorit100",
7122 #ifdef CONFIG_SND_DEBUG
7123 [ALC260_TEST] = "test",
7125 [ALC260_AUTO] = "auto",
7128 static struct snd_pci_quirk alc260_cfg_tbl[] = {
7129 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
7130 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
7131 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
7132 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
7133 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
7134 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */
7135 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
7136 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
7137 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
7138 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
7139 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
7140 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
7141 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
7142 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
7143 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
7144 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
7145 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
7146 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
7147 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
7148 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
7152 static struct alc_config_preset alc260_presets[] = {
7154 .mixers = { alc260_base_output_mixer,
7155 alc260_input_mixer },
7156 .init_verbs = { alc260_init_verbs },
7157 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7158 .dac_nids = alc260_dac_nids,
7159 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7160 .adc_nids = alc260_dual_adc_nids,
7161 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7162 .channel_mode = alc260_modes,
7163 .input_mux = &alc260_capture_source,
7166 .mixers = { alc260_hp_output_mixer,
7167 alc260_input_mixer },
7168 .init_verbs = { alc260_init_verbs,
7169 alc260_hp_unsol_verbs },
7170 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7171 .dac_nids = alc260_dac_nids,
7172 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
7173 .adc_nids = alc260_adc_nids_alt,
7174 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7175 .channel_mode = alc260_modes,
7176 .input_mux = &alc260_capture_source,
7177 .unsol_event = alc260_hp_unsol_event,
7178 .init_hook = alc260_hp_automute,
7180 [ALC260_HP_DC7600] = {
7181 .mixers = { alc260_hp_dc7600_mixer,
7182 alc260_input_mixer },
7183 .init_verbs = { alc260_init_verbs,
7184 alc260_hp_dc7600_verbs },
7185 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7186 .dac_nids = alc260_dac_nids,
7187 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
7188 .adc_nids = alc260_adc_nids_alt,
7189 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7190 .channel_mode = alc260_modes,
7191 .input_mux = &alc260_capture_source,
7192 .unsol_event = alc260_hp_3012_unsol_event,
7193 .init_hook = alc260_hp_3012_automute,
7195 [ALC260_HP_3013] = {
7196 .mixers = { alc260_hp_3013_mixer,
7197 alc260_input_mixer },
7198 .init_verbs = { alc260_hp_3013_init_verbs,
7199 alc260_hp_3013_unsol_verbs },
7200 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7201 .dac_nids = alc260_dac_nids,
7202 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
7203 .adc_nids = alc260_adc_nids_alt,
7204 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7205 .channel_mode = alc260_modes,
7206 .input_mux = &alc260_capture_source,
7207 .unsol_event = alc260_hp_3013_unsol_event,
7208 .init_hook = alc260_hp_3013_automute,
7210 [ALC260_FUJITSU_S702X] = {
7211 .mixers = { alc260_fujitsu_mixer },
7212 .init_verbs = { alc260_fujitsu_init_verbs },
7213 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7214 .dac_nids = alc260_dac_nids,
7215 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7216 .adc_nids = alc260_dual_adc_nids,
7217 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7218 .channel_mode = alc260_modes,
7219 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
7220 .input_mux = alc260_fujitsu_capture_sources,
7223 .mixers = { alc260_acer_mixer },
7224 .init_verbs = { alc260_acer_init_verbs },
7225 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7226 .dac_nids = alc260_dac_nids,
7227 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7228 .adc_nids = alc260_dual_adc_nids,
7229 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7230 .channel_mode = alc260_modes,
7231 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
7232 .input_mux = alc260_acer_capture_sources,
7234 [ALC260_FAVORIT100] = {
7235 .mixers = { alc260_favorit100_mixer },
7236 .init_verbs = { alc260_favorit100_init_verbs },
7237 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7238 .dac_nids = alc260_dac_nids,
7239 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7240 .adc_nids = alc260_dual_adc_nids,
7241 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7242 .channel_mode = alc260_modes,
7243 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
7244 .input_mux = alc260_favorit100_capture_sources,
7247 .mixers = { alc260_will_mixer },
7248 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
7249 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7250 .dac_nids = alc260_dac_nids,
7251 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
7252 .adc_nids = alc260_adc_nids,
7253 .dig_out_nid = ALC260_DIGOUT_NID,
7254 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7255 .channel_mode = alc260_modes,
7256 .input_mux = &alc260_capture_source,
7258 [ALC260_REPLACER_672V] = {
7259 .mixers = { alc260_replacer_672v_mixer },
7260 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
7261 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7262 .dac_nids = alc260_dac_nids,
7263 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
7264 .adc_nids = alc260_adc_nids,
7265 .dig_out_nid = ALC260_DIGOUT_NID,
7266 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7267 .channel_mode = alc260_modes,
7268 .input_mux = &alc260_capture_source,
7269 .unsol_event = alc260_replacer_672v_unsol_event,
7270 .init_hook = alc260_replacer_672v_automute,
7272 #ifdef CONFIG_SND_DEBUG
7274 .mixers = { alc260_test_mixer },
7275 .init_verbs = { alc260_test_init_verbs },
7276 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
7277 .dac_nids = alc260_test_dac_nids,
7278 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
7279 .adc_nids = alc260_test_adc_nids,
7280 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7281 .channel_mode = alc260_modes,
7282 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
7283 .input_mux = alc260_test_capture_sources,
7288 static int patch_alc260(struct hda_codec *codec)
7290 struct alc_spec *spec;
7291 int err, board_config;
7293 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
7299 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
7302 if (board_config < 0) {
7303 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
7305 board_config = ALC260_AUTO;
7308 if (board_config == ALC260_AUTO) {
7309 alc_pick_fixup(codec, NULL, alc260_fixup_tbl, alc260_fixups);
7310 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
7313 if (board_config == ALC260_AUTO) {
7314 /* automatic parse from the BIOS config */
7315 err = alc260_parse_auto_config(codec);
7321 "hda_codec: Cannot set up configuration "
7322 "from BIOS. Using base mode...\n");
7323 board_config = ALC260_BASIC;
7327 err = snd_hda_attach_beep_device(codec, 0x1);
7333 if (board_config != ALC260_AUTO)
7334 setup_preset(codec, &alc260_presets[board_config]);
7336 spec->stream_analog_playback = &alc260_pcm_analog_playback;
7337 spec->stream_analog_capture = &alc260_pcm_analog_capture;
7338 spec->stream_analog_alt_capture = &alc260_pcm_analog_capture;
7340 spec->stream_digital_playback = &alc260_pcm_digital_playback;
7341 spec->stream_digital_capture = &alc260_pcm_digital_capture;
7343 if (!spec->adc_nids && spec->input_mux) {
7344 /* check whether NID 0x04 is valid */
7345 unsigned int wcap = get_wcaps(codec, 0x04);
7346 wcap = get_wcaps_type(wcap);
7348 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
7349 spec->adc_nids = alc260_adc_nids_alt;
7350 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
7352 spec->adc_nids = alc260_adc_nids;
7353 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
7356 set_capture_mixer(codec);
7357 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
7359 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
7361 spec->vmaster_nid = 0x08;
7363 codec->patch_ops = alc_patch_ops;
7364 if (board_config == ALC260_AUTO)
7365 spec->init_hook = alc260_auto_init;
7366 #ifdef CONFIG_SND_HDA_POWER_SAVE
7367 if (!spec->loopback.amplist)
7368 spec->loopback.amplist = alc260_loopbacks;
7376 * ALC882/883/885/888/889 support
7378 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
7379 * configuration. Each pin widget can choose any input DACs and a mixer.
7380 * Each ADC is connected from a mixer of all inputs. This makes possible
7381 * 6-channel independent captures.
7383 * In addition, an independent DAC for the multi-playback (not used in this
7386 #define ALC882_DIGOUT_NID 0x06
7387 #define ALC882_DIGIN_NID 0x0a
7388 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
7389 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
7390 #define ALC1200_DIGOUT_NID 0x10
7393 static struct hda_channel_mode alc882_ch_modes[1] = {
7398 static hda_nid_t alc882_dac_nids[4] = {
7399 /* front, rear, clfe, rear_surr */
7400 0x02, 0x03, 0x04, 0x05
7402 #define alc883_dac_nids alc882_dac_nids
7405 #define alc882_adc_nids alc880_adc_nids
7406 #define alc882_adc_nids_alt alc880_adc_nids_alt
7407 #define alc883_adc_nids alc882_adc_nids_alt
7408 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
7409 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
7410 #define alc889_adc_nids alc880_adc_nids
7412 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
7413 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
7414 #define alc883_capsrc_nids alc882_capsrc_nids_alt
7415 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
7416 #define alc889_capsrc_nids alc882_capsrc_nids
7419 /* FIXME: should be a matrix-type input source selection */
7421 static struct hda_input_mux alc882_capture_source = {
7425 { "Front Mic", 0x1 },
7431 #define alc883_capture_source alc882_capture_source
7433 static struct hda_input_mux alc889_capture_source = {
7436 { "Front Mic", 0x0 },
7442 static struct hda_input_mux mb5_capture_source = {
7451 static struct hda_input_mux macmini3_capture_source = {
7459 static struct hda_input_mux alc883_3stack_6ch_intel = {
7463 { "Front Mic", 0x0 },
7469 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
7477 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
7481 { "Internal Mic", 0x1 },
7487 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
7491 { "Internal Mic", 0x1 },
7495 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
7499 { "Front Mic", 0x1 },
7504 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
7512 static struct hda_input_mux alc889A_mb31_capture_source = {
7516 /* Front Mic (0x01) unused */
7518 /* Line 2 (0x03) unused */
7519 /* CD (0x04) unused? */
7523 static struct hda_input_mux alc889A_imac91_capture_source = {
7527 { "Line", 0x2 }, /* Not sure! */
7534 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
7541 static struct hda_verb alc882_3ST_ch2_init[] = {
7542 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7543 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7544 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7545 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7552 static struct hda_verb alc882_3ST_ch4_init[] = {
7553 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7554 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7555 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7556 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7557 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7564 static struct hda_verb alc882_3ST_ch6_init[] = {
7565 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7566 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7567 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7568 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7569 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7570 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7574 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
7575 { 2, alc882_3ST_ch2_init },
7576 { 4, alc882_3ST_ch4_init },
7577 { 6, alc882_3ST_ch6_init },
7580 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
7585 static struct hda_verb alc883_3ST_ch2_clevo_init[] = {
7586 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
7587 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7588 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7589 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7590 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7597 static struct hda_verb alc883_3ST_ch4_clevo_init[] = {
7598 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7599 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7600 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7601 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7602 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7603 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7610 static struct hda_verb alc883_3ST_ch6_clevo_init[] = {
7611 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7612 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7613 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7614 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7615 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7616 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7617 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7621 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
7622 { 2, alc883_3ST_ch2_clevo_init },
7623 { 4, alc883_3ST_ch4_clevo_init },
7624 { 6, alc883_3ST_ch6_clevo_init },
7631 static struct hda_verb alc882_sixstack_ch6_init[] = {
7632 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7633 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7634 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7635 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7642 static struct hda_verb alc882_sixstack_ch8_init[] = {
7643 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7644 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7645 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7646 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7650 static struct hda_channel_mode alc882_sixstack_modes[2] = {
7651 { 6, alc882_sixstack_ch6_init },
7652 { 8, alc882_sixstack_ch8_init },
7656 /* Macbook Air 2,1 */
7658 static struct hda_channel_mode alc885_mba21_ch_modes[1] = {
7663 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
7669 static struct hda_verb alc885_mbp_ch2_init[] = {
7670 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7671 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7672 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7679 static struct hda_verb alc885_mbp_ch4_init[] = {
7680 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7681 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7682 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7683 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7684 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7688 static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
7689 { 2, alc885_mbp_ch2_init },
7690 { 4, alc885_mbp_ch4_init },
7695 * Speakers/Woofer/HP = Front
7698 static struct hda_verb alc885_mb5_ch2_init[] = {
7699 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7700 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7706 * Speakers/HP = Front
7710 static struct hda_verb alc885_mb5_ch6_init[] = {
7711 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7712 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7713 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7717 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
7718 { 2, alc885_mb5_ch2_init },
7719 { 6, alc885_mb5_ch6_init },
7722 #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes
7727 static struct hda_verb alc883_4ST_ch2_init[] = {
7728 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7729 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7730 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7731 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7732 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7733 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7740 static struct hda_verb alc883_4ST_ch4_init[] = {
7741 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7742 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7743 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7744 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7745 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7746 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7747 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7754 static struct hda_verb alc883_4ST_ch6_init[] = {
7755 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7756 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7757 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7758 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7759 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7760 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7761 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7762 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7769 static struct hda_verb alc883_4ST_ch8_init[] = {
7770 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7771 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7772 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7773 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7774 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7775 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7776 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7777 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7778 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7782 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
7783 { 2, alc883_4ST_ch2_init },
7784 { 4, alc883_4ST_ch4_init },
7785 { 6, alc883_4ST_ch6_init },
7786 { 8, alc883_4ST_ch8_init },
7793 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7794 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7795 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7796 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7797 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7804 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7805 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7806 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7807 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7808 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7809 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7816 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7817 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7818 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7819 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7820 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7821 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7822 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7826 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7827 { 2, alc883_3ST_ch2_intel_init },
7828 { 4, alc883_3ST_ch4_intel_init },
7829 { 6, alc883_3ST_ch6_intel_init },
7835 static struct hda_verb alc889_ch2_intel_init[] = {
7836 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7837 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
7838 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
7839 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
7840 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7841 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7848 static struct hda_verb alc889_ch6_intel_init[] = {
7849 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7850 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7851 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7852 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7853 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7854 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7861 static struct hda_verb alc889_ch8_intel_init[] = {
7862 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7863 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7864 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7865 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7866 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
7867 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7868 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7872 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
7873 { 2, alc889_ch2_intel_init },
7874 { 6, alc889_ch6_intel_init },
7875 { 8, alc889_ch8_intel_init },
7881 static struct hda_verb alc883_sixstack_ch6_init[] = {
7882 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7883 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7884 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7885 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7892 static struct hda_verb alc883_sixstack_ch8_init[] = {
7893 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7894 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7895 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7896 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7900 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7901 { 6, alc883_sixstack_ch6_init },
7902 { 8, alc883_sixstack_ch8_init },
7906 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7907 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7909 static struct snd_kcontrol_new alc882_base_mixer[] = {
7910 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7911 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7912 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7913 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7914 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7915 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7916 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7917 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7918 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7919 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7920 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7921 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7922 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7923 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7924 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7925 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7926 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
7927 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7928 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7929 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
7930 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7934 /* Macbook Air 2,1 same control for HP and internal Speaker */
7936 static struct snd_kcontrol_new alc885_mba21_mixer[] = {
7937 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7938 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT),
7943 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
7944 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7945 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7946 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7947 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
7948 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7949 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7950 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7951 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7952 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7953 HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT),
7954 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT),
7958 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7959 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7960 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7961 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7962 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7963 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7964 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7965 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7966 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7967 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
7968 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
7969 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7970 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7971 HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT),
7972 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0x00, HDA_INPUT),
7976 static struct snd_kcontrol_new alc885_macmini3_mixer[] = {
7977 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7978 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7979 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7980 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7981 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7982 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7983 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7984 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7985 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
7986 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
7987 HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT),
7991 static struct snd_kcontrol_new alc885_imac91_mixer[] = {
7992 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7993 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7998 static struct snd_kcontrol_new alc882_w2jc_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("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8002 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8003 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8004 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8005 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8006 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8007 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8011 static struct snd_kcontrol_new alc882_targa_mixer[] = {
8012 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8013 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8014 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8015 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8016 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8017 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8018 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8019 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8020 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8021 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8022 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8023 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8024 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
8028 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
8029 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
8031 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
8032 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8033 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8034 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8035 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
8036 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8037 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
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("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
8041 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
8042 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8043 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8044 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8048 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
8049 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8050 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8051 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8052 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8053 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8054 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8055 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8056 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8057 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8058 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8062 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
8064 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8065 .name = "Channel Mode",
8066 .info = alc_ch_mode_info,
8067 .get = alc_ch_mode_get,
8068 .put = alc_ch_mode_put,
8073 static struct hda_verb alc882_base_init_verbs[] = {
8074 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8075 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8076 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8078 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8079 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8081 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8082 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8084 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8085 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8087 /* Front Pin: output 0 (0x0c) */
8088 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8089 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8090 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8091 /* Rear Pin: output 1 (0x0d) */
8092 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8093 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8094 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8095 /* CLFE Pin: output 2 (0x0e) */
8096 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8097 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8098 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
8099 /* Side Pin: output 3 (0x0f) */
8100 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8101 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8102 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8103 /* Mic (rear) pin: input vref at 80% */
8104 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8105 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8106 /* Front Mic pin: input vref at 80% */
8107 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8108 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8109 /* Line In pin: input */
8110 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8111 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8112 /* Line-2 In: Headphone output (output 0 - 0x0c) */
8113 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8114 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8115 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8116 /* CD pin widget for input */
8117 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8119 /* FIXME: use matrix-type input source selection */
8120 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8122 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8124 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8125 /* ADC2: mute amp left and right */
8126 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8127 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8128 /* ADC3: mute amp left and right */
8129 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8130 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8135 static struct hda_verb alc882_adc1_init_verbs[] = {
8136 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8137 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8138 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8139 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8140 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8141 /* ADC1: mute amp left and right */
8142 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8143 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8147 static struct hda_verb alc882_eapd_verbs[] = {
8148 /* change to EAPD mode */
8149 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8150 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
8154 static struct hda_verb alc889_eapd_verbs[] = {
8155 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
8156 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
8160 static struct hda_verb alc_hp15_unsol_verbs[] = {
8161 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8162 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8166 static struct hda_verb alc885_init_verbs[] = {
8167 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8168 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8169 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8171 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8172 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8174 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8175 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8177 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8178 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8180 /* Front HP Pin: output 0 (0x0c) */
8181 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8182 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8183 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8184 /* Front Pin: output 0 (0x0c) */
8185 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8186 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8187 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8188 /* Rear Pin: output 1 (0x0d) */
8189 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8190 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8191 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
8192 /* CLFE Pin: output 2 (0x0e) */
8193 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8194 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8195 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
8196 /* Side Pin: output 3 (0x0f) */
8197 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8198 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8199 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8200 /* Mic (rear) pin: input vref at 80% */
8201 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8202 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8203 /* Front Mic pin: input vref at 80% */
8204 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8205 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8206 /* Line In pin: input */
8207 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8208 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8210 /* Mixer elements: 0x18, , 0x1a, 0x1b */
8212 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8214 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8216 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8217 /* ADC2: mute amp left and right */
8218 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8219 /* ADC3: mute amp left and right */
8220 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8225 static struct hda_verb alc885_init_input_verbs[] = {
8226 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8227 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8228 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
8233 /* Unmute Selector 24h and set the default input to front mic */
8234 static struct hda_verb alc889_init_input_verbs[] = {
8235 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
8236 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8241 #define alc883_init_verbs alc882_base_init_verbs
8244 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
8245 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8246 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8247 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
8248 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
8249 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
8250 /* FIXME: this looks suspicious...
8251 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
8252 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
8257 static struct hda_verb alc882_macpro_init_verbs[] = {
8258 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8259 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8260 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8261 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8262 /* Front Pin: output 0 (0x0c) */
8263 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8264 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8265 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8266 /* Front Mic pin: input vref at 80% */
8267 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8268 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8269 /* Speaker: output */
8270 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8271 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8272 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
8273 /* Headphone output (output 0 - 0x0c) */
8274 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8275 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8276 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8278 /* FIXME: use matrix-type input source selection */
8279 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8280 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8281 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8282 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8283 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8284 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8286 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8287 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8288 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8289 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8291 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8292 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8293 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8294 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8295 /* ADC1: mute amp left and right */
8296 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8297 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8298 /* ADC2: mute amp left and right */
8299 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8300 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8301 /* ADC3: mute amp left and right */
8302 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8303 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8309 static struct hda_verb alc885_mb5_init_verbs[] = {
8311 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8312 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8313 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8314 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8316 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8317 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8318 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8319 /* Surround mixer */
8320 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8321 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8322 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8324 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8325 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8326 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8328 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8329 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8330 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8331 /* Front Pin (0x0c) */
8332 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8333 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8334 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8335 /* LFE Pin (0x0e) */
8336 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8337 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8338 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
8340 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8341 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8342 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
8343 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8344 /* Front Mic pin: input vref at 80% */
8345 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8346 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8348 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8349 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8351 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)},
8352 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)},
8353 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)},
8358 static struct hda_verb alc885_macmini3_init_verbs[] = {
8360 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8361 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8362 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8363 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8365 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8366 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8367 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8368 /* Surround mixer */
8369 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8370 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8371 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8373 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8374 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8375 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8377 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8378 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8379 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8380 /* Front Pin (0x0c) */
8381 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8382 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8383 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8384 /* LFE Pin (0x0e) */
8385 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8386 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8387 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
8389 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8390 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8391 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
8392 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8394 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8395 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8397 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8398 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8399 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8400 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8405 static struct hda_verb alc885_mba21_init_verbs[] = {
8406 /*Internal and HP Speaker Mixer*/
8407 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8408 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8409 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8410 /*Internal Speaker Pin (0x0c)*/
8411 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8412 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8413 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8414 /* HP Pin: output 0 (0x0e) */
8415 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
8416 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8417 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8418 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
8419 /* Line in (is hp when jack connected)*/
8420 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
8421 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8427 /* Macbook Pro rev3 */
8428 static struct hda_verb alc885_mbp3_init_verbs[] = {
8429 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8430 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8431 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8432 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8434 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8435 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8436 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8438 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8439 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8440 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8441 /* Front Pin: output 0 (0x0c) */
8442 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8443 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8444 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8445 /* HP Pin: output 0 (0x0e) */
8446 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
8447 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8448 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
8449 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8450 /* Mic (rear) pin: input vref at 80% */
8451 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8452 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8453 /* Front Mic pin: input vref at 80% */
8454 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8455 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8456 /* Line In pin: use output 1 when in LineOut mode */
8457 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8458 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8459 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8461 /* FIXME: use matrix-type input source selection */
8462 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8463 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8464 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8465 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8466 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8467 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8469 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8470 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8471 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8472 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8474 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8475 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8476 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8477 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8478 /* ADC1: mute amp left and right */
8479 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8480 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8481 /* ADC2: mute amp left and right */
8482 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8483 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8484 /* ADC3: mute amp left and right */
8485 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8486 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8492 static struct hda_verb alc885_imac91_init_verbs[] = {
8493 /* Internal Speaker Pin (0x0c) */
8494 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8495 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8496 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8497 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8498 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8499 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8501 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8502 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8503 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8504 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
8506 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
8507 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8508 /* Front Mic pin: input vref at 80% */
8509 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8510 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8512 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8513 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8514 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8515 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
8516 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8517 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8518 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8519 /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8520 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8521 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8522 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8523 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8524 /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8525 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8526 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8527 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8528 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8529 /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8530 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8531 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8532 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8533 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8534 /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8535 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8536 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8537 /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8538 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8539 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8540 /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8541 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8542 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8546 /* iMac 24 mixer. */
8547 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
8548 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8549 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
8553 /* iMac 24 init verbs. */
8554 static struct hda_verb alc885_imac24_init_verbs[] = {
8555 /* Internal speakers: output 0 (0x0c) */
8556 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8557 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8558 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8559 /* Internal speakers: output 0 (0x0c) */
8560 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8561 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8562 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8563 /* Headphone: output 0 (0x0c) */
8564 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8565 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8566 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8567 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8568 /* Front Mic: input vref at 80% */
8569 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8570 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8574 /* Toggle speaker-output according to the hp-jack state */
8575 static void alc885_imac24_setup(struct hda_codec *codec)
8577 struct alc_spec *spec = codec->spec;
8579 spec->autocfg.hp_pins[0] = 0x14;
8580 spec->autocfg.speaker_pins[0] = 0x18;
8581 spec->autocfg.speaker_pins[1] = 0x1a;
8584 #define alc885_mb5_setup alc885_imac24_setup
8585 #define alc885_macmini3_setup alc885_imac24_setup
8587 /* Macbook Air 2,1 */
8588 static void alc885_mba21_setup(struct hda_codec *codec)
8590 struct alc_spec *spec = codec->spec;
8592 spec->autocfg.hp_pins[0] = 0x14;
8593 spec->autocfg.speaker_pins[0] = 0x18;
8598 static void alc885_mbp3_setup(struct hda_codec *codec)
8600 struct alc_spec *spec = codec->spec;
8602 spec->autocfg.hp_pins[0] = 0x15;
8603 spec->autocfg.speaker_pins[0] = 0x14;
8606 static void alc885_imac91_setup(struct hda_codec *codec)
8608 struct alc_spec *spec = codec->spec;
8610 spec->autocfg.hp_pins[0] = 0x14;
8611 spec->autocfg.speaker_pins[0] = 0x18;
8612 spec->autocfg.speaker_pins[1] = 0x1a;
8615 static struct hda_verb alc882_targa_verbs[] = {
8616 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8617 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8619 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8620 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8622 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8623 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8624 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8626 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8630 /* toggle speaker-output according to the hp-jack state */
8631 static void alc882_targa_automute(struct hda_codec *codec)
8633 struct alc_spec *spec = codec->spec;
8634 alc_automute_amp(codec);
8635 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
8636 spec->jack_present ? 1 : 3);
8639 static void alc882_targa_setup(struct hda_codec *codec)
8641 struct alc_spec *spec = codec->spec;
8643 spec->autocfg.hp_pins[0] = 0x14;
8644 spec->autocfg.speaker_pins[0] = 0x1b;
8647 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
8649 if ((res >> 26) == ALC880_HP_EVENT)
8650 alc882_targa_automute(codec);
8653 static struct hda_verb alc882_asus_a7j_verbs[] = {
8654 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8655 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8657 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8658 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8659 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8661 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8662 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8663 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8665 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8666 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8667 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8671 static struct hda_verb alc882_asus_a7m_verbs[] = {
8672 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8673 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8675 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8676 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8677 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8679 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8680 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8681 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8683 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8684 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8685 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8689 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
8691 unsigned int gpiostate, gpiomask, gpiodir;
8693 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
8694 AC_VERB_GET_GPIO_DATA, 0);
8697 gpiostate |= (1 << pin);
8699 gpiostate &= ~(1 << pin);
8701 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
8702 AC_VERB_GET_GPIO_MASK, 0);
8703 gpiomask |= (1 << pin);
8705 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
8706 AC_VERB_GET_GPIO_DIRECTION, 0);
8707 gpiodir |= (1 << pin);
8710 snd_hda_codec_write(codec, codec->afg, 0,
8711 AC_VERB_SET_GPIO_MASK, gpiomask);
8712 snd_hda_codec_write(codec, codec->afg, 0,
8713 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
8717 snd_hda_codec_write(codec, codec->afg, 0,
8718 AC_VERB_SET_GPIO_DATA, gpiostate);
8721 /* set up GPIO at initialization */
8722 static void alc885_macpro_init_hook(struct hda_codec *codec)
8724 alc882_gpio_mute(codec, 0, 0);
8725 alc882_gpio_mute(codec, 1, 0);
8728 /* set up GPIO and update auto-muting at initialization */
8729 static void alc885_imac24_init_hook(struct hda_codec *codec)
8731 alc885_macpro_init_hook(codec);
8732 alc_automute_amp(codec);
8736 * generic initialization of ADC, input mixers and output mixers
8738 static struct hda_verb alc883_auto_init_verbs[] = {
8740 * Unmute ADC0-2 and set the default input to mic-in
8742 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8743 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8744 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8745 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8748 * Set up output mixers (0x0c - 0x0f)
8750 /* set vol=0 to output mixers */
8751 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8752 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8753 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8754 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8755 /* set up input amps for analog loopback */
8756 /* Amp Indices: DAC = 0, mixer = 1 */
8757 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8758 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8759 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8760 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8761 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8762 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8763 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8764 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8765 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8766 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8768 /* FIXME: use matrix-type input source selection */
8769 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8771 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8773 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8777 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
8778 static struct hda_verb alc889A_mb31_ch2_init[] = {
8779 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8780 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8781 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8782 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8786 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
8787 static struct hda_verb alc889A_mb31_ch4_init[] = {
8788 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8789 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8790 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8791 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8795 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
8796 static struct hda_verb alc889A_mb31_ch5_init[] = {
8797 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
8798 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8799 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8800 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8804 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
8805 static struct hda_verb alc889A_mb31_ch6_init[] = {
8806 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
8807 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
8808 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8809 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8813 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
8814 { 2, alc889A_mb31_ch2_init },
8815 { 4, alc889A_mb31_ch4_init },
8816 { 5, alc889A_mb31_ch5_init },
8817 { 6, alc889A_mb31_ch6_init },
8820 static struct hda_verb alc883_medion_eapd_verbs[] = {
8821 /* eanable EAPD on medion laptop */
8822 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8823 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
8827 #define alc883_base_mixer alc882_base_mixer
8829 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
8830 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8831 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8832 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8833 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8834 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8835 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8836 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8837 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8838 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8839 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8840 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8841 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
8842 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8846 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
8847 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8848 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8849 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8850 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8851 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8852 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8853 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8854 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8855 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
8856 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8860 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
8861 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8862 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8863 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8864 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8865 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8866 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8867 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8868 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8869 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
8870 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8874 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
8875 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8876 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8877 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8878 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8879 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8880 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8881 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8882 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8883 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8884 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8885 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8886 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
8887 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8891 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
8892 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8893 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8894 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8895 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8896 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8897 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8898 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8899 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8900 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8901 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8902 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8903 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8904 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8905 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8906 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8907 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8908 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8909 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
8910 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8914 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
8915 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8916 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8917 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8918 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8919 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8921 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8922 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8923 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8924 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8925 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8926 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8927 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8928 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8929 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8930 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT),
8931 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8932 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8933 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT),
8934 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8938 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
8939 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8940 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8941 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8942 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8943 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8945 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8946 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8947 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8948 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8949 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
8950 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8951 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8952 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8953 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
8954 HDA_CODEC_VOLUME("Mic Boost Volume", 0x1b, 0, HDA_INPUT),
8955 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
8956 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8957 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT),
8958 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8962 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
8963 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8964 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8965 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8966 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8967 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8968 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8969 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8970 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8971 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8972 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8973 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8974 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8975 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8976 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8977 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8978 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8979 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8980 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
8981 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8985 static struct snd_kcontrol_new alc883_targa_mixer[] = {
8986 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8987 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8988 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8989 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8990 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8991 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8992 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8993 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8994 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8995 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8996 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8997 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8998 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8999 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9000 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9001 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9002 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9006 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
9007 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9008 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9009 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9010 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9011 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9012 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9013 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9014 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9015 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9016 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9017 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
9018 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9022 static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
9023 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
9024 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
9025 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9026 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
9027 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9031 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
9032 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9033 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9034 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9035 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
9036 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9037 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9038 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9039 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9043 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
9044 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9045 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
9046 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9047 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9048 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9049 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9050 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9051 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9052 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9056 static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = {
9057 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9058 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9059 HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9060 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
9061 HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT),
9062 HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT),
9066 static struct hda_verb alc883_medion_wim2160_verbs[] = {
9067 /* Unmute front mixer */
9068 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9069 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9071 /* Set speaker pin to front mixer */
9072 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9074 /* Init headphone pin */
9075 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9076 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9077 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
9078 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9083 /* toggle speaker-output according to the hp-jack state */
9084 static void alc883_medion_wim2160_setup(struct hda_codec *codec)
9086 struct alc_spec *spec = codec->spec;
9088 spec->autocfg.hp_pins[0] = 0x1a;
9089 spec->autocfg.speaker_pins[0] = 0x15;
9092 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
9093 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9094 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9095 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9096 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9097 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9098 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9099 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9100 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9104 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
9105 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9106 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
9107 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9108 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9109 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9110 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9111 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9112 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9113 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9117 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
9118 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9119 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9120 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
9121 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
9122 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
9123 0x0d, 1, 0x0, HDA_OUTPUT),
9124 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
9125 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
9126 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
9127 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
9128 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
9129 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9130 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9131 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9132 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9133 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9134 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9135 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9136 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9137 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
9138 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9142 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
9144 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
9145 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
9146 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
9147 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
9148 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
9150 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
9151 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
9152 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
9153 /* Output switches */
9154 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
9155 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
9156 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
9158 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT),
9159 HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT),
9161 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
9162 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
9163 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9164 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9168 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
9169 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9170 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9171 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9172 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9173 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT),
9174 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9178 static struct hda_bind_ctls alc883_bind_cap_vol = {
9179 .ops = &snd_hda_bind_vol,
9181 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
9182 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
9187 static struct hda_bind_ctls alc883_bind_cap_switch = {
9188 .ops = &snd_hda_bind_sw,
9190 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
9191 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
9196 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
9197 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9198 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9199 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9200 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9201 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9202 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9203 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9204 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9208 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
9209 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
9210 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
9212 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9213 /* .name = "Capture Source", */
9214 .name = "Input Source",
9216 .info = alc_mux_enum_info,
9217 .get = alc_mux_enum_get,
9218 .put = alc_mux_enum_put,
9223 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
9225 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9226 .name = "Channel Mode",
9227 .info = alc_ch_mode_info,
9228 .get = alc_ch_mode_get,
9229 .put = alc_ch_mode_put,
9234 /* toggle speaker-output according to the hp-jack state */
9235 static void alc883_mitac_setup(struct hda_codec *codec)
9237 struct alc_spec *spec = codec->spec;
9239 spec->autocfg.hp_pins[0] = 0x15;
9240 spec->autocfg.speaker_pins[0] = 0x14;
9241 spec->autocfg.speaker_pins[1] = 0x17;
9244 static struct hda_verb alc883_mitac_verbs[] = {
9246 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9247 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9249 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
9250 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9252 /* enable unsolicited event */
9253 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9254 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
9259 static struct hda_verb alc883_clevo_m540r_verbs[] = {
9261 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9262 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9264 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
9266 /* enable unsolicited event */
9268 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9269 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9275 static struct hda_verb alc883_clevo_m720_verbs[] = {
9277 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9278 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9280 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
9281 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9283 /* enable unsolicited event */
9284 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9285 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9290 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
9292 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9293 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9295 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9296 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9298 /* enable unsolicited event */
9299 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9304 static struct hda_verb alc883_targa_verbs[] = {
9305 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9306 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9308 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9309 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9311 /* Connect Line-Out side jack (SPDIF) to Side */
9312 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9313 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9314 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
9315 /* Connect Mic jack to CLFE */
9316 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9317 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9318 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
9319 /* Connect Line-in jack to Surround */
9320 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9321 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9322 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
9323 /* Connect HP out jack to Front */
9324 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9325 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9326 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9328 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9333 static struct hda_verb alc883_lenovo_101e_verbs[] = {
9334 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9335 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
9336 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
9340 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
9341 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9342 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9343 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9344 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9348 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
9349 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9350 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9351 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9352 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
9353 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9357 static struct hda_verb alc883_haier_w66_verbs[] = {
9358 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9359 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9361 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9363 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9364 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9365 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9366 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9370 static struct hda_verb alc888_lenovo_sky_verbs[] = {
9371 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9372 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9373 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9374 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9375 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9376 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9377 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
9378 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9382 static struct hda_verb alc888_6st_dell_verbs[] = {
9383 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9387 static struct hda_verb alc883_vaiott_verbs[] = {
9389 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9390 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9392 /* enable unsolicited event */
9393 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9398 static void alc888_3st_hp_setup(struct hda_codec *codec)
9400 struct alc_spec *spec = codec->spec;
9402 spec->autocfg.hp_pins[0] = 0x1b;
9403 spec->autocfg.speaker_pins[0] = 0x14;
9404 spec->autocfg.speaker_pins[1] = 0x16;
9405 spec->autocfg.speaker_pins[2] = 0x18;
9408 static struct hda_verb alc888_3st_hp_verbs[] = {
9409 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
9410 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
9411 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
9412 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9419 static struct hda_verb alc888_3st_hp_2ch_init[] = {
9420 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
9421 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9422 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
9423 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9430 static struct hda_verb alc888_3st_hp_4ch_init[] = {
9431 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
9432 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9433 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9434 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9435 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
9442 static struct hda_verb alc888_3st_hp_6ch_init[] = {
9443 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9444 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9445 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
9446 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9447 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9448 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
9452 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
9453 { 2, alc888_3st_hp_2ch_init },
9454 { 4, alc888_3st_hp_4ch_init },
9455 { 6, alc888_3st_hp_6ch_init },
9458 /* toggle front-jack and RCA according to the hp-jack state */
9459 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
9461 unsigned int present = snd_hda_jack_detect(codec, 0x1b);
9463 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9464 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9465 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9466 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9469 /* toggle RCA according to the front-jack state */
9470 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
9472 unsigned int present = snd_hda_jack_detect(codec, 0x14);
9474 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9475 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9478 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
9481 if ((res >> 26) == ALC880_HP_EVENT)
9482 alc888_lenovo_ms7195_front_automute(codec);
9483 if ((res >> 26) == ALC880_FRONT_EVENT)
9484 alc888_lenovo_ms7195_rca_automute(codec);
9487 /* toggle speaker-output according to the hp-jack state */
9488 static void alc883_lenovo_nb0763_setup(struct hda_codec *codec)
9490 struct alc_spec *spec = codec->spec;
9492 spec->autocfg.hp_pins[0] = 0x14;
9493 spec->autocfg.speaker_pins[0] = 0x15;
9496 /* toggle speaker-output according to the hp-jack state */
9497 #define alc883_targa_init_hook alc882_targa_init_hook
9498 #define alc883_targa_unsol_event alc882_targa_unsol_event
9500 static void alc883_clevo_m720_setup(struct hda_codec *codec)
9502 struct alc_spec *spec = codec->spec;
9504 spec->autocfg.hp_pins[0] = 0x15;
9505 spec->autocfg.speaker_pins[0] = 0x14;
9508 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
9510 alc_automute_amp(codec);
9511 alc88x_simple_mic_automute(codec);
9514 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
9517 switch (res >> 26) {
9518 case ALC880_MIC_EVENT:
9519 alc88x_simple_mic_automute(codec);
9522 alc_automute_amp_unsol_event(codec, res);
9527 /* toggle speaker-output according to the hp-jack state */
9528 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
9530 struct alc_spec *spec = codec->spec;
9532 spec->autocfg.hp_pins[0] = 0x14;
9533 spec->autocfg.speaker_pins[0] = 0x15;
9536 static void alc883_haier_w66_setup(struct hda_codec *codec)
9538 struct alc_spec *spec = codec->spec;
9540 spec->autocfg.hp_pins[0] = 0x1b;
9541 spec->autocfg.speaker_pins[0] = 0x14;
9544 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
9546 int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0;
9548 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9549 HDA_AMP_MUTE, bits);
9552 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
9554 int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0;
9556 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9557 HDA_AMP_MUTE, bits);
9558 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9559 HDA_AMP_MUTE, bits);
9562 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
9565 if ((res >> 26) == ALC880_HP_EVENT)
9566 alc883_lenovo_101e_all_automute(codec);
9567 if ((res >> 26) == ALC880_FRONT_EVENT)
9568 alc883_lenovo_101e_ispeaker_automute(codec);
9571 /* toggle speaker-output according to the hp-jack state */
9572 static void alc883_acer_aspire_setup(struct hda_codec *codec)
9574 struct alc_spec *spec = codec->spec;
9576 spec->autocfg.hp_pins[0] = 0x14;
9577 spec->autocfg.speaker_pins[0] = 0x15;
9578 spec->autocfg.speaker_pins[1] = 0x16;
9581 static struct hda_verb alc883_acer_eapd_verbs[] = {
9582 /* HP Pin: output 0 (0x0c) */
9583 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9584 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9585 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9586 /* Front Pin: output 0 (0x0c) */
9587 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9588 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9589 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9590 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
9591 /* eanable EAPD on medion laptop */
9592 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9593 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
9594 /* enable unsolicited event */
9595 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9599 static void alc888_6st_dell_setup(struct hda_codec *codec)
9601 struct alc_spec *spec = codec->spec;
9603 spec->autocfg.hp_pins[0] = 0x1b;
9604 spec->autocfg.speaker_pins[0] = 0x14;
9605 spec->autocfg.speaker_pins[1] = 0x15;
9606 spec->autocfg.speaker_pins[2] = 0x16;
9607 spec->autocfg.speaker_pins[3] = 0x17;
9610 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
9612 struct alc_spec *spec = codec->spec;
9614 spec->autocfg.hp_pins[0] = 0x1b;
9615 spec->autocfg.speaker_pins[0] = 0x14;
9616 spec->autocfg.speaker_pins[1] = 0x15;
9617 spec->autocfg.speaker_pins[2] = 0x16;
9618 spec->autocfg.speaker_pins[3] = 0x17;
9619 spec->autocfg.speaker_pins[4] = 0x1a;
9622 static void alc883_vaiott_setup(struct hda_codec *codec)
9624 struct alc_spec *spec = codec->spec;
9626 spec->autocfg.hp_pins[0] = 0x15;
9627 spec->autocfg.speaker_pins[0] = 0x14;
9628 spec->autocfg.speaker_pins[1] = 0x17;
9631 static struct hda_verb alc888_asus_m90v_verbs[] = {
9632 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9633 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9634 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9635 /* enable unsolicited event */
9636 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9637 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9641 static void alc883_mode2_setup(struct hda_codec *codec)
9643 struct alc_spec *spec = codec->spec;
9645 spec->autocfg.hp_pins[0] = 0x1b;
9646 spec->autocfg.speaker_pins[0] = 0x14;
9647 spec->autocfg.speaker_pins[1] = 0x15;
9648 spec->autocfg.speaker_pins[2] = 0x16;
9649 spec->ext_mic.pin = 0x18;
9650 spec->int_mic.pin = 0x19;
9651 spec->ext_mic.mux_idx = 0;
9652 spec->int_mic.mux_idx = 1;
9656 static struct hda_verb alc888_asus_eee1601_verbs[] = {
9657 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9658 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9659 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9660 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9661 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9662 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
9663 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
9664 /* enable unsolicited event */
9665 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9669 static void alc883_eee1601_inithook(struct hda_codec *codec)
9671 struct alc_spec *spec = codec->spec;
9673 spec->autocfg.hp_pins[0] = 0x14;
9674 spec->autocfg.speaker_pins[0] = 0x1b;
9675 alc_automute_pin(codec);
9678 static struct hda_verb alc889A_mb31_verbs[] = {
9679 /* Init rear pin (used as headphone output) */
9680 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
9681 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
9682 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9683 /* Init line pin (used as output in 4ch and 6ch mode) */
9684 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
9685 /* Init line 2 pin (used as headphone out by default) */
9686 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
9687 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
9691 /* Mute speakers according to the headphone jack state */
9692 static void alc889A_mb31_automute(struct hda_codec *codec)
9694 unsigned int present;
9696 /* Mute only in 2ch or 4ch mode */
9697 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
9699 present = snd_hda_jack_detect(codec, 0x15);
9700 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9701 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9702 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9703 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9707 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
9709 if ((res >> 26) == ALC880_HP_EVENT)
9710 alc889A_mb31_automute(codec);
9714 #ifdef CONFIG_SND_HDA_POWER_SAVE
9715 #define alc882_loopbacks alc880_loopbacks
9718 /* pcm configuration: identical with ALC880 */
9719 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
9720 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
9721 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
9722 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
9724 static hda_nid_t alc883_slave_dig_outs[] = {
9725 ALC1200_DIGOUT_NID, 0,
9728 static hda_nid_t alc1200_slave_dig_outs[] = {
9729 ALC883_DIGOUT_NID, 0,
9733 * configuration and preset
9735 static const char * const alc882_models[ALC882_MODEL_LAST] = {
9736 [ALC882_3ST_DIG] = "3stack-dig",
9737 [ALC882_6ST_DIG] = "6stack-dig",
9738 [ALC882_ARIMA] = "arima",
9739 [ALC882_W2JC] = "w2jc",
9740 [ALC882_TARGA] = "targa",
9741 [ALC882_ASUS_A7J] = "asus-a7j",
9742 [ALC882_ASUS_A7M] = "asus-a7m",
9743 [ALC885_MACPRO] = "macpro",
9744 [ALC885_MB5] = "mb5",
9745 [ALC885_MACMINI3] = "macmini3",
9746 [ALC885_MBA21] = "mba21",
9747 [ALC885_MBP3] = "mbp3",
9748 [ALC885_IMAC24] = "imac24",
9749 [ALC885_IMAC91] = "imac91",
9750 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
9751 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
9752 [ALC883_3ST_6ch] = "3stack-6ch",
9753 [ALC883_6ST_DIG] = "alc883-6stack-dig",
9754 [ALC883_TARGA_DIG] = "targa-dig",
9755 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
9756 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
9757 [ALC883_ACER] = "acer",
9758 [ALC883_ACER_ASPIRE] = "acer-aspire",
9759 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
9760 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
9761 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
9762 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
9763 [ALC883_MEDION] = "medion",
9764 [ALC883_MEDION_WIM2160] = "medion-wim2160",
9765 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
9766 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
9767 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
9768 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
9769 [ALC888_LENOVO_SKY] = "lenovo-sky",
9770 [ALC883_HAIER_W66] = "haier-w66",
9771 [ALC888_3ST_HP] = "3stack-hp",
9772 [ALC888_6ST_DELL] = "6stack-dell",
9773 [ALC883_MITAC] = "mitac",
9774 [ALC883_CLEVO_M540R] = "clevo-m540r",
9775 [ALC883_CLEVO_M720] = "clevo-m720",
9776 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
9777 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
9778 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
9779 [ALC889A_INTEL] = "intel-alc889a",
9780 [ALC889_INTEL] = "intel-x58",
9781 [ALC1200_ASUS_P5Q] = "asus-p5q",
9782 [ALC889A_MB31] = "mb31",
9783 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
9784 [ALC882_AUTO] = "auto",
9787 static struct snd_pci_quirk alc882_cfg_tbl[] = {
9788 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
9790 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
9791 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
9792 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
9793 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
9794 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
9795 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
9796 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
9797 ALC888_ACER_ASPIRE_4930G),
9798 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
9799 ALC888_ACER_ASPIRE_4930G),
9800 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
9801 ALC888_ACER_ASPIRE_8930G),
9802 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
9803 ALC888_ACER_ASPIRE_8930G),
9804 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
9805 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
9806 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
9807 ALC888_ACER_ASPIRE_6530G),
9808 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
9809 ALC888_ACER_ASPIRE_6530G),
9810 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
9811 ALC888_ACER_ASPIRE_7730G),
9812 /* default Acer -- disabled as it causes more problems.
9813 * model=auto should work fine now
9815 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
9817 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
9819 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
9820 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
9821 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
9822 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
9823 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
9824 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
9826 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
9827 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
9828 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
9829 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
9830 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
9831 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
9832 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
9833 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
9834 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
9835 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
9836 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
9838 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
9839 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
9840 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
9841 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
9842 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
9843 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
9844 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
9845 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
9846 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
9848 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
9849 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
9850 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
9851 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
9852 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
9853 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
9854 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
9855 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
9856 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
9857 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
9858 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
9859 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
9860 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
9861 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
9862 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
9863 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
9864 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
9865 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
9866 SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG),
9867 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
9868 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
9869 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
9870 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
9871 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
9872 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
9873 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
9874 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
9875 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
9876 SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG),
9877 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
9878 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
9880 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
9881 SND_PCI_QUIRK(0x1558, 0x0571, "Clevo laptop M570U", ALC883_3ST_6ch_DIG),
9882 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
9883 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
9884 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
9885 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
9886 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
9887 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
9888 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
9889 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9890 ALC883_FUJITSU_PI2515),
9891 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9892 ALC888_FUJITSU_XA3530),
9893 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
9894 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9895 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9896 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9897 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
9898 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
9899 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
9900 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
9902 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
9903 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
9904 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
9905 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
9906 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
9907 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
9908 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG),
9913 /* codec SSID table for Intel Mac */
9914 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
9915 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
9916 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
9917 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
9918 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
9919 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
9920 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
9921 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
9922 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31),
9923 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_ASUS_A7M),
9924 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3),
9925 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21),
9926 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
9927 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
9928 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
9929 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
9930 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
9931 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5),
9932 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
9933 * so apparently no perfect solution yet
9935 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
9936 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
9937 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3),
9941 static struct alc_config_preset alc882_presets[] = {
9942 [ALC882_3ST_DIG] = {
9943 .mixers = { alc882_base_mixer },
9944 .init_verbs = { alc882_base_init_verbs,
9945 alc882_adc1_init_verbs },
9946 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9947 .dac_nids = alc882_dac_nids,
9948 .dig_out_nid = ALC882_DIGOUT_NID,
9949 .dig_in_nid = ALC882_DIGIN_NID,
9950 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9951 .channel_mode = alc882_ch_modes,
9953 .input_mux = &alc882_capture_source,
9955 [ALC882_6ST_DIG] = {
9956 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9957 .init_verbs = { alc882_base_init_verbs,
9958 alc882_adc1_init_verbs },
9959 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9960 .dac_nids = alc882_dac_nids,
9961 .dig_out_nid = ALC882_DIGOUT_NID,
9962 .dig_in_nid = ALC882_DIGIN_NID,
9963 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9964 .channel_mode = alc882_sixstack_modes,
9965 .input_mux = &alc882_capture_source,
9968 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9969 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9970 alc882_eapd_verbs },
9971 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9972 .dac_nids = alc882_dac_nids,
9973 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9974 .channel_mode = alc882_sixstack_modes,
9975 .input_mux = &alc882_capture_source,
9978 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
9979 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9980 alc882_eapd_verbs, alc880_gpio1_init_verbs },
9981 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9982 .dac_nids = alc882_dac_nids,
9983 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9984 .channel_mode = alc880_threestack_modes,
9986 .input_mux = &alc882_capture_source,
9987 .dig_out_nid = ALC882_DIGOUT_NID,
9990 .mixers = { alc885_mba21_mixer },
9991 .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs },
9993 .dac_nids = alc882_dac_nids,
9994 .channel_mode = alc885_mba21_ch_modes,
9995 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
9996 .input_mux = &alc882_capture_source,
9997 .unsol_event = alc_automute_amp_unsol_event,
9998 .setup = alc885_mba21_setup,
9999 .init_hook = alc_automute_amp,
10002 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
10003 .init_verbs = { alc885_mbp3_init_verbs,
10004 alc880_gpio1_init_verbs },
10006 .dac_nids = alc882_dac_nids,
10008 .channel_mode = alc885_mbp_4ch_modes,
10009 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
10010 .input_mux = &alc882_capture_source,
10011 .dig_out_nid = ALC882_DIGOUT_NID,
10012 .dig_in_nid = ALC882_DIGIN_NID,
10013 .unsol_event = alc_automute_amp_unsol_event,
10014 .setup = alc885_mbp3_setup,
10015 .init_hook = alc_automute_amp,
10018 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
10019 .init_verbs = { alc885_mb5_init_verbs,
10020 alc880_gpio1_init_verbs },
10021 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10022 .dac_nids = alc882_dac_nids,
10023 .channel_mode = alc885_mb5_6ch_modes,
10024 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
10025 .input_mux = &mb5_capture_source,
10026 .dig_out_nid = ALC882_DIGOUT_NID,
10027 .dig_in_nid = ALC882_DIGIN_NID,
10028 .unsol_event = alc_automute_amp_unsol_event,
10029 .setup = alc885_mb5_setup,
10030 .init_hook = alc_automute_amp,
10032 [ALC885_MACMINI3] = {
10033 .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer },
10034 .init_verbs = { alc885_macmini3_init_verbs,
10035 alc880_gpio1_init_verbs },
10036 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10037 .dac_nids = alc882_dac_nids,
10038 .channel_mode = alc885_macmini3_6ch_modes,
10039 .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes),
10040 .input_mux = &macmini3_capture_source,
10041 .dig_out_nid = ALC882_DIGOUT_NID,
10042 .dig_in_nid = ALC882_DIGIN_NID,
10043 .unsol_event = alc_automute_amp_unsol_event,
10044 .setup = alc885_macmini3_setup,
10045 .init_hook = alc_automute_amp,
10047 [ALC885_MACPRO] = {
10048 .mixers = { alc882_macpro_mixer },
10049 .init_verbs = { alc882_macpro_init_verbs },
10050 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10051 .dac_nids = alc882_dac_nids,
10052 .dig_out_nid = ALC882_DIGOUT_NID,
10053 .dig_in_nid = ALC882_DIGIN_NID,
10054 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
10055 .channel_mode = alc882_ch_modes,
10056 .input_mux = &alc882_capture_source,
10057 .init_hook = alc885_macpro_init_hook,
10059 [ALC885_IMAC24] = {
10060 .mixers = { alc885_imac24_mixer },
10061 .init_verbs = { alc885_imac24_init_verbs },
10062 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10063 .dac_nids = alc882_dac_nids,
10064 .dig_out_nid = ALC882_DIGOUT_NID,
10065 .dig_in_nid = ALC882_DIGIN_NID,
10066 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
10067 .channel_mode = alc882_ch_modes,
10068 .input_mux = &alc882_capture_source,
10069 .unsol_event = alc_automute_amp_unsol_event,
10070 .setup = alc885_imac24_setup,
10071 .init_hook = alc885_imac24_init_hook,
10073 [ALC885_IMAC91] = {
10074 .mixers = {alc885_imac91_mixer},
10075 .init_verbs = { alc885_imac91_init_verbs,
10076 alc880_gpio1_init_verbs },
10077 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10078 .dac_nids = alc882_dac_nids,
10079 .channel_mode = alc885_mba21_ch_modes,
10080 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
10081 .input_mux = &alc889A_imac91_capture_source,
10082 .dig_out_nid = ALC882_DIGOUT_NID,
10083 .dig_in_nid = ALC882_DIGIN_NID,
10084 .unsol_event = alc_automute_amp_unsol_event,
10085 .setup = alc885_imac91_setup,
10086 .init_hook = alc_automute_amp,
10089 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
10090 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10091 alc880_gpio3_init_verbs, alc882_targa_verbs},
10092 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10093 .dac_nids = alc882_dac_nids,
10094 .dig_out_nid = ALC882_DIGOUT_NID,
10095 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
10096 .adc_nids = alc882_adc_nids,
10097 .capsrc_nids = alc882_capsrc_nids,
10098 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
10099 .channel_mode = alc882_3ST_6ch_modes,
10101 .input_mux = &alc882_capture_source,
10102 .unsol_event = alc882_targa_unsol_event,
10103 .setup = alc882_targa_setup,
10104 .init_hook = alc882_targa_automute,
10106 [ALC882_ASUS_A7J] = {
10107 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
10108 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10109 alc882_asus_a7j_verbs},
10110 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10111 .dac_nids = alc882_dac_nids,
10112 .dig_out_nid = ALC882_DIGOUT_NID,
10113 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
10114 .adc_nids = alc882_adc_nids,
10115 .capsrc_nids = alc882_capsrc_nids,
10116 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
10117 .channel_mode = alc882_3ST_6ch_modes,
10119 .input_mux = &alc882_capture_source,
10121 [ALC882_ASUS_A7M] = {
10122 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
10123 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10124 alc882_eapd_verbs, alc880_gpio1_init_verbs,
10125 alc882_asus_a7m_verbs },
10126 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10127 .dac_nids = alc882_dac_nids,
10128 .dig_out_nid = ALC882_DIGOUT_NID,
10129 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
10130 .channel_mode = alc880_threestack_modes,
10132 .input_mux = &alc882_capture_source,
10134 [ALC883_3ST_2ch_DIG] = {
10135 .mixers = { alc883_3ST_2ch_mixer },
10136 .init_verbs = { alc883_init_verbs },
10137 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10138 .dac_nids = alc883_dac_nids,
10139 .dig_out_nid = ALC883_DIGOUT_NID,
10140 .dig_in_nid = ALC883_DIGIN_NID,
10141 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10142 .channel_mode = alc883_3ST_2ch_modes,
10143 .input_mux = &alc883_capture_source,
10145 [ALC883_3ST_6ch_DIG] = {
10146 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10147 .init_verbs = { alc883_init_verbs },
10148 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10149 .dac_nids = alc883_dac_nids,
10150 .dig_out_nid = ALC883_DIGOUT_NID,
10151 .dig_in_nid = ALC883_DIGIN_NID,
10152 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10153 .channel_mode = alc883_3ST_6ch_modes,
10155 .input_mux = &alc883_capture_source,
10157 [ALC883_3ST_6ch] = {
10158 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10159 .init_verbs = { alc883_init_verbs },
10160 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10161 .dac_nids = alc883_dac_nids,
10162 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10163 .channel_mode = alc883_3ST_6ch_modes,
10165 .input_mux = &alc883_capture_source,
10167 [ALC883_3ST_6ch_INTEL] = {
10168 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
10169 .init_verbs = { alc883_init_verbs },
10170 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10171 .dac_nids = alc883_dac_nids,
10172 .dig_out_nid = ALC883_DIGOUT_NID,
10173 .dig_in_nid = ALC883_DIGIN_NID,
10174 .slave_dig_outs = alc883_slave_dig_outs,
10175 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
10176 .channel_mode = alc883_3ST_6ch_intel_modes,
10178 .input_mux = &alc883_3stack_6ch_intel,
10180 [ALC889A_INTEL] = {
10181 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
10182 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
10183 alc_hp15_unsol_verbs },
10184 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10185 .dac_nids = alc883_dac_nids,
10186 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10187 .adc_nids = alc889_adc_nids,
10188 .dig_out_nid = ALC883_DIGOUT_NID,
10189 .dig_in_nid = ALC883_DIGIN_NID,
10190 .slave_dig_outs = alc883_slave_dig_outs,
10191 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
10192 .channel_mode = alc889_8ch_intel_modes,
10193 .capsrc_nids = alc889_capsrc_nids,
10194 .input_mux = &alc889_capture_source,
10195 .setup = alc889_automute_setup,
10196 .init_hook = alc_automute_amp,
10197 .unsol_event = alc_automute_amp_unsol_event,
10201 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
10202 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
10203 alc889_eapd_verbs, alc_hp15_unsol_verbs},
10204 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10205 .dac_nids = alc883_dac_nids,
10206 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10207 .adc_nids = alc889_adc_nids,
10208 .dig_out_nid = ALC883_DIGOUT_NID,
10209 .dig_in_nid = ALC883_DIGIN_NID,
10210 .slave_dig_outs = alc883_slave_dig_outs,
10211 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
10212 .channel_mode = alc889_8ch_intel_modes,
10213 .capsrc_nids = alc889_capsrc_nids,
10214 .input_mux = &alc889_capture_source,
10215 .setup = alc889_automute_setup,
10216 .init_hook = alc889_intel_init_hook,
10217 .unsol_event = alc_automute_amp_unsol_event,
10220 [ALC883_6ST_DIG] = {
10221 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10222 .init_verbs = { alc883_init_verbs },
10223 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10224 .dac_nids = alc883_dac_nids,
10225 .dig_out_nid = ALC883_DIGOUT_NID,
10226 .dig_in_nid = ALC883_DIGIN_NID,
10227 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10228 .channel_mode = alc883_sixstack_modes,
10229 .input_mux = &alc883_capture_source,
10231 [ALC883_TARGA_DIG] = {
10232 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
10233 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10234 alc883_targa_verbs},
10235 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10236 .dac_nids = alc883_dac_nids,
10237 .dig_out_nid = ALC883_DIGOUT_NID,
10238 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10239 .channel_mode = alc883_3ST_6ch_modes,
10241 .input_mux = &alc883_capture_source,
10242 .unsol_event = alc883_targa_unsol_event,
10243 .setup = alc882_targa_setup,
10244 .init_hook = alc882_targa_automute,
10246 [ALC883_TARGA_2ch_DIG] = {
10247 .mixers = { alc883_targa_2ch_mixer},
10248 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10249 alc883_targa_verbs},
10250 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10251 .dac_nids = alc883_dac_nids,
10252 .adc_nids = alc883_adc_nids_alt,
10253 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10254 .capsrc_nids = alc883_capsrc_nids,
10255 .dig_out_nid = ALC883_DIGOUT_NID,
10256 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10257 .channel_mode = alc883_3ST_2ch_modes,
10258 .input_mux = &alc883_capture_source,
10259 .unsol_event = alc883_targa_unsol_event,
10260 .setup = alc882_targa_setup,
10261 .init_hook = alc882_targa_automute,
10263 [ALC883_TARGA_8ch_DIG] = {
10264 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
10265 alc883_chmode_mixer },
10266 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10267 alc883_targa_verbs },
10268 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10269 .dac_nids = alc883_dac_nids,
10270 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10271 .adc_nids = alc883_adc_nids_rev,
10272 .capsrc_nids = alc883_capsrc_nids_rev,
10273 .dig_out_nid = ALC883_DIGOUT_NID,
10274 .dig_in_nid = ALC883_DIGIN_NID,
10275 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
10276 .channel_mode = alc883_4ST_8ch_modes,
10278 .input_mux = &alc883_capture_source,
10279 .unsol_event = alc883_targa_unsol_event,
10280 .setup = alc882_targa_setup,
10281 .init_hook = alc882_targa_automute,
10284 .mixers = { alc883_base_mixer },
10285 /* On TravelMate laptops, GPIO 0 enables the internal speaker
10286 * and the headphone jack. Turn this on and rely on the
10287 * standard mute methods whenever the user wants to turn
10288 * these outputs off.
10290 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
10291 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10292 .dac_nids = alc883_dac_nids,
10293 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10294 .channel_mode = alc883_3ST_2ch_modes,
10295 .input_mux = &alc883_capture_source,
10297 [ALC883_ACER_ASPIRE] = {
10298 .mixers = { alc883_acer_aspire_mixer },
10299 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
10300 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10301 .dac_nids = alc883_dac_nids,
10302 .dig_out_nid = ALC883_DIGOUT_NID,
10303 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10304 .channel_mode = alc883_3ST_2ch_modes,
10305 .input_mux = &alc883_capture_source,
10306 .unsol_event = alc_automute_amp_unsol_event,
10307 .setup = alc883_acer_aspire_setup,
10308 .init_hook = alc_automute_amp,
10310 [ALC888_ACER_ASPIRE_4930G] = {
10311 .mixers = { alc888_acer_aspire_4930g_mixer,
10312 alc883_chmode_mixer },
10313 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10314 alc888_acer_aspire_4930g_verbs },
10315 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10316 .dac_nids = alc883_dac_nids,
10317 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10318 .adc_nids = alc883_adc_nids_rev,
10319 .capsrc_nids = alc883_capsrc_nids_rev,
10320 .dig_out_nid = ALC883_DIGOUT_NID,
10321 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10322 .channel_mode = alc883_3ST_6ch_modes,
10324 .const_channel_count = 6,
10326 ARRAY_SIZE(alc888_2_capture_sources),
10327 .input_mux = alc888_2_capture_sources,
10328 .unsol_event = alc_automute_amp_unsol_event,
10329 .setup = alc888_acer_aspire_4930g_setup,
10330 .init_hook = alc_automute_amp,
10332 [ALC888_ACER_ASPIRE_6530G] = {
10333 .mixers = { alc888_acer_aspire_6530_mixer },
10334 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10335 alc888_acer_aspire_6530g_verbs },
10336 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10337 .dac_nids = alc883_dac_nids,
10338 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10339 .adc_nids = alc883_adc_nids_rev,
10340 .capsrc_nids = alc883_capsrc_nids_rev,
10341 .dig_out_nid = ALC883_DIGOUT_NID,
10342 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10343 .channel_mode = alc883_3ST_2ch_modes,
10345 ARRAY_SIZE(alc888_2_capture_sources),
10346 .input_mux = alc888_acer_aspire_6530_sources,
10347 .unsol_event = alc_automute_amp_unsol_event,
10348 .setup = alc888_acer_aspire_6530g_setup,
10349 .init_hook = alc_automute_amp,
10351 [ALC888_ACER_ASPIRE_8930G] = {
10352 .mixers = { alc889_acer_aspire_8930g_mixer,
10353 alc883_chmode_mixer },
10354 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10355 alc889_acer_aspire_8930g_verbs,
10356 alc889_eapd_verbs},
10357 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10358 .dac_nids = alc883_dac_nids,
10359 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10360 .adc_nids = alc889_adc_nids,
10361 .capsrc_nids = alc889_capsrc_nids,
10362 .dig_out_nid = ALC883_DIGOUT_NID,
10363 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10364 .channel_mode = alc883_3ST_6ch_modes,
10366 .const_channel_count = 6,
10368 ARRAY_SIZE(alc889_capture_sources),
10369 .input_mux = alc889_capture_sources,
10370 .unsol_event = alc_automute_amp_unsol_event,
10371 .setup = alc889_acer_aspire_8930g_setup,
10372 .init_hook = alc_automute_amp,
10373 #ifdef CONFIG_SND_HDA_POWER_SAVE
10374 .power_hook = alc_power_eapd,
10377 [ALC888_ACER_ASPIRE_7730G] = {
10378 .mixers = { alc883_3ST_6ch_mixer,
10379 alc883_chmode_mixer },
10380 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10381 alc888_acer_aspire_7730G_verbs },
10382 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10383 .dac_nids = alc883_dac_nids,
10384 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10385 .adc_nids = alc883_adc_nids_rev,
10386 .capsrc_nids = alc883_capsrc_nids_rev,
10387 .dig_out_nid = ALC883_DIGOUT_NID,
10388 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10389 .channel_mode = alc883_3ST_6ch_modes,
10391 .const_channel_count = 6,
10392 .input_mux = &alc883_capture_source,
10393 .unsol_event = alc_automute_amp_unsol_event,
10394 .setup = alc888_acer_aspire_7730g_setup,
10395 .init_hook = alc_automute_amp,
10397 [ALC883_MEDION] = {
10398 .mixers = { alc883_fivestack_mixer,
10399 alc883_chmode_mixer },
10400 .init_verbs = { alc883_init_verbs,
10401 alc883_medion_eapd_verbs },
10402 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10403 .dac_nids = alc883_dac_nids,
10404 .adc_nids = alc883_adc_nids_alt,
10405 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10406 .capsrc_nids = alc883_capsrc_nids,
10407 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10408 .channel_mode = alc883_sixstack_modes,
10409 .input_mux = &alc883_capture_source,
10411 [ALC883_MEDION_WIM2160] = {
10412 .mixers = { alc883_medion_wim2160_mixer },
10413 .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs },
10414 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10415 .dac_nids = alc883_dac_nids,
10416 .dig_out_nid = ALC883_DIGOUT_NID,
10417 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10418 .adc_nids = alc883_adc_nids,
10419 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10420 .channel_mode = alc883_3ST_2ch_modes,
10421 .input_mux = &alc883_capture_source,
10422 .unsol_event = alc_automute_amp_unsol_event,
10423 .setup = alc883_medion_wim2160_setup,
10424 .init_hook = alc_automute_amp,
10426 [ALC883_LAPTOP_EAPD] = {
10427 .mixers = { alc883_base_mixer },
10428 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
10429 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10430 .dac_nids = alc883_dac_nids,
10431 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10432 .channel_mode = alc883_3ST_2ch_modes,
10433 .input_mux = &alc883_capture_source,
10435 [ALC883_CLEVO_M540R] = {
10436 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10437 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
10438 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10439 .dac_nids = alc883_dac_nids,
10440 .dig_out_nid = ALC883_DIGOUT_NID,
10441 .dig_in_nid = ALC883_DIGIN_NID,
10442 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
10443 .channel_mode = alc883_3ST_6ch_clevo_modes,
10445 .input_mux = &alc883_capture_source,
10446 /* This machine has the hardware HP auto-muting, thus
10447 * we need no software mute via unsol event
10450 [ALC883_CLEVO_M720] = {
10451 .mixers = { alc883_clevo_m720_mixer },
10452 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
10453 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10454 .dac_nids = alc883_dac_nids,
10455 .dig_out_nid = ALC883_DIGOUT_NID,
10456 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10457 .channel_mode = alc883_3ST_2ch_modes,
10458 .input_mux = &alc883_capture_source,
10459 .unsol_event = alc883_clevo_m720_unsol_event,
10460 .setup = alc883_clevo_m720_setup,
10461 .init_hook = alc883_clevo_m720_init_hook,
10463 [ALC883_LENOVO_101E_2ch] = {
10464 .mixers = { alc883_lenovo_101e_2ch_mixer},
10465 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
10466 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10467 .dac_nids = alc883_dac_nids,
10468 .adc_nids = alc883_adc_nids_alt,
10469 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10470 .capsrc_nids = alc883_capsrc_nids,
10471 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10472 .channel_mode = alc883_3ST_2ch_modes,
10473 .input_mux = &alc883_lenovo_101e_capture_source,
10474 .unsol_event = alc883_lenovo_101e_unsol_event,
10475 .init_hook = alc883_lenovo_101e_all_automute,
10477 [ALC883_LENOVO_NB0763] = {
10478 .mixers = { alc883_lenovo_nb0763_mixer },
10479 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
10480 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10481 .dac_nids = alc883_dac_nids,
10482 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10483 .channel_mode = alc883_3ST_2ch_modes,
10485 .input_mux = &alc883_lenovo_nb0763_capture_source,
10486 .unsol_event = alc_automute_amp_unsol_event,
10487 .setup = alc883_lenovo_nb0763_setup,
10488 .init_hook = alc_automute_amp,
10490 [ALC888_LENOVO_MS7195_DIG] = {
10491 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10492 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
10493 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10494 .dac_nids = alc883_dac_nids,
10495 .dig_out_nid = ALC883_DIGOUT_NID,
10496 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10497 .channel_mode = alc883_3ST_6ch_modes,
10499 .input_mux = &alc883_capture_source,
10500 .unsol_event = alc883_lenovo_ms7195_unsol_event,
10501 .init_hook = alc888_lenovo_ms7195_front_automute,
10503 [ALC883_HAIER_W66] = {
10504 .mixers = { alc883_targa_2ch_mixer},
10505 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
10506 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10507 .dac_nids = alc883_dac_nids,
10508 .dig_out_nid = ALC883_DIGOUT_NID,
10509 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10510 .channel_mode = alc883_3ST_2ch_modes,
10511 .input_mux = &alc883_capture_source,
10512 .unsol_event = alc_automute_amp_unsol_event,
10513 .setup = alc883_haier_w66_setup,
10514 .init_hook = alc_automute_amp,
10516 [ALC888_3ST_HP] = {
10517 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10518 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
10519 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10520 .dac_nids = alc883_dac_nids,
10521 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
10522 .channel_mode = alc888_3st_hp_modes,
10524 .input_mux = &alc883_capture_source,
10525 .unsol_event = alc_automute_amp_unsol_event,
10526 .setup = alc888_3st_hp_setup,
10527 .init_hook = alc_automute_amp,
10529 [ALC888_6ST_DELL] = {
10530 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10531 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
10532 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10533 .dac_nids = alc883_dac_nids,
10534 .dig_out_nid = ALC883_DIGOUT_NID,
10535 .dig_in_nid = ALC883_DIGIN_NID,
10536 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10537 .channel_mode = alc883_sixstack_modes,
10538 .input_mux = &alc883_capture_source,
10539 .unsol_event = alc_automute_amp_unsol_event,
10540 .setup = alc888_6st_dell_setup,
10541 .init_hook = alc_automute_amp,
10544 .mixers = { alc883_mitac_mixer },
10545 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
10546 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10547 .dac_nids = alc883_dac_nids,
10548 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10549 .channel_mode = alc883_3ST_2ch_modes,
10550 .input_mux = &alc883_capture_source,
10551 .unsol_event = alc_automute_amp_unsol_event,
10552 .setup = alc883_mitac_setup,
10553 .init_hook = alc_automute_amp,
10555 [ALC883_FUJITSU_PI2515] = {
10556 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
10557 .init_verbs = { alc883_init_verbs,
10558 alc883_2ch_fujitsu_pi2515_verbs},
10559 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10560 .dac_nids = alc883_dac_nids,
10561 .dig_out_nid = ALC883_DIGOUT_NID,
10562 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10563 .channel_mode = alc883_3ST_2ch_modes,
10564 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10565 .unsol_event = alc_automute_amp_unsol_event,
10566 .setup = alc883_2ch_fujitsu_pi2515_setup,
10567 .init_hook = alc_automute_amp,
10569 [ALC888_FUJITSU_XA3530] = {
10570 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
10571 .init_verbs = { alc883_init_verbs,
10572 alc888_fujitsu_xa3530_verbs },
10573 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10574 .dac_nids = alc883_dac_nids,
10575 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10576 .adc_nids = alc883_adc_nids_rev,
10577 .capsrc_nids = alc883_capsrc_nids_rev,
10578 .dig_out_nid = ALC883_DIGOUT_NID,
10579 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
10580 .channel_mode = alc888_4ST_8ch_intel_modes,
10582 ARRAY_SIZE(alc888_2_capture_sources),
10583 .input_mux = alc888_2_capture_sources,
10584 .unsol_event = alc_automute_amp_unsol_event,
10585 .setup = alc888_fujitsu_xa3530_setup,
10586 .init_hook = alc_automute_amp,
10588 [ALC888_LENOVO_SKY] = {
10589 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
10590 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
10591 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10592 .dac_nids = alc883_dac_nids,
10593 .dig_out_nid = ALC883_DIGOUT_NID,
10594 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10595 .channel_mode = alc883_sixstack_modes,
10597 .input_mux = &alc883_lenovo_sky_capture_source,
10598 .unsol_event = alc_automute_amp_unsol_event,
10599 .setup = alc888_lenovo_sky_setup,
10600 .init_hook = alc_automute_amp,
10602 [ALC888_ASUS_M90V] = {
10603 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10604 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
10605 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10606 .dac_nids = alc883_dac_nids,
10607 .dig_out_nid = ALC883_DIGOUT_NID,
10608 .dig_in_nid = ALC883_DIGIN_NID,
10609 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10610 .channel_mode = alc883_3ST_6ch_modes,
10612 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10613 .unsol_event = alc_sku_unsol_event,
10614 .setup = alc883_mode2_setup,
10615 .init_hook = alc_inithook,
10617 [ALC888_ASUS_EEE1601] = {
10618 .mixers = { alc883_asus_eee1601_mixer },
10619 .cap_mixer = alc883_asus_eee1601_cap_mixer,
10620 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
10621 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10622 .dac_nids = alc883_dac_nids,
10623 .dig_out_nid = ALC883_DIGOUT_NID,
10624 .dig_in_nid = ALC883_DIGIN_NID,
10625 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10626 .channel_mode = alc883_3ST_2ch_modes,
10628 .input_mux = &alc883_asus_eee1601_capture_source,
10629 .unsol_event = alc_sku_unsol_event,
10630 .init_hook = alc883_eee1601_inithook,
10632 [ALC1200_ASUS_P5Q] = {
10633 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10634 .init_verbs = { alc883_init_verbs },
10635 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10636 .dac_nids = alc883_dac_nids,
10637 .dig_out_nid = ALC1200_DIGOUT_NID,
10638 .dig_in_nid = ALC883_DIGIN_NID,
10639 .slave_dig_outs = alc1200_slave_dig_outs,
10640 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10641 .channel_mode = alc883_sixstack_modes,
10642 .input_mux = &alc883_capture_source,
10645 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
10646 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
10647 alc880_gpio1_init_verbs },
10648 .adc_nids = alc883_adc_nids,
10649 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10650 .capsrc_nids = alc883_capsrc_nids,
10651 .dac_nids = alc883_dac_nids,
10652 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10653 .channel_mode = alc889A_mb31_6ch_modes,
10654 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
10655 .input_mux = &alc889A_mb31_capture_source,
10656 .dig_out_nid = ALC883_DIGOUT_NID,
10657 .unsol_event = alc889A_mb31_unsol_event,
10658 .init_hook = alc889A_mb31_automute,
10660 [ALC883_SONY_VAIO_TT] = {
10661 .mixers = { alc883_vaiott_mixer },
10662 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
10663 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10664 .dac_nids = alc883_dac_nids,
10665 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10666 .channel_mode = alc883_3ST_2ch_modes,
10667 .input_mux = &alc883_capture_source,
10668 .unsol_event = alc_automute_amp_unsol_event,
10669 .setup = alc883_vaiott_setup,
10670 .init_hook = alc_automute_amp,
10679 PINFIX_ABIT_AW9D_MAX,
10681 PINFIX_ACER_ASPIRE_7736,
10684 static const struct alc_fixup alc882_fixups[] = {
10685 [PINFIX_ABIT_AW9D_MAX] = {
10686 .type = ALC_FIXUP_PINS,
10687 .v.pins = (const struct alc_pincfg[]) {
10688 { 0x15, 0x01080104 }, /* side */
10689 { 0x16, 0x01011012 }, /* rear */
10690 { 0x17, 0x01016011 }, /* clfe */
10694 [PINFIX_PB_M5210] = {
10695 .type = ALC_FIXUP_VERBS,
10696 .v.verbs = (const struct hda_verb[]) {
10697 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 },
10701 [PINFIX_ACER_ASPIRE_7736] = {
10702 .type = ALC_FIXUP_SKU,
10703 .v.sku = ALC_FIXUP_SKU_IGNORE,
10707 static struct snd_pci_quirk alc882_fixup_tbl[] = {
10708 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210),
10709 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
10710 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", PINFIX_ACER_ASPIRE_7736),
10715 * BIOS auto configuration
10717 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
10718 const struct auto_pin_cfg *cfg)
10720 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
10723 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
10724 hda_nid_t nid, int pin_type,
10729 /* set as output */
10730 alc_set_pin_output(codec, nid, pin_type);
10734 else if (dac >= 0x02 && dac <= 0x05)
10738 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
10741 static void alc882_auto_init_multi_out(struct hda_codec *codec)
10743 struct alc_spec *spec = codec->spec;
10746 for (i = 0; i <= HDA_SIDE; i++) {
10747 hda_nid_t nid = spec->autocfg.line_out_pins[i];
10748 int pin_type = get_pin_type(spec->autocfg.line_out_type);
10750 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
10751 spec->multiout.dac_nids[i]);
10755 static void alc882_auto_init_hp_out(struct hda_codec *codec)
10757 struct alc_spec *spec = codec->spec;
10758 hda_nid_t pin, dac;
10761 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
10762 pin = spec->autocfg.hp_pins[i];
10765 dac = spec->multiout.hp_nid;
10767 dac = spec->multiout.dac_nids[0]; /* to front */
10768 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac);
10770 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
10771 pin = spec->autocfg.speaker_pins[i];
10774 dac = spec->multiout.extra_out_nid[0];
10776 dac = spec->multiout.dac_nids[0]; /* to front */
10777 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac);
10781 static void alc882_auto_init_analog_input(struct hda_codec *codec)
10783 struct alc_spec *spec = codec->spec;
10784 struct auto_pin_cfg *cfg = &spec->autocfg;
10787 for (i = 0; i < cfg->num_inputs; i++) {
10788 hda_nid_t nid = cfg->inputs[i].pin;
10789 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
10790 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
10791 snd_hda_codec_write(codec, nid, 0,
10792 AC_VERB_SET_AMP_GAIN_MUTE,
10797 static void alc882_auto_init_input_src(struct hda_codec *codec)
10799 struct alc_spec *spec = codec->spec;
10802 for (c = 0; c < spec->num_adc_nids; c++) {
10803 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
10804 hda_nid_t nid = spec->capsrc_nids[c];
10805 unsigned int mux_idx;
10806 const struct hda_input_mux *imux;
10807 int conns, mute, idx, item;
10809 conns = snd_hda_get_connections(codec, nid, conn_list,
10810 ARRAY_SIZE(conn_list));
10813 mux_idx = c >= spec->num_mux_defs ? 0 : c;
10814 imux = &spec->input_mux[mux_idx];
10815 if (!imux->num_items && mux_idx > 0)
10816 imux = &spec->input_mux[0];
10817 for (idx = 0; idx < conns; idx++) {
10818 /* if the current connection is the selected one,
10819 * unmute it as default - otherwise mute it
10821 mute = AMP_IN_MUTE(idx);
10822 for (item = 0; item < imux->num_items; item++) {
10823 if (imux->items[item].index == idx) {
10824 if (spec->cur_mux[c] == item)
10825 mute = AMP_IN_UNMUTE(idx);
10829 /* check if we have a selector or mixer
10830 * we could check for the widget type instead, but
10831 * just check for Amp-In presence (in case of mixer
10832 * without amp-in there is something wrong, this
10833 * function shouldn't be used or capsrc nid is wrong)
10835 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
10836 snd_hda_codec_write(codec, nid, 0,
10837 AC_VERB_SET_AMP_GAIN_MUTE,
10839 else if (mute != AMP_IN_MUTE(idx))
10840 snd_hda_codec_write(codec, nid, 0,
10841 AC_VERB_SET_CONNECT_SEL,
10847 /* add mic boosts if needed */
10848 static int alc_auto_add_mic_boost(struct hda_codec *codec)
10850 struct alc_spec *spec = codec->spec;
10851 struct auto_pin_cfg *cfg = &spec->autocfg;
10855 const char *prev_label = NULL;
10857 for (i = 0; i < cfg->num_inputs; i++) {
10858 if (cfg->inputs[i].type > AUTO_PIN_MIC)
10860 nid = cfg->inputs[i].pin;
10861 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) {
10863 char boost_label[32];
10865 label = hda_get_autocfg_input_label(codec, cfg, i);
10866 if (prev_label && !strcmp(label, prev_label))
10870 prev_label = label;
10872 snprintf(boost_label, sizeof(boost_label),
10873 "%s Boost Volume", label);
10874 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10875 boost_label, type_idx,
10876 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10884 /* almost identical with ALC880 parser... */
10885 static int alc882_parse_auto_config(struct hda_codec *codec)
10887 struct alc_spec *spec = codec->spec;
10888 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
10891 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10895 if (!spec->autocfg.line_outs)
10896 return 0; /* can't find valid BIOS pin config */
10898 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
10901 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
10904 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
10908 err = alc880_auto_create_extra_out(spec,
10909 spec->autocfg.speaker_pins[0],
10913 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
10917 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10919 alc_auto_parse_digital(codec);
10921 if (spec->kctls.list)
10922 add_mixer(spec, spec->kctls.list);
10924 add_verb(spec, alc883_auto_init_verbs);
10925 /* if ADC 0x07 is available, initialize it, too */
10926 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
10927 add_verb(spec, alc882_adc1_init_verbs);
10929 spec->num_mux_defs = 1;
10930 spec->input_mux = &spec->private_imux[0];
10932 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
10934 err = alc_auto_add_mic_boost(codec);
10938 return 1; /* config found */
10941 /* additional initialization for auto-configuration model */
10942 static void alc882_auto_init(struct hda_codec *codec)
10944 struct alc_spec *spec = codec->spec;
10945 alc882_auto_init_multi_out(codec);
10946 alc882_auto_init_hp_out(codec);
10947 alc882_auto_init_analog_input(codec);
10948 alc882_auto_init_input_src(codec);
10949 alc_auto_init_digital(codec);
10950 if (spec->unsol_event)
10951 alc_inithook(codec);
10954 static int patch_alc882(struct hda_codec *codec)
10956 struct alc_spec *spec;
10957 int err, board_config;
10959 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10963 codec->spec = spec;
10965 switch (codec->vendor_id) {
10970 /* ALC883 and variants */
10971 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10975 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
10979 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
10980 board_config = snd_hda_check_board_codec_sid_config(codec,
10981 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
10983 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
10984 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
10986 board_config = ALC882_AUTO;
10989 if (board_config == ALC882_AUTO) {
10990 alc_pick_fixup(codec, NULL, alc882_fixup_tbl, alc882_fixups);
10991 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
10994 alc_auto_parse_customize_define(codec);
10996 if (board_config == ALC882_AUTO) {
10997 /* automatic parse from the BIOS config */
10998 err = alc882_parse_auto_config(codec);
11004 "hda_codec: Cannot set up configuration "
11005 "from BIOS. Using base mode...\n");
11006 board_config = ALC882_3ST_DIG;
11010 if (has_cdefine_beep(codec)) {
11011 err = snd_hda_attach_beep_device(codec, 0x1);
11018 if (board_config != ALC882_AUTO)
11019 setup_preset(codec, &alc882_presets[board_config]);
11021 spec->stream_analog_playback = &alc882_pcm_analog_playback;
11022 spec->stream_analog_capture = &alc882_pcm_analog_capture;
11023 /* FIXME: setup DAC5 */
11024 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
11025 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
11027 spec->stream_digital_playback = &alc882_pcm_digital_playback;
11028 spec->stream_digital_capture = &alc882_pcm_digital_capture;
11030 if (!spec->adc_nids && spec->input_mux) {
11032 spec->num_adc_nids = 0;
11033 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
11034 const struct hda_input_mux *imux = spec->input_mux;
11036 hda_nid_t items[16];
11037 hda_nid_t nid = alc882_adc_nids[i];
11038 unsigned int wcap = get_wcaps(codec, nid);
11040 wcap = get_wcaps_type(wcap);
11041 if (wcap != AC_WID_AUD_IN)
11043 spec->private_adc_nids[spec->num_adc_nids] = nid;
11044 err = snd_hda_get_connections(codec, nid, &cap, 1);
11047 err = snd_hda_get_connections(codec, cap, items,
11048 ARRAY_SIZE(items));
11051 for (j = 0; j < imux->num_items; j++)
11052 if (imux->items[j].index >= err)
11054 if (j < imux->num_items)
11056 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
11057 spec->num_adc_nids++;
11059 spec->adc_nids = spec->private_adc_nids;
11060 spec->capsrc_nids = spec->private_capsrc_nids;
11063 set_capture_mixer(codec);
11065 if (has_cdefine_beep(codec))
11066 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11068 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
11070 spec->vmaster_nid = 0x0c;
11072 codec->patch_ops = alc_patch_ops;
11073 if (board_config == ALC882_AUTO)
11074 spec->init_hook = alc882_auto_init;
11076 alc_init_jacks(codec);
11077 #ifdef CONFIG_SND_HDA_POWER_SAVE
11078 if (!spec->loopback.amplist)
11079 spec->loopback.amplist = alc882_loopbacks;
11090 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
11091 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
11093 #define alc262_dac_nids alc260_dac_nids
11094 #define alc262_adc_nids alc882_adc_nids
11095 #define alc262_adc_nids_alt alc882_adc_nids_alt
11096 #define alc262_capsrc_nids alc882_capsrc_nids
11097 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
11099 #define alc262_modes alc260_modes
11100 #define alc262_capture_source alc882_capture_source
11102 static hda_nid_t alc262_dmic_adc_nids[1] = {
11107 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
11109 static struct snd_kcontrol_new alc262_base_mixer[] = {
11110 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11111 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11112 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11113 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11114 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11115 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11116 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11117 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11118 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11119 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11120 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11121 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11122 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
11123 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11124 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
11125 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
11129 /* update HP, line and mono-out pins according to the master switch */
11130 static void alc262_hp_master_update(struct hda_codec *codec)
11132 struct alc_spec *spec = codec->spec;
11133 int val = spec->master_sw;
11135 /* HP & line-out */
11136 snd_hda_codec_write_cache(codec, 0x1b, 0,
11137 AC_VERB_SET_PIN_WIDGET_CONTROL,
11139 snd_hda_codec_write_cache(codec, 0x15, 0,
11140 AC_VERB_SET_PIN_WIDGET_CONTROL,
11142 /* mono (speaker) depending on the HP jack sense */
11143 val = val && !spec->jack_present;
11144 snd_hda_codec_write_cache(codec, 0x16, 0,
11145 AC_VERB_SET_PIN_WIDGET_CONTROL,
11146 val ? PIN_OUT : 0);
11149 static void alc262_hp_bpc_automute(struct hda_codec *codec)
11151 struct alc_spec *spec = codec->spec;
11153 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
11154 alc262_hp_master_update(codec);
11157 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
11159 if ((res >> 26) != ALC880_HP_EVENT)
11161 alc262_hp_bpc_automute(codec);
11164 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
11166 struct alc_spec *spec = codec->spec;
11168 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11169 alc262_hp_master_update(codec);
11172 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
11175 if ((res >> 26) != ALC880_HP_EVENT)
11177 alc262_hp_wildwest_automute(codec);
11180 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
11182 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
11183 struct snd_ctl_elem_value *ucontrol)
11185 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11186 struct alc_spec *spec = codec->spec;
11187 int val = !!*ucontrol->value.integer.value;
11189 if (val == spec->master_sw)
11191 spec->master_sw = val;
11192 alc262_hp_master_update(codec);
11196 #define ALC262_HP_MASTER_SWITCH \
11198 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
11199 .name = "Master Playback Switch", \
11200 .info = snd_ctl_boolean_mono_info, \
11201 .get = alc262_hp_master_sw_get, \
11202 .put = alc262_hp_master_sw_put, \
11205 .iface = NID_MAPPING, \
11206 .name = "Master Playback Switch", \
11207 .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \
11211 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
11212 ALC262_HP_MASTER_SWITCH,
11213 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11214 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11215 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11216 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
11218 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
11220 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11221 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11222 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11223 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11224 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11225 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11226 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11227 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11228 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11229 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11230 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
11231 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
11235 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
11236 ALC262_HP_MASTER_SWITCH,
11237 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11238 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11239 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11240 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11241 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
11243 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
11245 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
11246 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
11247 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x1a, 0, HDA_INPUT),
11248 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
11249 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
11250 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11251 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11255 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
11256 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11257 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11258 HDA_CODEC_VOLUME("Rear Mic Boost Volume", 0x18, 0, HDA_INPUT),
11262 /* mute/unmute internal speaker according to the hp jack and mute state */
11263 static void alc262_hp_t5735_setup(struct hda_codec *codec)
11265 struct alc_spec *spec = codec->spec;
11267 spec->autocfg.hp_pins[0] = 0x15;
11268 spec->autocfg.speaker_pins[0] = 0x14;
11271 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
11272 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11273 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11274 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11275 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11276 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11277 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11278 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11282 static struct hda_verb alc262_hp_t5735_verbs[] = {
11283 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11284 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11286 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11290 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
11291 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11292 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11293 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
11294 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
11295 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
11296 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
11300 static struct hda_verb alc262_hp_rp5700_verbs[] = {
11301 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11302 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11303 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11304 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11305 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11306 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11307 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11308 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11309 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
11310 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
11314 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
11321 /* bind hp and internal speaker mute (with plug check) as master switch */
11322 static void alc262_hippo_master_update(struct hda_codec *codec)
11324 struct alc_spec *spec = codec->spec;
11325 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11326 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
11327 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
11331 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
11332 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
11333 HDA_AMP_MUTE, mute);
11334 /* mute internal speaker per jack sense */
11335 if (spec->jack_present)
11336 mute = HDA_AMP_MUTE;
11338 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
11339 HDA_AMP_MUTE, mute);
11340 if (speaker_nid && speaker_nid != line_nid)
11341 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
11342 HDA_AMP_MUTE, mute);
11345 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
11347 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
11348 struct snd_ctl_elem_value *ucontrol)
11350 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11351 struct alc_spec *spec = codec->spec;
11352 int val = !!*ucontrol->value.integer.value;
11354 if (val == spec->master_sw)
11356 spec->master_sw = val;
11357 alc262_hippo_master_update(codec);
11361 #define ALC262_HIPPO_MASTER_SWITCH \
11363 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
11364 .name = "Master Playback Switch", \
11365 .info = snd_ctl_boolean_mono_info, \
11366 .get = alc262_hippo_master_sw_get, \
11367 .put = alc262_hippo_master_sw_put, \
11370 .iface = NID_MAPPING, \
11371 .name = "Master Playback Switch", \
11372 .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \
11373 (SUBDEV_SPEAKER(0) << 16), \
11376 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
11377 ALC262_HIPPO_MASTER_SWITCH,
11378 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11379 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11380 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11381 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11382 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11383 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11384 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11385 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11386 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11387 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11388 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11389 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11393 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
11394 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11395 ALC262_HIPPO_MASTER_SWITCH,
11396 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11397 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11398 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11399 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11400 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11401 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11402 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11403 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11404 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11405 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11409 /* mute/unmute internal speaker according to the hp jack and mute state */
11410 static void alc262_hippo_automute(struct hda_codec *codec)
11412 struct alc_spec *spec = codec->spec;
11413 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11415 spec->jack_present = snd_hda_jack_detect(codec, hp_nid);
11416 alc262_hippo_master_update(codec);
11419 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
11421 if ((res >> 26) != ALC880_HP_EVENT)
11423 alc262_hippo_automute(codec);
11426 static void alc262_hippo_setup(struct hda_codec *codec)
11428 struct alc_spec *spec = codec->spec;
11430 spec->autocfg.hp_pins[0] = 0x15;
11431 spec->autocfg.speaker_pins[0] = 0x14;
11434 static void alc262_hippo1_setup(struct hda_codec *codec)
11436 struct alc_spec *spec = codec->spec;
11438 spec->autocfg.hp_pins[0] = 0x1b;
11439 spec->autocfg.speaker_pins[0] = 0x14;
11443 static struct snd_kcontrol_new alc262_sony_mixer[] = {
11444 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11445 ALC262_HIPPO_MASTER_SWITCH,
11446 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11447 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11448 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11449 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11453 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
11454 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11455 ALC262_HIPPO_MASTER_SWITCH,
11456 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11457 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11458 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11459 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11460 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11464 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
11465 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11466 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11467 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
11468 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
11469 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11470 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11471 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11472 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11473 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11474 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11475 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11476 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11480 static struct hda_verb alc262_tyan_verbs[] = {
11481 /* Headphone automute */
11482 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11483 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11484 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11486 /* P11 AUX_IN, white 4-pin connector */
11487 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11488 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
11489 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
11490 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
11495 /* unsolicited event for HP jack sensing */
11496 static void alc262_tyan_setup(struct hda_codec *codec)
11498 struct alc_spec *spec = codec->spec;
11500 spec->autocfg.hp_pins[0] = 0x1b;
11501 spec->autocfg.speaker_pins[0] = 0x15;
11505 #define alc262_capture_mixer alc882_capture_mixer
11506 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
11509 * generic initialization of ADC, input mixers and output mixers
11511 static struct hda_verb alc262_init_verbs[] = {
11513 * Unmute ADC0-2 and set the default input to mic-in
11515 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11516 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11517 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11518 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11519 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11520 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11522 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11524 * Note: PASD motherboards uses the Line In 2 as the input for
11525 * front panel mic (mic 2)
11527 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11528 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11529 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11530 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11531 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11532 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11535 * Set up output mixers (0x0c - 0x0e)
11537 /* set vol=0 to output mixers */
11538 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11539 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11540 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11541 /* set up input amps for analog loopback */
11542 /* Amp Indices: DAC = 0, mixer = 1 */
11543 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11544 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11545 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11546 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11547 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11548 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11550 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11551 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11552 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11553 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11554 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11555 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11557 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11558 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11559 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11560 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11561 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11563 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11564 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11566 /* FIXME: use matrix-type input source selection */
11567 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11568 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11569 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11570 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11571 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11572 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11574 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11575 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11576 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11577 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11579 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11580 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11581 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11582 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11587 static struct hda_verb alc262_eapd_verbs[] = {
11588 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11589 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11593 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
11594 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11595 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11596 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11598 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11599 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11603 static struct hda_verb alc262_sony_unsol_verbs[] = {
11604 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11605 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11606 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
11608 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11609 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11613 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
11614 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11615 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11616 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11617 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11618 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11622 static struct hda_verb alc262_toshiba_s06_verbs[] = {
11623 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11624 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11625 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11626 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11627 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
11628 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11629 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11630 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11634 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
11636 struct alc_spec *spec = codec->spec;
11638 spec->autocfg.hp_pins[0] = 0x15;
11639 spec->autocfg.speaker_pins[0] = 0x14;
11640 spec->ext_mic.pin = 0x18;
11641 spec->ext_mic.mux_idx = 0;
11642 spec->int_mic.pin = 0x12;
11643 spec->int_mic.mux_idx = 9;
11644 spec->auto_mic = 1;
11650 * 0x16 = internal speaker
11651 * 0x18 = external mic
11654 static struct snd_kcontrol_new alc262_nec_mixer[] = {
11655 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
11656 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
11658 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11659 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11660 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11662 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11663 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11667 static struct hda_verb alc262_nec_verbs[] = {
11668 /* Unmute Speaker */
11669 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11672 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11673 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11675 /* External mic to headphone */
11676 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11677 /* External mic to speaker */
11678 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11684 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
11685 * 0x1b = port replicator headphone out
11688 #define ALC_HP_EVENT 0x37
11690 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
11691 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11692 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11693 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11694 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11698 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
11699 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11700 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11704 static struct hda_verb alc262_lenovo_3000_init_verbs[] = {
11705 /* Front Mic pin: input vref at 50% */
11706 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
11707 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11711 static struct hda_input_mux alc262_fujitsu_capture_source = {
11715 { "Internal Mic", 0x1 },
11720 static struct hda_input_mux alc262_HP_capture_source = {
11724 { "Front Mic", 0x1 },
11731 static struct hda_input_mux alc262_HP_D7000_capture_source = {
11735 { "Front Mic", 0x2 },
11741 /* mute/unmute internal speaker according to the hp jacks and mute state */
11742 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
11744 struct alc_spec *spec = codec->spec;
11747 if (force || !spec->sense_updated) {
11748 spec->jack_present = snd_hda_jack_detect(codec, 0x14) ||
11749 snd_hda_jack_detect(codec, 0x1b);
11750 spec->sense_updated = 1;
11752 /* unmute internal speaker only if both HPs are unplugged and
11753 * master switch is on
11755 if (spec->jack_present)
11756 mute = HDA_AMP_MUTE;
11758 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11759 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11760 HDA_AMP_MUTE, mute);
11763 /* unsolicited event for HP jack sensing */
11764 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
11767 if ((res >> 26) != ALC_HP_EVENT)
11769 alc262_fujitsu_automute(codec, 1);
11772 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
11774 alc262_fujitsu_automute(codec, 1);
11777 /* bind volumes of both NID 0x0c and 0x0d */
11778 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
11779 .ops = &snd_hda_bind_vol,
11781 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
11782 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
11787 /* mute/unmute internal speaker according to the hp jack and mute state */
11788 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
11790 struct alc_spec *spec = codec->spec;
11793 if (force || !spec->sense_updated) {
11794 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
11795 spec->sense_updated = 1;
11797 if (spec->jack_present) {
11798 /* mute internal speaker */
11799 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11800 HDA_AMP_MUTE, HDA_AMP_MUTE);
11801 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11802 HDA_AMP_MUTE, HDA_AMP_MUTE);
11804 /* unmute internal speaker if necessary */
11805 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
11806 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11807 HDA_AMP_MUTE, mute);
11808 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11809 HDA_AMP_MUTE, mute);
11813 /* unsolicited event for HP jack sensing */
11814 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
11817 if ((res >> 26) != ALC_HP_EVENT)
11819 alc262_lenovo_3000_automute(codec, 1);
11822 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
11823 int dir, int idx, long *valp)
11827 for (i = 0; i < 2; i++, valp++)
11828 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
11830 *valp ? 0 : HDA_AMP_MUTE);
11834 /* bind hp and internal speaker mute (with plug check) */
11835 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
11836 struct snd_ctl_elem_value *ucontrol)
11838 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11839 long *valp = ucontrol->value.integer.value;
11842 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
11843 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11845 alc262_fujitsu_automute(codec, 0);
11849 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
11850 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11852 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11853 .name = "Master Playback Switch",
11854 .subdevice = HDA_SUBDEV_AMP_FLAG,
11855 .info = snd_hda_mixer_amp_switch_info,
11856 .get = snd_hda_mixer_amp_switch_get,
11857 .put = alc262_fujitsu_master_sw_put,
11858 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11861 .iface = NID_MAPPING,
11862 .name = "Master Playback Switch",
11863 .private_value = 0x1b,
11865 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11866 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11867 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11868 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11869 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11870 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
11871 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11872 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11876 /* bind hp and internal speaker mute (with plug check) */
11877 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
11878 struct snd_ctl_elem_value *ucontrol)
11880 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11881 long *valp = ucontrol->value.integer.value;
11884 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11886 alc262_lenovo_3000_automute(codec, 0);
11890 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
11891 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11893 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11894 .name = "Master Playback Switch",
11895 .subdevice = HDA_SUBDEV_AMP_FLAG,
11896 .info = snd_hda_mixer_amp_switch_info,
11897 .get = snd_hda_mixer_amp_switch_get,
11898 .put = alc262_lenovo_3000_master_sw_put,
11899 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
11901 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11902 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11903 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11904 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11905 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11906 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
11907 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11908 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11912 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
11913 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11914 ALC262_HIPPO_MASTER_SWITCH,
11915 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11916 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11917 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11918 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11919 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11920 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11924 /* additional init verbs for Benq laptops */
11925 static struct hda_verb alc262_EAPD_verbs[] = {
11926 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11927 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
11931 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
11932 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11933 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11935 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11936 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
11940 /* Samsung Q1 Ultra Vista model setup */
11941 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
11942 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11943 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11944 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11945 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11946 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT),
11947 HDA_CODEC_VOLUME("Headphone Mic Boost Volume", 0x15, 0, HDA_INPUT),
11951 static struct hda_verb alc262_ultra_verbs[] = {
11953 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11954 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11955 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11957 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11958 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11959 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11960 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11962 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11963 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11964 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11965 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11966 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11968 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11969 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11970 /* ADC, choose mic */
11971 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11972 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11973 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11974 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11975 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11976 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11977 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11978 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11979 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11980 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
11984 /* mute/unmute internal speaker according to the hp jack and mute state */
11985 static void alc262_ultra_automute(struct hda_codec *codec)
11987 struct alc_spec *spec = codec->spec;
11991 /* auto-mute only when HP is used as HP */
11992 if (!spec->cur_mux[0]) {
11993 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11994 if (spec->jack_present)
11995 mute = HDA_AMP_MUTE;
11997 /* mute/unmute internal speaker */
11998 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11999 HDA_AMP_MUTE, mute);
12000 /* mute/unmute HP */
12001 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12002 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
12005 /* unsolicited event for HP jack sensing */
12006 static void alc262_ultra_unsol_event(struct hda_codec *codec,
12009 if ((res >> 26) != ALC880_HP_EVENT)
12011 alc262_ultra_automute(codec);
12014 static struct hda_input_mux alc262_ultra_capture_source = {
12018 { "Headphone", 0x7 },
12022 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
12023 struct snd_ctl_elem_value *ucontrol)
12025 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12026 struct alc_spec *spec = codec->spec;
12029 ret = alc_mux_enum_put(kcontrol, ucontrol);
12032 /* reprogram the HP pin as mic or HP according to the input source */
12033 snd_hda_codec_write_cache(codec, 0x15, 0,
12034 AC_VERB_SET_PIN_WIDGET_CONTROL,
12035 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
12036 alc262_ultra_automute(codec); /* mute/unmute HP */
12040 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
12041 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
12042 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
12044 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12045 .name = "Capture Source",
12046 .info = alc_mux_enum_info,
12047 .get = alc_mux_enum_get,
12048 .put = alc262_ultra_mux_enum_put,
12051 .iface = NID_MAPPING,
12052 .name = "Capture Source",
12053 .private_value = 0x15,
12058 /* We use two mixers depending on the output pin; 0x16 is a mono output
12059 * and thus it's bound with a different mixer.
12060 * This function returns which mixer amp should be used.
12062 static int alc262_check_volbit(hda_nid_t nid)
12066 else if (nid == 0x16)
12072 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
12073 const char *pfx, int *vbits, int idx)
12078 vbit = alc262_check_volbit(nid);
12081 if (*vbits & vbit) /* a volume control for this mixer already there */
12085 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
12087 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
12088 return __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, idx, val);
12091 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
12092 const char *pfx, int idx)
12099 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
12101 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
12102 return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, idx, val);
12105 /* add playback controls from the parsed DAC table */
12106 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
12107 const struct auto_pin_cfg *cfg)
12113 spec->multiout.num_dacs = 1; /* only use one dac */
12114 spec->multiout.dac_nids = spec->private_dac_nids;
12115 spec->multiout.dac_nids[0] = 2;
12117 pfx = alc_get_line_out_pfx(cfg, true);
12120 for (i = 0; i < 2; i++) {
12121 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[i], pfx, i);
12124 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) {
12125 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[i],
12130 if (cfg->line_out_type != AUTO_PIN_HP_OUT) {
12131 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[i],
12138 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
12139 alc262_check_volbit(cfg->speaker_pins[0]) |
12140 alc262_check_volbit(cfg->hp_pins[0]);
12141 if (vbits == 1 || vbits == 2)
12142 pfx = "Master"; /* only one mixer is used */
12144 for (i = 0; i < 2; i++) {
12145 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[i], pfx,
12149 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) {
12150 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[i],
12151 "Speaker", &vbits, i);
12155 if (cfg->line_out_type != AUTO_PIN_HP_OUT) {
12156 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[i],
12157 "Headphone", &vbits, i);
12165 #define alc262_auto_create_input_ctls \
12166 alc882_auto_create_input_ctls
12169 * generic initialization of ADC, input mixers and output mixers
12171 static struct hda_verb alc262_volume_init_verbs[] = {
12173 * Unmute ADC0-2 and set the default input to mic-in
12175 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12176 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12177 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12178 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12179 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12180 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12182 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12184 * Note: PASD motherboards uses the Line In 2 as the input for
12185 * front panel mic (mic 2)
12187 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12188 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12189 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12190 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12191 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12192 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12195 * Set up output mixers (0x0c - 0x0f)
12197 /* set vol=0 to output mixers */
12198 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12199 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12200 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12202 /* set up input amps for analog loopback */
12203 /* Amp Indices: DAC = 0, mixer = 1 */
12204 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12205 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12206 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12207 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12208 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12209 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12211 /* FIXME: use matrix-type input source selection */
12212 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12213 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12214 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12215 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12216 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12217 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12219 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12220 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12221 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12222 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12224 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12225 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12226 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12227 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12232 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
12234 * Unmute ADC0-2 and set the default input to mic-in
12236 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12237 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12238 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12239 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12240 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12241 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12243 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12245 * Note: PASD motherboards uses the Line In 2 as the input for
12246 * front panel mic (mic 2)
12248 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12249 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12250 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12251 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12252 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12253 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12254 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12255 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
12258 * Set up output mixers (0x0c - 0x0e)
12260 /* set vol=0 to output mixers */
12261 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12262 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12263 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12265 /* set up input amps for analog loopback */
12266 /* Amp Indices: DAC = 0, mixer = 1 */
12267 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12268 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12269 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12270 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12271 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12272 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12274 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12275 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12276 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12278 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12279 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12281 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12282 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12284 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12285 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12286 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12287 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12288 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12290 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12291 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12292 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12293 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12294 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12295 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12298 /* FIXME: use matrix-type input source selection */
12299 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
12300 /* Input mixer1: only unmute Mic */
12301 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12302 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12303 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12304 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12305 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12306 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12307 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12308 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12309 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12311 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12312 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12313 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12314 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12315 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12316 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12317 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12318 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12319 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12321 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12322 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12323 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12324 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12325 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12326 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12327 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12328 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12329 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12331 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12336 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
12338 * Unmute ADC0-2 and set the default input to mic-in
12340 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12341 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12342 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12343 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12344 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12345 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12347 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12349 * Note: PASD motherboards uses the Line In 2 as the input for front
12350 * panel mic (mic 2)
12352 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12353 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12354 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12355 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12356 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12357 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12358 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12359 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
12360 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
12362 * Set up output mixers (0x0c - 0x0e)
12364 /* set vol=0 to output mixers */
12365 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12366 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12367 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12369 /* set up input amps for analog loopback */
12370 /* Amp Indices: DAC = 0, mixer = 1 */
12371 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12372 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12373 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12374 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12375 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12376 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12379 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
12380 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
12381 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
12382 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
12383 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
12384 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
12385 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
12387 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12388 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12390 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12391 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12393 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
12394 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12395 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12396 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
12397 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12398 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12400 /* FIXME: use matrix-type input source selection */
12401 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12402 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12403 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
12404 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
12405 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
12406 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
12407 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
12408 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12409 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
12411 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12412 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
12413 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
12414 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
12415 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
12416 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12417 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
12419 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12420 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
12421 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
12422 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
12423 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
12424 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12425 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
12427 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12432 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
12434 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
12435 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12436 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
12438 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
12439 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
12440 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
12441 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
12443 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
12444 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12445 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12456 static const struct alc_fixup alc262_fixups[] = {
12457 [PINFIX_FSC_H270] = {
12458 .type = ALC_FIXUP_PINS,
12459 .v.pins = (const struct alc_pincfg[]) {
12460 { 0x14, 0x99130110 }, /* speaker */
12461 { 0x15, 0x0221142f }, /* front HP */
12462 { 0x1b, 0x0121141f }, /* rear HP */
12468 static struct snd_pci_quirk alc262_fixup_tbl[] = {
12469 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", PINFIX_FSC_H270),
12474 #ifdef CONFIG_SND_HDA_POWER_SAVE
12475 #define alc262_loopbacks alc880_loopbacks
12478 /* pcm configuration: identical with ALC880 */
12479 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
12480 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
12481 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
12482 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
12485 * BIOS auto configuration
12487 static int alc262_parse_auto_config(struct hda_codec *codec)
12489 struct alc_spec *spec = codec->spec;
12491 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
12493 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12497 if (!spec->autocfg.line_outs) {
12498 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12499 spec->multiout.max_channels = 2;
12500 spec->no_analog = 1;
12503 return 0; /* can't find valid BIOS pin config */
12505 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
12508 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
12512 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12515 alc_auto_parse_digital(codec);
12517 if (spec->kctls.list)
12518 add_mixer(spec, spec->kctls.list);
12520 add_verb(spec, alc262_volume_init_verbs);
12521 spec->num_mux_defs = 1;
12522 spec->input_mux = &spec->private_imux[0];
12524 err = alc_auto_add_mic_boost(codec);
12528 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
12533 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
12534 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
12535 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
12536 #define alc262_auto_init_input_src alc882_auto_init_input_src
12539 /* init callback for auto-configuration model -- overriding the default init */
12540 static void alc262_auto_init(struct hda_codec *codec)
12542 struct alc_spec *spec = codec->spec;
12543 alc262_auto_init_multi_out(codec);
12544 alc262_auto_init_hp_out(codec);
12545 alc262_auto_init_analog_input(codec);
12546 alc262_auto_init_input_src(codec);
12547 alc_auto_init_digital(codec);
12548 if (spec->unsol_event)
12549 alc_inithook(codec);
12553 * configuration and preset
12555 static const char * const alc262_models[ALC262_MODEL_LAST] = {
12556 [ALC262_BASIC] = "basic",
12557 [ALC262_HIPPO] = "hippo",
12558 [ALC262_HIPPO_1] = "hippo_1",
12559 [ALC262_FUJITSU] = "fujitsu",
12560 [ALC262_HP_BPC] = "hp-bpc",
12561 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
12562 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
12563 [ALC262_HP_RP5700] = "hp-rp5700",
12564 [ALC262_BENQ_ED8] = "benq",
12565 [ALC262_BENQ_T31] = "benq-t31",
12566 [ALC262_SONY_ASSAMD] = "sony-assamd",
12567 [ALC262_TOSHIBA_S06] = "toshiba-s06",
12568 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
12569 [ALC262_ULTRA] = "ultra",
12570 [ALC262_LENOVO_3000] = "lenovo-3000",
12571 [ALC262_NEC] = "nec",
12572 [ALC262_TYAN] = "tyan",
12573 [ALC262_AUTO] = "auto",
12576 static struct snd_pci_quirk alc262_cfg_tbl[] = {
12577 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
12578 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
12579 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
12581 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
12583 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1500, "HP z series",
12585 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
12587 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
12588 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
12589 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
12590 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
12591 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
12592 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
12593 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
12594 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
12595 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
12596 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
12597 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
12598 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
12599 ALC262_HP_TC_T5735),
12600 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
12601 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12602 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
12603 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12604 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
12605 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
12606 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
12607 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
12608 #if 0 /* disable the quirk since model=auto works better in recent versions */
12609 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
12610 ALC262_SONY_ASSAMD),
12612 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
12613 ALC262_TOSHIBA_RX1),
12614 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
12615 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
12616 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
12617 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
12618 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
12620 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
12621 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
12622 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
12623 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
12624 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
12628 static struct alc_config_preset alc262_presets[] = {
12630 .mixers = { alc262_base_mixer },
12631 .init_verbs = { alc262_init_verbs },
12632 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12633 .dac_nids = alc262_dac_nids,
12635 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12636 .channel_mode = alc262_modes,
12637 .input_mux = &alc262_capture_source,
12640 .mixers = { alc262_hippo_mixer },
12641 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
12642 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12643 .dac_nids = alc262_dac_nids,
12645 .dig_out_nid = ALC262_DIGOUT_NID,
12646 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12647 .channel_mode = alc262_modes,
12648 .input_mux = &alc262_capture_source,
12649 .unsol_event = alc262_hippo_unsol_event,
12650 .setup = alc262_hippo_setup,
12651 .init_hook = alc262_hippo_automute,
12653 [ALC262_HIPPO_1] = {
12654 .mixers = { alc262_hippo1_mixer },
12655 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
12656 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12657 .dac_nids = alc262_dac_nids,
12659 .dig_out_nid = ALC262_DIGOUT_NID,
12660 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12661 .channel_mode = alc262_modes,
12662 .input_mux = &alc262_capture_source,
12663 .unsol_event = alc262_hippo_unsol_event,
12664 .setup = alc262_hippo1_setup,
12665 .init_hook = alc262_hippo_automute,
12667 [ALC262_FUJITSU] = {
12668 .mixers = { alc262_fujitsu_mixer },
12669 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12670 alc262_fujitsu_unsol_verbs },
12671 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12672 .dac_nids = alc262_dac_nids,
12674 .dig_out_nid = ALC262_DIGOUT_NID,
12675 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12676 .channel_mode = alc262_modes,
12677 .input_mux = &alc262_fujitsu_capture_source,
12678 .unsol_event = alc262_fujitsu_unsol_event,
12679 .init_hook = alc262_fujitsu_init_hook,
12681 [ALC262_HP_BPC] = {
12682 .mixers = { alc262_HP_BPC_mixer },
12683 .init_verbs = { alc262_HP_BPC_init_verbs },
12684 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12685 .dac_nids = alc262_dac_nids,
12687 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12688 .channel_mode = alc262_modes,
12689 .input_mux = &alc262_HP_capture_source,
12690 .unsol_event = alc262_hp_bpc_unsol_event,
12691 .init_hook = alc262_hp_bpc_automute,
12693 [ALC262_HP_BPC_D7000_WF] = {
12694 .mixers = { alc262_HP_BPC_WildWest_mixer },
12695 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12696 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12697 .dac_nids = alc262_dac_nids,
12699 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12700 .channel_mode = alc262_modes,
12701 .input_mux = &alc262_HP_D7000_capture_source,
12702 .unsol_event = alc262_hp_wildwest_unsol_event,
12703 .init_hook = alc262_hp_wildwest_automute,
12705 [ALC262_HP_BPC_D7000_WL] = {
12706 .mixers = { alc262_HP_BPC_WildWest_mixer,
12707 alc262_HP_BPC_WildWest_option_mixer },
12708 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12709 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12710 .dac_nids = alc262_dac_nids,
12712 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12713 .channel_mode = alc262_modes,
12714 .input_mux = &alc262_HP_D7000_capture_source,
12715 .unsol_event = alc262_hp_wildwest_unsol_event,
12716 .init_hook = alc262_hp_wildwest_automute,
12718 [ALC262_HP_TC_T5735] = {
12719 .mixers = { alc262_hp_t5735_mixer },
12720 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
12721 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12722 .dac_nids = alc262_dac_nids,
12724 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12725 .channel_mode = alc262_modes,
12726 .input_mux = &alc262_capture_source,
12727 .unsol_event = alc_sku_unsol_event,
12728 .setup = alc262_hp_t5735_setup,
12729 .init_hook = alc_inithook,
12731 [ALC262_HP_RP5700] = {
12732 .mixers = { alc262_hp_rp5700_mixer },
12733 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
12734 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12735 .dac_nids = alc262_dac_nids,
12736 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12737 .channel_mode = alc262_modes,
12738 .input_mux = &alc262_hp_rp5700_capture_source,
12740 [ALC262_BENQ_ED8] = {
12741 .mixers = { alc262_base_mixer },
12742 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
12743 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12744 .dac_nids = alc262_dac_nids,
12746 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12747 .channel_mode = alc262_modes,
12748 .input_mux = &alc262_capture_source,
12750 [ALC262_SONY_ASSAMD] = {
12751 .mixers = { alc262_sony_mixer },
12752 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
12753 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12754 .dac_nids = alc262_dac_nids,
12756 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12757 .channel_mode = alc262_modes,
12758 .input_mux = &alc262_capture_source,
12759 .unsol_event = alc262_hippo_unsol_event,
12760 .setup = alc262_hippo_setup,
12761 .init_hook = alc262_hippo_automute,
12763 [ALC262_BENQ_T31] = {
12764 .mixers = { alc262_benq_t31_mixer },
12765 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
12766 alc_hp15_unsol_verbs },
12767 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12768 .dac_nids = alc262_dac_nids,
12770 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12771 .channel_mode = alc262_modes,
12772 .input_mux = &alc262_capture_source,
12773 .unsol_event = alc262_hippo_unsol_event,
12774 .setup = alc262_hippo_setup,
12775 .init_hook = alc262_hippo_automute,
12778 .mixers = { alc262_ultra_mixer },
12779 .cap_mixer = alc262_ultra_capture_mixer,
12780 .init_verbs = { alc262_ultra_verbs },
12781 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12782 .dac_nids = alc262_dac_nids,
12783 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12784 .channel_mode = alc262_modes,
12785 .input_mux = &alc262_ultra_capture_source,
12786 .adc_nids = alc262_adc_nids, /* ADC0 */
12787 .capsrc_nids = alc262_capsrc_nids,
12788 .num_adc_nids = 1, /* single ADC */
12789 .unsol_event = alc262_ultra_unsol_event,
12790 .init_hook = alc262_ultra_automute,
12792 [ALC262_LENOVO_3000] = {
12793 .mixers = { alc262_lenovo_3000_mixer },
12794 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12795 alc262_lenovo_3000_unsol_verbs,
12796 alc262_lenovo_3000_init_verbs },
12797 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12798 .dac_nids = alc262_dac_nids,
12800 .dig_out_nid = ALC262_DIGOUT_NID,
12801 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12802 .channel_mode = alc262_modes,
12803 .input_mux = &alc262_fujitsu_capture_source,
12804 .unsol_event = alc262_lenovo_3000_unsol_event,
12807 .mixers = { alc262_nec_mixer },
12808 .init_verbs = { alc262_nec_verbs },
12809 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12810 .dac_nids = alc262_dac_nids,
12812 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12813 .channel_mode = alc262_modes,
12814 .input_mux = &alc262_capture_source,
12816 [ALC262_TOSHIBA_S06] = {
12817 .mixers = { alc262_toshiba_s06_mixer },
12818 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
12819 alc262_eapd_verbs },
12820 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12821 .capsrc_nids = alc262_dmic_capsrc_nids,
12822 .dac_nids = alc262_dac_nids,
12823 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
12824 .num_adc_nids = 1, /* single ADC */
12825 .dig_out_nid = ALC262_DIGOUT_NID,
12826 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12827 .channel_mode = alc262_modes,
12828 .unsol_event = alc_sku_unsol_event,
12829 .setup = alc262_toshiba_s06_setup,
12830 .init_hook = alc_inithook,
12832 [ALC262_TOSHIBA_RX1] = {
12833 .mixers = { alc262_toshiba_rx1_mixer },
12834 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
12835 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12836 .dac_nids = alc262_dac_nids,
12838 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12839 .channel_mode = alc262_modes,
12840 .input_mux = &alc262_capture_source,
12841 .unsol_event = alc262_hippo_unsol_event,
12842 .setup = alc262_hippo_setup,
12843 .init_hook = alc262_hippo_automute,
12846 .mixers = { alc262_tyan_mixer },
12847 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
12848 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12849 .dac_nids = alc262_dac_nids,
12851 .dig_out_nid = ALC262_DIGOUT_NID,
12852 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12853 .channel_mode = alc262_modes,
12854 .input_mux = &alc262_capture_source,
12855 .unsol_event = alc_automute_amp_unsol_event,
12856 .setup = alc262_tyan_setup,
12857 .init_hook = alc_automute_amp,
12861 static int patch_alc262(struct hda_codec *codec)
12863 struct alc_spec *spec;
12867 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12871 codec->spec = spec;
12873 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
12878 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12879 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
12880 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12881 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
12884 alc_auto_parse_customize_define(codec);
12886 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
12888 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
12892 if (board_config < 0) {
12893 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12895 board_config = ALC262_AUTO;
12898 if (board_config == ALC262_AUTO) {
12899 alc_pick_fixup(codec, NULL, alc262_fixup_tbl, alc262_fixups);
12900 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
12903 if (board_config == ALC262_AUTO) {
12904 /* automatic parse from the BIOS config */
12905 err = alc262_parse_auto_config(codec);
12911 "hda_codec: Cannot set up configuration "
12912 "from BIOS. Using base mode...\n");
12913 board_config = ALC262_BASIC;
12917 if (!spec->no_analog && has_cdefine_beep(codec)) {
12918 err = snd_hda_attach_beep_device(codec, 0x1);
12925 if (board_config != ALC262_AUTO)
12926 setup_preset(codec, &alc262_presets[board_config]);
12928 spec->stream_analog_playback = &alc262_pcm_analog_playback;
12929 spec->stream_analog_capture = &alc262_pcm_analog_capture;
12931 spec->stream_digital_playback = &alc262_pcm_digital_playback;
12932 spec->stream_digital_capture = &alc262_pcm_digital_capture;
12934 if (!spec->adc_nids && spec->input_mux) {
12936 /* check whether the digital-mic has to be supported */
12937 for (i = 0; i < spec->input_mux->num_items; i++) {
12938 if (spec->input_mux->items[i].index >= 9)
12941 if (i < spec->input_mux->num_items) {
12942 /* use only ADC0 */
12943 spec->adc_nids = alc262_dmic_adc_nids;
12944 spec->num_adc_nids = 1;
12945 spec->capsrc_nids = alc262_dmic_capsrc_nids;
12947 /* all analog inputs */
12948 /* check whether NID 0x07 is valid */
12949 unsigned int wcap = get_wcaps(codec, 0x07);
12952 wcap = get_wcaps_type(wcap);
12953 if (wcap != AC_WID_AUD_IN) {
12954 spec->adc_nids = alc262_adc_nids_alt;
12955 spec->num_adc_nids =
12956 ARRAY_SIZE(alc262_adc_nids_alt);
12957 spec->capsrc_nids = alc262_capsrc_nids_alt;
12959 spec->adc_nids = alc262_adc_nids;
12960 spec->num_adc_nids =
12961 ARRAY_SIZE(alc262_adc_nids);
12962 spec->capsrc_nids = alc262_capsrc_nids;
12966 if (!spec->cap_mixer && !spec->no_analog)
12967 set_capture_mixer(codec);
12968 if (!spec->no_analog && has_cdefine_beep(codec))
12969 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12971 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
12973 spec->vmaster_nid = 0x0c;
12975 codec->patch_ops = alc_patch_ops;
12976 if (board_config == ALC262_AUTO)
12977 spec->init_hook = alc262_auto_init;
12979 alc_init_jacks(codec);
12980 #ifdef CONFIG_SND_HDA_POWER_SAVE
12981 if (!spec->loopback.amplist)
12982 spec->loopback.amplist = alc262_loopbacks;
12989 * ALC268 channel source setting (2 channel)
12991 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
12992 #define alc268_modes alc260_modes
12994 static hda_nid_t alc268_dac_nids[2] = {
12999 static hda_nid_t alc268_adc_nids[2] = {
13004 static hda_nid_t alc268_adc_nids_alt[1] = {
13009 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
13011 static struct snd_kcontrol_new alc268_base_mixer[] = {
13012 /* output mixer control */
13013 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13014 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13015 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13016 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13017 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13018 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
13019 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
13023 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
13024 /* output mixer control */
13025 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13026 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13027 ALC262_HIPPO_MASTER_SWITCH,
13028 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13029 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
13030 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
13034 /* bind Beep switches of both NID 0x0f and 0x10 */
13035 static struct hda_bind_ctls alc268_bind_beep_sw = {
13036 .ops = &snd_hda_bind_sw,
13038 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
13039 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
13044 static struct snd_kcontrol_new alc268_beep_mixer[] = {
13045 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
13046 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
13050 static struct hda_verb alc268_eapd_verbs[] = {
13051 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13052 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13056 /* Toshiba specific */
13057 static struct hda_verb alc268_toshiba_verbs[] = {
13058 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13062 /* Acer specific */
13063 /* bind volumes of both NID 0x02 and 0x03 */
13064 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
13065 .ops = &snd_hda_bind_vol,
13067 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
13068 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
13073 /* mute/unmute internal speaker according to the hp jack and mute state */
13074 static void alc268_acer_automute(struct hda_codec *codec, int force)
13076 struct alc_spec *spec = codec->spec;
13079 if (force || !spec->sense_updated) {
13080 spec->jack_present = snd_hda_jack_detect(codec, 0x14);
13081 spec->sense_updated = 1;
13083 if (spec->jack_present)
13084 mute = HDA_AMP_MUTE; /* mute internal speaker */
13085 else /* unmute internal speaker if necessary */
13086 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
13087 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
13088 HDA_AMP_MUTE, mute);
13092 /* bind hp and internal speaker mute (with plug check) */
13093 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
13094 struct snd_ctl_elem_value *ucontrol)
13096 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
13097 long *valp = ucontrol->value.integer.value;
13100 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
13102 alc268_acer_automute(codec, 0);
13106 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
13107 /* output mixer control */
13108 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13110 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13111 .name = "Master Playback Switch",
13112 .subdevice = HDA_SUBDEV_AMP_FLAG,
13113 .info = snd_hda_mixer_amp_switch_info,
13114 .get = snd_hda_mixer_amp_switch_get,
13115 .put = alc268_acer_master_sw_put,
13116 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13118 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
13122 static struct snd_kcontrol_new alc268_acer_mixer[] = {
13123 /* output mixer control */
13124 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13126 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13127 .name = "Master Playback Switch",
13128 .subdevice = HDA_SUBDEV_AMP_FLAG,
13129 .info = snd_hda_mixer_amp_switch_info,
13130 .get = snd_hda_mixer_amp_switch_get,
13131 .put = alc268_acer_master_sw_put,
13132 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13134 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13135 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
13136 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
13140 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
13141 /* output mixer control */
13142 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13144 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13145 .name = "Master Playback Switch",
13146 .subdevice = HDA_SUBDEV_AMP_FLAG,
13147 .info = snd_hda_mixer_amp_switch_info,
13148 .get = snd_hda_mixer_amp_switch_get,
13149 .put = alc268_acer_master_sw_put,
13150 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13152 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13153 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
13157 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
13158 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13159 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13160 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13161 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13162 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
13163 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
13167 static struct hda_verb alc268_acer_verbs[] = {
13168 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
13169 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13170 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13171 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13172 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13173 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13174 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13178 /* unsolicited event for HP jack sensing */
13179 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
13180 #define alc268_toshiba_setup alc262_hippo_setup
13181 #define alc268_toshiba_automute alc262_hippo_automute
13183 static void alc268_acer_unsol_event(struct hda_codec *codec,
13186 if ((res >> 26) != ALC880_HP_EVENT)
13188 alc268_acer_automute(codec, 1);
13191 static void alc268_acer_init_hook(struct hda_codec *codec)
13193 alc268_acer_automute(codec, 1);
13196 /* toggle speaker-output according to the hp-jack state */
13197 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
13199 unsigned int present;
13200 unsigned char bits;
13202 present = snd_hda_jack_detect(codec, 0x15);
13203 bits = present ? HDA_AMP_MUTE : 0;
13204 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
13205 HDA_AMP_MUTE, bits);
13206 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
13207 HDA_AMP_MUTE, bits);
13210 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
13213 switch (res >> 26) {
13214 case ALC880_HP_EVENT:
13215 alc268_aspire_one_speaker_automute(codec);
13217 case ALC880_MIC_EVENT:
13218 alc_mic_automute(codec);
13223 static void alc268_acer_lc_setup(struct hda_codec *codec)
13225 struct alc_spec *spec = codec->spec;
13226 spec->ext_mic.pin = 0x18;
13227 spec->ext_mic.mux_idx = 0;
13228 spec->int_mic.pin = 0x12;
13229 spec->int_mic.mux_idx = 6;
13230 spec->auto_mic = 1;
13233 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
13235 alc268_aspire_one_speaker_automute(codec);
13236 alc_mic_automute(codec);
13239 static struct snd_kcontrol_new alc268_dell_mixer[] = {
13240 /* output mixer control */
13241 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13242 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13243 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13244 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13245 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13246 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
13250 static struct hda_verb alc268_dell_verbs[] = {
13251 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13252 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13253 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13254 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
13258 /* mute/unmute internal speaker according to the hp jack and mute state */
13259 static void alc268_dell_setup(struct hda_codec *codec)
13261 struct alc_spec *spec = codec->spec;
13263 spec->autocfg.hp_pins[0] = 0x15;
13264 spec->autocfg.speaker_pins[0] = 0x14;
13265 spec->ext_mic.pin = 0x18;
13266 spec->ext_mic.mux_idx = 0;
13267 spec->int_mic.pin = 0x19;
13268 spec->int_mic.mux_idx = 1;
13269 spec->auto_mic = 1;
13272 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
13273 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13274 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13275 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13276 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13277 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13278 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
13279 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13280 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
13284 static struct hda_verb alc267_quanta_il1_verbs[] = {
13285 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13286 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
13290 static void alc267_quanta_il1_setup(struct hda_codec *codec)
13292 struct alc_spec *spec = codec->spec;
13293 spec->autocfg.hp_pins[0] = 0x15;
13294 spec->autocfg.speaker_pins[0] = 0x14;
13295 spec->ext_mic.pin = 0x18;
13296 spec->ext_mic.mux_idx = 0;
13297 spec->int_mic.pin = 0x19;
13298 spec->int_mic.mux_idx = 1;
13299 spec->auto_mic = 1;
13303 * generic initialization of ADC, input mixers and output mixers
13305 static struct hda_verb alc268_base_init_verbs[] = {
13306 /* Unmute DAC0-1 and set vol = 0 */
13307 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13308 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13311 * Set up output mixers (0x0c - 0x0e)
13313 /* set vol=0 to output mixers */
13314 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13315 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
13317 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13318 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13320 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
13321 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
13322 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
13323 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13324 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13325 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13326 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13327 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13329 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13330 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13331 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13332 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13333 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13335 /* set PCBEEP vol = 0, mute connections */
13336 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13337 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13338 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13340 /* Unmute Selector 23h,24h and set the default input to mic-in */
13342 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
13343 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13344 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
13345 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13351 * generic initialization of ADC, input mixers and output mixers
13353 static struct hda_verb alc268_volume_init_verbs[] = {
13354 /* set output DAC */
13355 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13356 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13358 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13359 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13360 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13361 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13362 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13364 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13365 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13366 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13368 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13369 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13371 /* set PCBEEP vol = 0, mute connections */
13372 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13373 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13374 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13379 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
13380 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13381 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13385 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
13386 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13387 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13392 static struct snd_kcontrol_new alc268_capture_mixer[] = {
13393 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13394 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13395 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
13396 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
13401 static struct hda_input_mux alc268_capture_source = {
13405 { "Front Mic", 0x1 },
13411 static struct hda_input_mux alc268_acer_capture_source = {
13415 { "Internal Mic", 0x1 },
13420 static struct hda_input_mux alc268_acer_dmic_capture_source = {
13424 { "Internal Mic", 0x6 },
13429 #ifdef CONFIG_SND_DEBUG
13430 static struct snd_kcontrol_new alc268_test_mixer[] = {
13431 /* Volume widgets */
13432 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13433 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13434 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
13435 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
13436 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
13437 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
13438 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
13439 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
13440 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
13441 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
13442 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
13443 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
13444 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
13445 /* The below appears problematic on some hardwares */
13446 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
13447 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13448 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
13449 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
13450 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
13452 /* Modes for retasking pin widgets */
13453 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
13454 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
13455 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
13456 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
13458 /* Controls for GPIO pins, assuming they are configured as outputs */
13459 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
13460 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
13461 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
13462 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
13464 /* Switches to allow the digital SPDIF output pin to be enabled.
13465 * The ALC268 does not have an SPDIF input.
13467 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
13469 /* A switch allowing EAPD to be enabled. Some laptops seem to use
13470 * this output to turn on an external amplifier.
13472 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
13473 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
13479 /* create input playback/capture controls for the given pin */
13480 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
13481 const char *ctlname, int idx)
13492 case 0x1a: /* ALC259/269 only */
13493 case 0x1b: /* ALC259/269 only */
13494 case 0x21: /* ALC269vb has this pin, too */
13498 snd_printd(KERN_WARNING "hda_codec: "
13499 "ignoring pin 0x%x as unknown\n", nid);
13502 if (spec->multiout.dac_nids[0] != dac &&
13503 spec->multiout.dac_nids[1] != dac) {
13504 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
13505 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
13509 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
13513 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
13514 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
13516 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
13517 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
13523 /* add playback controls from the parsed DAC table */
13524 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
13525 const struct auto_pin_cfg *cfg)
13530 spec->multiout.dac_nids = spec->private_dac_nids;
13532 nid = cfg->line_out_pins[0];
13535 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
13539 err = alc268_new_analog_output(spec, nid, name, 0);
13544 nid = cfg->speaker_pins[0];
13546 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
13547 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
13551 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
13555 nid = cfg->hp_pins[0];
13557 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
13562 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
13564 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
13565 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
13572 /* create playback/capture controls for input pins */
13573 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
13574 const struct auto_pin_cfg *cfg)
13576 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
13579 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
13580 hda_nid_t nid, int pin_type)
13584 alc_set_pin_output(codec, nid, pin_type);
13585 if (nid == 0x14 || nid == 0x16)
13589 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
13592 static void alc268_auto_init_multi_out(struct hda_codec *codec)
13594 struct alc_spec *spec = codec->spec;
13597 for (i = 0; i < spec->autocfg.line_outs; i++) {
13598 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13599 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13600 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
13604 static void alc268_auto_init_hp_out(struct hda_codec *codec)
13606 struct alc_spec *spec = codec->spec;
13610 for (i = 0; i < spec->autocfg.hp_outs; i++) {
13611 pin = spec->autocfg.hp_pins[i];
13612 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
13614 for (i = 0; i < spec->autocfg.speaker_outs; i++) {
13615 pin = spec->autocfg.speaker_pins[i];
13616 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
13618 if (spec->autocfg.mono_out_pin)
13619 snd_hda_codec_write(codec, spec->autocfg.mono_out_pin, 0,
13620 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
13623 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
13625 struct alc_spec *spec = codec->spec;
13626 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
13627 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
13628 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
13629 unsigned int dac_vol1, dac_vol2;
13631 if (line_nid == 0x1d || speaker_nid == 0x1d) {
13632 snd_hda_codec_write(codec, speaker_nid, 0,
13633 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
13634 /* mute mixer inputs from 0x1d */
13635 snd_hda_codec_write(codec, 0x0f, 0,
13636 AC_VERB_SET_AMP_GAIN_MUTE,
13638 snd_hda_codec_write(codec, 0x10, 0,
13639 AC_VERB_SET_AMP_GAIN_MUTE,
13642 /* unmute mixer inputs from 0x1d */
13643 snd_hda_codec_write(codec, 0x0f, 0,
13644 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13645 snd_hda_codec_write(codec, 0x10, 0,
13646 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13649 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
13650 if (line_nid == 0x14)
13651 dac_vol2 = AMP_OUT_ZERO;
13652 else if (line_nid == 0x15)
13653 dac_vol1 = AMP_OUT_ZERO;
13654 if (hp_nid == 0x14)
13655 dac_vol2 = AMP_OUT_ZERO;
13656 else if (hp_nid == 0x15)
13657 dac_vol1 = AMP_OUT_ZERO;
13658 if (line_nid != 0x16 || hp_nid != 0x16 ||
13659 spec->autocfg.line_out_pins[1] != 0x16 ||
13660 spec->autocfg.line_out_pins[2] != 0x16)
13661 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
13663 snd_hda_codec_write(codec, 0x02, 0,
13664 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
13665 snd_hda_codec_write(codec, 0x03, 0,
13666 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
13669 /* pcm configuration: identical with ALC880 */
13670 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
13671 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
13672 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
13673 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
13676 * BIOS auto configuration
13678 static int alc268_parse_auto_config(struct hda_codec *codec)
13680 struct alc_spec *spec = codec->spec;
13682 static hda_nid_t alc268_ignore[] = { 0 };
13684 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13688 if (!spec->autocfg.line_outs) {
13689 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
13690 spec->multiout.max_channels = 2;
13691 spec->no_analog = 1;
13694 return 0; /* can't find valid BIOS pin config */
13696 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
13699 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
13703 spec->multiout.max_channels = 2;
13706 /* digital only support output */
13707 alc_auto_parse_digital(codec);
13708 if (spec->kctls.list)
13709 add_mixer(spec, spec->kctls.list);
13711 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
13712 add_mixer(spec, alc268_beep_mixer);
13714 add_verb(spec, alc268_volume_init_verbs);
13715 spec->num_mux_defs = 2;
13716 spec->input_mux = &spec->private_imux[0];
13718 err = alc_auto_add_mic_boost(codec);
13722 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
13727 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
13729 /* init callback for auto-configuration model -- overriding the default init */
13730 static void alc268_auto_init(struct hda_codec *codec)
13732 struct alc_spec *spec = codec->spec;
13733 alc268_auto_init_multi_out(codec);
13734 alc268_auto_init_hp_out(codec);
13735 alc268_auto_init_mono_speaker_out(codec);
13736 alc268_auto_init_analog_input(codec);
13737 alc_auto_init_digital(codec);
13738 if (spec->unsol_event)
13739 alc_inithook(codec);
13743 * configuration and preset
13745 static const char * const alc268_models[ALC268_MODEL_LAST] = {
13746 [ALC267_QUANTA_IL1] = "quanta-il1",
13747 [ALC268_3ST] = "3stack",
13748 [ALC268_TOSHIBA] = "toshiba",
13749 [ALC268_ACER] = "acer",
13750 [ALC268_ACER_DMIC] = "acer-dmic",
13751 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
13752 [ALC268_DELL] = "dell",
13753 [ALC268_ZEPTO] = "zepto",
13754 #ifdef CONFIG_SND_DEBUG
13755 [ALC268_TEST] = "test",
13757 [ALC268_AUTO] = "auto",
13760 static struct snd_pci_quirk alc268_cfg_tbl[] = {
13761 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
13762 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
13763 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
13764 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
13765 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
13766 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
13767 ALC268_ACER_ASPIRE_ONE),
13768 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
13769 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
13770 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
13771 /* almost compatible with toshiba but with optional digital outs;
13772 * auto-probing seems working fine
13774 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
13776 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
13777 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
13778 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
13779 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
13780 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
13784 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
13785 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
13786 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
13787 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
13788 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
13793 static struct alc_config_preset alc268_presets[] = {
13794 [ALC267_QUANTA_IL1] = {
13795 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
13796 alc268_capture_nosrc_mixer },
13797 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13798 alc267_quanta_il1_verbs },
13799 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13800 .dac_nids = alc268_dac_nids,
13801 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13802 .adc_nids = alc268_adc_nids_alt,
13804 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13805 .channel_mode = alc268_modes,
13806 .unsol_event = alc_sku_unsol_event,
13807 .setup = alc267_quanta_il1_setup,
13808 .init_hook = alc_inithook,
13811 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13812 alc268_beep_mixer },
13813 .init_verbs = { alc268_base_init_verbs },
13814 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13815 .dac_nids = alc268_dac_nids,
13816 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13817 .adc_nids = alc268_adc_nids_alt,
13818 .capsrc_nids = alc268_capsrc_nids,
13820 .dig_out_nid = ALC268_DIGOUT_NID,
13821 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13822 .channel_mode = alc268_modes,
13823 .input_mux = &alc268_capture_source,
13825 [ALC268_TOSHIBA] = {
13826 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
13827 alc268_beep_mixer },
13828 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13829 alc268_toshiba_verbs },
13830 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13831 .dac_nids = alc268_dac_nids,
13832 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13833 .adc_nids = alc268_adc_nids_alt,
13834 .capsrc_nids = alc268_capsrc_nids,
13836 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13837 .channel_mode = alc268_modes,
13838 .input_mux = &alc268_capture_source,
13839 .unsol_event = alc268_toshiba_unsol_event,
13840 .setup = alc268_toshiba_setup,
13841 .init_hook = alc268_toshiba_automute,
13844 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
13845 alc268_beep_mixer },
13846 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13847 alc268_acer_verbs },
13848 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13849 .dac_nids = alc268_dac_nids,
13850 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13851 .adc_nids = alc268_adc_nids_alt,
13852 .capsrc_nids = alc268_capsrc_nids,
13854 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13855 .channel_mode = alc268_modes,
13856 .input_mux = &alc268_acer_capture_source,
13857 .unsol_event = alc268_acer_unsol_event,
13858 .init_hook = alc268_acer_init_hook,
13860 [ALC268_ACER_DMIC] = {
13861 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
13862 alc268_beep_mixer },
13863 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13864 alc268_acer_verbs },
13865 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13866 .dac_nids = alc268_dac_nids,
13867 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13868 .adc_nids = alc268_adc_nids_alt,
13869 .capsrc_nids = alc268_capsrc_nids,
13871 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13872 .channel_mode = alc268_modes,
13873 .input_mux = &alc268_acer_dmic_capture_source,
13874 .unsol_event = alc268_acer_unsol_event,
13875 .init_hook = alc268_acer_init_hook,
13877 [ALC268_ACER_ASPIRE_ONE] = {
13878 .mixers = { alc268_acer_aspire_one_mixer,
13880 alc268_capture_nosrc_mixer },
13881 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13882 alc268_acer_aspire_one_verbs },
13883 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13884 .dac_nids = alc268_dac_nids,
13885 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13886 .adc_nids = alc268_adc_nids_alt,
13887 .capsrc_nids = alc268_capsrc_nids,
13889 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13890 .channel_mode = alc268_modes,
13891 .unsol_event = alc268_acer_lc_unsol_event,
13892 .setup = alc268_acer_lc_setup,
13893 .init_hook = alc268_acer_lc_init_hook,
13896 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
13897 alc268_capture_nosrc_mixer },
13898 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13899 alc268_dell_verbs },
13900 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13901 .dac_nids = alc268_dac_nids,
13902 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13903 .adc_nids = alc268_adc_nids_alt,
13904 .capsrc_nids = alc268_capsrc_nids,
13906 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13907 .channel_mode = alc268_modes,
13908 .unsol_event = alc_sku_unsol_event,
13909 .setup = alc268_dell_setup,
13910 .init_hook = alc_inithook,
13913 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13914 alc268_beep_mixer },
13915 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13916 alc268_toshiba_verbs },
13917 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13918 .dac_nids = alc268_dac_nids,
13919 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13920 .adc_nids = alc268_adc_nids_alt,
13921 .capsrc_nids = alc268_capsrc_nids,
13923 .dig_out_nid = ALC268_DIGOUT_NID,
13924 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13925 .channel_mode = alc268_modes,
13926 .input_mux = &alc268_capture_source,
13927 .setup = alc268_toshiba_setup,
13928 .init_hook = alc268_toshiba_automute,
13930 #ifdef CONFIG_SND_DEBUG
13932 .mixers = { alc268_test_mixer, alc268_capture_mixer },
13933 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13934 alc268_volume_init_verbs },
13935 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13936 .dac_nids = alc268_dac_nids,
13937 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13938 .adc_nids = alc268_adc_nids_alt,
13939 .capsrc_nids = alc268_capsrc_nids,
13941 .dig_out_nid = ALC268_DIGOUT_NID,
13942 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13943 .channel_mode = alc268_modes,
13944 .input_mux = &alc268_capture_source,
13949 static int patch_alc268(struct hda_codec *codec)
13951 struct alc_spec *spec;
13953 int i, has_beep, err;
13955 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13959 codec->spec = spec;
13961 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
13965 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
13966 board_config = snd_hda_check_board_codec_sid_config(codec,
13967 ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
13969 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
13970 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13972 board_config = ALC268_AUTO;
13975 if (board_config == ALC268_AUTO) {
13976 /* automatic parse from the BIOS config */
13977 err = alc268_parse_auto_config(codec);
13983 "hda_codec: Cannot set up configuration "
13984 "from BIOS. Using base mode...\n");
13985 board_config = ALC268_3ST;
13989 if (board_config != ALC268_AUTO)
13990 setup_preset(codec, &alc268_presets[board_config]);
13992 spec->stream_analog_playback = &alc268_pcm_analog_playback;
13993 spec->stream_analog_capture = &alc268_pcm_analog_capture;
13994 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
13996 spec->stream_digital_playback = &alc268_pcm_digital_playback;
13999 for (i = 0; i < spec->num_mixers; i++) {
14000 if (spec->mixers[i] == alc268_beep_mixer) {
14007 err = snd_hda_attach_beep_device(codec, 0x1);
14012 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
14013 /* override the amp caps for beep generator */
14014 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
14015 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
14016 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
14017 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
14018 (0 << AC_AMPCAP_MUTE_SHIFT));
14021 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
14022 /* check whether NID 0x07 is valid */
14023 unsigned int wcap = get_wcaps(codec, 0x07);
14026 spec->capsrc_nids = alc268_capsrc_nids;
14028 wcap = get_wcaps_type(wcap);
14029 if (spec->auto_mic ||
14030 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
14031 spec->adc_nids = alc268_adc_nids_alt;
14032 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
14033 if (spec->auto_mic)
14034 fixup_automic_adc(codec);
14035 if (spec->auto_mic || spec->input_mux->num_items == 1)
14036 add_mixer(spec, alc268_capture_nosrc_mixer);
14038 add_mixer(spec, alc268_capture_alt_mixer);
14040 spec->adc_nids = alc268_adc_nids;
14041 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
14042 add_mixer(spec, alc268_capture_mixer);
14044 /* set default input source */
14045 for (i = 0; i < spec->num_adc_nids; i++)
14046 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
14047 0, AC_VERB_SET_CONNECT_SEL,
14048 i < spec->num_mux_defs ?
14049 spec->input_mux[i].items[0].index :
14050 spec->input_mux->items[0].index);
14053 spec->vmaster_nid = 0x02;
14055 codec->patch_ops = alc_patch_ops;
14056 if (board_config == ALC268_AUTO)
14057 spec->init_hook = alc268_auto_init;
14059 alc_init_jacks(codec);
14065 * ALC269 channel source setting (2 channel)
14067 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
14069 #define alc269_dac_nids alc260_dac_nids
14071 static hda_nid_t alc269_adc_nids[1] = {
14076 static hda_nid_t alc269_capsrc_nids[1] = {
14080 static hda_nid_t alc269vb_adc_nids[1] = {
14085 static hda_nid_t alc269vb_capsrc_nids[1] = {
14089 static hda_nid_t alc269_adc_candidates[] = {
14093 #define alc269_modes alc260_modes
14094 #define alc269_capture_source alc880_lg_lw_capture_source
14096 static struct snd_kcontrol_new alc269_base_mixer[] = {
14097 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14098 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14099 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14100 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14101 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14102 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14103 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14104 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
14105 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
14106 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
14107 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14108 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
14112 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
14113 /* output mixer control */
14114 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
14116 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14117 .name = "Master Playback Switch",
14118 .subdevice = HDA_SUBDEV_AMP_FLAG,
14119 .info = snd_hda_mixer_amp_switch_info,
14120 .get = snd_hda_mixer_amp_switch_get,
14121 .put = alc268_acer_master_sw_put,
14122 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14124 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14125 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14126 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14127 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
14128 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
14129 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
14133 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
14134 /* output mixer control */
14135 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
14137 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14138 .name = "Master Playback Switch",
14139 .subdevice = HDA_SUBDEV_AMP_FLAG,
14140 .info = snd_hda_mixer_amp_switch_info,
14141 .get = snd_hda_mixer_amp_switch_get,
14142 .put = alc268_acer_master_sw_put,
14143 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14145 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14146 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14147 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14148 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
14149 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
14150 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
14151 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
14152 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
14153 HDA_CODEC_VOLUME("Dock Mic Boost Volume", 0x1b, 0, HDA_INPUT),
14157 static struct snd_kcontrol_new alc269_laptop_mixer[] = {
14158 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14159 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14160 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14161 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14165 static struct snd_kcontrol_new alc269vb_laptop_mixer[] = {
14166 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14167 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14168 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
14169 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14173 static struct snd_kcontrol_new alc269_asus_mixer[] = {
14174 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14175 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x0, HDA_INPUT),
14179 /* capture mixer elements */
14180 static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = {
14181 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
14182 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
14183 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14184 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
14188 static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = {
14189 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
14190 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
14191 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14195 static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = {
14196 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
14197 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
14198 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14199 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
14203 static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = {
14204 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
14205 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
14206 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14211 #define alc269_fujitsu_mixer alc269_laptop_mixer
14213 static struct hda_verb alc269_quanta_fl1_verbs[] = {
14214 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14215 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14216 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14217 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
14218 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14219 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14223 static struct hda_verb alc269_lifebook_verbs[] = {
14224 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14225 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
14226 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14227 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14228 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
14229 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14230 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14231 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
14232 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14233 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14237 /* toggle speaker-output according to the hp-jack state */
14238 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
14240 unsigned int present;
14241 unsigned char bits;
14243 present = snd_hda_jack_detect(codec, 0x15);
14244 bits = present ? HDA_AMP_MUTE : 0;
14245 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14246 HDA_AMP_MUTE, bits);
14247 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14248 HDA_AMP_MUTE, bits);
14250 snd_hda_codec_write(codec, 0x20, 0,
14251 AC_VERB_SET_COEF_INDEX, 0x0c);
14252 snd_hda_codec_write(codec, 0x20, 0,
14253 AC_VERB_SET_PROC_COEF, 0x680);
14255 snd_hda_codec_write(codec, 0x20, 0,
14256 AC_VERB_SET_COEF_INDEX, 0x0c);
14257 snd_hda_codec_write(codec, 0x20, 0,
14258 AC_VERB_SET_PROC_COEF, 0x480);
14261 /* toggle speaker-output according to the hp-jacks state */
14262 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
14264 unsigned int present;
14265 unsigned char bits;
14267 /* Check laptop headphone socket */
14268 present = snd_hda_jack_detect(codec, 0x15);
14270 /* Check port replicator headphone socket */
14271 present |= snd_hda_jack_detect(codec, 0x1a);
14273 bits = present ? HDA_AMP_MUTE : 0;
14274 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14275 HDA_AMP_MUTE, bits);
14276 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14277 HDA_AMP_MUTE, bits);
14279 snd_hda_codec_write(codec, 0x20, 0,
14280 AC_VERB_SET_COEF_INDEX, 0x0c);
14281 snd_hda_codec_write(codec, 0x20, 0,
14282 AC_VERB_SET_PROC_COEF, 0x680);
14284 snd_hda_codec_write(codec, 0x20, 0,
14285 AC_VERB_SET_COEF_INDEX, 0x0c);
14286 snd_hda_codec_write(codec, 0x20, 0,
14287 AC_VERB_SET_PROC_COEF, 0x480);
14290 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
14292 unsigned int present_laptop;
14293 unsigned int present_dock;
14295 present_laptop = snd_hda_jack_detect(codec, 0x18);
14296 present_dock = snd_hda_jack_detect(codec, 0x1b);
14298 /* Laptop mic port overrides dock mic port, design decision */
14300 snd_hda_codec_write(codec, 0x23, 0,
14301 AC_VERB_SET_CONNECT_SEL, 0x3);
14302 if (present_laptop)
14303 snd_hda_codec_write(codec, 0x23, 0,
14304 AC_VERB_SET_CONNECT_SEL, 0x0);
14305 if (!present_dock && !present_laptop)
14306 snd_hda_codec_write(codec, 0x23, 0,
14307 AC_VERB_SET_CONNECT_SEL, 0x1);
14310 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
14313 switch (res >> 26) {
14314 case ALC880_HP_EVENT:
14315 alc269_quanta_fl1_speaker_automute(codec);
14317 case ALC880_MIC_EVENT:
14318 alc_mic_automute(codec);
14323 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
14326 if ((res >> 26) == ALC880_HP_EVENT)
14327 alc269_lifebook_speaker_automute(codec);
14328 if ((res >> 26) == ALC880_MIC_EVENT)
14329 alc269_lifebook_mic_autoswitch(codec);
14332 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
14334 struct alc_spec *spec = codec->spec;
14335 spec->autocfg.hp_pins[0] = 0x15;
14336 spec->autocfg.speaker_pins[0] = 0x14;
14337 spec->ext_mic.pin = 0x18;
14338 spec->ext_mic.mux_idx = 0;
14339 spec->int_mic.pin = 0x19;
14340 spec->int_mic.mux_idx = 1;
14341 spec->auto_mic = 1;
14344 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
14346 alc269_quanta_fl1_speaker_automute(codec);
14347 alc_mic_automute(codec);
14350 static void alc269_lifebook_init_hook(struct hda_codec *codec)
14352 alc269_lifebook_speaker_automute(codec);
14353 alc269_lifebook_mic_autoswitch(codec);
14356 static struct hda_verb alc269_laptop_dmic_init_verbs[] = {
14357 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14358 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
14359 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14360 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14361 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14362 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14363 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14367 static struct hda_verb alc269_laptop_amic_init_verbs[] = {
14368 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14369 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
14370 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14371 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
14372 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14373 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14377 static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = {
14378 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
14379 {0x22, AC_VERB_SET_CONNECT_SEL, 0x06},
14380 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14381 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14382 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14383 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14384 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14388 static struct hda_verb alc269vb_laptop_amic_init_verbs[] = {
14389 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
14390 {0x22, AC_VERB_SET_CONNECT_SEL, 0x01},
14391 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14392 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14393 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14394 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14395 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14399 static struct hda_verb alc271_acer_dmic_verbs[] = {
14400 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
14401 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
14402 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14403 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14404 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14405 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14406 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00},
14407 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14408 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14409 {0x22, AC_VERB_SET_CONNECT_SEL, 6},
14413 /* toggle speaker-output according to the hp-jack state */
14414 static void alc269_speaker_automute(struct hda_codec *codec)
14416 struct alc_spec *spec = codec->spec;
14417 unsigned int nid = spec->autocfg.hp_pins[0];
14418 unsigned int present;
14419 unsigned char bits;
14421 present = snd_hda_jack_detect(codec, nid);
14422 bits = present ? HDA_AMP_MUTE : 0;
14423 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14424 HDA_AMP_MUTE, bits);
14425 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14426 HDA_AMP_MUTE, bits);
14427 snd_hda_input_jack_report(codec, nid);
14430 /* unsolicited event for HP jack sensing */
14431 static void alc269_laptop_unsol_event(struct hda_codec *codec,
14434 switch (res >> 26) {
14435 case ALC880_HP_EVENT:
14436 alc269_speaker_automute(codec);
14438 case ALC880_MIC_EVENT:
14439 alc_mic_automute(codec);
14444 static void alc269_laptop_amic_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_laptop_dmic_setup(struct hda_codec *codec)
14458 struct alc_spec *spec = codec->spec;
14459 spec->autocfg.hp_pins[0] = 0x15;
14460 spec->autocfg.speaker_pins[0] = 0x14;
14461 spec->ext_mic.pin = 0x18;
14462 spec->ext_mic.mux_idx = 0;
14463 spec->int_mic.pin = 0x12;
14464 spec->int_mic.mux_idx = 5;
14465 spec->auto_mic = 1;
14468 static void alc269vb_laptop_amic_setup(struct hda_codec *codec)
14470 struct alc_spec *spec = codec->spec;
14471 spec->autocfg.hp_pins[0] = 0x21;
14472 spec->autocfg.speaker_pins[0] = 0x14;
14473 spec->ext_mic.pin = 0x18;
14474 spec->ext_mic.mux_idx = 0;
14475 spec->int_mic.pin = 0x19;
14476 spec->int_mic.mux_idx = 1;
14477 spec->auto_mic = 1;
14480 static void alc269vb_laptop_dmic_setup(struct hda_codec *codec)
14482 struct alc_spec *spec = codec->spec;
14483 spec->autocfg.hp_pins[0] = 0x21;
14484 spec->autocfg.speaker_pins[0] = 0x14;
14485 spec->ext_mic.pin = 0x18;
14486 spec->ext_mic.mux_idx = 0;
14487 spec->int_mic.pin = 0x12;
14488 spec->int_mic.mux_idx = 6;
14489 spec->auto_mic = 1;
14492 static void alc269_laptop_inithook(struct hda_codec *codec)
14494 alc269_speaker_automute(codec);
14495 alc_mic_automute(codec);
14499 * generic initialization of ADC, input mixers and output mixers
14501 static struct hda_verb alc269_init_verbs[] = {
14503 * Unmute ADC0 and set the default input to mic-in
14505 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14508 * Set up output mixers (0x02 - 0x03)
14510 /* set vol=0 to output mixers */
14511 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14512 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14514 /* set up input amps for analog loopback */
14515 /* Amp Indices: DAC = 0, mixer = 1 */
14516 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14517 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14518 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14519 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14520 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14521 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14523 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14524 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14525 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14526 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14527 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14528 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14529 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14531 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14532 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14534 /* FIXME: use Mux-type input source selection */
14535 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14536 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14537 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
14540 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14544 static struct hda_verb alc269vb_init_verbs[] = {
14546 * Unmute ADC0 and set the default input to mic-in
14548 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14551 * Set up output mixers (0x02 - 0x03)
14553 /* set vol=0 to output mixers */
14554 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14555 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14557 /* set up input amps for analog loopback */
14558 /* Amp Indices: DAC = 0, mixer = 1 */
14559 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14560 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14561 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14562 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14563 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14564 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14566 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14567 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14568 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14569 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14570 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14571 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14572 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14574 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14575 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14577 /* FIXME: use Mux-type input source selection */
14578 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14579 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14580 {0x22, AC_VERB_SET_CONNECT_SEL, 0x00},
14583 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14587 #define alc269_auto_create_multi_out_ctls \
14588 alc268_auto_create_multi_out_ctls
14589 #define alc269_auto_create_input_ctls \
14590 alc268_auto_create_input_ctls
14592 #ifdef CONFIG_SND_HDA_POWER_SAVE
14593 #define alc269_loopbacks alc880_loopbacks
14596 /* pcm configuration: identical with ALC880 */
14597 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
14598 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
14599 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
14600 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
14602 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
14606 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14607 /* NID is set in alc_build_pcms */
14609 .open = alc880_playback_pcm_open,
14610 .prepare = alc880_playback_pcm_prepare,
14611 .cleanup = alc880_playback_pcm_cleanup
14615 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
14619 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14620 /* NID is set in alc_build_pcms */
14623 #ifdef CONFIG_SND_HDA_POWER_SAVE
14624 static int alc269_mic2_for_mute_led(struct hda_codec *codec)
14626 switch (codec->subsystem_id) {
14633 static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid)
14635 /* update mute-LED according to the speaker mute state */
14636 if (nid == 0x01 || nid == 0x14) {
14638 if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) &
14643 /* mic2 vref pin is used for mute LED control */
14644 snd_hda_codec_update_cache(codec, 0x19, 0,
14645 AC_VERB_SET_PIN_WIDGET_CONTROL,
14648 return alc_check_power_status(codec, nid);
14650 #endif /* CONFIG_SND_HDA_POWER_SAVE */
14652 static int alc275_setup_dual_adc(struct hda_codec *codec)
14654 struct alc_spec *spec = codec->spec;
14656 if (codec->vendor_id != 0x10ec0275 || !spec->auto_mic)
14658 if ((spec->ext_mic.pin >= 0x18 && spec->int_mic.pin <= 0x13) ||
14659 (spec->ext_mic.pin <= 0x12 && spec->int_mic.pin >= 0x18)) {
14660 if (spec->ext_mic.pin <= 0x12) {
14661 spec->private_adc_nids[0] = 0x08;
14662 spec->private_adc_nids[1] = 0x11;
14663 spec->private_capsrc_nids[0] = 0x23;
14664 spec->private_capsrc_nids[1] = 0x22;
14666 spec->private_adc_nids[0] = 0x11;
14667 spec->private_adc_nids[1] = 0x08;
14668 spec->private_capsrc_nids[0] = 0x22;
14669 spec->private_capsrc_nids[1] = 0x23;
14671 spec->adc_nids = spec->private_adc_nids;
14672 spec->capsrc_nids = spec->private_capsrc_nids;
14673 spec->num_adc_nids = 2;
14674 spec->dual_adc_switch = 1;
14675 snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n",
14676 spec->adc_nids[0], spec->adc_nids[1]);
14682 /* different alc269-variants */
14684 ALC269_TYPE_NORMAL,
14685 ALC269_TYPE_ALC258,
14686 ALC269_TYPE_ALC259,
14687 ALC269_TYPE_ALC269VB,
14688 ALC269_TYPE_ALC270,
14689 ALC269_TYPE_ALC271X,
14693 * BIOS auto configuration
14695 static int alc269_parse_auto_config(struct hda_codec *codec)
14697 struct alc_spec *spec = codec->spec;
14699 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
14701 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14706 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
14709 if (spec->codec_variant == ALC269_TYPE_NORMAL)
14710 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
14712 err = alc_auto_create_input_ctls(codec, &spec->autocfg, 0,
14717 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14719 alc_auto_parse_digital(codec);
14721 if (spec->kctls.list)
14722 add_mixer(spec, spec->kctls.list);
14724 if (spec->codec_variant != ALC269_TYPE_NORMAL) {
14725 add_verb(spec, alc269vb_init_verbs);
14726 alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21);
14728 add_verb(spec, alc269_init_verbs);
14729 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
14732 spec->num_mux_defs = 1;
14733 spec->input_mux = &spec->private_imux[0];
14735 if (!alc275_setup_dual_adc(codec))
14736 fillup_priv_adc_nids(codec, alc269_adc_candidates,
14737 sizeof(alc269_adc_candidates));
14739 /* set default input source */
14740 if (!spec->dual_adc_switch)
14741 select_or_unmute_capsrc(codec, spec->capsrc_nids[0],
14742 spec->input_mux->items[0].index);
14744 err = alc_auto_add_mic_boost(codec);
14748 if (!spec->cap_mixer && !spec->no_analog)
14749 set_capture_mixer(codec);
14754 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
14755 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
14756 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
14759 /* init callback for auto-configuration model -- overriding the default init */
14760 static void alc269_auto_init(struct hda_codec *codec)
14762 struct alc_spec *spec = codec->spec;
14763 alc269_auto_init_multi_out(codec);
14764 alc269_auto_init_hp_out(codec);
14765 alc269_auto_init_analog_input(codec);
14766 alc_auto_init_digital(codec);
14767 if (spec->unsol_event)
14768 alc_inithook(codec);
14771 #ifdef SND_HDA_NEEDS_RESUME
14772 static void alc269_toggle_power_output(struct hda_codec *codec, int power_up)
14774 int val = alc_read_coef_idx(codec, 0x04);
14779 alc_write_coef_idx(codec, 0x04, val);
14782 #ifdef CONFIG_SND_HDA_POWER_SAVE
14783 static int alc269_suspend(struct hda_codec *codec, pm_message_t state)
14785 struct alc_spec *spec = codec->spec;
14787 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017)
14788 alc269_toggle_power_output(codec, 0);
14789 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
14790 alc269_toggle_power_output(codec, 0);
14795 if (spec && spec->power_hook)
14796 spec->power_hook(codec);
14799 #endif /* CONFIG_SND_HDA_POWER_SAVE */
14801 static int alc269_resume(struct hda_codec *codec)
14803 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
14804 alc269_toggle_power_output(codec, 0);
14808 codec->patch_ops.init(codec);
14810 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) {
14811 alc269_toggle_power_output(codec, 1);
14815 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018)
14816 alc269_toggle_power_output(codec, 1);
14818 snd_hda_codec_resume_amp(codec);
14819 snd_hda_codec_resume_cache(codec);
14820 hda_call_check_power_status(codec, 0x01);
14823 #endif /* SND_HDA_NEEDS_RESUME */
14825 static void alc269_fixup_hweq(struct hda_codec *codec,
14826 const struct alc_fixup *fix, int action)
14830 if (action != ALC_FIXUP_ACT_INIT)
14832 coef = alc_read_coef_idx(codec, 0x1e);
14833 alc_write_coef_idx(codec, 0x1e, coef | 0x80);
14837 ALC269_FIXUP_SONY_VAIO,
14838 ALC275_FIXUP_SONY_VAIO_GPIO2,
14839 ALC269_FIXUP_DELL_M101Z,
14840 ALC269_FIXUP_SKU_IGNORE,
14841 ALC269_FIXUP_ASUS_G73JW,
14842 ALC269_FIXUP_LENOVO_EAPD,
14843 ALC275_FIXUP_SONY_HWEQ,
14846 static const struct alc_fixup alc269_fixups[] = {
14847 [ALC269_FIXUP_SONY_VAIO] = {
14848 .type = ALC_FIXUP_VERBS,
14849 .v.verbs = (const struct hda_verb[]) {
14850 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD},
14854 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
14855 .type = ALC_FIXUP_VERBS,
14856 .v.verbs = (const struct hda_verb[]) {
14857 {0x01, AC_VERB_SET_GPIO_MASK, 0x04},
14858 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04},
14859 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
14863 .chain_id = ALC269_FIXUP_SONY_VAIO
14865 [ALC269_FIXUP_DELL_M101Z] = {
14866 .type = ALC_FIXUP_VERBS,
14867 .v.verbs = (const struct hda_verb[]) {
14868 /* Enables internal speaker */
14869 {0x20, AC_VERB_SET_COEF_INDEX, 13},
14870 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
14874 [ALC269_FIXUP_SKU_IGNORE] = {
14875 .type = ALC_FIXUP_SKU,
14876 .v.sku = ALC_FIXUP_SKU_IGNORE,
14878 [ALC269_FIXUP_ASUS_G73JW] = {
14879 .type = ALC_FIXUP_PINS,
14880 .v.pins = (const struct alc_pincfg[]) {
14881 { 0x17, 0x99130111 }, /* subwoofer */
14885 [ALC269_FIXUP_LENOVO_EAPD] = {
14886 .type = ALC_FIXUP_VERBS,
14887 .v.verbs = (const struct hda_verb[]) {
14888 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
14892 [ALC275_FIXUP_SONY_HWEQ] = {
14893 .type = ALC_FIXUP_FUNC,
14894 .v.func = alc269_fixup_hweq,
14896 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
14900 static struct snd_pci_quirk alc269_fixup_tbl[] = {
14901 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
14902 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
14903 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
14904 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
14905 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
14906 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
14907 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
14908 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
14909 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
14910 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
14911 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
14912 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
14918 * configuration and preset
14920 static const char * const alc269_models[ALC269_MODEL_LAST] = {
14921 [ALC269_BASIC] = "basic",
14922 [ALC269_QUANTA_FL1] = "quanta",
14923 [ALC269_AMIC] = "laptop-amic",
14924 [ALC269_DMIC] = "laptop-dmic",
14925 [ALC269_FUJITSU] = "fujitsu",
14926 [ALC269_LIFEBOOK] = "lifebook",
14927 [ALC269_AUTO] = "auto",
14930 static struct snd_pci_quirk alc269_cfg_tbl[] = {
14931 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
14932 SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER),
14933 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
14935 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC),
14936 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC),
14937 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC),
14938 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC),
14939 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC),
14940 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC),
14941 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC),
14942 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC),
14943 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC),
14944 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269VB_AMIC),
14945 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC),
14946 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC),
14947 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC),
14948 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC),
14949 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC),
14950 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC),
14951 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC),
14952 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC),
14953 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC),
14954 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC),
14955 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC),
14956 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC),
14957 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC),
14958 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC),
14959 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC),
14960 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC),
14961 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC),
14962 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC),
14963 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC),
14964 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC),
14965 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC),
14966 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC),
14967 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC),
14968 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC),
14969 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC),
14970 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC),
14971 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
14973 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
14975 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC),
14976 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC),
14977 SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO),
14978 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
14979 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC),
14980 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
14981 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC),
14982 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC),
14983 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC),
14984 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC),
14988 static struct alc_config_preset alc269_presets[] = {
14990 .mixers = { alc269_base_mixer },
14991 .init_verbs = { alc269_init_verbs },
14992 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14993 .dac_nids = alc269_dac_nids,
14995 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14996 .channel_mode = alc269_modes,
14997 .input_mux = &alc269_capture_source,
14999 [ALC269_QUANTA_FL1] = {
15000 .mixers = { alc269_quanta_fl1_mixer },
15001 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
15002 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15003 .dac_nids = alc269_dac_nids,
15005 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15006 .channel_mode = alc269_modes,
15007 .input_mux = &alc269_capture_source,
15008 .unsol_event = alc269_quanta_fl1_unsol_event,
15009 .setup = alc269_quanta_fl1_setup,
15010 .init_hook = alc269_quanta_fl1_init_hook,
15013 .mixers = { alc269_laptop_mixer },
15014 .cap_mixer = alc269_laptop_analog_capture_mixer,
15015 .init_verbs = { alc269_init_verbs,
15016 alc269_laptop_amic_init_verbs },
15017 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15018 .dac_nids = alc269_dac_nids,
15020 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15021 .channel_mode = alc269_modes,
15022 .unsol_event = alc269_laptop_unsol_event,
15023 .setup = alc269_laptop_amic_setup,
15024 .init_hook = alc269_laptop_inithook,
15027 .mixers = { alc269_laptop_mixer },
15028 .cap_mixer = alc269_laptop_digital_capture_mixer,
15029 .init_verbs = { alc269_init_verbs,
15030 alc269_laptop_dmic_init_verbs },
15031 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15032 .dac_nids = alc269_dac_nids,
15034 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15035 .channel_mode = alc269_modes,
15036 .unsol_event = alc269_laptop_unsol_event,
15037 .setup = alc269_laptop_dmic_setup,
15038 .init_hook = alc269_laptop_inithook,
15040 [ALC269VB_AMIC] = {
15041 .mixers = { alc269vb_laptop_mixer },
15042 .cap_mixer = alc269vb_laptop_analog_capture_mixer,
15043 .init_verbs = { alc269vb_init_verbs,
15044 alc269vb_laptop_amic_init_verbs },
15045 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15046 .dac_nids = alc269_dac_nids,
15048 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15049 .channel_mode = alc269_modes,
15050 .unsol_event = alc269_laptop_unsol_event,
15051 .setup = alc269vb_laptop_amic_setup,
15052 .init_hook = alc269_laptop_inithook,
15054 [ALC269VB_DMIC] = {
15055 .mixers = { alc269vb_laptop_mixer },
15056 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
15057 .init_verbs = { alc269vb_init_verbs,
15058 alc269vb_laptop_dmic_init_verbs },
15059 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15060 .dac_nids = alc269_dac_nids,
15062 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15063 .channel_mode = alc269_modes,
15064 .unsol_event = alc269_laptop_unsol_event,
15065 .setup = alc269vb_laptop_dmic_setup,
15066 .init_hook = alc269_laptop_inithook,
15068 [ALC269_FUJITSU] = {
15069 .mixers = { alc269_fujitsu_mixer },
15070 .cap_mixer = alc269_laptop_digital_capture_mixer,
15071 .init_verbs = { alc269_init_verbs,
15072 alc269_laptop_dmic_init_verbs },
15073 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15074 .dac_nids = alc269_dac_nids,
15076 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15077 .channel_mode = alc269_modes,
15078 .unsol_event = alc269_laptop_unsol_event,
15079 .setup = alc269_laptop_dmic_setup,
15080 .init_hook = alc269_laptop_inithook,
15082 [ALC269_LIFEBOOK] = {
15083 .mixers = { alc269_lifebook_mixer },
15084 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
15085 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15086 .dac_nids = alc269_dac_nids,
15088 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15089 .channel_mode = alc269_modes,
15090 .input_mux = &alc269_capture_source,
15091 .unsol_event = alc269_lifebook_unsol_event,
15092 .init_hook = alc269_lifebook_init_hook,
15095 .mixers = { alc269_asus_mixer },
15096 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
15097 .init_verbs = { alc269_init_verbs, alc271_acer_dmic_verbs },
15098 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15099 .dac_nids = alc269_dac_nids,
15100 .adc_nids = alc262_dmic_adc_nids,
15101 .num_adc_nids = ARRAY_SIZE(alc262_dmic_adc_nids),
15102 .capsrc_nids = alc262_dmic_capsrc_nids,
15103 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15104 .channel_mode = alc269_modes,
15105 .input_mux = &alc269_capture_source,
15106 .dig_out_nid = ALC880_DIGOUT_NID,
15107 .unsol_event = alc_sku_unsol_event,
15108 .setup = alc269vb_laptop_dmic_setup,
15109 .init_hook = alc_inithook,
15113 static int alc269_fill_coef(struct hda_codec *codec)
15117 if ((alc_read_coef_idx(codec, 0) & 0x00ff) < 0x015) {
15118 alc_write_coef_idx(codec, 0xf, 0x960b);
15119 alc_write_coef_idx(codec, 0xe, 0x8817);
15122 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x016) {
15123 alc_write_coef_idx(codec, 0xf, 0x960b);
15124 alc_write_coef_idx(codec, 0xe, 0x8814);
15127 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) {
15128 val = alc_read_coef_idx(codec, 0x04);
15129 /* Power up output pin */
15130 alc_write_coef_idx(codec, 0x04, val | (1<<11));
15133 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
15134 val = alc_read_coef_idx(codec, 0xd);
15135 if ((val & 0x0c00) >> 10 != 0x1) {
15136 /* Capless ramp up clock control */
15137 alc_write_coef_idx(codec, 0xd, val | 1<<10);
15139 val = alc_read_coef_idx(codec, 0x17);
15140 if ((val & 0x01c0) >> 6 != 0x4) {
15141 /* Class D power on reset */
15142 alc_write_coef_idx(codec, 0x17, val | 1<<7);
15148 static int patch_alc269(struct hda_codec *codec)
15150 struct alc_spec *spec;
15151 int board_config, coef;
15154 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15158 codec->spec = spec;
15160 alc_auto_parse_customize_define(codec);
15162 if (codec->vendor_id == 0x10ec0269) {
15163 coef = alc_read_coef_idx(codec, 0);
15164 if ((coef & 0x00f0) == 0x0010) {
15165 if (codec->bus->pci->subsystem_vendor == 0x1025 &&
15166 spec->cdefine.platform_type == 1) {
15167 alc_codec_rename(codec, "ALC271X");
15168 spec->codec_variant = ALC269_TYPE_ALC271X;
15169 } else if ((coef & 0xf000) == 0x1000) {
15170 spec->codec_variant = ALC269_TYPE_ALC270;
15171 } else if ((coef & 0xf000) == 0x2000) {
15172 alc_codec_rename(codec, "ALC259");
15173 spec->codec_variant = ALC269_TYPE_ALC259;
15174 } else if ((coef & 0xf000) == 0x3000) {
15175 alc_codec_rename(codec, "ALC258");
15176 spec->codec_variant = ALC269_TYPE_ALC258;
15178 alc_codec_rename(codec, "ALC269VB");
15179 spec->codec_variant = ALC269_TYPE_ALC269VB;
15182 alc_fix_pll_init(codec, 0x20, 0x04, 15);
15183 alc269_fill_coef(codec);
15186 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
15190 if (board_config < 0) {
15191 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15193 board_config = ALC269_AUTO;
15196 if (board_config == ALC269_AUTO) {
15197 alc_pick_fixup(codec, NULL, alc269_fixup_tbl, alc269_fixups);
15198 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
15201 if (board_config == ALC269_AUTO) {
15202 /* automatic parse from the BIOS config */
15203 err = alc269_parse_auto_config(codec);
15209 "hda_codec: Cannot set up configuration "
15210 "from BIOS. Using base mode...\n");
15211 board_config = ALC269_BASIC;
15215 if (has_cdefine_beep(codec)) {
15216 err = snd_hda_attach_beep_device(codec, 0x1);
15223 if (board_config != ALC269_AUTO)
15224 setup_preset(codec, &alc269_presets[board_config]);
15226 if (board_config == ALC269_QUANTA_FL1) {
15227 /* Due to a hardware problem on Lenovo Ideadpad, we need to
15228 * fix the sample rate of analog I/O to 44.1kHz
15230 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
15231 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
15232 } else if (spec->dual_adc_switch) {
15233 spec->stream_analog_playback = &alc269_pcm_analog_playback;
15234 /* switch ADC dynamically */
15235 spec->stream_analog_capture = &dualmic_pcm_analog_capture;
15237 spec->stream_analog_playback = &alc269_pcm_analog_playback;
15238 spec->stream_analog_capture = &alc269_pcm_analog_capture;
15240 spec->stream_digital_playback = &alc269_pcm_digital_playback;
15241 spec->stream_digital_capture = &alc269_pcm_digital_capture;
15243 if (!spec->adc_nids) { /* wasn't filled automatically? use default */
15244 if (spec->codec_variant == ALC269_TYPE_NORMAL) {
15245 spec->adc_nids = alc269_adc_nids;
15246 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
15247 spec->capsrc_nids = alc269_capsrc_nids;
15249 spec->adc_nids = alc269vb_adc_nids;
15250 spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids);
15251 spec->capsrc_nids = alc269vb_capsrc_nids;
15255 if (!spec->cap_mixer)
15256 set_capture_mixer(codec);
15257 if (has_cdefine_beep(codec))
15258 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
15260 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
15262 spec->vmaster_nid = 0x02;
15264 codec->patch_ops = alc_patch_ops;
15265 #ifdef CONFIG_SND_HDA_POWER_SAVE
15266 codec->patch_ops.suspend = alc269_suspend;
15268 #ifdef SND_HDA_NEEDS_RESUME
15269 codec->patch_ops.resume = alc269_resume;
15271 if (board_config == ALC269_AUTO)
15272 spec->init_hook = alc269_auto_init;
15274 alc_init_jacks(codec);
15275 #ifdef CONFIG_SND_HDA_POWER_SAVE
15276 if (!spec->loopback.amplist)
15277 spec->loopback.amplist = alc269_loopbacks;
15278 if (alc269_mic2_for_mute_led(codec))
15279 codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps;
15286 * ALC861 channel source setting (2/6 channel selection for 3-stack)
15290 * set the path ways for 2 channel output
15291 * need to set the codec line out and mic 1 pin widgets to inputs
15293 static struct hda_verb alc861_threestack_ch2_init[] = {
15294 /* set pin widget 1Ah (line in) for input */
15295 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15296 /* set pin widget 18h (mic1/2) for input, for mic also enable
15299 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15301 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
15303 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15304 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
15310 * need to set the codec line out and mic 1 pin widgets to outputs
15312 static struct hda_verb alc861_threestack_ch6_init[] = {
15313 /* set pin widget 1Ah (line in) for output (Back Surround)*/
15314 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15315 /* set pin widget 18h (mic1) for output (CLFE)*/
15316 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15318 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
15319 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
15321 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
15323 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15324 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
15329 static struct hda_channel_mode alc861_threestack_modes[2] = {
15330 { 2, alc861_threestack_ch2_init },
15331 { 6, alc861_threestack_ch6_init },
15333 /* Set mic1 as input and unmute the mixer */
15334 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
15335 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15336 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15339 /* Set mic1 as output and mute mixer */
15340 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
15341 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15342 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15346 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
15347 { 2, alc861_uniwill_m31_ch2_init },
15348 { 4, alc861_uniwill_m31_ch4_init },
15351 /* Set mic1 and line-in as input and unmute the mixer */
15352 static struct hda_verb alc861_asus_ch2_init[] = {
15353 /* set pin widget 1Ah (line in) for input */
15354 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15355 /* set pin widget 18h (mic1/2) for input, for mic also enable
15358 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15360 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
15362 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15363 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
15367 /* Set mic1 nad line-in as output and mute mixer */
15368 static struct hda_verb alc861_asus_ch6_init[] = {
15369 /* set pin widget 1Ah (line in) for output (Back Surround)*/
15370 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15371 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
15372 /* set pin widget 18h (mic1) for output (CLFE)*/
15373 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15374 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
15375 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
15376 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
15378 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
15380 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15381 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
15386 static struct hda_channel_mode alc861_asus_modes[2] = {
15387 { 2, alc861_asus_ch2_init },
15388 { 6, alc861_asus_ch6_init },
15393 static struct snd_kcontrol_new alc861_base_mixer[] = {
15394 /* output mixer control */
15395 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15396 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15397 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15398 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15399 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
15401 /*Input mixer control */
15402 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15403 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15404 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15405 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15406 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15407 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15408 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15409 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15410 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15411 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
15416 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
15417 /* output mixer control */
15418 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15419 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15420 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15421 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15422 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
15424 /* Input mixer control */
15425 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15426 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15427 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15428 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15429 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15430 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15431 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15432 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15433 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15434 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
15437 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15438 .name = "Channel Mode",
15439 .info = alc_ch_mode_info,
15440 .get = alc_ch_mode_get,
15441 .put = alc_ch_mode_put,
15442 .private_value = ARRAY_SIZE(alc861_threestack_modes),
15447 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
15448 /* output mixer control */
15449 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15450 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15451 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15456 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
15457 /* output mixer control */
15458 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15459 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15460 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15461 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15462 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
15464 /* Input mixer control */
15465 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15466 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15467 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15468 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15469 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15470 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15471 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15472 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15473 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15474 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
15477 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15478 .name = "Channel Mode",
15479 .info = alc_ch_mode_info,
15480 .get = alc_ch_mode_get,
15481 .put = alc_ch_mode_put,
15482 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
15487 static struct snd_kcontrol_new alc861_asus_mixer[] = {
15488 /* output mixer control */
15489 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15490 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15491 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15492 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15493 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
15495 /* Input mixer control */
15496 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15497 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15498 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15499 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15500 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15501 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15502 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15503 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15504 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15505 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
15508 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15509 .name = "Channel Mode",
15510 .info = alc_ch_mode_info,
15511 .get = alc_ch_mode_get,
15512 .put = alc_ch_mode_put,
15513 .private_value = ARRAY_SIZE(alc861_asus_modes),
15518 /* additional mixer */
15519 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
15520 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15521 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15526 * generic initialization of ADC, input mixers and output mixers
15528 static struct hda_verb alc861_base_init_verbs[] = {
15530 * Unmute ADC0 and set the default input to mic-in
15532 /* port-A for surround (rear panel) */
15533 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15534 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
15535 /* port-B for mic-in (rear panel) with vref */
15536 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15537 /* port-C for line-in (rear panel) */
15538 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15539 /* port-D for Front */
15540 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15541 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15542 /* port-E for HP out (front panel) */
15543 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
15544 /* route front PCM to HP */
15545 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15546 /* port-F for mic-in (front panel) with vref */
15547 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15548 /* port-G for CLFE (rear panel) */
15549 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15550 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15551 /* port-H for side (rear panel) */
15552 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15553 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
15555 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15556 /* route front mic to ADC1*/
15557 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15558 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15560 /* Unmute DAC0~3 & spdif out*/
15561 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15562 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15563 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15564 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15565 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15567 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15568 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15569 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15570 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15571 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15573 /* Unmute Stereo Mixer 15 */
15574 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15575 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15576 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15577 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15579 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15580 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15581 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15582 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15583 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15584 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15585 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15586 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15587 /* hp used DAC 3 (Front) */
15588 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15589 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15594 static struct hda_verb alc861_threestack_init_verbs[] = {
15596 * Unmute ADC0 and set the default input to mic-in
15598 /* port-A for surround (rear panel) */
15599 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15600 /* port-B for mic-in (rear panel) with vref */
15601 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15602 /* port-C for line-in (rear panel) */
15603 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15604 /* port-D for Front */
15605 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15606 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15607 /* port-E for HP out (front panel) */
15608 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
15609 /* route front PCM to HP */
15610 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15611 /* port-F for mic-in (front panel) with vref */
15612 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15613 /* port-G for CLFE (rear panel) */
15614 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15615 /* port-H for side (rear panel) */
15616 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15618 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15619 /* route front mic to ADC1*/
15620 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15621 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15622 /* Unmute DAC0~3 & spdif out*/
15623 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15624 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15625 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15626 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15627 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15629 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15630 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15631 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15632 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15633 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15635 /* Unmute Stereo Mixer 15 */
15636 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15637 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15638 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15639 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15641 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15642 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15643 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15644 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15645 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15646 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15647 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15648 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15649 /* hp used DAC 3 (Front) */
15650 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15651 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15655 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
15657 * Unmute ADC0 and set the default input to mic-in
15659 /* port-A for surround (rear panel) */
15660 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15661 /* port-B for mic-in (rear panel) with vref */
15662 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15663 /* port-C for line-in (rear panel) */
15664 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15665 /* port-D for Front */
15666 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15667 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15668 /* port-E for HP out (front panel) */
15669 /* this has to be set to VREF80 */
15670 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15671 /* route front PCM to HP */
15672 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15673 /* port-F for mic-in (front panel) with vref */
15674 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15675 /* port-G for CLFE (rear panel) */
15676 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15677 /* port-H for side (rear panel) */
15678 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15680 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15681 /* route front mic to ADC1*/
15682 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15683 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15684 /* Unmute DAC0~3 & spdif out*/
15685 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15686 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15687 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15688 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15689 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15691 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15692 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15693 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15694 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15695 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15697 /* Unmute Stereo Mixer 15 */
15698 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15699 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15700 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15701 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15703 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15704 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15705 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15706 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15707 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15708 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15709 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15710 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15711 /* hp used DAC 3 (Front) */
15712 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15713 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15717 static struct hda_verb alc861_asus_init_verbs[] = {
15719 * Unmute ADC0 and set the default input to mic-in
15721 /* port-A for surround (rear panel)
15722 * according to codec#0 this is the HP jack
15724 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
15725 /* route front PCM to HP */
15726 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
15727 /* port-B for mic-in (rear panel) with vref */
15728 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15729 /* port-C for line-in (rear panel) */
15730 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15731 /* port-D for Front */
15732 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15733 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15734 /* port-E for HP out (front panel) */
15735 /* this has to be set to VREF80 */
15736 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15737 /* route front PCM to HP */
15738 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15739 /* port-F for mic-in (front panel) with vref */
15740 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15741 /* port-G for CLFE (rear panel) */
15742 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15743 /* port-H for side (rear panel) */
15744 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15746 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15747 /* route front mic to ADC1*/
15748 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15749 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15750 /* Unmute DAC0~3 & spdif out*/
15751 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15752 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15753 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15754 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15755 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15756 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15757 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15758 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15759 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15760 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15762 /* Unmute Stereo Mixer 15 */
15763 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15764 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15765 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15766 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15768 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15769 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15770 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15771 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15772 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15773 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15774 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15775 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15776 /* hp used DAC 3 (Front) */
15777 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15778 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15782 /* additional init verbs for ASUS laptops */
15783 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
15784 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
15785 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
15790 * generic initialization of ADC, input mixers and output mixers
15792 static struct hda_verb alc861_auto_init_verbs[] = {
15794 * Unmute ADC0 and set the default input to mic-in
15796 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
15797 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15799 /* Unmute DAC0~3 & spdif out*/
15800 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15801 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15802 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15803 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15804 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15806 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15807 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15808 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15809 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15810 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15812 /* Unmute Stereo Mixer 15 */
15813 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15814 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15815 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15816 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
15818 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15819 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15820 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15821 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15822 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15823 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15824 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15825 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15827 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15828 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15829 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15830 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15831 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15832 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15833 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15834 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15836 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
15841 static struct hda_verb alc861_toshiba_init_verbs[] = {
15842 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15847 /* toggle speaker-output according to the hp-jack state */
15848 static void alc861_toshiba_automute(struct hda_codec *codec)
15850 unsigned int present = snd_hda_jack_detect(codec, 0x0f);
15852 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
15853 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
15854 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
15855 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
15858 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
15861 if ((res >> 26) == ALC880_HP_EVENT)
15862 alc861_toshiba_automute(codec);
15865 /* pcm configuration: identical with ALC880 */
15866 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
15867 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
15868 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
15869 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
15872 #define ALC861_DIGOUT_NID 0x07
15874 static struct hda_channel_mode alc861_8ch_modes[1] = {
15878 static hda_nid_t alc861_dac_nids[4] = {
15879 /* front, surround, clfe, side */
15880 0x03, 0x06, 0x05, 0x04
15883 static hda_nid_t alc660_dac_nids[3] = {
15884 /* front, clfe, surround */
15888 static hda_nid_t alc861_adc_nids[1] = {
15893 static struct hda_input_mux alc861_capture_source = {
15897 { "Front Mic", 0x3 },
15904 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
15906 struct alc_spec *spec = codec->spec;
15907 hda_nid_t mix, srcs[5];
15910 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
15912 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
15915 for (i = 0; i < num; i++) {
15917 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
15918 if (type != AC_WID_AUD_OUT)
15920 for (j = 0; j < spec->multiout.num_dacs; j++)
15921 if (spec->multiout.dac_nids[j] == srcs[i])
15923 if (j >= spec->multiout.num_dacs)
15929 /* fill in the dac_nids table from the parsed pin configuration */
15930 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
15931 const struct auto_pin_cfg *cfg)
15933 struct alc_spec *spec = codec->spec;
15935 hda_nid_t nid, dac;
15937 spec->multiout.dac_nids = spec->private_dac_nids;
15938 for (i = 0; i < cfg->line_outs; i++) {
15939 nid = cfg->line_out_pins[i];
15940 dac = alc861_look_for_dac(codec, nid);
15943 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
15948 static int __alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
15949 hda_nid_t nid, int idx, unsigned int chs)
15951 return __add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx, idx,
15952 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
15955 #define alc861_create_out_sw(codec, pfx, nid, chs) \
15956 __alc861_create_out_sw(codec, pfx, nid, 0, chs)
15958 /* add playback controls from the parsed DAC table */
15959 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
15960 const struct auto_pin_cfg *cfg)
15962 struct alc_spec *spec = codec->spec;
15963 static const char * const chname[4] = {
15964 "Front", "Surround", NULL /*CLFE*/, "Side"
15966 const char *pfx = alc_get_line_out_pfx(cfg, true);
15970 for (i = 0; i < cfg->line_outs; i++) {
15971 nid = spec->multiout.dac_nids[i];
15974 if (!pfx && i == 2) {
15976 err = alc861_create_out_sw(codec, "Center", nid, 1);
15979 err = alc861_create_out_sw(codec, "LFE", nid, 2);
15983 const char *name = pfx;
15986 err = __alc861_create_out_sw(codec, name, nid, i, 3);
15994 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
15996 struct alc_spec *spec = codec->spec;
16003 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
16004 nid = alc861_look_for_dac(codec, pin);
16006 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
16009 spec->multiout.hp_nid = nid;
16015 /* create playback/capture controls for input pins */
16016 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
16017 const struct auto_pin_cfg *cfg)
16019 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
16022 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
16024 int pin_type, hda_nid_t dac)
16026 hda_nid_t mix, srcs[5];
16029 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
16031 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16033 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
16035 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
16038 for (i = 0; i < num; i++) {
16040 if (srcs[i] == dac || srcs[i] == 0x15)
16041 mute = AMP_IN_UNMUTE(i);
16043 mute = AMP_IN_MUTE(i);
16044 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16049 static void alc861_auto_init_multi_out(struct hda_codec *codec)
16051 struct alc_spec *spec = codec->spec;
16054 for (i = 0; i < spec->autocfg.line_outs; i++) {
16055 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16056 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16058 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
16059 spec->multiout.dac_nids[i]);
16063 static void alc861_auto_init_hp_out(struct hda_codec *codec)
16065 struct alc_spec *spec = codec->spec;
16067 if (spec->autocfg.hp_outs)
16068 alc861_auto_set_output_and_unmute(codec,
16069 spec->autocfg.hp_pins[0],
16071 spec->multiout.hp_nid);
16072 if (spec->autocfg.speaker_outs)
16073 alc861_auto_set_output_and_unmute(codec,
16074 spec->autocfg.speaker_pins[0],
16076 spec->multiout.dac_nids[0]);
16079 static void alc861_auto_init_analog_input(struct hda_codec *codec)
16081 struct alc_spec *spec = codec->spec;
16082 struct auto_pin_cfg *cfg = &spec->autocfg;
16085 for (i = 0; i < cfg->num_inputs; i++) {
16086 hda_nid_t nid = cfg->inputs[i].pin;
16087 if (nid >= 0x0c && nid <= 0x11)
16088 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
16092 /* parse the BIOS configuration and set up the alc_spec */
16093 /* return 1 if successful, 0 if the proper config is not found,
16094 * or a negative error code
16096 static int alc861_parse_auto_config(struct hda_codec *codec)
16098 struct alc_spec *spec = codec->spec;
16100 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
16102 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16106 if (!spec->autocfg.line_outs)
16107 return 0; /* can't find valid BIOS pin config */
16109 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
16112 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
16115 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
16118 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
16122 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16124 alc_auto_parse_digital(codec);
16126 if (spec->kctls.list)
16127 add_mixer(spec, spec->kctls.list);
16129 add_verb(spec, alc861_auto_init_verbs);
16131 spec->num_mux_defs = 1;
16132 spec->input_mux = &spec->private_imux[0];
16134 spec->adc_nids = alc861_adc_nids;
16135 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
16136 set_capture_mixer(codec);
16138 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0);
16143 /* additional initialization for auto-configuration model */
16144 static void alc861_auto_init(struct hda_codec *codec)
16146 struct alc_spec *spec = codec->spec;
16147 alc861_auto_init_multi_out(codec);
16148 alc861_auto_init_hp_out(codec);
16149 alc861_auto_init_analog_input(codec);
16150 alc_auto_init_digital(codec);
16151 if (spec->unsol_event)
16152 alc_inithook(codec);
16155 #ifdef CONFIG_SND_HDA_POWER_SAVE
16156 static struct hda_amp_list alc861_loopbacks[] = {
16157 { 0x15, HDA_INPUT, 0 },
16158 { 0x15, HDA_INPUT, 1 },
16159 { 0x15, HDA_INPUT, 2 },
16160 { 0x15, HDA_INPUT, 3 },
16167 * configuration and preset
16169 static const char * const alc861_models[ALC861_MODEL_LAST] = {
16170 [ALC861_3ST] = "3stack",
16171 [ALC660_3ST] = "3stack-660",
16172 [ALC861_3ST_DIG] = "3stack-dig",
16173 [ALC861_6ST_DIG] = "6stack-dig",
16174 [ALC861_UNIWILL_M31] = "uniwill-m31",
16175 [ALC861_TOSHIBA] = "toshiba",
16176 [ALC861_ASUS] = "asus",
16177 [ALC861_ASUS_LAPTOP] = "asus-laptop",
16178 [ALC861_AUTO] = "auto",
16181 static struct snd_pci_quirk alc861_cfg_tbl[] = {
16182 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
16183 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
16184 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
16185 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
16186 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
16187 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
16188 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
16189 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
16190 * Any other models that need this preset?
16192 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
16193 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
16194 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
16195 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
16196 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
16197 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
16198 /* FIXME: the below seems conflict */
16199 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
16200 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
16201 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
16205 static struct alc_config_preset alc861_presets[] = {
16207 .mixers = { alc861_3ST_mixer },
16208 .init_verbs = { alc861_threestack_init_verbs },
16209 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16210 .dac_nids = alc861_dac_nids,
16211 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
16212 .channel_mode = alc861_threestack_modes,
16214 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16215 .adc_nids = alc861_adc_nids,
16216 .input_mux = &alc861_capture_source,
16218 [ALC861_3ST_DIG] = {
16219 .mixers = { alc861_base_mixer },
16220 .init_verbs = { alc861_threestack_init_verbs },
16221 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16222 .dac_nids = alc861_dac_nids,
16223 .dig_out_nid = ALC861_DIGOUT_NID,
16224 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
16225 .channel_mode = alc861_threestack_modes,
16227 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16228 .adc_nids = alc861_adc_nids,
16229 .input_mux = &alc861_capture_source,
16231 [ALC861_6ST_DIG] = {
16232 .mixers = { alc861_base_mixer },
16233 .init_verbs = { alc861_base_init_verbs },
16234 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16235 .dac_nids = alc861_dac_nids,
16236 .dig_out_nid = ALC861_DIGOUT_NID,
16237 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
16238 .channel_mode = alc861_8ch_modes,
16239 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16240 .adc_nids = alc861_adc_nids,
16241 .input_mux = &alc861_capture_source,
16244 .mixers = { alc861_3ST_mixer },
16245 .init_verbs = { alc861_threestack_init_verbs },
16246 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
16247 .dac_nids = alc660_dac_nids,
16248 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
16249 .channel_mode = alc861_threestack_modes,
16251 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16252 .adc_nids = alc861_adc_nids,
16253 .input_mux = &alc861_capture_source,
16255 [ALC861_UNIWILL_M31] = {
16256 .mixers = { alc861_uniwill_m31_mixer },
16257 .init_verbs = { alc861_uniwill_m31_init_verbs },
16258 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16259 .dac_nids = alc861_dac_nids,
16260 .dig_out_nid = ALC861_DIGOUT_NID,
16261 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
16262 .channel_mode = alc861_uniwill_m31_modes,
16264 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16265 .adc_nids = alc861_adc_nids,
16266 .input_mux = &alc861_capture_source,
16268 [ALC861_TOSHIBA] = {
16269 .mixers = { alc861_toshiba_mixer },
16270 .init_verbs = { alc861_base_init_verbs,
16271 alc861_toshiba_init_verbs },
16272 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16273 .dac_nids = alc861_dac_nids,
16274 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
16275 .channel_mode = alc883_3ST_2ch_modes,
16276 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16277 .adc_nids = alc861_adc_nids,
16278 .input_mux = &alc861_capture_source,
16279 .unsol_event = alc861_toshiba_unsol_event,
16280 .init_hook = alc861_toshiba_automute,
16283 .mixers = { alc861_asus_mixer },
16284 .init_verbs = { alc861_asus_init_verbs },
16285 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16286 .dac_nids = alc861_dac_nids,
16287 .dig_out_nid = ALC861_DIGOUT_NID,
16288 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
16289 .channel_mode = alc861_asus_modes,
16292 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16293 .adc_nids = alc861_adc_nids,
16294 .input_mux = &alc861_capture_source,
16296 [ALC861_ASUS_LAPTOP] = {
16297 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
16298 .init_verbs = { alc861_asus_init_verbs,
16299 alc861_asus_laptop_init_verbs },
16300 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16301 .dac_nids = alc861_dac_nids,
16302 .dig_out_nid = ALC861_DIGOUT_NID,
16303 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
16304 .channel_mode = alc883_3ST_2ch_modes,
16306 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16307 .adc_nids = alc861_adc_nids,
16308 .input_mux = &alc861_capture_source,
16312 /* Pin config fixes */
16314 PINFIX_FSC_AMILO_PI1505,
16317 static const struct alc_fixup alc861_fixups[] = {
16318 [PINFIX_FSC_AMILO_PI1505] = {
16319 .type = ALC_FIXUP_PINS,
16320 .v.pins = (const struct alc_pincfg[]) {
16321 { 0x0b, 0x0221101f }, /* HP */
16322 { 0x0f, 0x90170310 }, /* speaker */
16328 static struct snd_pci_quirk alc861_fixup_tbl[] = {
16329 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
16333 static int patch_alc861(struct hda_codec *codec)
16335 struct alc_spec *spec;
16339 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16343 codec->spec = spec;
16345 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
16349 if (board_config < 0) {
16350 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
16352 board_config = ALC861_AUTO;
16355 if (board_config == ALC861_AUTO) {
16356 alc_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
16357 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
16360 if (board_config == ALC861_AUTO) {
16361 /* automatic parse from the BIOS config */
16362 err = alc861_parse_auto_config(codec);
16368 "hda_codec: Cannot set up configuration "
16369 "from BIOS. Using base mode...\n");
16370 board_config = ALC861_3ST_DIG;
16374 err = snd_hda_attach_beep_device(codec, 0x23);
16380 if (board_config != ALC861_AUTO)
16381 setup_preset(codec, &alc861_presets[board_config]);
16383 spec->stream_analog_playback = &alc861_pcm_analog_playback;
16384 spec->stream_analog_capture = &alc861_pcm_analog_capture;
16386 spec->stream_digital_playback = &alc861_pcm_digital_playback;
16387 spec->stream_digital_capture = &alc861_pcm_digital_capture;
16389 if (!spec->cap_mixer)
16390 set_capture_mixer(codec);
16391 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
16393 spec->vmaster_nid = 0x03;
16395 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
16397 codec->patch_ops = alc_patch_ops;
16398 if (board_config == ALC861_AUTO) {
16399 spec->init_hook = alc861_auto_init;
16400 #ifdef CONFIG_SND_HDA_POWER_SAVE
16401 spec->power_hook = alc_power_eapd;
16404 #ifdef CONFIG_SND_HDA_POWER_SAVE
16405 if (!spec->loopback.amplist)
16406 spec->loopback.amplist = alc861_loopbacks;
16413 * ALC861-VD support
16417 * In addition, an independent DAC
16419 #define ALC861VD_DIGOUT_NID 0x06
16421 static hda_nid_t alc861vd_dac_nids[4] = {
16422 /* front, surr, clfe, side surr */
16423 0x02, 0x03, 0x04, 0x05
16426 /* dac_nids for ALC660vd are in a different order - according to
16427 * Realtek's driver.
16428 * This should probably result in a different mixer for 6stack models
16429 * of ALC660vd codecs, but for now there is only 3stack mixer
16430 * - and it is the same as in 861vd.
16431 * adc_nids in ALC660vd are (is) the same as in 861vd
16433 static hda_nid_t alc660vd_dac_nids[3] = {
16434 /* front, rear, clfe, rear_surr */
16438 static hda_nid_t alc861vd_adc_nids[1] = {
16443 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
16446 /* FIXME: should be a matrix-type input source selection */
16447 static struct hda_input_mux alc861vd_capture_source = {
16451 { "Front Mic", 0x1 },
16457 static struct hda_input_mux alc861vd_dallas_capture_source = {
16461 { "Internal Mic", 0x1 },
16465 static struct hda_input_mux alc861vd_hp_capture_source = {
16468 { "Front Mic", 0x0 },
16469 { "ATAPI Mic", 0x1 },
16476 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
16483 static struct hda_verb alc861vd_6stack_ch6_init[] = {
16484 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16485 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16486 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16487 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16494 static struct hda_verb alc861vd_6stack_ch8_init[] = {
16495 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16496 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16497 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16498 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16502 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
16503 { 6, alc861vd_6stack_ch6_init },
16504 { 8, alc861vd_6stack_ch8_init },
16507 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
16509 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16510 .name = "Channel Mode",
16511 .info = alc_ch_mode_info,
16512 .get = alc_ch_mode_get,
16513 .put = alc_ch_mode_put,
16518 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16519 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16521 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
16522 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16523 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16525 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16526 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
16528 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
16530 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
16532 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
16533 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
16535 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
16536 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
16538 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16540 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
16541 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16542 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16544 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
16545 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16546 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16548 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16549 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16551 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16552 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16557 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
16558 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16559 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16561 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16563 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
16564 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16565 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16567 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
16568 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16569 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16571 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16572 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16574 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16575 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16580 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
16581 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16582 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
16583 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16585 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16587 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
16588 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16589 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16591 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
16592 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16593 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16595 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16596 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16601 /* Pin assignment: Speaker=0x14, HP = 0x15,
16602 * Mic=0x18, Internal Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
16604 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
16605 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16606 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
16607 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16608 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
16609 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
16610 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16611 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16612 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
16613 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16614 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16618 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
16619 * Front Mic=0x18, ATAPI Mic = 0x19,
16621 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
16622 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16623 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16624 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16625 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
16626 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16627 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16628 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16629 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16635 * generic initialization of ADC, input mixers and output mixers
16637 static struct hda_verb alc861vd_volume_init_verbs[] = {
16639 * Unmute ADC0 and set the default input to mic-in
16641 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16642 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16644 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
16645 * the analog-loopback mixer widget
16647 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16648 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16649 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16650 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16651 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16652 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16654 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
16655 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16656 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16657 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
16658 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
16661 * Set up output mixers (0x02 - 0x05)
16663 /* set vol=0 to output mixers */
16664 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16665 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16666 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16667 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16669 /* set up input amps for analog loopback */
16670 /* Amp Indices: DAC = 0, mixer = 1 */
16671 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16672 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16673 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16674 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16675 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16676 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16677 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16678 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16684 * 3-stack pin configuration:
16685 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
16687 static struct hda_verb alc861vd_3stack_init_verbs[] = {
16689 * Set pin mode and muting
16691 /* set front pin widgets 0x14 for output */
16692 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16693 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16694 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
16696 /* Mic (rear) pin: input vref at 80% */
16697 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16698 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16699 /* Front Mic pin: input vref at 80% */
16700 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16701 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16702 /* Line In pin: input */
16703 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16704 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16705 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16706 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16707 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16708 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16709 /* CD pin widget for input */
16710 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16716 * 6-stack pin configuration:
16718 static struct hda_verb alc861vd_6stack_init_verbs[] = {
16720 * Set pin mode and muting
16722 /* set front pin widgets 0x14 for output */
16723 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16724 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16725 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
16727 /* Rear Pin: output 1 (0x0d) */
16728 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16729 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16730 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
16731 /* CLFE Pin: output 2 (0x0e) */
16732 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16733 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16734 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
16735 /* Side Pin: output 3 (0x0f) */
16736 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16737 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16738 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
16740 /* Mic (rear) pin: input vref at 80% */
16741 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16742 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16743 /* Front Mic pin: input vref at 80% */
16744 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16745 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16746 /* Line In pin: input */
16747 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16748 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16749 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16750 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16751 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16752 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16753 /* CD pin widget for input */
16754 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16759 static struct hda_verb alc861vd_eapd_verbs[] = {
16760 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16764 static struct hda_verb alc660vd_eapd_verbs[] = {
16765 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16766 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16770 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
16771 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16772 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16773 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
16774 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16775 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16779 static void alc861vd_lenovo_setup(struct hda_codec *codec)
16781 struct alc_spec *spec = codec->spec;
16782 spec->autocfg.hp_pins[0] = 0x1b;
16783 spec->autocfg.speaker_pins[0] = 0x14;
16786 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
16788 alc_automute_amp(codec);
16789 alc88x_simple_mic_automute(codec);
16792 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
16795 switch (res >> 26) {
16796 case ALC880_MIC_EVENT:
16797 alc88x_simple_mic_automute(codec);
16800 alc_automute_amp_unsol_event(codec, res);
16805 static struct hda_verb alc861vd_dallas_verbs[] = {
16806 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16807 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16808 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16809 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16811 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16812 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16813 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16814 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16815 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16816 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16817 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16818 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16820 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16821 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16822 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16823 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16824 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16825 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16826 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16827 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16829 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
16830 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16831 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
16832 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16833 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16834 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16835 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16836 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16838 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16839 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16840 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16841 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16843 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16844 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16845 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16850 /* toggle speaker-output according to the hp-jack state */
16851 static void alc861vd_dallas_setup(struct hda_codec *codec)
16853 struct alc_spec *spec = codec->spec;
16855 spec->autocfg.hp_pins[0] = 0x15;
16856 spec->autocfg.speaker_pins[0] = 0x14;
16859 #ifdef CONFIG_SND_HDA_POWER_SAVE
16860 #define alc861vd_loopbacks alc880_loopbacks
16863 /* pcm configuration: identical with ALC880 */
16864 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
16865 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
16866 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
16867 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
16870 * configuration and preset
16872 static const char * const alc861vd_models[ALC861VD_MODEL_LAST] = {
16873 [ALC660VD_3ST] = "3stack-660",
16874 [ALC660VD_3ST_DIG] = "3stack-660-digout",
16875 [ALC660VD_ASUS_V1S] = "asus-v1s",
16876 [ALC861VD_3ST] = "3stack",
16877 [ALC861VD_3ST_DIG] = "3stack-digout",
16878 [ALC861VD_6ST_DIG] = "6stack-digout",
16879 [ALC861VD_LENOVO] = "lenovo",
16880 [ALC861VD_DALLAS] = "dallas",
16881 [ALC861VD_HP] = "hp",
16882 [ALC861VD_AUTO] = "auto",
16885 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
16886 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
16887 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
16888 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
16889 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
16890 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
16891 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
16892 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
16893 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
16894 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
16895 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
16896 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
16897 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
16898 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
16899 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
16900 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
16904 static struct alc_config_preset alc861vd_presets[] = {
16906 .mixers = { alc861vd_3st_mixer },
16907 .init_verbs = { alc861vd_volume_init_verbs,
16908 alc861vd_3stack_init_verbs },
16909 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16910 .dac_nids = alc660vd_dac_nids,
16911 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16912 .channel_mode = alc861vd_3stack_2ch_modes,
16913 .input_mux = &alc861vd_capture_source,
16915 [ALC660VD_3ST_DIG] = {
16916 .mixers = { alc861vd_3st_mixer },
16917 .init_verbs = { alc861vd_volume_init_verbs,
16918 alc861vd_3stack_init_verbs },
16919 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16920 .dac_nids = alc660vd_dac_nids,
16921 .dig_out_nid = ALC861VD_DIGOUT_NID,
16922 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16923 .channel_mode = alc861vd_3stack_2ch_modes,
16924 .input_mux = &alc861vd_capture_source,
16927 .mixers = { alc861vd_3st_mixer },
16928 .init_verbs = { alc861vd_volume_init_verbs,
16929 alc861vd_3stack_init_verbs },
16930 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16931 .dac_nids = alc861vd_dac_nids,
16932 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16933 .channel_mode = alc861vd_3stack_2ch_modes,
16934 .input_mux = &alc861vd_capture_source,
16936 [ALC861VD_3ST_DIG] = {
16937 .mixers = { alc861vd_3st_mixer },
16938 .init_verbs = { alc861vd_volume_init_verbs,
16939 alc861vd_3stack_init_verbs },
16940 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16941 .dac_nids = alc861vd_dac_nids,
16942 .dig_out_nid = ALC861VD_DIGOUT_NID,
16943 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16944 .channel_mode = alc861vd_3stack_2ch_modes,
16945 .input_mux = &alc861vd_capture_source,
16947 [ALC861VD_6ST_DIG] = {
16948 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
16949 .init_verbs = { alc861vd_volume_init_verbs,
16950 alc861vd_6stack_init_verbs },
16951 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16952 .dac_nids = alc861vd_dac_nids,
16953 .dig_out_nid = ALC861VD_DIGOUT_NID,
16954 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
16955 .channel_mode = alc861vd_6stack_modes,
16956 .input_mux = &alc861vd_capture_source,
16958 [ALC861VD_LENOVO] = {
16959 .mixers = { alc861vd_lenovo_mixer },
16960 .init_verbs = { alc861vd_volume_init_verbs,
16961 alc861vd_3stack_init_verbs,
16962 alc861vd_eapd_verbs,
16963 alc861vd_lenovo_unsol_verbs },
16964 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16965 .dac_nids = alc660vd_dac_nids,
16966 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16967 .channel_mode = alc861vd_3stack_2ch_modes,
16968 .input_mux = &alc861vd_capture_source,
16969 .unsol_event = alc861vd_lenovo_unsol_event,
16970 .setup = alc861vd_lenovo_setup,
16971 .init_hook = alc861vd_lenovo_init_hook,
16973 [ALC861VD_DALLAS] = {
16974 .mixers = { alc861vd_dallas_mixer },
16975 .init_verbs = { alc861vd_dallas_verbs },
16976 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16977 .dac_nids = alc861vd_dac_nids,
16978 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16979 .channel_mode = alc861vd_3stack_2ch_modes,
16980 .input_mux = &alc861vd_dallas_capture_source,
16981 .unsol_event = alc_automute_amp_unsol_event,
16982 .setup = alc861vd_dallas_setup,
16983 .init_hook = alc_automute_amp,
16986 .mixers = { alc861vd_hp_mixer },
16987 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
16988 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16989 .dac_nids = alc861vd_dac_nids,
16990 .dig_out_nid = ALC861VD_DIGOUT_NID,
16991 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16992 .channel_mode = alc861vd_3stack_2ch_modes,
16993 .input_mux = &alc861vd_hp_capture_source,
16994 .unsol_event = alc_automute_amp_unsol_event,
16995 .setup = alc861vd_dallas_setup,
16996 .init_hook = alc_automute_amp,
16998 [ALC660VD_ASUS_V1S] = {
16999 .mixers = { alc861vd_lenovo_mixer },
17000 .init_verbs = { alc861vd_volume_init_verbs,
17001 alc861vd_3stack_init_verbs,
17002 alc861vd_eapd_verbs,
17003 alc861vd_lenovo_unsol_verbs },
17004 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
17005 .dac_nids = alc660vd_dac_nids,
17006 .dig_out_nid = ALC861VD_DIGOUT_NID,
17007 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17008 .channel_mode = alc861vd_3stack_2ch_modes,
17009 .input_mux = &alc861vd_capture_source,
17010 .unsol_event = alc861vd_lenovo_unsol_event,
17011 .setup = alc861vd_lenovo_setup,
17012 .init_hook = alc861vd_lenovo_init_hook,
17017 * BIOS auto configuration
17019 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
17020 const struct auto_pin_cfg *cfg)
17022 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x22, 0);
17026 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
17027 hda_nid_t nid, int pin_type, int dac_idx)
17029 alc_set_pin_output(codec, nid, pin_type);
17032 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
17034 struct alc_spec *spec = codec->spec;
17037 for (i = 0; i <= HDA_SIDE; i++) {
17038 hda_nid_t nid = spec->autocfg.line_out_pins[i];
17039 int pin_type = get_pin_type(spec->autocfg.line_out_type);
17041 alc861vd_auto_set_output_and_unmute(codec, nid,
17047 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
17049 struct alc_spec *spec = codec->spec;
17052 pin = spec->autocfg.hp_pins[0];
17053 if (pin) /* connect to front and use dac 0 */
17054 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
17055 pin = spec->autocfg.speaker_pins[0];
17057 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
17060 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
17062 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
17064 struct alc_spec *spec = codec->spec;
17065 struct auto_pin_cfg *cfg = &spec->autocfg;
17068 for (i = 0; i < cfg->num_inputs; i++) {
17069 hda_nid_t nid = cfg->inputs[i].pin;
17070 if (alc_is_input_pin(codec, nid)) {
17071 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
17072 if (nid != ALC861VD_PIN_CD_NID &&
17073 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
17074 snd_hda_codec_write(codec, nid, 0,
17075 AC_VERB_SET_AMP_GAIN_MUTE,
17081 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
17083 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
17084 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
17086 /* add playback controls from the parsed DAC table */
17087 /* Based on ALC880 version. But ALC861VD has separate,
17088 * different NIDs for mute/unmute switch and volume control */
17089 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
17090 const struct auto_pin_cfg *cfg)
17092 static const char * const chname[4] = {
17093 "Front", "Surround", "CLFE", "Side"
17095 const char *pfx = alc_get_line_out_pfx(cfg, true);
17096 hda_nid_t nid_v, nid_s;
17099 for (i = 0; i < cfg->line_outs; i++) {
17100 if (!spec->multiout.dac_nids[i])
17102 nid_v = alc861vd_idx_to_mixer_vol(
17104 spec->multiout.dac_nids[i]));
17105 nid_s = alc861vd_idx_to_mixer_switch(
17107 spec->multiout.dac_nids[i]));
17109 if (!pfx && i == 2) {
17111 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
17113 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
17117 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
17119 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
17123 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
17125 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
17129 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
17131 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
17136 const char *name = pfx;
17139 err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
17141 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
17145 err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
17147 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
17156 /* add playback controls for speaker and HP outputs */
17157 /* Based on ALC880 version. But ALC861VD has separate,
17158 * different NIDs for mute/unmute switch and volume control */
17159 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
17160 hda_nid_t pin, const char *pfx)
17162 hda_nid_t nid_v, nid_s;
17168 if (alc880_is_fixed_pin(pin)) {
17169 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
17170 /* specify the DAC as the extra output */
17171 if (!spec->multiout.hp_nid)
17172 spec->multiout.hp_nid = nid_v;
17174 spec->multiout.extra_out_nid[0] = nid_v;
17175 /* control HP volume/switch on the output mixer amp */
17176 nid_v = alc861vd_idx_to_mixer_vol(
17177 alc880_fixed_pin_idx(pin));
17178 nid_s = alc861vd_idx_to_mixer_switch(
17179 alc880_fixed_pin_idx(pin));
17181 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
17182 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
17185 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
17186 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
17189 } else if (alc880_is_multi_pin(pin)) {
17190 /* set manual connection */
17191 /* we have only a switch on HP-out PIN */
17192 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17193 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17200 /* parse the BIOS configuration and set up the alc_spec
17201 * return 1 if successful, 0 if the proper config is not found,
17202 * or a negative error code
17203 * Based on ALC880 version - had to change it to override
17204 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
17205 static int alc861vd_parse_auto_config(struct hda_codec *codec)
17207 struct alc_spec *spec = codec->spec;
17209 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
17211 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17215 if (!spec->autocfg.line_outs)
17216 return 0; /* can't find valid BIOS pin config */
17218 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
17221 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
17224 err = alc861vd_auto_create_extra_out(spec,
17225 spec->autocfg.speaker_pins[0],
17229 err = alc861vd_auto_create_extra_out(spec,
17230 spec->autocfg.hp_pins[0],
17234 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
17238 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
17240 alc_auto_parse_digital(codec);
17242 if (spec->kctls.list)
17243 add_mixer(spec, spec->kctls.list);
17245 add_verb(spec, alc861vd_volume_init_verbs);
17247 spec->num_mux_defs = 1;
17248 spec->input_mux = &spec->private_imux[0];
17250 err = alc_auto_add_mic_boost(codec);
17254 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
17259 /* additional initialization for auto-configuration model */
17260 static void alc861vd_auto_init(struct hda_codec *codec)
17262 struct alc_spec *spec = codec->spec;
17263 alc861vd_auto_init_multi_out(codec);
17264 alc861vd_auto_init_hp_out(codec);
17265 alc861vd_auto_init_analog_input(codec);
17266 alc861vd_auto_init_input_src(codec);
17267 alc_auto_init_digital(codec);
17268 if (spec->unsol_event)
17269 alc_inithook(codec);
17273 ALC660VD_FIX_ASUS_GPIO1
17277 static const struct alc_fixup alc861vd_fixups[] = {
17278 [ALC660VD_FIX_ASUS_GPIO1] = {
17279 .type = ALC_FIXUP_VERBS,
17280 .v.verbs = (const struct hda_verb[]) {
17281 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
17282 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
17283 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
17289 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
17290 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
17294 static int patch_alc861vd(struct hda_codec *codec)
17296 struct alc_spec *spec;
17297 int err, board_config;
17299 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
17303 codec->spec = spec;
17305 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
17309 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
17310 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
17312 board_config = ALC861VD_AUTO;
17315 if (board_config == ALC861VD_AUTO) {
17316 alc_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
17317 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
17320 if (board_config == ALC861VD_AUTO) {
17321 /* automatic parse from the BIOS config */
17322 err = alc861vd_parse_auto_config(codec);
17328 "hda_codec: Cannot set up configuration "
17329 "from BIOS. Using base mode...\n");
17330 board_config = ALC861VD_3ST;
17334 err = snd_hda_attach_beep_device(codec, 0x23);
17340 if (board_config != ALC861VD_AUTO)
17341 setup_preset(codec, &alc861vd_presets[board_config]);
17343 if (codec->vendor_id == 0x10ec0660) {
17344 /* always turn on EAPD */
17345 add_verb(spec, alc660vd_eapd_verbs);
17348 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
17349 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
17351 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
17352 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
17354 if (!spec->adc_nids) {
17355 spec->adc_nids = alc861vd_adc_nids;
17356 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
17358 if (!spec->capsrc_nids)
17359 spec->capsrc_nids = alc861vd_capsrc_nids;
17361 set_capture_mixer(codec);
17362 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
17364 spec->vmaster_nid = 0x02;
17366 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
17368 codec->patch_ops = alc_patch_ops;
17370 if (board_config == ALC861VD_AUTO)
17371 spec->init_hook = alc861vd_auto_init;
17372 #ifdef CONFIG_SND_HDA_POWER_SAVE
17373 if (!spec->loopback.amplist)
17374 spec->loopback.amplist = alc861vd_loopbacks;
17383 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
17384 * configuration. Each pin widget can choose any input DACs and a mixer.
17385 * Each ADC is connected from a mixer of all inputs. This makes possible
17386 * 6-channel independent captures.
17388 * In addition, an independent DAC for the multi-playback (not used in this
17391 #define ALC662_DIGOUT_NID 0x06
17392 #define ALC662_DIGIN_NID 0x0a
17394 static hda_nid_t alc662_dac_nids[4] = {
17395 /* front, rear, clfe, rear_surr */
17399 static hda_nid_t alc272_dac_nids[2] = {
17403 static hda_nid_t alc662_adc_nids[2] = {
17408 static hda_nid_t alc272_adc_nids[1] = {
17413 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
17414 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
17418 /* FIXME: should be a matrix-type input source selection */
17419 static struct hda_input_mux alc662_capture_source = {
17423 { "Front Mic", 0x1 },
17429 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
17437 static struct hda_input_mux alc663_capture_source = {
17441 { "Front Mic", 0x1 },
17446 #if 0 /* set to 1 for testing other input sources below */
17447 static struct hda_input_mux alc272_nc10_capture_source = {
17450 { "Autoselect Mic", 0x0 },
17451 { "Internal Mic", 0x1 },
17452 { "In-0x02", 0x2 },
17453 { "In-0x03", 0x3 },
17454 { "In-0x04", 0x4 },
17455 { "In-0x05", 0x5 },
17456 { "In-0x06", 0x6 },
17457 { "In-0x07", 0x7 },
17458 { "In-0x08", 0x8 },
17459 { "In-0x09", 0x9 },
17460 { "In-0x0a", 0x0a },
17461 { "In-0x0b", 0x0b },
17462 { "In-0x0c", 0x0c },
17463 { "In-0x0d", 0x0d },
17464 { "In-0x0e", 0x0e },
17465 { "In-0x0f", 0x0f },
17473 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
17480 static struct hda_verb alc662_3ST_ch2_init[] = {
17481 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
17482 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
17483 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
17484 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
17491 static struct hda_verb alc662_3ST_ch6_init[] = {
17492 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17493 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
17494 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
17495 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17496 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
17497 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
17501 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
17502 { 2, alc662_3ST_ch2_init },
17503 { 6, alc662_3ST_ch6_init },
17509 static struct hda_verb alc662_sixstack_ch6_init[] = {
17510 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
17511 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
17512 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17519 static struct hda_verb alc662_sixstack_ch8_init[] = {
17520 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17521 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17522 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17526 static struct hda_channel_mode alc662_5stack_modes[2] = {
17527 { 2, alc662_sixstack_ch6_init },
17528 { 6, alc662_sixstack_ch8_init },
17531 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
17532 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
17535 static struct snd_kcontrol_new alc662_base_mixer[] = {
17536 /* output mixer control */
17537 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
17538 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17539 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
17540 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
17541 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17542 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17543 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
17544 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
17545 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17547 /*Input mixer control */
17548 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
17549 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
17550 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
17551 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
17552 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
17553 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
17554 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
17555 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
17559 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
17560 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17561 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17562 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17563 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
17564 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
17565 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17566 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17567 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17568 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17569 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17570 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17574 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
17575 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17576 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17577 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17578 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
17579 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17580 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17581 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
17582 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
17583 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17584 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
17585 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
17586 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17587 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17588 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17589 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17590 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17591 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17595 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
17596 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17597 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
17598 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17599 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
17600 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17601 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17602 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17603 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17604 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17608 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
17609 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17610 ALC262_HIPPO_MASTER_SWITCH,
17612 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
17613 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17614 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17616 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
17617 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17618 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17622 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
17623 ALC262_HIPPO_MASTER_SWITCH,
17624 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17625 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17626 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17627 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17628 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
17629 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17630 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17631 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17632 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17636 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
17637 .ops = &snd_hda_bind_vol,
17639 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
17640 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
17645 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
17646 .ops = &snd_hda_bind_sw,
17648 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17649 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17654 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
17655 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17656 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
17657 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17658 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17662 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
17663 .ops = &snd_hda_bind_sw,
17665 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17666 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17667 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17672 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
17673 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17674 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
17675 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17676 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17677 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17678 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17683 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
17684 .ops = &snd_hda_bind_sw,
17686 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17687 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17688 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
17693 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
17694 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17695 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
17696 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17697 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17698 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17699 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17703 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
17704 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17705 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17706 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17707 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17708 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17709 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17710 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17714 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
17715 .ops = &snd_hda_bind_vol,
17717 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
17718 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
17723 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
17724 .ops = &snd_hda_bind_sw,
17726 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17727 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
17732 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
17733 HDA_BIND_VOL("Master Playback Volume",
17734 &alc663_asus_two_bind_master_vol),
17735 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
17736 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17737 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17738 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17739 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17743 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
17744 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17745 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
17746 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17747 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17748 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17749 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17753 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
17754 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17755 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17756 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17757 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17758 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17760 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17761 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17762 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17763 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17767 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
17768 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17769 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17770 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17772 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17773 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17774 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17775 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17776 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17777 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17781 static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
17782 .ops = &snd_hda_bind_sw,
17784 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17785 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17786 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
17787 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
17788 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17793 static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
17794 .ops = &snd_hda_bind_sw,
17796 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17797 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
17802 static struct snd_kcontrol_new alc663_mode7_mixer[] = {
17803 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17804 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17805 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
17806 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17807 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17808 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17809 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17810 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17811 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17815 static struct snd_kcontrol_new alc663_mode8_mixer[] = {
17816 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17817 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17818 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
17819 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17820 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17821 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17822 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17827 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
17829 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
17830 .name = "Channel Mode",
17831 .info = alc_ch_mode_info,
17832 .get = alc_ch_mode_get,
17833 .put = alc_ch_mode_put,
17838 static struct hda_verb alc662_init_verbs[] = {
17839 /* ADC: mute amp left and right */
17840 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17841 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
17843 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17844 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17845 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17846 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17847 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17848 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17850 /* Front Pin: output 0 (0x0c) */
17851 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17852 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17854 /* Rear Pin: output 1 (0x0d) */
17855 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17856 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17858 /* CLFE Pin: output 2 (0x0e) */
17859 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17860 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17862 /* Mic (rear) pin: input vref at 80% */
17863 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
17864 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17865 /* Front Mic pin: input vref at 80% */
17866 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
17867 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17868 /* Line In pin: input */
17869 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17870 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17871 /* Line-2 In: Headphone output (output 0 - 0x0c) */
17872 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17873 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17874 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
17875 /* CD pin widget for input */
17876 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17878 /* FIXME: use matrix-type input source selection */
17879 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
17881 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17882 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17884 /* always trun on EAPD */
17885 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
17886 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
17891 static struct hda_verb alc663_init_verbs[] = {
17892 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17893 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17894 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17895 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17896 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17897 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17901 static struct hda_verb alc272_init_verbs[] = {
17902 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17903 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17904 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17905 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17906 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17907 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17908 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17909 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17913 static struct hda_verb alc662_sue_init_verbs[] = {
17914 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
17915 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
17919 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
17920 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17921 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17925 /* Set Unsolicited Event*/
17926 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
17927 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17928 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17932 static struct hda_verb alc663_m51va_init_verbs[] = {
17933 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17934 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17935 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17936 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17937 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17938 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17939 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17940 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17941 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17945 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
17946 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17947 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17948 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17949 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17950 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17951 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17952 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17956 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
17957 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17958 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17959 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17960 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17961 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17962 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17963 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17964 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17968 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
17969 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17970 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17971 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17972 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17973 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17974 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17975 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17979 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
17980 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17981 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17982 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17983 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
17984 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17985 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17986 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
17987 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17988 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17989 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17990 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17991 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17995 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
17996 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17997 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17998 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17999 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18000 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18001 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18002 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18003 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18004 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
18005 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18006 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18007 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18011 static struct hda_verb alc663_g71v_init_verbs[] = {
18012 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18013 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
18014 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
18016 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18017 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18018 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
18020 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
18021 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
18022 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
18026 static struct hda_verb alc663_g50v_init_verbs[] = {
18027 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18028 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18029 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
18031 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18032 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18036 static struct hda_verb alc662_ecs_init_verbs[] = {
18037 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
18038 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18039 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18040 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18044 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
18045 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18046 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18047 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18048 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18049 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18050 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18051 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18052 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18053 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18054 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18055 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18059 static struct hda_verb alc272_dell_init_verbs[] = {
18060 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18061 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18062 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18063 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
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 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18068 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
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 alc663_mode7_init_verbs[] = {
18075 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18076 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18077 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
18078 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18079 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18080 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18081 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
18082 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18083 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18084 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18085 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18086 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18087 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18088 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18089 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18093 static struct hda_verb alc663_mode8_init_verbs[] = {
18094 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18095 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18096 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18097 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
18098 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18099 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
18100 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18101 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18102 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18103 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18104 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18105 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18106 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18107 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18108 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18109 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18113 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
18114 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
18115 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
18119 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
18120 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
18121 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
18125 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
18127 unsigned int present;
18128 unsigned char bits;
18130 present = snd_hda_jack_detect(codec, 0x14);
18131 bits = present ? HDA_AMP_MUTE : 0;
18133 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
18134 HDA_AMP_MUTE, bits);
18137 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
18139 unsigned int present;
18140 unsigned char bits;
18142 present = snd_hda_jack_detect(codec, 0x1b);
18143 bits = present ? HDA_AMP_MUTE : 0;
18145 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
18146 HDA_AMP_MUTE, bits);
18147 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18148 HDA_AMP_MUTE, bits);
18151 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
18154 if ((res >> 26) == ALC880_HP_EVENT)
18155 alc662_lenovo_101e_all_automute(codec);
18156 if ((res >> 26) == ALC880_FRONT_EVENT)
18157 alc662_lenovo_101e_ispeaker_automute(codec);
18160 /* unsolicited event for HP jack sensing */
18161 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
18164 if ((res >> 26) == ALC880_MIC_EVENT)
18165 alc_mic_automute(codec);
18167 alc262_hippo_unsol_event(codec, res);
18170 static void alc662_eeepc_setup(struct hda_codec *codec)
18172 struct alc_spec *spec = codec->spec;
18174 alc262_hippo1_setup(codec);
18175 spec->ext_mic.pin = 0x18;
18176 spec->ext_mic.mux_idx = 0;
18177 spec->int_mic.pin = 0x19;
18178 spec->int_mic.mux_idx = 1;
18179 spec->auto_mic = 1;
18182 static void alc662_eeepc_inithook(struct hda_codec *codec)
18184 alc262_hippo_automute(codec);
18185 alc_mic_automute(codec);
18188 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
18190 struct alc_spec *spec = codec->spec;
18192 spec->autocfg.hp_pins[0] = 0x14;
18193 spec->autocfg.speaker_pins[0] = 0x1b;
18196 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
18198 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
18200 unsigned int present;
18201 unsigned char bits;
18203 present = snd_hda_jack_detect(codec, 0x21);
18204 bits = present ? HDA_AMP_MUTE : 0;
18205 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18206 HDA_AMP_MUTE, bits);
18207 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18208 HDA_AMP_MUTE, bits);
18211 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
18213 unsigned int present;
18214 unsigned char bits;
18216 present = snd_hda_jack_detect(codec, 0x21);
18217 bits = present ? HDA_AMP_MUTE : 0;
18218 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18219 HDA_AMP_MUTE, bits);
18220 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18221 HDA_AMP_MUTE, bits);
18222 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
18223 HDA_AMP_MUTE, bits);
18224 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
18225 HDA_AMP_MUTE, bits);
18228 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
18230 unsigned int present;
18231 unsigned char bits;
18233 present = snd_hda_jack_detect(codec, 0x15);
18234 bits = present ? HDA_AMP_MUTE : 0;
18235 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18236 HDA_AMP_MUTE, bits);
18237 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18238 HDA_AMP_MUTE, bits);
18239 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
18240 HDA_AMP_MUTE, bits);
18241 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
18242 HDA_AMP_MUTE, bits);
18245 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
18247 unsigned int present;
18248 unsigned char bits;
18250 present = snd_hda_jack_detect(codec, 0x1b);
18251 bits = present ? 0 : PIN_OUT;
18252 snd_hda_codec_write(codec, 0x14, 0,
18253 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
18256 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
18258 unsigned int present1, present2;
18260 present1 = snd_hda_jack_detect(codec, 0x21);
18261 present2 = snd_hda_jack_detect(codec, 0x15);
18263 if (present1 || present2) {
18264 snd_hda_codec_write_cache(codec, 0x14, 0,
18265 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18267 snd_hda_codec_write_cache(codec, 0x14, 0,
18268 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18272 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
18274 unsigned int present1, present2;
18276 present1 = snd_hda_jack_detect(codec, 0x1b);
18277 present2 = snd_hda_jack_detect(codec, 0x15);
18279 if (present1 || present2) {
18280 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18281 HDA_AMP_MUTE, HDA_AMP_MUTE);
18282 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18283 HDA_AMP_MUTE, HDA_AMP_MUTE);
18285 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18287 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18292 static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
18294 unsigned int present1, present2;
18296 present1 = snd_hda_codec_read(codec, 0x1b, 0,
18297 AC_VERB_GET_PIN_SENSE, 0)
18298 & AC_PINSENSE_PRESENCE;
18299 present2 = snd_hda_codec_read(codec, 0x21, 0,
18300 AC_VERB_GET_PIN_SENSE, 0)
18301 & AC_PINSENSE_PRESENCE;
18303 if (present1 || present2) {
18304 snd_hda_codec_write_cache(codec, 0x14, 0,
18305 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18306 snd_hda_codec_write_cache(codec, 0x17, 0,
18307 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18309 snd_hda_codec_write_cache(codec, 0x14, 0,
18310 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18311 snd_hda_codec_write_cache(codec, 0x17, 0,
18312 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18316 static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
18318 unsigned int present1, present2;
18320 present1 = snd_hda_codec_read(codec, 0x21, 0,
18321 AC_VERB_GET_PIN_SENSE, 0)
18322 & AC_PINSENSE_PRESENCE;
18323 present2 = snd_hda_codec_read(codec, 0x15, 0,
18324 AC_VERB_GET_PIN_SENSE, 0)
18325 & AC_PINSENSE_PRESENCE;
18327 if (present1 || present2) {
18328 snd_hda_codec_write_cache(codec, 0x14, 0,
18329 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18330 snd_hda_codec_write_cache(codec, 0x17, 0,
18331 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18333 snd_hda_codec_write_cache(codec, 0x14, 0,
18334 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18335 snd_hda_codec_write_cache(codec, 0x17, 0,
18336 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18340 static void alc663_m51va_unsol_event(struct hda_codec *codec,
18343 switch (res >> 26) {
18344 case ALC880_HP_EVENT:
18345 alc663_m51va_speaker_automute(codec);
18347 case ALC880_MIC_EVENT:
18348 alc_mic_automute(codec);
18353 static void alc663_m51va_setup(struct hda_codec *codec)
18355 struct alc_spec *spec = codec->spec;
18356 spec->ext_mic.pin = 0x18;
18357 spec->ext_mic.mux_idx = 0;
18358 spec->int_mic.pin = 0x12;
18359 spec->int_mic.mux_idx = 9;
18360 spec->auto_mic = 1;
18363 static void alc663_m51va_inithook(struct hda_codec *codec)
18365 alc663_m51va_speaker_automute(codec);
18366 alc_mic_automute(codec);
18369 /* ***************** Mode1 ******************************/
18370 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
18372 static void alc663_mode1_setup(struct hda_codec *codec)
18374 struct alc_spec *spec = codec->spec;
18375 spec->ext_mic.pin = 0x18;
18376 spec->ext_mic.mux_idx = 0;
18377 spec->int_mic.pin = 0x19;
18378 spec->int_mic.mux_idx = 1;
18379 spec->auto_mic = 1;
18382 #define alc663_mode1_inithook alc663_m51va_inithook
18384 /* ***************** Mode2 ******************************/
18385 static void alc662_mode2_unsol_event(struct hda_codec *codec,
18388 switch (res >> 26) {
18389 case ALC880_HP_EVENT:
18390 alc662_f5z_speaker_automute(codec);
18392 case ALC880_MIC_EVENT:
18393 alc_mic_automute(codec);
18398 #define alc662_mode2_setup alc663_mode1_setup
18400 static void alc662_mode2_inithook(struct hda_codec *codec)
18402 alc662_f5z_speaker_automute(codec);
18403 alc_mic_automute(codec);
18405 /* ***************** Mode3 ******************************/
18406 static void alc663_mode3_unsol_event(struct hda_codec *codec,
18409 switch (res >> 26) {
18410 case ALC880_HP_EVENT:
18411 alc663_two_hp_m1_speaker_automute(codec);
18413 case ALC880_MIC_EVENT:
18414 alc_mic_automute(codec);
18419 #define alc663_mode3_setup alc663_mode1_setup
18421 static void alc663_mode3_inithook(struct hda_codec *codec)
18423 alc663_two_hp_m1_speaker_automute(codec);
18424 alc_mic_automute(codec);
18426 /* ***************** Mode4 ******************************/
18427 static void alc663_mode4_unsol_event(struct hda_codec *codec,
18430 switch (res >> 26) {
18431 case ALC880_HP_EVENT:
18432 alc663_21jd_two_speaker_automute(codec);
18434 case ALC880_MIC_EVENT:
18435 alc_mic_automute(codec);
18440 #define alc663_mode4_setup alc663_mode1_setup
18442 static void alc663_mode4_inithook(struct hda_codec *codec)
18444 alc663_21jd_two_speaker_automute(codec);
18445 alc_mic_automute(codec);
18447 /* ***************** Mode5 ******************************/
18448 static void alc663_mode5_unsol_event(struct hda_codec *codec,
18451 switch (res >> 26) {
18452 case ALC880_HP_EVENT:
18453 alc663_15jd_two_speaker_automute(codec);
18455 case ALC880_MIC_EVENT:
18456 alc_mic_automute(codec);
18461 #define alc663_mode5_setup alc663_mode1_setup
18463 static void alc663_mode5_inithook(struct hda_codec *codec)
18465 alc663_15jd_two_speaker_automute(codec);
18466 alc_mic_automute(codec);
18468 /* ***************** Mode6 ******************************/
18469 static void alc663_mode6_unsol_event(struct hda_codec *codec,
18472 switch (res >> 26) {
18473 case ALC880_HP_EVENT:
18474 alc663_two_hp_m2_speaker_automute(codec);
18476 case ALC880_MIC_EVENT:
18477 alc_mic_automute(codec);
18482 #define alc663_mode6_setup alc663_mode1_setup
18484 static void alc663_mode6_inithook(struct hda_codec *codec)
18486 alc663_two_hp_m2_speaker_automute(codec);
18487 alc_mic_automute(codec);
18490 /* ***************** Mode7 ******************************/
18491 static void alc663_mode7_unsol_event(struct hda_codec *codec,
18494 switch (res >> 26) {
18495 case ALC880_HP_EVENT:
18496 alc663_two_hp_m7_speaker_automute(codec);
18498 case ALC880_MIC_EVENT:
18499 alc_mic_automute(codec);
18504 #define alc663_mode7_setup alc663_mode1_setup
18506 static void alc663_mode7_inithook(struct hda_codec *codec)
18508 alc663_two_hp_m7_speaker_automute(codec);
18509 alc_mic_automute(codec);
18512 /* ***************** Mode8 ******************************/
18513 static void alc663_mode8_unsol_event(struct hda_codec *codec,
18516 switch (res >> 26) {
18517 case ALC880_HP_EVENT:
18518 alc663_two_hp_m8_speaker_automute(codec);
18520 case ALC880_MIC_EVENT:
18521 alc_mic_automute(codec);
18526 #define alc663_mode8_setup alc663_m51va_setup
18528 static void alc663_mode8_inithook(struct hda_codec *codec)
18530 alc663_two_hp_m8_speaker_automute(codec);
18531 alc_mic_automute(codec);
18534 static void alc663_g71v_hp_automute(struct hda_codec *codec)
18536 unsigned int present;
18537 unsigned char bits;
18539 present = snd_hda_jack_detect(codec, 0x21);
18540 bits = present ? HDA_AMP_MUTE : 0;
18541 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
18542 HDA_AMP_MUTE, bits);
18543 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18544 HDA_AMP_MUTE, bits);
18547 static void alc663_g71v_front_automute(struct hda_codec *codec)
18549 unsigned int present;
18550 unsigned char bits;
18552 present = snd_hda_jack_detect(codec, 0x15);
18553 bits = present ? HDA_AMP_MUTE : 0;
18554 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18555 HDA_AMP_MUTE, bits);
18558 static void alc663_g71v_unsol_event(struct hda_codec *codec,
18561 switch (res >> 26) {
18562 case ALC880_HP_EVENT:
18563 alc663_g71v_hp_automute(codec);
18565 case ALC880_FRONT_EVENT:
18566 alc663_g71v_front_automute(codec);
18568 case ALC880_MIC_EVENT:
18569 alc_mic_automute(codec);
18574 #define alc663_g71v_setup alc663_m51va_setup
18576 static void alc663_g71v_inithook(struct hda_codec *codec)
18578 alc663_g71v_front_automute(codec);
18579 alc663_g71v_hp_automute(codec);
18580 alc_mic_automute(codec);
18583 static void alc663_g50v_unsol_event(struct hda_codec *codec,
18586 switch (res >> 26) {
18587 case ALC880_HP_EVENT:
18588 alc663_m51va_speaker_automute(codec);
18590 case ALC880_MIC_EVENT:
18591 alc_mic_automute(codec);
18596 #define alc663_g50v_setup alc663_m51va_setup
18598 static void alc663_g50v_inithook(struct hda_codec *codec)
18600 alc663_m51va_speaker_automute(codec);
18601 alc_mic_automute(codec);
18604 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
18605 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
18606 ALC262_HIPPO_MASTER_SWITCH,
18608 HDA_CODEC_VOLUME("Mic/LineIn Boost Volume", 0x18, 0, HDA_INPUT),
18609 HDA_CODEC_VOLUME("Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
18610 HDA_CODEC_MUTE("Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
18612 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
18613 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
18614 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
18618 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
18619 /* Master Playback automatically created from Speaker and Headphone */
18620 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
18621 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
18622 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
18623 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
18625 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
18626 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
18627 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
18629 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
18630 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
18631 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
18635 #ifdef CONFIG_SND_HDA_POWER_SAVE
18636 #define alc662_loopbacks alc880_loopbacks
18640 /* pcm configuration: identical with ALC880 */
18641 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
18642 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
18643 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
18644 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
18647 * configuration and preset
18649 static const char * const alc662_models[ALC662_MODEL_LAST] = {
18650 [ALC662_3ST_2ch_DIG] = "3stack-dig",
18651 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
18652 [ALC662_3ST_6ch] = "3stack-6ch",
18653 [ALC662_5ST_DIG] = "6stack-dig",
18654 [ALC662_LENOVO_101E] = "lenovo-101e",
18655 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
18656 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
18657 [ALC662_ECS] = "ecs",
18658 [ALC663_ASUS_M51VA] = "m51va",
18659 [ALC663_ASUS_G71V] = "g71v",
18660 [ALC663_ASUS_H13] = "h13",
18661 [ALC663_ASUS_G50V] = "g50v",
18662 [ALC663_ASUS_MODE1] = "asus-mode1",
18663 [ALC662_ASUS_MODE2] = "asus-mode2",
18664 [ALC663_ASUS_MODE3] = "asus-mode3",
18665 [ALC663_ASUS_MODE4] = "asus-mode4",
18666 [ALC663_ASUS_MODE5] = "asus-mode5",
18667 [ALC663_ASUS_MODE6] = "asus-mode6",
18668 [ALC663_ASUS_MODE7] = "asus-mode7",
18669 [ALC663_ASUS_MODE8] = "asus-mode8",
18670 [ALC272_DELL] = "dell",
18671 [ALC272_DELL_ZM1] = "dell-zm1",
18672 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
18673 [ALC662_AUTO] = "auto",
18676 static struct snd_pci_quirk alc662_cfg_tbl[] = {
18677 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
18678 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
18679 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
18680 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
18681 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
18682 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1),
18683 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
18684 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
18685 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
18686 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
18687 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
18688 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
18689 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
18690 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
18691 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
18692 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
18693 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
18694 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
18695 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
18696 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
18697 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
18698 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
18699 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
18700 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
18701 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
18702 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
18703 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
18704 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
18705 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
18706 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
18707 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
18708 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
18709 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
18710 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
18711 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
18712 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
18713 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
18714 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
18715 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
18716 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
18717 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
18718 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1),
18719 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
18720 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
18721 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
18722 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
18723 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
18724 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
18725 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
18726 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
18727 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
18728 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
18729 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
18730 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
18731 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
18732 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
18733 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
18734 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
18735 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
18736 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
18737 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
18738 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
18739 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
18740 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
18741 ALC662_3ST_6ch_DIG),
18742 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO),
18743 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
18744 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
18745 ALC662_3ST_6ch_DIG),
18746 SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13),
18747 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
18748 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
18749 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
18750 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
18751 ALC662_3ST_6ch_DIG),
18752 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
18754 SND_PCI_QUIRK(0x1991, 0x5628, "Ordissimo EVE", ALC662_LENOVO_101E),
18758 static struct alc_config_preset alc662_presets[] = {
18759 [ALC662_3ST_2ch_DIG] = {
18760 .mixers = { alc662_3ST_2ch_mixer },
18761 .init_verbs = { alc662_init_verbs },
18762 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18763 .dac_nids = alc662_dac_nids,
18764 .dig_out_nid = ALC662_DIGOUT_NID,
18765 .dig_in_nid = ALC662_DIGIN_NID,
18766 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18767 .channel_mode = alc662_3ST_2ch_modes,
18768 .input_mux = &alc662_capture_source,
18770 [ALC662_3ST_6ch_DIG] = {
18771 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18772 .init_verbs = { alc662_init_verbs },
18773 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18774 .dac_nids = alc662_dac_nids,
18775 .dig_out_nid = ALC662_DIGOUT_NID,
18776 .dig_in_nid = ALC662_DIGIN_NID,
18777 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18778 .channel_mode = alc662_3ST_6ch_modes,
18780 .input_mux = &alc662_capture_source,
18782 [ALC662_3ST_6ch] = {
18783 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18784 .init_verbs = { alc662_init_verbs },
18785 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18786 .dac_nids = alc662_dac_nids,
18787 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18788 .channel_mode = alc662_3ST_6ch_modes,
18790 .input_mux = &alc662_capture_source,
18792 [ALC662_5ST_DIG] = {
18793 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
18794 .init_verbs = { alc662_init_verbs },
18795 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18796 .dac_nids = alc662_dac_nids,
18797 .dig_out_nid = ALC662_DIGOUT_NID,
18798 .dig_in_nid = ALC662_DIGIN_NID,
18799 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
18800 .channel_mode = alc662_5stack_modes,
18801 .input_mux = &alc662_capture_source,
18803 [ALC662_LENOVO_101E] = {
18804 .mixers = { alc662_lenovo_101e_mixer },
18805 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
18806 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18807 .dac_nids = alc662_dac_nids,
18808 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18809 .channel_mode = alc662_3ST_2ch_modes,
18810 .input_mux = &alc662_lenovo_101e_capture_source,
18811 .unsol_event = alc662_lenovo_101e_unsol_event,
18812 .init_hook = alc662_lenovo_101e_all_automute,
18814 [ALC662_ASUS_EEEPC_P701] = {
18815 .mixers = { alc662_eeepc_p701_mixer },
18816 .init_verbs = { alc662_init_verbs,
18817 alc662_eeepc_sue_init_verbs },
18818 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18819 .dac_nids = alc662_dac_nids,
18820 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18821 .channel_mode = alc662_3ST_2ch_modes,
18822 .unsol_event = alc662_eeepc_unsol_event,
18823 .setup = alc662_eeepc_setup,
18824 .init_hook = alc662_eeepc_inithook,
18826 [ALC662_ASUS_EEEPC_EP20] = {
18827 .mixers = { alc662_eeepc_ep20_mixer,
18828 alc662_chmode_mixer },
18829 .init_verbs = { alc662_init_verbs,
18830 alc662_eeepc_ep20_sue_init_verbs },
18831 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18832 .dac_nids = alc662_dac_nids,
18833 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18834 .channel_mode = alc662_3ST_6ch_modes,
18835 .input_mux = &alc662_lenovo_101e_capture_source,
18836 .unsol_event = alc662_eeepc_unsol_event,
18837 .setup = alc662_eeepc_ep20_setup,
18838 .init_hook = alc662_eeepc_ep20_inithook,
18841 .mixers = { alc662_ecs_mixer },
18842 .init_verbs = { alc662_init_verbs,
18843 alc662_ecs_init_verbs },
18844 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18845 .dac_nids = alc662_dac_nids,
18846 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18847 .channel_mode = alc662_3ST_2ch_modes,
18848 .unsol_event = alc662_eeepc_unsol_event,
18849 .setup = alc662_eeepc_setup,
18850 .init_hook = alc662_eeepc_inithook,
18852 [ALC663_ASUS_M51VA] = {
18853 .mixers = { alc663_m51va_mixer },
18854 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
18855 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18856 .dac_nids = alc662_dac_nids,
18857 .dig_out_nid = ALC662_DIGOUT_NID,
18858 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18859 .channel_mode = alc662_3ST_2ch_modes,
18860 .unsol_event = alc663_m51va_unsol_event,
18861 .setup = alc663_m51va_setup,
18862 .init_hook = alc663_m51va_inithook,
18864 [ALC663_ASUS_G71V] = {
18865 .mixers = { alc663_g71v_mixer },
18866 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
18867 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18868 .dac_nids = alc662_dac_nids,
18869 .dig_out_nid = ALC662_DIGOUT_NID,
18870 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18871 .channel_mode = alc662_3ST_2ch_modes,
18872 .unsol_event = alc663_g71v_unsol_event,
18873 .setup = alc663_g71v_setup,
18874 .init_hook = alc663_g71v_inithook,
18876 [ALC663_ASUS_H13] = {
18877 .mixers = { alc663_m51va_mixer },
18878 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
18879 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18880 .dac_nids = alc662_dac_nids,
18881 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18882 .channel_mode = alc662_3ST_2ch_modes,
18883 .unsol_event = alc663_m51va_unsol_event,
18884 .init_hook = alc663_m51va_inithook,
18886 [ALC663_ASUS_G50V] = {
18887 .mixers = { alc663_g50v_mixer },
18888 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
18889 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18890 .dac_nids = alc662_dac_nids,
18891 .dig_out_nid = ALC662_DIGOUT_NID,
18892 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18893 .channel_mode = alc662_3ST_6ch_modes,
18894 .input_mux = &alc663_capture_source,
18895 .unsol_event = alc663_g50v_unsol_event,
18896 .setup = alc663_g50v_setup,
18897 .init_hook = alc663_g50v_inithook,
18899 [ALC663_ASUS_MODE1] = {
18900 .mixers = { alc663_m51va_mixer },
18901 .cap_mixer = alc662_auto_capture_mixer,
18902 .init_verbs = { alc662_init_verbs,
18903 alc663_21jd_amic_init_verbs },
18904 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18906 .dac_nids = alc662_dac_nids,
18907 .dig_out_nid = ALC662_DIGOUT_NID,
18908 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18909 .channel_mode = alc662_3ST_2ch_modes,
18910 .unsol_event = alc663_mode1_unsol_event,
18911 .setup = alc663_mode1_setup,
18912 .init_hook = alc663_mode1_inithook,
18914 [ALC662_ASUS_MODE2] = {
18915 .mixers = { alc662_1bjd_mixer },
18916 .cap_mixer = alc662_auto_capture_mixer,
18917 .init_verbs = { alc662_init_verbs,
18918 alc662_1bjd_amic_init_verbs },
18919 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18920 .dac_nids = alc662_dac_nids,
18921 .dig_out_nid = ALC662_DIGOUT_NID,
18922 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18923 .channel_mode = alc662_3ST_2ch_modes,
18924 .unsol_event = alc662_mode2_unsol_event,
18925 .setup = alc662_mode2_setup,
18926 .init_hook = alc662_mode2_inithook,
18928 [ALC663_ASUS_MODE3] = {
18929 .mixers = { alc663_two_hp_m1_mixer },
18930 .cap_mixer = alc662_auto_capture_mixer,
18931 .init_verbs = { alc662_init_verbs,
18932 alc663_two_hp_amic_m1_init_verbs },
18933 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18935 .dac_nids = alc662_dac_nids,
18936 .dig_out_nid = ALC662_DIGOUT_NID,
18937 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18938 .channel_mode = alc662_3ST_2ch_modes,
18939 .unsol_event = alc663_mode3_unsol_event,
18940 .setup = alc663_mode3_setup,
18941 .init_hook = alc663_mode3_inithook,
18943 [ALC663_ASUS_MODE4] = {
18944 .mixers = { alc663_asus_21jd_clfe_mixer },
18945 .cap_mixer = alc662_auto_capture_mixer,
18946 .init_verbs = { alc662_init_verbs,
18947 alc663_21jd_amic_init_verbs},
18948 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18950 .dac_nids = alc662_dac_nids,
18951 .dig_out_nid = ALC662_DIGOUT_NID,
18952 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18953 .channel_mode = alc662_3ST_2ch_modes,
18954 .unsol_event = alc663_mode4_unsol_event,
18955 .setup = alc663_mode4_setup,
18956 .init_hook = alc663_mode4_inithook,
18958 [ALC663_ASUS_MODE5] = {
18959 .mixers = { alc663_asus_15jd_clfe_mixer },
18960 .cap_mixer = alc662_auto_capture_mixer,
18961 .init_verbs = { alc662_init_verbs,
18962 alc663_15jd_amic_init_verbs },
18963 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18965 .dac_nids = alc662_dac_nids,
18966 .dig_out_nid = ALC662_DIGOUT_NID,
18967 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18968 .channel_mode = alc662_3ST_2ch_modes,
18969 .unsol_event = alc663_mode5_unsol_event,
18970 .setup = alc663_mode5_setup,
18971 .init_hook = alc663_mode5_inithook,
18973 [ALC663_ASUS_MODE6] = {
18974 .mixers = { alc663_two_hp_m2_mixer },
18975 .cap_mixer = alc662_auto_capture_mixer,
18976 .init_verbs = { alc662_init_verbs,
18977 alc663_two_hp_amic_m2_init_verbs },
18978 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18980 .dac_nids = alc662_dac_nids,
18981 .dig_out_nid = ALC662_DIGOUT_NID,
18982 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18983 .channel_mode = alc662_3ST_2ch_modes,
18984 .unsol_event = alc663_mode6_unsol_event,
18985 .setup = alc663_mode6_setup,
18986 .init_hook = alc663_mode6_inithook,
18988 [ALC663_ASUS_MODE7] = {
18989 .mixers = { alc663_mode7_mixer },
18990 .cap_mixer = alc662_auto_capture_mixer,
18991 .init_verbs = { alc662_init_verbs,
18992 alc663_mode7_init_verbs },
18993 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18995 .dac_nids = alc662_dac_nids,
18996 .dig_out_nid = ALC662_DIGOUT_NID,
18997 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18998 .channel_mode = alc662_3ST_2ch_modes,
18999 .unsol_event = alc663_mode7_unsol_event,
19000 .setup = alc663_mode7_setup,
19001 .init_hook = alc663_mode7_inithook,
19003 [ALC663_ASUS_MODE8] = {
19004 .mixers = { alc663_mode8_mixer },
19005 .cap_mixer = alc662_auto_capture_mixer,
19006 .init_verbs = { alc662_init_verbs,
19007 alc663_mode8_init_verbs },
19008 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
19010 .dac_nids = alc662_dac_nids,
19011 .dig_out_nid = ALC662_DIGOUT_NID,
19012 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19013 .channel_mode = alc662_3ST_2ch_modes,
19014 .unsol_event = alc663_mode8_unsol_event,
19015 .setup = alc663_mode8_setup,
19016 .init_hook = alc663_mode8_inithook,
19019 .mixers = { alc663_m51va_mixer },
19020 .cap_mixer = alc272_auto_capture_mixer,
19021 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
19022 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
19023 .dac_nids = alc662_dac_nids,
19024 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19025 .adc_nids = alc272_adc_nids,
19026 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
19027 .capsrc_nids = alc272_capsrc_nids,
19028 .channel_mode = alc662_3ST_2ch_modes,
19029 .unsol_event = alc663_m51va_unsol_event,
19030 .setup = alc663_m51va_setup,
19031 .init_hook = alc663_m51va_inithook,
19033 [ALC272_DELL_ZM1] = {
19034 .mixers = { alc663_m51va_mixer },
19035 .cap_mixer = alc662_auto_capture_mixer,
19036 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
19037 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
19038 .dac_nids = alc662_dac_nids,
19039 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19040 .adc_nids = alc662_adc_nids,
19042 .capsrc_nids = alc662_capsrc_nids,
19043 .channel_mode = alc662_3ST_2ch_modes,
19044 .unsol_event = alc663_m51va_unsol_event,
19045 .setup = alc663_m51va_setup,
19046 .init_hook = alc663_m51va_inithook,
19048 [ALC272_SAMSUNG_NC10] = {
19049 .mixers = { alc272_nc10_mixer },
19050 .init_verbs = { alc662_init_verbs,
19051 alc663_21jd_amic_init_verbs },
19052 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
19053 .dac_nids = alc272_dac_nids,
19054 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19055 .channel_mode = alc662_3ST_2ch_modes,
19056 /*.input_mux = &alc272_nc10_capture_source,*/
19057 .unsol_event = alc663_mode4_unsol_event,
19058 .setup = alc663_mode4_setup,
19059 .init_hook = alc663_mode4_inithook,
19065 * BIOS auto configuration
19068 /* convert from MIX nid to DAC */
19069 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
19073 else if (nid >= 0x0c && nid <= 0x0e)
19074 return nid - 0x0c + 0x02;
19075 else if (nid == 0x26) /* ALC887-VD has this DAC too */
19081 /* get MIX nid connected to the given pin targeted to DAC */
19082 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
19088 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
19089 for (i = 0; i < num; i++) {
19090 if (alc662_mix_to_dac(mix[i]) == dac)
19096 /* look for an empty DAC slot */
19097 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
19099 struct alc_spec *spec = codec->spec;
19103 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
19106 for (i = 0; i < num; i++) {
19107 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
19110 for (j = 0; j < spec->multiout.num_dacs; j++)
19111 if (spec->multiout.dac_nids[j] == nid)
19113 if (j >= spec->multiout.num_dacs)
19119 /* fill in the dac_nids table from the parsed pin configuration */
19120 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
19121 const struct auto_pin_cfg *cfg)
19123 struct alc_spec *spec = codec->spec;
19127 spec->multiout.dac_nids = spec->private_dac_nids;
19128 for (i = 0; i < cfg->line_outs; i++) {
19129 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
19132 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
19137 static inline int __alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
19138 hda_nid_t nid, int idx, unsigned int chs)
19140 return __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, idx,
19141 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
19144 static inline int __alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
19145 hda_nid_t nid, int idx, unsigned int chs)
19147 return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, idx,
19148 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
19151 #define alc662_add_vol_ctl(spec, pfx, nid, chs) \
19152 __alc662_add_vol_ctl(spec, pfx, nid, 0, chs)
19153 #define alc662_add_sw_ctl(spec, pfx, nid, chs) \
19154 __alc662_add_sw_ctl(spec, pfx, nid, 0, chs)
19155 #define alc662_add_stereo_vol(spec, pfx, nid) \
19156 alc662_add_vol_ctl(spec, pfx, nid, 3)
19157 #define alc662_add_stereo_sw(spec, pfx, nid) \
19158 alc662_add_sw_ctl(spec, pfx, nid, 3)
19160 /* add playback controls from the parsed DAC table */
19161 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
19162 const struct auto_pin_cfg *cfg)
19164 struct alc_spec *spec = codec->spec;
19165 static const char * const chname[4] = {
19166 "Front", "Surround", NULL /*CLFE*/, "Side"
19168 const char *pfx = alc_get_line_out_pfx(cfg, true);
19169 hda_nid_t nid, mix;
19172 for (i = 0; i < cfg->line_outs; i++) {
19173 nid = spec->multiout.dac_nids[i];
19176 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
19179 if (!pfx && i == 2) {
19181 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
19184 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
19187 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
19190 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
19194 const char *name = pfx;
19197 err = __alc662_add_vol_ctl(spec, name, nid, i, 3);
19200 err = __alc662_add_sw_ctl(spec, name, mix, i, 3);
19208 /* add playback controls for speaker and HP outputs */
19209 /* return DAC nid if any new DAC is assigned */
19210 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
19213 struct alc_spec *spec = codec->spec;
19214 hda_nid_t nid, mix;
19219 nid = alc662_look_for_dac(codec, pin);
19221 /* the corresponding DAC is already occupied */
19222 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
19223 return 0; /* no way */
19224 /* create a switch only */
19225 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
19226 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
19229 mix = alc662_dac_to_mix(codec, pin, nid);
19232 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
19235 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
19241 /* create playback/capture controls for input pins */
19242 #define alc662_auto_create_input_ctls \
19243 alc882_auto_create_input_ctls
19245 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
19246 hda_nid_t nid, int pin_type,
19250 hda_nid_t srcs[HDA_MAX_CONNECTIONS];
19252 alc_set_pin_output(codec, nid, pin_type);
19253 /* need the manual connection? */
19254 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
19257 for (i = 0; i < num; i++) {
19258 if (alc662_mix_to_dac(srcs[i]) != dac)
19260 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
19265 static void alc662_auto_init_multi_out(struct hda_codec *codec)
19267 struct alc_spec *spec = codec->spec;
19268 int pin_type = get_pin_type(spec->autocfg.line_out_type);
19271 for (i = 0; i <= HDA_SIDE; i++) {
19272 hda_nid_t nid = spec->autocfg.line_out_pins[i];
19274 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
19275 spec->multiout.dac_nids[i]);
19279 static void alc662_auto_init_hp_out(struct hda_codec *codec)
19281 struct alc_spec *spec = codec->spec;
19284 pin = spec->autocfg.hp_pins[0];
19286 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
19287 spec->multiout.hp_nid);
19288 pin = spec->autocfg.speaker_pins[0];
19290 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
19291 spec->multiout.extra_out_nid[0]);
19294 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
19296 static void alc662_auto_init_analog_input(struct hda_codec *codec)
19298 struct alc_spec *spec = codec->spec;
19299 struct auto_pin_cfg *cfg = &spec->autocfg;
19302 for (i = 0; i < cfg->num_inputs; i++) {
19303 hda_nid_t nid = cfg->inputs[i].pin;
19304 if (alc_is_input_pin(codec, nid)) {
19305 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
19306 if (nid != ALC662_PIN_CD_NID &&
19307 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
19308 snd_hda_codec_write(codec, nid, 0,
19309 AC_VERB_SET_AMP_GAIN_MUTE,
19315 #define alc662_auto_init_input_src alc882_auto_init_input_src
19317 static int alc662_parse_auto_config(struct hda_codec *codec)
19319 struct alc_spec *spec = codec->spec;
19321 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
19323 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
19327 if (!spec->autocfg.line_outs)
19328 return 0; /* can't find valid BIOS pin config */
19330 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
19333 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
19336 err = alc662_auto_create_extra_out(codec,
19337 spec->autocfg.speaker_pins[0],
19342 spec->multiout.extra_out_nid[0] = err;
19343 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
19348 spec->multiout.hp_nid = err;
19349 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
19353 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
19355 alc_auto_parse_digital(codec);
19357 if (spec->kctls.list)
19358 add_mixer(spec, spec->kctls.list);
19360 spec->num_mux_defs = 1;
19361 spec->input_mux = &spec->private_imux[0];
19363 add_verb(spec, alc662_init_verbs);
19364 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
19365 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
19366 add_verb(spec, alc663_init_verbs);
19368 if (codec->vendor_id == 0x10ec0272)
19369 add_verb(spec, alc272_init_verbs);
19371 err = alc_auto_add_mic_boost(codec);
19375 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
19376 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
19377 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21);
19379 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
19384 /* additional initialization for auto-configuration model */
19385 static void alc662_auto_init(struct hda_codec *codec)
19387 struct alc_spec *spec = codec->spec;
19388 alc662_auto_init_multi_out(codec);
19389 alc662_auto_init_hp_out(codec);
19390 alc662_auto_init_analog_input(codec);
19391 alc662_auto_init_input_src(codec);
19392 alc_auto_init_digital(codec);
19393 if (spec->unsol_event)
19394 alc_inithook(codec);
19397 static void alc272_fixup_mario(struct hda_codec *codec,
19398 const struct alc_fixup *fix, int action)
19400 if (action != ALC_FIXUP_ACT_PROBE)
19402 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
19403 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
19404 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
19405 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
19406 (0 << AC_AMPCAP_MUTE_SHIFT)))
19407 printk(KERN_WARNING
19408 "hda_codec: failed to override amp caps for NID 0x2\n");
19412 ALC662_FIXUP_ASPIRE,
19413 ALC662_FIXUP_IDEAPAD,
19414 ALC272_FIXUP_MARIO,
19415 ALC662_FIXUP_CZC_P10T,
19418 static const struct alc_fixup alc662_fixups[] = {
19419 [ALC662_FIXUP_ASPIRE] = {
19420 .type = ALC_FIXUP_PINS,
19421 .v.pins = (const struct alc_pincfg[]) {
19422 { 0x15, 0x99130112 }, /* subwoofer */
19426 [ALC662_FIXUP_IDEAPAD] = {
19427 .type = ALC_FIXUP_PINS,
19428 .v.pins = (const struct alc_pincfg[]) {
19429 { 0x17, 0x99130112 }, /* subwoofer */
19433 [ALC272_FIXUP_MARIO] = {
19434 .type = ALC_FIXUP_FUNC,
19435 .v.func = alc272_fixup_mario,
19437 [ALC662_FIXUP_CZC_P10T] = {
19438 .type = ALC_FIXUP_VERBS,
19439 .v.verbs = (const struct hda_verb[]) {
19440 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
19446 static struct snd_pci_quirk alc662_fixup_tbl[] = {
19447 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
19448 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
19449 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
19450 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
19451 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
19452 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
19456 static const struct alc_model_fixup alc662_fixup_models[] = {
19457 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
19462 static int patch_alc662(struct hda_codec *codec)
19464 struct alc_spec *spec;
19465 int err, board_config;
19468 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
19472 codec->spec = spec;
19474 alc_auto_parse_customize_define(codec);
19476 alc_fix_pll_init(codec, 0x20, 0x04, 15);
19478 coef = alc_read_coef_idx(codec, 0);
19479 if (coef == 0x8020 || coef == 0x8011)
19480 alc_codec_rename(codec, "ALC661");
19481 else if (coef & (1 << 14) &&
19482 codec->bus->pci->subsystem_vendor == 0x1025 &&
19483 spec->cdefine.platform_type == 1)
19484 alc_codec_rename(codec, "ALC272X");
19485 else if (coef == 0x4011)
19486 alc_codec_rename(codec, "ALC656");
19488 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
19491 if (board_config < 0) {
19492 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
19494 board_config = ALC662_AUTO;
19497 if (board_config == ALC662_AUTO) {
19498 alc_pick_fixup(codec, alc662_fixup_models,
19499 alc662_fixup_tbl, alc662_fixups);
19500 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
19501 /* automatic parse from the BIOS config */
19502 err = alc662_parse_auto_config(codec);
19508 "hda_codec: Cannot set up configuration "
19509 "from BIOS. Using base mode...\n");
19510 board_config = ALC662_3ST_2ch_DIG;
19514 if (has_cdefine_beep(codec)) {
19515 err = snd_hda_attach_beep_device(codec, 0x1);
19522 if (board_config != ALC662_AUTO)
19523 setup_preset(codec, &alc662_presets[board_config]);
19525 spec->stream_analog_playback = &alc662_pcm_analog_playback;
19526 spec->stream_analog_capture = &alc662_pcm_analog_capture;
19528 spec->stream_digital_playback = &alc662_pcm_digital_playback;
19529 spec->stream_digital_capture = &alc662_pcm_digital_capture;
19531 if (!spec->adc_nids) {
19532 spec->adc_nids = alc662_adc_nids;
19533 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
19535 if (!spec->capsrc_nids)
19536 spec->capsrc_nids = alc662_capsrc_nids;
19538 if (!spec->cap_mixer)
19539 set_capture_mixer(codec);
19541 if (has_cdefine_beep(codec)) {
19542 switch (codec->vendor_id) {
19544 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
19549 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
19552 set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
19556 spec->vmaster_nid = 0x02;
19558 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
19560 codec->patch_ops = alc_patch_ops;
19561 if (board_config == ALC662_AUTO)
19562 spec->init_hook = alc662_auto_init;
19564 alc_init_jacks(codec);
19566 #ifdef CONFIG_SND_HDA_POWER_SAVE
19567 if (!spec->loopback.amplist)
19568 spec->loopback.amplist = alc662_loopbacks;
19574 static int patch_alc888(struct hda_codec *codec)
19576 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
19577 kfree(codec->chip_name);
19578 if (codec->vendor_id == 0x10ec0887)
19579 codec->chip_name = kstrdup("ALC887-VD", GFP_KERNEL);
19581 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
19582 if (!codec->chip_name) {
19586 return patch_alc662(codec);
19588 return patch_alc882(codec);
19594 #define ALC680_DIGIN_NID ALC880_DIGIN_NID
19595 #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID
19596 #define alc680_modes alc260_modes
19598 static hda_nid_t alc680_dac_nids[3] = {
19599 /* Lout1, Lout2, hp */
19603 static hda_nid_t alc680_adc_nids[3] = {
19605 /* DMIC, MIC, Line-in*/
19610 * Analog capture ADC cgange
19612 static void alc680_rec_autoswitch(struct hda_codec *codec)
19614 struct alc_spec *spec = codec->spec;
19615 struct auto_pin_cfg *cfg = &spec->autocfg;
19617 int type_found = AUTO_PIN_LAST;
19621 for (i = 0; i < cfg->num_inputs; i++) {
19622 nid = cfg->inputs[i].pin;
19623 if (!(snd_hda_query_pin_caps(codec, nid) &
19624 AC_PINCAP_PRES_DETECT))
19626 if (snd_hda_jack_detect(codec, nid)) {
19627 if (cfg->inputs[i].type < type_found) {
19628 type_found = cfg->inputs[i].type;
19636 snd_hda_get_connections(codec, pin_found, &nid, 1);
19638 if (nid != spec->cur_adc)
19639 __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1);
19640 spec->cur_adc = nid;
19641 snd_hda_codec_setup_stream(codec, nid, spec->cur_adc_stream_tag, 0,
19642 spec->cur_adc_format);
19645 static int alc680_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
19646 struct hda_codec *codec,
19647 unsigned int stream_tag,
19648 unsigned int format,
19649 struct snd_pcm_substream *substream)
19651 struct alc_spec *spec = codec->spec;
19653 spec->cur_adc = 0x07;
19654 spec->cur_adc_stream_tag = stream_tag;
19655 spec->cur_adc_format = format;
19657 alc680_rec_autoswitch(codec);
19661 static int alc680_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
19662 struct hda_codec *codec,
19663 struct snd_pcm_substream *substream)
19665 snd_hda_codec_cleanup_stream(codec, 0x07);
19666 snd_hda_codec_cleanup_stream(codec, 0x08);
19667 snd_hda_codec_cleanup_stream(codec, 0x09);
19671 static struct hda_pcm_stream alc680_pcm_analog_auto_capture = {
19672 .substreams = 1, /* can be overridden */
19675 /* NID is set in alc_build_pcms */
19677 .prepare = alc680_capture_pcm_prepare,
19678 .cleanup = alc680_capture_pcm_cleanup
19682 static struct snd_kcontrol_new alc680_base_mixer[] = {
19683 /* output mixer control */
19684 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
19685 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
19686 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT),
19687 HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT),
19688 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x12, 0, HDA_INPUT),
19689 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
19690 HDA_CODEC_VOLUME("Line In Boost Volume", 0x19, 0, HDA_INPUT),
19694 static struct hda_bind_ctls alc680_bind_cap_vol = {
19695 .ops = &snd_hda_bind_vol,
19697 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT),
19698 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
19699 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
19704 static struct hda_bind_ctls alc680_bind_cap_switch = {
19705 .ops = &snd_hda_bind_sw,
19707 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT),
19708 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
19709 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
19714 static struct snd_kcontrol_new alc680_master_capture_mixer[] = {
19715 HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol),
19716 HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch),
19721 * generic initialization of ADC, input mixers and output mixers
19723 static struct hda_verb alc680_init_verbs[] = {
19724 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19725 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19726 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19728 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
19729 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
19730 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
19731 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
19732 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
19733 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
19735 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19736 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19737 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19738 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19739 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19741 {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
19742 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
19743 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
19748 /* toggle speaker-output according to the hp-jack state */
19749 static void alc680_base_setup(struct hda_codec *codec)
19751 struct alc_spec *spec = codec->spec;
19753 spec->autocfg.hp_pins[0] = 0x16;
19754 spec->autocfg.speaker_pins[0] = 0x14;
19755 spec->autocfg.speaker_pins[1] = 0x15;
19756 spec->autocfg.num_inputs = 2;
19757 spec->autocfg.inputs[0].pin = 0x18;
19758 spec->autocfg.inputs[0].type = AUTO_PIN_MIC;
19759 spec->autocfg.inputs[1].pin = 0x19;
19760 spec->autocfg.inputs[1].type = AUTO_PIN_LINE_IN;
19763 static void alc680_unsol_event(struct hda_codec *codec,
19766 if ((res >> 26) == ALC880_HP_EVENT)
19767 alc_automute_amp(codec);
19768 if ((res >> 26) == ALC880_MIC_EVENT)
19769 alc680_rec_autoswitch(codec);
19772 static void alc680_inithook(struct hda_codec *codec)
19774 alc_automute_amp(codec);
19775 alc680_rec_autoswitch(codec);
19778 /* create input playback/capture controls for the given pin */
19779 static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
19780 const char *ctlname, int idx)
19798 if (spec->multiout.dac_nids[0] != dac &&
19799 spec->multiout.dac_nids[1] != dac) {
19800 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
19801 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
19806 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
19807 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
19811 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
19817 /* add playback controls from the parsed DAC table */
19818 static int alc680_auto_create_multi_out_ctls(struct alc_spec *spec,
19819 const struct auto_pin_cfg *cfg)
19824 spec->multiout.dac_nids = spec->private_dac_nids;
19826 nid = cfg->line_out_pins[0];
19829 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
19833 err = alc680_new_analog_output(spec, nid, name, 0);
19838 nid = cfg->speaker_pins[0];
19840 err = alc680_new_analog_output(spec, nid, "Speaker", 0);
19844 nid = cfg->hp_pins[0];
19846 err = alc680_new_analog_output(spec, nid, "Headphone", 0);
19854 static void alc680_auto_set_output_and_unmute(struct hda_codec *codec,
19855 hda_nid_t nid, int pin_type)
19857 alc_set_pin_output(codec, nid, pin_type);
19860 static void alc680_auto_init_multi_out(struct hda_codec *codec)
19862 struct alc_spec *spec = codec->spec;
19863 hda_nid_t nid = spec->autocfg.line_out_pins[0];
19865 int pin_type = get_pin_type(spec->autocfg.line_out_type);
19866 alc680_auto_set_output_and_unmute(codec, nid, pin_type);
19870 static void alc680_auto_init_hp_out(struct hda_codec *codec)
19872 struct alc_spec *spec = codec->spec;
19875 pin = spec->autocfg.hp_pins[0];
19877 alc680_auto_set_output_and_unmute(codec, pin, PIN_HP);
19878 pin = spec->autocfg.speaker_pins[0];
19880 alc680_auto_set_output_and_unmute(codec, pin, PIN_OUT);
19883 /* pcm configuration: identical with ALC880 */
19884 #define alc680_pcm_analog_playback alc880_pcm_analog_playback
19885 #define alc680_pcm_analog_capture alc880_pcm_analog_capture
19886 #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
19887 #define alc680_pcm_digital_playback alc880_pcm_digital_playback
19888 #define alc680_pcm_digital_capture alc880_pcm_digital_capture
19891 * BIOS auto configuration
19893 static int alc680_parse_auto_config(struct hda_codec *codec)
19895 struct alc_spec *spec = codec->spec;
19897 static hda_nid_t alc680_ignore[] = { 0 };
19899 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
19904 if (!spec->autocfg.line_outs) {
19905 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
19906 spec->multiout.max_channels = 2;
19907 spec->no_analog = 1;
19910 return 0; /* can't find valid BIOS pin config */
19912 err = alc680_auto_create_multi_out_ctls(spec, &spec->autocfg);
19916 spec->multiout.max_channels = 2;
19919 /* digital only support output */
19920 alc_auto_parse_digital(codec);
19921 if (spec->kctls.list)
19922 add_mixer(spec, spec->kctls.list);
19924 add_verb(spec, alc680_init_verbs);
19926 err = alc_auto_add_mic_boost(codec);
19933 #define alc680_auto_init_analog_input alc882_auto_init_analog_input
19935 /* init callback for auto-configuration model -- overriding the default init */
19936 static void alc680_auto_init(struct hda_codec *codec)
19938 struct alc_spec *spec = codec->spec;
19939 alc680_auto_init_multi_out(codec);
19940 alc680_auto_init_hp_out(codec);
19941 alc680_auto_init_analog_input(codec);
19942 alc_auto_init_digital(codec);
19943 if (spec->unsol_event)
19944 alc_inithook(codec);
19948 * configuration and preset
19950 static const char * const alc680_models[ALC680_MODEL_LAST] = {
19951 [ALC680_BASE] = "base",
19952 [ALC680_AUTO] = "auto",
19955 static struct snd_pci_quirk alc680_cfg_tbl[] = {
19956 SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE),
19960 static struct alc_config_preset alc680_presets[] = {
19962 .mixers = { alc680_base_mixer },
19963 .cap_mixer = alc680_master_capture_mixer,
19964 .init_verbs = { alc680_init_verbs },
19965 .num_dacs = ARRAY_SIZE(alc680_dac_nids),
19966 .dac_nids = alc680_dac_nids,
19967 .dig_out_nid = ALC680_DIGOUT_NID,
19968 .num_channel_mode = ARRAY_SIZE(alc680_modes),
19969 .channel_mode = alc680_modes,
19970 .unsol_event = alc680_unsol_event,
19971 .setup = alc680_base_setup,
19972 .init_hook = alc680_inithook,
19977 static int patch_alc680(struct hda_codec *codec)
19979 struct alc_spec *spec;
19983 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
19987 codec->spec = spec;
19989 board_config = snd_hda_check_board_config(codec, ALC680_MODEL_LAST,
19993 if (board_config < 0 || board_config >= ALC680_MODEL_LAST) {
19994 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
19996 board_config = ALC680_AUTO;
19999 if (board_config == ALC680_AUTO) {
20000 /* automatic parse from the BIOS config */
20001 err = alc680_parse_auto_config(codec);
20007 "hda_codec: Cannot set up configuration "
20008 "from BIOS. Using base mode...\n");
20009 board_config = ALC680_BASE;
20013 if (board_config != ALC680_AUTO)
20014 setup_preset(codec, &alc680_presets[board_config]);
20016 spec->stream_analog_playback = &alc680_pcm_analog_playback;
20017 spec->stream_analog_capture = &alc680_pcm_analog_auto_capture;
20018 spec->stream_digital_playback = &alc680_pcm_digital_playback;
20019 spec->stream_digital_capture = &alc680_pcm_digital_capture;
20021 if (!spec->adc_nids) {
20022 spec->adc_nids = alc680_adc_nids;
20023 spec->num_adc_nids = ARRAY_SIZE(alc680_adc_nids);
20026 if (!spec->cap_mixer)
20027 set_capture_mixer(codec);
20029 spec->vmaster_nid = 0x02;
20031 codec->patch_ops = alc_patch_ops;
20032 if (board_config == ALC680_AUTO)
20033 spec->init_hook = alc680_auto_init;
20041 static struct hda_codec_preset snd_hda_preset_realtek[] = {
20042 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
20043 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
20044 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
20045 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
20046 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
20047 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
20048 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
20049 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
20050 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
20051 .patch = patch_alc861 },
20052 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
20053 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
20054 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
20055 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
20056 .patch = patch_alc882 },
20057 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
20058 .patch = patch_alc662 },
20059 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
20060 { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
20061 { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
20062 { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 },
20063 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
20064 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
20065 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
20066 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
20067 .patch = patch_alc882 },
20068 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
20069 .patch = patch_alc882 },
20070 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
20071 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc888 },
20072 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
20073 .patch = patch_alc882 },
20074 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
20075 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
20076 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
20077 {} /* terminator */
20080 MODULE_ALIAS("snd-hda-codec-id:10ec*");
20082 MODULE_LICENSE("GPL");
20083 MODULE_DESCRIPTION("Realtek HD-audio codec");
20085 static struct hda_codec_preset_list realtek_list = {
20086 .preset = snd_hda_preset_realtek,
20087 .owner = THIS_MODULE,
20090 static int __init patch_realtek_init(void)
20092 return snd_hda_add_codec_preset(&realtek_list);
20095 static void __exit patch_realtek_exit(void)
20097 snd_hda_delete_codec_preset(&realtek_list);
20100 module_init(patch_realtek_init)
20101 module_exit(patch_realtek_exit)