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 "hda_codec.h"
32 #include "hda_local.h"
35 #define ALC880_FRONT_EVENT 0x01
36 #define ALC880_DCVOL_EVENT 0x02
37 #define ALC880_HP_EVENT 0x04
38 #define ALC880_MIC_EVENT 0x08
40 /* ALC880 board config type */
64 #ifdef CONFIG_SND_DEBUG
68 ALC880_MODEL_LAST /* last tag */
82 #ifdef CONFIG_SND_DEBUG
86 ALC260_MODEL_LAST /* last tag */
96 ALC262_HP_BPC_D7000_WL,
97 ALC262_HP_BPC_D7000_WF,
110 ALC262_MODEL_LAST /* last tag */
120 ALC268_ACER_ASPIRE_ONE,
123 #ifdef CONFIG_SND_DEBUG
127 ALC268_MODEL_LAST /* last tag */
141 ALC269_MODEL_LAST /* last tag */
158 /* ALC861-VD models */
180 ALC662_ASUS_EEEPC_P701,
181 ALC662_ASUS_EEEPC_EP20,
223 ALC883_TARGA_2ch_DIG,
224 ALC883_TARGA_8ch_DIG,
227 ALC888_ACER_ASPIRE_4930G,
228 ALC888_ACER_ASPIRE_6530G,
229 ALC888_ACER_ASPIRE_8930G,
230 ALC888_ACER_ASPIRE_7730G,
233 ALC883_MEDION_WIM2160,
235 ALC883_LENOVO_101E_2ch,
236 ALC883_LENOVO_NB0763,
237 ALC888_LENOVO_MS7195_DIG,
245 ALC883_FUJITSU_PI2515,
246 ALC888_FUJITSU_XA3530,
247 ALC883_3ST_6ch_INTEL,
260 #define GPIO_MASK 0x03
262 /* extra amp-initialization sequence types */
271 struct alc_mic_route {
273 unsigned char mux_idx;
274 unsigned char amix_idx;
277 #define MUX_IDX_UNDEF ((unsigned char)-1)
280 /* codec parameterization */
281 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
282 unsigned int num_mixers;
283 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
284 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
286 const struct hda_verb *init_verbs[10]; /* initialization verbs
290 unsigned int num_init_verbs;
292 char stream_name_analog[32]; /* analog PCM stream */
293 struct hda_pcm_stream *stream_analog_playback;
294 struct hda_pcm_stream *stream_analog_capture;
295 struct hda_pcm_stream *stream_analog_alt_playback;
296 struct hda_pcm_stream *stream_analog_alt_capture;
298 char stream_name_digital[32]; /* digital PCM stream */
299 struct hda_pcm_stream *stream_digital_playback;
300 struct hda_pcm_stream *stream_digital_capture;
303 struct hda_multi_out multiout; /* playback set-up
304 * max_channels, dacs must be set
305 * dig_out_nid and hp_nid are optional
307 hda_nid_t alt_dac_nid;
308 hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */
312 unsigned int num_adc_nids;
314 hda_nid_t *capsrc_nids;
315 hda_nid_t dig_in_nid; /* digital-in NID; optional */
318 unsigned int num_mux_defs;
319 const struct hda_input_mux *input_mux;
320 unsigned int cur_mux[3];
321 struct alc_mic_route ext_mic;
322 struct alc_mic_route int_mic;
325 const struct hda_channel_mode *channel_mode;
326 int num_channel_mode;
328 int const_channel_count;
329 int ext_channel_count;
331 /* PCM information */
332 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
334 /* dynamic controls, init_verbs and input_mux */
335 struct auto_pin_cfg autocfg;
336 struct snd_array kctls;
337 struct hda_input_mux private_imux[3];
338 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
339 hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS];
340 hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS];
343 void (*init_hook)(struct hda_codec *codec);
344 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
345 #ifdef CONFIG_SND_HDA_POWER_SAVE
346 void (*power_hook)(struct hda_codec *codec);
349 /* for pin sensing */
350 unsigned int sense_updated: 1;
351 unsigned int jack_present: 1;
352 unsigned int master_sw: 1;
353 unsigned int auto_mic:1;
356 unsigned int no_analog :1; /* digital I/O only */
359 /* for virtual master */
360 hda_nid_t vmaster_nid;
361 #ifdef CONFIG_SND_HDA_POWER_SAVE
362 struct hda_loopback_check loopback;
367 unsigned int pll_coef_idx, pll_coef_bit;
371 * configuration template - to be copied to the spec instance
373 struct alc_config_preset {
374 struct snd_kcontrol_new *mixers[5]; /* should be identical size
377 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
378 const struct hda_verb *init_verbs[5];
379 unsigned int num_dacs;
381 hda_nid_t dig_out_nid; /* optional */
382 hda_nid_t hp_nid; /* optional */
383 hda_nid_t *slave_dig_outs;
384 unsigned int num_adc_nids;
386 hda_nid_t *capsrc_nids;
387 hda_nid_t dig_in_nid;
388 unsigned int num_channel_mode;
389 const struct hda_channel_mode *channel_mode;
391 int const_channel_count;
392 unsigned int num_mux_defs;
393 const struct hda_input_mux *input_mux;
394 void (*unsol_event)(struct hda_codec *, unsigned int);
395 void (*setup)(struct hda_codec *);
396 void (*init_hook)(struct hda_codec *);
397 #ifdef CONFIG_SND_HDA_POWER_SAVE
398 struct hda_amp_list *loopbacks;
399 void (*power_hook)(struct hda_codec *codec);
407 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
408 struct snd_ctl_elem_info *uinfo)
410 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
411 struct alc_spec *spec = codec->spec;
412 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
413 if (mux_idx >= spec->num_mux_defs)
415 if (!spec->input_mux[mux_idx].num_items && mux_idx > 0)
417 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
420 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
421 struct snd_ctl_elem_value *ucontrol)
423 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
424 struct alc_spec *spec = codec->spec;
425 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
427 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
431 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
432 struct snd_ctl_elem_value *ucontrol)
434 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
435 struct alc_spec *spec = codec->spec;
436 const struct hda_input_mux *imux;
437 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
438 unsigned int mux_idx;
439 hda_nid_t nid = spec->capsrc_nids ?
440 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
443 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
444 imux = &spec->input_mux[mux_idx];
445 if (!imux->num_items && mux_idx > 0)
446 imux = &spec->input_mux[0];
448 type = get_wcaps_type(get_wcaps(codec, nid));
449 if (type == AC_WID_AUD_MIX) {
450 /* Matrix-mixer style (e.g. ALC882) */
451 unsigned int *cur_val = &spec->cur_mux[adc_idx];
454 idx = ucontrol->value.enumerated.item[0];
455 if (idx >= imux->num_items)
456 idx = imux->num_items - 1;
459 for (i = 0; i < imux->num_items; i++) {
460 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
461 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
462 imux->items[i].index,
468 /* MUX style (e.g. ALC880) */
469 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
470 &spec->cur_mux[adc_idx]);
475 * channel mode setting
477 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
478 struct snd_ctl_elem_info *uinfo)
480 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
481 struct alc_spec *spec = codec->spec;
482 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
483 spec->num_channel_mode);
486 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
487 struct snd_ctl_elem_value *ucontrol)
489 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
490 struct alc_spec *spec = codec->spec;
491 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
492 spec->num_channel_mode,
493 spec->ext_channel_count);
496 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
497 struct snd_ctl_elem_value *ucontrol)
499 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
500 struct alc_spec *spec = codec->spec;
501 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
502 spec->num_channel_mode,
503 &spec->ext_channel_count);
504 if (err >= 0 && !spec->const_channel_count) {
505 spec->multiout.max_channels = spec->ext_channel_count;
506 if (spec->need_dac_fix)
507 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
513 * Control the mode of pin widget settings via the mixer. "pc" is used
514 * instead of "%" to avoid consequences of accidently treating the % as
515 * being part of a format specifier. Maximum allowed length of a value is
516 * 63 characters plus NULL terminator.
518 * Note: some retasking pin complexes seem to ignore requests for input
519 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
520 * are requested. Therefore order this list so that this behaviour will not
521 * cause problems when mixer clients move through the enum sequentially.
522 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
525 static char *alc_pin_mode_names[] = {
526 "Mic 50pc bias", "Mic 80pc bias",
527 "Line in", "Line out", "Headphone out",
529 static unsigned char alc_pin_mode_values[] = {
530 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
532 /* The control can present all 5 options, or it can limit the options based
533 * in the pin being assumed to be exclusively an input or an output pin. In
534 * addition, "input" pins may or may not process the mic bias option
535 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
536 * accept requests for bias as of chip versions up to March 2006) and/or
537 * wiring in the computer.
539 #define ALC_PIN_DIR_IN 0x00
540 #define ALC_PIN_DIR_OUT 0x01
541 #define ALC_PIN_DIR_INOUT 0x02
542 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
543 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
545 /* Info about the pin modes supported by the different pin direction modes.
546 * For each direction the minimum and maximum values are given.
548 static signed char alc_pin_mode_dir_info[5][2] = {
549 { 0, 2 }, /* ALC_PIN_DIR_IN */
550 { 3, 4 }, /* ALC_PIN_DIR_OUT */
551 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
552 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
553 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
555 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
556 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
557 #define alc_pin_mode_n_items(_dir) \
558 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
560 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
561 struct snd_ctl_elem_info *uinfo)
563 unsigned int item_num = uinfo->value.enumerated.item;
564 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
566 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
568 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
570 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
571 item_num = alc_pin_mode_min(dir);
572 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
576 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
577 struct snd_ctl_elem_value *ucontrol)
580 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
581 hda_nid_t nid = kcontrol->private_value & 0xffff;
582 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
583 long *valp = ucontrol->value.integer.value;
584 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
585 AC_VERB_GET_PIN_WIDGET_CONTROL,
588 /* Find enumerated value for current pinctl setting */
589 i = alc_pin_mode_min(dir);
590 while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl)
592 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
596 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
597 struct snd_ctl_elem_value *ucontrol)
600 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
601 hda_nid_t nid = kcontrol->private_value & 0xffff;
602 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
603 long val = *ucontrol->value.integer.value;
604 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
605 AC_VERB_GET_PIN_WIDGET_CONTROL,
608 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
609 val = alc_pin_mode_min(dir);
611 change = pinctl != alc_pin_mode_values[val];
613 /* Set pin mode to that requested */
614 snd_hda_codec_write_cache(codec, nid, 0,
615 AC_VERB_SET_PIN_WIDGET_CONTROL,
616 alc_pin_mode_values[val]);
618 /* Also enable the retasking pin's input/output as required
619 * for the requested pin mode. Enum values of 2 or less are
622 * Dynamically switching the input/output buffers probably
623 * reduces noise slightly (particularly on input) so we'll
624 * do it. However, having both input and output buffers
625 * enabled simultaneously doesn't seem to be problematic if
626 * this turns out to be necessary in the future.
629 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
630 HDA_AMP_MUTE, HDA_AMP_MUTE);
631 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
634 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
635 HDA_AMP_MUTE, HDA_AMP_MUTE);
636 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
643 #define ALC_PIN_MODE(xname, nid, dir) \
644 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
645 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
646 .info = alc_pin_mode_info, \
647 .get = alc_pin_mode_get, \
648 .put = alc_pin_mode_put, \
649 .private_value = nid | (dir<<16) }
651 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
652 * together using a mask with more than one bit set. This control is
653 * currently used only by the ALC260 test model. At this stage they are not
654 * needed for any "production" models.
656 #ifdef CONFIG_SND_DEBUG
657 #define alc_gpio_data_info snd_ctl_boolean_mono_info
659 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
660 struct snd_ctl_elem_value *ucontrol)
662 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
663 hda_nid_t nid = kcontrol->private_value & 0xffff;
664 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
665 long *valp = ucontrol->value.integer.value;
666 unsigned int val = snd_hda_codec_read(codec, nid, 0,
667 AC_VERB_GET_GPIO_DATA, 0x00);
669 *valp = (val & mask) != 0;
672 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
673 struct snd_ctl_elem_value *ucontrol)
676 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
677 hda_nid_t nid = kcontrol->private_value & 0xffff;
678 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
679 long val = *ucontrol->value.integer.value;
680 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
681 AC_VERB_GET_GPIO_DATA,
684 /* Set/unset the masked GPIO bit(s) as needed */
685 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
690 snd_hda_codec_write_cache(codec, nid, 0,
691 AC_VERB_SET_GPIO_DATA, gpio_data);
695 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
696 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
697 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
698 .info = alc_gpio_data_info, \
699 .get = alc_gpio_data_get, \
700 .put = alc_gpio_data_put, \
701 .private_value = nid | (mask<<16) }
702 #endif /* CONFIG_SND_DEBUG */
704 /* A switch control to allow the enabling of the digital IO pins on the
705 * ALC260. This is incredibly simplistic; the intention of this control is
706 * to provide something in the test model allowing digital outputs to be
707 * identified if present. If models are found which can utilise these
708 * outputs a more complete mixer control can be devised for those models if
711 #ifdef CONFIG_SND_DEBUG
712 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
714 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
715 struct snd_ctl_elem_value *ucontrol)
717 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
718 hda_nid_t nid = kcontrol->private_value & 0xffff;
719 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
720 long *valp = ucontrol->value.integer.value;
721 unsigned int val = snd_hda_codec_read(codec, nid, 0,
722 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
724 *valp = (val & mask) != 0;
727 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
728 struct snd_ctl_elem_value *ucontrol)
731 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
732 hda_nid_t nid = kcontrol->private_value & 0xffff;
733 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
734 long val = *ucontrol->value.integer.value;
735 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
736 AC_VERB_GET_DIGI_CONVERT_1,
739 /* Set/unset the masked control bit(s) as needed */
740 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
745 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
750 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
751 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
752 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
753 .info = alc_spdif_ctrl_info, \
754 .get = alc_spdif_ctrl_get, \
755 .put = alc_spdif_ctrl_put, \
756 .private_value = nid | (mask<<16) }
757 #endif /* CONFIG_SND_DEBUG */
759 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
760 * Again, this is only used in the ALC26x test models to help identify when
761 * the EAPD line must be asserted for features to work.
763 #ifdef CONFIG_SND_DEBUG
764 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
766 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
767 struct snd_ctl_elem_value *ucontrol)
769 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
770 hda_nid_t nid = kcontrol->private_value & 0xffff;
771 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
772 long *valp = ucontrol->value.integer.value;
773 unsigned int val = snd_hda_codec_read(codec, nid, 0,
774 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
776 *valp = (val & mask) != 0;
780 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
781 struct snd_ctl_elem_value *ucontrol)
784 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
785 hda_nid_t nid = kcontrol->private_value & 0xffff;
786 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
787 long val = *ucontrol->value.integer.value;
788 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
789 AC_VERB_GET_EAPD_BTLENABLE,
792 /* Set/unset the masked control bit(s) as needed */
793 change = (!val ? 0 : mask) != (ctrl_data & mask);
798 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
804 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
805 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
806 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
807 .info = alc_eapd_ctrl_info, \
808 .get = alc_eapd_ctrl_get, \
809 .put = alc_eapd_ctrl_put, \
810 .private_value = nid | (mask<<16) }
811 #endif /* CONFIG_SND_DEBUG */
814 * set up the input pin config (depending on the given auto-pin type)
816 static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
819 unsigned int val = PIN_IN;
821 if (auto_pin_type <= AUTO_PIN_FRONT_MIC) {
823 pincap = snd_hda_query_pin_caps(codec, nid);
824 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
825 if (pincap & AC_PINCAP_VREF_80)
827 else if (pincap & AC_PINCAP_VREF_50)
829 else if (pincap & AC_PINCAP_VREF_100)
831 else if (pincap & AC_PINCAP_VREF_GRD)
834 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val);
839 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
841 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
843 spec->mixers[spec->num_mixers++] = mix;
846 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
848 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
850 spec->init_verbs[spec->num_init_verbs++] = verb;
854 * set up from the preset table
856 static void setup_preset(struct hda_codec *codec,
857 const struct alc_config_preset *preset)
859 struct alc_spec *spec = codec->spec;
862 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
863 add_mixer(spec, preset->mixers[i]);
864 spec->cap_mixer = preset->cap_mixer;
865 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
867 add_verb(spec, preset->init_verbs[i]);
869 spec->channel_mode = preset->channel_mode;
870 spec->num_channel_mode = preset->num_channel_mode;
871 spec->need_dac_fix = preset->need_dac_fix;
872 spec->const_channel_count = preset->const_channel_count;
874 if (preset->const_channel_count)
875 spec->multiout.max_channels = preset->const_channel_count;
877 spec->multiout.max_channels = spec->channel_mode[0].channels;
878 spec->ext_channel_count = spec->channel_mode[0].channels;
880 spec->multiout.num_dacs = preset->num_dacs;
881 spec->multiout.dac_nids = preset->dac_nids;
882 spec->multiout.dig_out_nid = preset->dig_out_nid;
883 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
884 spec->multiout.hp_nid = preset->hp_nid;
886 spec->num_mux_defs = preset->num_mux_defs;
887 if (!spec->num_mux_defs)
888 spec->num_mux_defs = 1;
889 spec->input_mux = preset->input_mux;
891 spec->num_adc_nids = preset->num_adc_nids;
892 spec->adc_nids = preset->adc_nids;
893 spec->capsrc_nids = preset->capsrc_nids;
894 spec->dig_in_nid = preset->dig_in_nid;
896 spec->unsol_event = preset->unsol_event;
897 spec->init_hook = preset->init_hook;
898 #ifdef CONFIG_SND_HDA_POWER_SAVE
899 spec->power_hook = preset->power_hook;
900 spec->loopback.amplist = preset->loopbacks;
904 preset->setup(codec);
907 /* Enable GPIO mask and set output */
908 static struct hda_verb alc_gpio1_init_verbs[] = {
909 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
910 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
911 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
915 static struct hda_verb alc_gpio2_init_verbs[] = {
916 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
917 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
918 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
922 static struct hda_verb alc_gpio3_init_verbs[] = {
923 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
924 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
925 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
930 * Fix hardware PLL issue
931 * On some codecs, the analog PLL gating control must be off while
932 * the default value is 1.
934 static void alc_fix_pll(struct hda_codec *codec)
936 struct alc_spec *spec = codec->spec;
941 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
943 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
944 AC_VERB_GET_PROC_COEF, 0);
945 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
947 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
948 val & ~(1 << spec->pll_coef_bit));
951 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
952 unsigned int coef_idx, unsigned int coef_bit)
954 struct alc_spec *spec = codec->spec;
956 spec->pll_coef_idx = coef_idx;
957 spec->pll_coef_bit = coef_bit;
961 static void alc_automute_pin(struct hda_codec *codec)
963 struct alc_spec *spec = codec->spec;
964 unsigned int nid = spec->autocfg.hp_pins[0];
969 spec->jack_present = snd_hda_jack_detect(codec, nid);
970 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
971 nid = spec->autocfg.speaker_pins[i];
974 snd_hda_codec_write(codec, nid, 0,
975 AC_VERB_SET_PIN_WIDGET_CONTROL,
976 spec->jack_present ? 0 : PIN_OUT);
980 static int get_connection_index(struct hda_codec *codec, hda_nid_t mux,
983 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
986 nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn));
987 for (i = 0; i < nums; i++)
993 static void alc_mic_automute(struct hda_codec *codec)
995 struct alc_spec *spec = codec->spec;
996 struct alc_mic_route *dead, *alive;
997 unsigned int present, type;
1000 if (!spec->auto_mic)
1002 if (!spec->int_mic.pin || !spec->ext_mic.pin)
1004 if (snd_BUG_ON(!spec->adc_nids))
1007 cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0];
1009 present = snd_hda_jack_detect(codec, spec->ext_mic.pin);
1011 alive = &spec->ext_mic;
1012 dead = &spec->int_mic;
1014 alive = &spec->int_mic;
1015 dead = &spec->ext_mic;
1018 type = get_wcaps_type(get_wcaps(codec, cap_nid));
1019 if (type == AC_WID_AUD_MIX) {
1020 /* Matrix-mixer style (e.g. ALC882) */
1021 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1024 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1026 HDA_AMP_MUTE, HDA_AMP_MUTE);
1028 /* MUX style (e.g. ALC880) */
1029 snd_hda_codec_write_cache(codec, cap_nid, 0,
1030 AC_VERB_SET_CONNECT_SEL,
1034 /* FIXME: analog mixer */
1037 /* unsolicited event for HP jack sensing */
1038 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
1040 if (codec->vendor_id == 0x10ec0880)
1045 case ALC880_HP_EVENT:
1046 alc_automute_pin(codec);
1048 case ALC880_MIC_EVENT:
1049 alc_mic_automute(codec);
1054 static void alc_inithook(struct hda_codec *codec)
1056 alc_automute_pin(codec);
1057 alc_mic_automute(codec);
1060 /* additional initialization for ALC888 variants */
1061 static void alc888_coef_init(struct hda_codec *codec)
1065 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
1066 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1067 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1068 if ((tmp & 0xf0) == 0x20)
1070 snd_hda_codec_read(codec, 0x20, 0,
1071 AC_VERB_SET_PROC_COEF, 0x830);
1074 snd_hda_codec_read(codec, 0x20, 0,
1075 AC_VERB_SET_PROC_COEF, 0x3030);
1078 static void alc889_coef_init(struct hda_codec *codec)
1082 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1083 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1084 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1085 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010);
1088 /* turn on/off EAPD control (only if available) */
1089 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
1091 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
1093 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
1094 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
1098 static void alc_auto_init_amp(struct hda_codec *codec, int type)
1103 case ALC_INIT_GPIO1:
1104 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1106 case ALC_INIT_GPIO2:
1107 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1109 case ALC_INIT_GPIO3:
1110 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1112 case ALC_INIT_DEFAULT:
1113 switch (codec->vendor_id) {
1115 set_eapd(codec, 0x0f, 1);
1116 set_eapd(codec, 0x10, 1);
1129 set_eapd(codec, 0x14, 1);
1130 set_eapd(codec, 0x15, 1);
1133 switch (codec->vendor_id) {
1135 snd_hda_codec_write(codec, 0x1a, 0,
1136 AC_VERB_SET_COEF_INDEX, 7);
1137 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1138 AC_VERB_GET_PROC_COEF, 0);
1139 snd_hda_codec_write(codec, 0x1a, 0,
1140 AC_VERB_SET_COEF_INDEX, 7);
1141 snd_hda_codec_write(codec, 0x1a, 0,
1142 AC_VERB_SET_PROC_COEF,
1152 alc889_coef_init(codec);
1155 alc888_coef_init(codec);
1157 #if 0 /* XXX: This may cause the silent output on speaker on some machines */
1160 snd_hda_codec_write(codec, 0x20, 0,
1161 AC_VERB_SET_COEF_INDEX, 7);
1162 tmp = snd_hda_codec_read(codec, 0x20, 0,
1163 AC_VERB_GET_PROC_COEF, 0);
1164 snd_hda_codec_write(codec, 0x20, 0,
1165 AC_VERB_SET_COEF_INDEX, 7);
1166 snd_hda_codec_write(codec, 0x20, 0,
1167 AC_VERB_SET_PROC_COEF,
1176 static void alc_init_auto_hp(struct hda_codec *codec)
1178 struct alc_spec *spec = codec->spec;
1180 if (!spec->autocfg.hp_pins[0])
1183 if (!spec->autocfg.speaker_pins[0]) {
1184 if (spec->autocfg.line_out_pins[0] &&
1185 spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT)
1186 spec->autocfg.speaker_pins[0] =
1187 spec->autocfg.line_out_pins[0];
1192 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1193 spec->autocfg.hp_pins[0]);
1194 snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0,
1195 AC_VERB_SET_UNSOLICITED_ENABLE,
1196 AC_USRSP_EN | ALC880_HP_EVENT);
1197 spec->unsol_event = alc_sku_unsol_event;
1200 static void alc_init_auto_mic(struct hda_codec *codec)
1202 struct alc_spec *spec = codec->spec;
1203 struct auto_pin_cfg *cfg = &spec->autocfg;
1204 hda_nid_t fixed, ext;
1207 /* there must be only two mic inputs exclusively */
1208 for (i = AUTO_PIN_LINE; i < AUTO_PIN_LAST; i++)
1209 if (cfg->input_pins[i])
1213 for (i = AUTO_PIN_MIC; i <= AUTO_PIN_FRONT_MIC; i++) {
1214 hda_nid_t nid = cfg->input_pins[i];
1215 unsigned int defcfg;
1218 defcfg = snd_hda_codec_get_pincfg(codec, nid);
1219 switch (get_defcfg_connect(defcfg)) {
1220 case AC_JACK_PORT_FIXED:
1222 return; /* already occupied */
1225 case AC_JACK_PORT_COMPLEX:
1227 return; /* already occupied */
1231 return; /* invalid entry */
1236 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP))
1237 return; /* no unsol support */
1238 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n",
1240 spec->ext_mic.pin = ext;
1241 spec->int_mic.pin = fixed;
1242 spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1243 spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1245 snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0,
1246 AC_VERB_SET_UNSOLICITED_ENABLE,
1247 AC_USRSP_EN | ALC880_MIC_EVENT);
1248 spec->unsol_event = alc_sku_unsol_event;
1251 /* check subsystem ID and set up device-specific initialization;
1252 * return 1 if initialized, 0 if invalid SSID
1254 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1255 * 31 ~ 16 : Manufacture ID
1257 * 7 ~ 0 : Assembly ID
1258 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1260 static int alc_subsystem_id(struct hda_codec *codec,
1261 hda_nid_t porta, hda_nid_t porte,
1262 hda_nid_t portd, hda_nid_t porti)
1264 unsigned int ass, tmp, i;
1266 struct alc_spec *spec = codec->spec;
1268 ass = codec->subsystem_id & 0xffff;
1269 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1272 /* invalid SSID, check the special NID pin defcfg instead */
1274 * 31~30 : port connectivity
1277 * 19~16 : Check sum (15:1)
1282 if (codec->vendor_id == 0x10ec0260)
1284 ass = snd_hda_codec_get_pincfg(codec, nid);
1285 snd_printd("realtek: No valid SSID, "
1286 "checking pincfg 0x%08x for NID 0x%x\n",
1290 if ((ass >> 30) != 1) /* no physical connection */
1295 for (i = 1; i < 16; i++) {
1299 if (((ass >> 16) & 0xf) != tmp)
1302 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1303 ass & 0xffff, codec->vendor_id);
1307 * 2 : 0 --> Desktop, 1 --> Laptop
1308 * 3~5 : External Amplifier control
1311 tmp = (ass & 0x38) >> 3; /* external Amp control */
1314 spec->init_amp = ALC_INIT_GPIO1;
1317 spec->init_amp = ALC_INIT_GPIO2;
1320 spec->init_amp = ALC_INIT_GPIO3;
1323 spec->init_amp = ALC_INIT_DEFAULT;
1327 /* is laptop or Desktop and enable the function "Mute internal speaker
1328 * when the external headphone out jack is plugged"
1330 if (!(ass & 0x8000))
1333 * 10~8 : Jack location
1334 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1336 * 15 : 1 --> enable the function "Mute internal speaker
1337 * when the external headphone out jack is plugged"
1339 if (!spec->autocfg.hp_pins[0]) {
1341 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1352 for (i = 0; i < spec->autocfg.line_outs; i++)
1353 if (spec->autocfg.line_out_pins[i] == nid)
1355 spec->autocfg.hp_pins[0] = nid;
1358 alc_init_auto_hp(codec);
1359 alc_init_auto_mic(codec);
1363 static void alc_ssid_check(struct hda_codec *codec,
1364 hda_nid_t porta, hda_nid_t porte,
1365 hda_nid_t portd, hda_nid_t porti)
1367 if (!alc_subsystem_id(codec, porta, porte, portd, porti)) {
1368 struct alc_spec *spec = codec->spec;
1369 snd_printd("realtek: "
1370 "Enable default setup for auto mode as fallback\n");
1371 spec->init_amp = ALC_INIT_DEFAULT;
1372 alc_init_auto_hp(codec);
1373 alc_init_auto_mic(codec);
1378 * Fix-up pin default configurations and add default verbs
1387 const struct alc_pincfg *pins;
1388 const struct hda_verb *verbs;
1391 static void alc_pick_fixup(struct hda_codec *codec,
1392 const struct snd_pci_quirk *quirk,
1393 const struct alc_fixup *fix,
1396 const struct alc_pincfg *cfg;
1398 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1401 fix += quirk->value;
1403 if (pre_init && cfg) {
1404 #ifdef CONFIG_SND_DEBUG_VERBOSE
1405 snd_printdd(KERN_INFO "hda_codec: %s: Apply pincfg for %s\n",
1406 codec->chip_name, quirk->name);
1408 for (; cfg->nid; cfg++)
1409 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1411 if (!pre_init && fix->verbs) {
1412 #ifdef CONFIG_SND_DEBUG_VERBOSE
1413 snd_printdd(KERN_INFO "hda_codec: %s: Apply fix-verbs for %s\n",
1414 codec->chip_name, quirk->name);
1416 add_verb(codec->spec, fix->verbs);
1420 static int alc_read_coef_idx(struct hda_codec *codec,
1421 unsigned int coef_idx)
1424 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX,
1426 val = snd_hda_codec_read(codec, 0x20, 0,
1427 AC_VERB_GET_PROC_COEF, 0);
1438 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1439 /* Mic-in jack as mic in */
1440 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1441 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1442 /* Line-in jack as Line in */
1443 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1444 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1445 /* Line-Out as Front */
1446 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1453 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1454 /* Mic-in jack as mic in */
1455 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1456 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1457 /* Line-in jack as Surround */
1458 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1459 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1460 /* Line-Out as Front */
1461 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1468 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1469 /* Mic-in jack as CLFE */
1470 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1471 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1472 /* Line-in jack as Surround */
1473 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1474 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1475 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1476 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1483 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1484 /* Mic-in jack as CLFE */
1485 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1486 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1487 /* Line-in jack as Surround */
1488 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1489 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1490 /* Line-Out as Side */
1491 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1495 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1496 { 2, alc888_4ST_ch2_intel_init },
1497 { 4, alc888_4ST_ch4_intel_init },
1498 { 6, alc888_4ST_ch6_intel_init },
1499 { 8, alc888_4ST_ch8_intel_init },
1503 * ALC888 Fujitsu Siemens Amillo xa3530
1506 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1507 /* Front Mic: set to PIN_IN (empty by default) */
1508 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1509 /* Connect Internal HP to Front */
1510 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1511 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1512 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1513 /* Connect Bass HP to Front */
1514 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1515 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1516 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1517 /* Connect Line-Out side jack (SPDIF) to Side */
1518 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1519 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1520 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1521 /* Connect Mic jack to CLFE */
1522 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1523 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1524 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1525 /* Connect Line-in jack to Surround */
1526 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1527 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1528 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1529 /* Connect HP out jack to Front */
1530 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1531 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1532 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1533 /* Enable unsolicited event for HP jack and Line-out jack */
1534 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1535 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1539 static void alc_automute_amp(struct hda_codec *codec)
1541 struct alc_spec *spec = codec->spec;
1546 spec->jack_present = 0;
1547 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
1548 nid = spec->autocfg.hp_pins[i];
1551 if (snd_hda_jack_detect(codec, nid)) {
1552 spec->jack_present = 1;
1557 mute = spec->jack_present ? HDA_AMP_MUTE : 0;
1558 /* Toggle internal speakers muting */
1559 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1560 nid = spec->autocfg.speaker_pins[i];
1563 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1564 HDA_AMP_MUTE, mute);
1568 static void alc_automute_amp_unsol_event(struct hda_codec *codec,
1571 if (codec->vendor_id == 0x10ec0880)
1575 if (res == ALC880_HP_EVENT)
1576 alc_automute_amp(codec);
1579 static void alc889_automute_setup(struct hda_codec *codec)
1581 struct alc_spec *spec = codec->spec;
1583 spec->autocfg.hp_pins[0] = 0x15;
1584 spec->autocfg.speaker_pins[0] = 0x14;
1585 spec->autocfg.speaker_pins[1] = 0x16;
1586 spec->autocfg.speaker_pins[2] = 0x17;
1587 spec->autocfg.speaker_pins[3] = 0x19;
1588 spec->autocfg.speaker_pins[4] = 0x1a;
1591 static void alc889_intel_init_hook(struct hda_codec *codec)
1593 alc889_coef_init(codec);
1594 alc_automute_amp(codec);
1597 static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec)
1599 struct alc_spec *spec = codec->spec;
1601 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
1602 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
1603 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
1604 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
1608 * ALC888 Acer Aspire 4930G model
1611 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1612 /* Front Mic: set to PIN_IN (empty by default) */
1613 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1614 /* Unselect Front Mic by default in input mixer 3 */
1615 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1616 /* Enable unsolicited event for HP jack */
1617 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1618 /* Connect Internal HP to front */
1619 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1620 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1621 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1622 /* Connect HP out to front */
1623 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1624 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1625 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1630 * ALC888 Acer Aspire 6530G model
1633 static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
1634 /* Route to built-in subwoofer as well as speakers */
1635 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1636 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1637 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1638 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1639 /* Bias voltage on for external mic port */
1640 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
1641 /* Front Mic: set to PIN_IN (empty by default) */
1642 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1643 /* Unselect Front Mic by default in input mixer 3 */
1644 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1645 /* Enable unsolicited event for HP jack */
1646 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1647 /* Enable speaker output */
1648 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1649 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1650 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
1651 /* Enable headphone output */
1652 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1653 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1654 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1655 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
1660 * ALC889 Acer Aspire 8930G model
1663 static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
1664 /* Front Mic: set to PIN_IN (empty by default) */
1665 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1666 /* Unselect Front Mic by default in input mixer 3 */
1667 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1668 /* Enable unsolicited event for HP jack */
1669 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1670 /* Connect Internal Front to Front */
1671 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1672 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1673 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1674 /* Connect Internal Rear to Rear */
1675 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1676 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1677 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
1678 /* Connect Internal CLFE to CLFE */
1679 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1680 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1681 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
1682 /* Connect HP out to Front */
1683 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1684 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1685 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1686 /* Enable all DACs */
1687 /* DAC DISABLE/MUTE 1? */
1688 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
1689 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
1690 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1691 /* DAC DISABLE/MUTE 2? */
1692 /* some bit here disables the other DACs. Init=0x4900 */
1693 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
1694 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1696 * This laptop has a stereo digital microphone. The mics are only 1cm apart
1697 * which makes the stereo useless. However, either the mic or the ALC889
1698 * makes the signal become a difference/sum signal instead of standard
1699 * stereo, which is annoying. So instead we flip this bit which makes the
1700 * codec replicate the sum signal to both channels, turning it into a
1703 /* DMIC_CONTROL? Init value = 0x0001 */
1704 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
1705 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
1709 static struct hda_input_mux alc888_2_capture_sources[2] = {
1710 /* Front mic only available on one ADC */
1717 { "Front Mic", 0xb },
1730 static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
1731 /* Interal mic only available on one ADC */
1738 { "Input Mix", 0xa },
1748 { "Input Mix", 0xa },
1753 static struct hda_input_mux alc889_capture_sources[3] = {
1754 /* Digital mic only available on first "ADC" */
1761 { "Front Mic", 0xb },
1762 { "Input Mix", 0xa },
1771 { "Input Mix", 0xa },
1780 { "Input Mix", 0xa },
1785 static struct snd_kcontrol_new alc888_base_mixer[] = {
1786 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1787 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1788 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1789 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1790 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1792 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1793 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1794 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1795 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1796 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1797 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1798 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1799 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1800 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1801 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1802 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1803 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1807 static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = {
1808 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1809 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1810 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1811 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1812 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1814 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1815 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1816 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1817 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1818 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1819 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1820 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1821 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1826 static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
1828 struct alc_spec *spec = codec->spec;
1830 spec->autocfg.hp_pins[0] = 0x15;
1831 spec->autocfg.speaker_pins[0] = 0x14;
1832 spec->autocfg.speaker_pins[1] = 0x16;
1833 spec->autocfg.speaker_pins[2] = 0x17;
1836 static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
1838 struct alc_spec *spec = codec->spec;
1840 spec->autocfg.hp_pins[0] = 0x15;
1841 spec->autocfg.speaker_pins[0] = 0x14;
1842 spec->autocfg.speaker_pins[1] = 0x16;
1843 spec->autocfg.speaker_pins[2] = 0x17;
1846 static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
1848 struct alc_spec *spec = codec->spec;
1850 spec->autocfg.hp_pins[0] = 0x15;
1851 spec->autocfg.speaker_pins[0] = 0x14;
1852 spec->autocfg.speaker_pins[1] = 0x16;
1853 spec->autocfg.speaker_pins[2] = 0x1b;
1857 * ALC880 3-stack model
1859 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1860 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1861 * F-Mic = 0x1b, HP = 0x19
1864 static hda_nid_t alc880_dac_nids[4] = {
1865 /* front, rear, clfe, rear_surr */
1866 0x02, 0x05, 0x04, 0x03
1869 static hda_nid_t alc880_adc_nids[3] = {
1874 /* The datasheet says the node 0x07 is connected from inputs,
1875 * but it shows zero connection in the real implementation on some devices.
1876 * Note: this is a 915GAV bug, fixed on 915GLV
1878 static hda_nid_t alc880_adc_nids_alt[2] = {
1883 #define ALC880_DIGOUT_NID 0x06
1884 #define ALC880_DIGIN_NID 0x0a
1886 static struct hda_input_mux alc880_capture_source = {
1890 { "Front Mic", 0x3 },
1896 /* channel source setting (2/6 channel selection for 3-stack) */
1898 static struct hda_verb alc880_threestack_ch2_init[] = {
1899 /* set line-in to input, mute it */
1900 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1901 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1902 /* set mic-in to input vref 80%, mute it */
1903 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1904 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1909 static struct hda_verb alc880_threestack_ch6_init[] = {
1910 /* set line-in to output, unmute it */
1911 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1912 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1913 /* set mic-in to output, unmute it */
1914 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1915 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1919 static struct hda_channel_mode alc880_threestack_modes[2] = {
1920 { 2, alc880_threestack_ch2_init },
1921 { 6, alc880_threestack_ch6_init },
1924 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1925 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1926 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1927 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1928 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1929 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1930 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1931 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1932 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1933 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1934 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1935 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1936 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1937 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1938 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1939 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1940 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1941 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1943 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1944 .name = "Channel Mode",
1945 .info = alc_ch_mode_info,
1946 .get = alc_ch_mode_get,
1947 .put = alc_ch_mode_put,
1952 /* capture mixer elements */
1953 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1954 struct snd_ctl_elem_info *uinfo)
1956 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1957 struct alc_spec *spec = codec->spec;
1960 mutex_lock(&codec->control_mutex);
1961 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1963 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
1964 mutex_unlock(&codec->control_mutex);
1968 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1969 unsigned int size, unsigned int __user *tlv)
1971 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1972 struct alc_spec *spec = codec->spec;
1975 mutex_lock(&codec->control_mutex);
1976 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1978 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1979 mutex_unlock(&codec->control_mutex);
1983 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
1984 struct snd_ctl_elem_value *ucontrol);
1986 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1987 struct snd_ctl_elem_value *ucontrol,
1990 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1991 struct alc_spec *spec = codec->spec;
1992 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1995 mutex_lock(&codec->control_mutex);
1996 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1998 err = func(kcontrol, ucontrol);
1999 mutex_unlock(&codec->control_mutex);
2003 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
2004 struct snd_ctl_elem_value *ucontrol)
2006 return alc_cap_getput_caller(kcontrol, ucontrol,
2007 snd_hda_mixer_amp_volume_get);
2010 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
2011 struct snd_ctl_elem_value *ucontrol)
2013 return alc_cap_getput_caller(kcontrol, ucontrol,
2014 snd_hda_mixer_amp_volume_put);
2017 /* capture mixer elements */
2018 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
2020 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
2021 struct snd_ctl_elem_value *ucontrol)
2023 return alc_cap_getput_caller(kcontrol, ucontrol,
2024 snd_hda_mixer_amp_switch_get);
2027 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
2028 struct snd_ctl_elem_value *ucontrol)
2030 return alc_cap_getput_caller(kcontrol, ucontrol,
2031 snd_hda_mixer_amp_switch_put);
2034 #define _DEFINE_CAPMIX(num) \
2036 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2037 .name = "Capture Switch", \
2038 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
2040 .info = alc_cap_sw_info, \
2041 .get = alc_cap_sw_get, \
2042 .put = alc_cap_sw_put, \
2045 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2046 .name = "Capture Volume", \
2047 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
2048 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
2049 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
2051 .info = alc_cap_vol_info, \
2052 .get = alc_cap_vol_get, \
2053 .put = alc_cap_vol_put, \
2054 .tlv = { .c = alc_cap_vol_tlv }, \
2057 #define _DEFINE_CAPSRC(num) \
2059 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2060 /* .name = "Capture Source", */ \
2061 .name = "Input Source", \
2063 .info = alc_mux_enum_info, \
2064 .get = alc_mux_enum_get, \
2065 .put = alc_mux_enum_put, \
2068 #define DEFINE_CAPMIX(num) \
2069 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2070 _DEFINE_CAPMIX(num), \
2071 _DEFINE_CAPSRC(num), \
2075 #define DEFINE_CAPMIX_NOSRC(num) \
2076 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2077 _DEFINE_CAPMIX(num), \
2081 /* up to three ADCs */
2085 DEFINE_CAPMIX_NOSRC(1);
2086 DEFINE_CAPMIX_NOSRC(2);
2087 DEFINE_CAPMIX_NOSRC(3);
2090 * ALC880 5-stack model
2092 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2094 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2095 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2098 /* additional mixers to alc880_three_stack_mixer */
2099 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2100 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2101 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2105 /* channel source setting (6/8 channel selection for 5-stack) */
2107 static struct hda_verb alc880_fivestack_ch6_init[] = {
2108 /* set line-in to input, mute it */
2109 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2110 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2115 static struct hda_verb alc880_fivestack_ch8_init[] = {
2116 /* set line-in to output, unmute it */
2117 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2118 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2122 static struct hda_channel_mode alc880_fivestack_modes[2] = {
2123 { 6, alc880_fivestack_ch6_init },
2124 { 8, alc880_fivestack_ch8_init },
2129 * ALC880 6-stack model
2131 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2132 * Side = 0x05 (0x0f)
2133 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2134 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2137 static hda_nid_t alc880_6st_dac_nids[4] = {
2138 /* front, rear, clfe, rear_surr */
2139 0x02, 0x03, 0x04, 0x05
2142 static struct hda_input_mux alc880_6stack_capture_source = {
2146 { "Front Mic", 0x1 },
2152 /* fixed 8-channels */
2153 static struct hda_channel_mode alc880_sixstack_modes[1] = {
2157 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2158 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2159 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2160 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2161 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2162 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2163 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2164 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2165 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2166 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2167 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2168 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2169 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2170 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2171 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2172 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2173 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2174 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2175 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2177 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2178 .name = "Channel Mode",
2179 .info = alc_ch_mode_info,
2180 .get = alc_ch_mode_get,
2181 .put = alc_ch_mode_put,
2190 * W810 has rear IO for:
2193 * Center/LFE (DAC 04)
2196 * The system also has a pair of internal speakers, and a headphone jack.
2197 * These are both connected to Line2 on the codec, hence to DAC 02.
2199 * There is a variable resistor to control the speaker or headphone
2200 * volume. This is a hardware-only device without a software API.
2202 * Plugging headphones in will disable the internal speakers. This is
2203 * implemented in hardware, not via the driver using jack sense. In
2204 * a similar fashion, plugging into the rear socket marked "front" will
2205 * disable both the speakers and headphones.
2207 * For input, there's a microphone jack, and an "audio in" jack.
2208 * These may not do anything useful with this driver yet, because I
2209 * haven't setup any initialization verbs for these yet...
2212 static hda_nid_t alc880_w810_dac_nids[3] = {
2213 /* front, rear/surround, clfe */
2217 /* fixed 6 channels */
2218 static struct hda_channel_mode alc880_w810_modes[1] = {
2222 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2223 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2224 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2225 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2226 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2227 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2228 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2229 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2230 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2231 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2232 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2240 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2241 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2245 static hda_nid_t alc880_z71v_dac_nids[1] = {
2248 #define ALC880_Z71V_HP_DAC 0x03
2250 /* fixed 2 channels */
2251 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2255 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2256 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2257 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2258 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2259 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2260 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2261 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2262 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2263 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2269 * ALC880 F1734 model
2271 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2272 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2275 static hda_nid_t alc880_f1734_dac_nids[1] = {
2278 #define ALC880_F1734_HP_DAC 0x02
2280 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2281 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2282 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2283 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2284 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2285 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2286 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2287 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2288 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2292 static struct hda_input_mux alc880_f1734_capture_source = {
2304 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2305 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2306 * Mic = 0x18, Line = 0x1a
2309 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2310 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2312 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2313 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2314 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2315 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2316 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2317 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2318 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2319 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2320 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2321 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2322 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2323 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2324 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2325 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2326 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2328 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2329 .name = "Channel Mode",
2330 .info = alc_ch_mode_info,
2331 .get = alc_ch_mode_get,
2332 .put = alc_ch_mode_put,
2338 * ALC880 ASUS W1V model
2340 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2341 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2342 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2345 /* additional mixers to alc880_asus_mixer */
2346 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2347 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2348 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2353 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2354 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2355 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2356 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2357 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2358 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2359 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2360 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2361 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2362 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2367 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2368 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2369 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2370 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2371 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2372 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2373 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2374 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2375 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2376 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2377 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2378 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2379 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2380 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2381 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2382 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2383 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2385 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2386 .name = "Channel Mode",
2387 .info = alc_ch_mode_info,
2388 .get = alc_ch_mode_get,
2389 .put = alc_ch_mode_put,
2394 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2395 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2396 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2397 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2398 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2399 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2400 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2401 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2402 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2403 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2404 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2408 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2409 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2410 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2411 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2412 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2413 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2414 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2419 * virtual master controls
2423 * slave controls for virtual master
2425 static const char *alc_slave_vols[] = {
2426 "Front Playback Volume",
2427 "Surround Playback Volume",
2428 "Center Playback Volume",
2429 "LFE Playback Volume",
2430 "Side Playback Volume",
2431 "Headphone Playback Volume",
2432 "Speaker Playback Volume",
2433 "Mono Playback Volume",
2434 "Line-Out Playback Volume",
2435 "PCM Playback Volume",
2439 static const char *alc_slave_sws[] = {
2440 "Front Playback Switch",
2441 "Surround Playback Switch",
2442 "Center Playback Switch",
2443 "LFE Playback Switch",
2444 "Side Playback Switch",
2445 "Headphone Playback Switch",
2446 "Speaker Playback Switch",
2447 "Mono Playback Switch",
2448 "IEC958 Playback Switch",
2449 "Line-Out Playback Switch",
2450 "PCM Playback Switch",
2455 * build control elements
2458 #define NID_MAPPING (-1)
2460 #define SUBDEV_SPEAKER_ (0 << 6)
2461 #define SUBDEV_HP_ (1 << 6)
2462 #define SUBDEV_LINE_ (2 << 6)
2463 #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f))
2464 #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f))
2465 #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f))
2467 static void alc_free_kctls(struct hda_codec *codec);
2469 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2470 /* additional beep mixers; the actual parameters are overwritten at build */
2471 static struct snd_kcontrol_new alc_beep_mixer[] = {
2472 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2473 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
2478 static int alc_build_controls(struct hda_codec *codec)
2480 struct alc_spec *spec = codec->spec;
2481 struct snd_kcontrol *kctl;
2482 struct snd_kcontrol_new *knew;
2487 for (i = 0; i < spec->num_mixers; i++) {
2488 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2492 if (spec->cap_mixer) {
2493 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2497 if (spec->multiout.dig_out_nid) {
2498 err = snd_hda_create_spdif_out_ctls(codec,
2499 spec->multiout.dig_out_nid);
2502 if (!spec->no_analog) {
2503 err = snd_hda_create_spdif_share_sw(codec,
2507 spec->multiout.share_spdif = 1;
2510 if (spec->dig_in_nid) {
2511 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2516 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2517 /* create beep controls if needed */
2518 if (spec->beep_amp) {
2519 struct snd_kcontrol_new *knew;
2520 for (knew = alc_beep_mixer; knew->name; knew++) {
2521 struct snd_kcontrol *kctl;
2522 kctl = snd_ctl_new1(knew, codec);
2525 kctl->private_value = spec->beep_amp;
2526 err = snd_hda_ctl_add(codec, 0, kctl);
2533 /* if we have no master control, let's create it */
2534 if (!spec->no_analog &&
2535 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2536 unsigned int vmaster_tlv[4];
2537 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2538 HDA_OUTPUT, vmaster_tlv);
2539 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2540 vmaster_tlv, alc_slave_vols);
2544 if (!spec->no_analog &&
2545 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2546 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2547 NULL, alc_slave_sws);
2552 /* assign Capture Source enums to NID */
2553 kctl = snd_hda_find_mixer_ctl(codec, "Capture Source");
2555 kctl = snd_hda_find_mixer_ctl(codec, "Input Source");
2556 for (i = 0; kctl && i < kctl->count; i++) {
2557 hda_nid_t *nids = spec->capsrc_nids;
2559 nids = spec->adc_nids;
2560 err = snd_hda_add_nid(codec, kctl, i, nids[i]);
2564 if (spec->cap_mixer) {
2565 const char *kname = kctl ? kctl->id.name : NULL;
2566 for (knew = spec->cap_mixer; knew->name; knew++) {
2567 if (kname && strcmp(knew->name, kname) == 0)
2569 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2570 for (i = 0; kctl && i < kctl->count; i++) {
2571 err = snd_hda_add_nid(codec, kctl, i,
2579 /* other nid->control mapping */
2580 for (i = 0; i < spec->num_mixers; i++) {
2581 for (knew = spec->mixers[i]; knew->name; knew++) {
2582 if (knew->iface != NID_MAPPING)
2584 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2587 u = knew->subdevice;
2588 for (j = 0; j < 4; j++, u >>= 8) {
2593 case SUBDEV_SPEAKER_:
2594 nid = spec->autocfg.speaker_pins[nid];
2597 nid = spec->autocfg.line_out_pins[nid];
2600 nid = spec->autocfg.hp_pins[nid];
2605 err = snd_hda_add_nid(codec, kctl, 0, nid);
2609 u = knew->private_value;
2610 for (j = 0; j < 4; j++, u >>= 8) {
2614 err = snd_hda_add_nid(codec, kctl, 0, nid);
2621 alc_free_kctls(codec); /* no longer needed */
2628 * initialize the codec volumes, etc
2632 * generic initialization of ADC, input mixers and output mixers
2634 static struct hda_verb alc880_volume_init_verbs[] = {
2636 * Unmute ADC0-2 and set the default input to mic-in
2638 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2639 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2640 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2641 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2642 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2643 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2645 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2647 * Note: PASD motherboards uses the Line In 2 as the input for front
2650 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2651 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2652 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2653 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2654 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2655 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2656 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2657 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2660 * Set up output mixers (0x0c - 0x0f)
2662 /* set vol=0 to output mixers */
2663 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2664 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2665 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2666 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2667 /* set up input amps for analog loopback */
2668 /* Amp Indices: DAC = 0, mixer = 1 */
2669 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2670 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2671 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2672 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2673 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2674 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2675 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2676 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2682 * 3-stack pin configuration:
2683 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2685 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2687 * preset connection lists of input pins
2688 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2690 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2691 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2692 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2695 * Set pin mode and muting
2697 /* set front pin widgets 0x14 for output */
2698 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2699 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2700 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2701 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2702 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2703 /* Mic2 (as headphone out) for HP output */
2704 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2705 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2706 /* Line In pin widget for input */
2707 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2708 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2709 /* Line2 (as front mic) pin widget for input and vref at 80% */
2710 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2711 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2712 /* CD pin widget for input */
2713 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2719 * 5-stack pin configuration:
2720 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2721 * line-in/side = 0x1a, f-mic = 0x1b
2723 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2725 * preset connection lists of input pins
2726 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2728 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2729 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2732 * Set pin mode and muting
2734 /* set pin widgets 0x14-0x17 for output */
2735 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2736 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2737 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2738 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2739 /* unmute pins for output (no gain on this amp) */
2740 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2741 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2742 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2743 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2745 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2746 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2747 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2748 /* Mic2 (as headphone out) for HP output */
2749 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2750 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2751 /* Line In pin widget for input */
2752 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2753 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2754 /* Line2 (as front mic) pin widget for input and vref at 80% */
2755 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2756 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2757 /* CD pin widget for input */
2758 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2764 * W810 pin configuration:
2765 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2767 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2768 /* hphone/speaker input selector: front DAC */
2769 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2771 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2772 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2773 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2774 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2775 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2776 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2778 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2779 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2785 * Z71V pin configuration:
2786 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2788 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2789 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2790 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2791 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2792 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2794 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2795 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2796 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2797 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2803 * 6-stack pin configuration:
2804 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2805 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2807 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2808 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2810 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2811 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2812 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2813 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2814 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2815 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2816 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2817 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2819 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2820 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2821 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2822 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2823 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2824 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2825 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2826 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2827 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2833 * Uniwill pin configuration:
2834 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2837 static struct hda_verb alc880_uniwill_init_verbs[] = {
2838 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2840 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2841 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2842 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2843 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2844 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2845 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2846 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2847 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2848 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2849 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2850 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2851 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2852 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2853 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2855 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2856 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2857 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2858 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2859 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2860 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2861 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2862 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2863 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2865 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2866 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2873 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2875 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2876 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2878 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2879 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2880 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2881 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2882 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2883 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2884 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2885 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2886 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2887 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2888 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2889 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2891 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2892 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2893 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2894 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2895 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2896 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2898 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2899 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2904 static struct hda_verb alc880_beep_init_verbs[] = {
2905 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2909 /* auto-toggle front mic */
2910 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2912 unsigned int present;
2915 present = snd_hda_jack_detect(codec, 0x18);
2916 bits = present ? HDA_AMP_MUTE : 0;
2917 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2920 static void alc880_uniwill_setup(struct hda_codec *codec)
2922 struct alc_spec *spec = codec->spec;
2924 spec->autocfg.hp_pins[0] = 0x14;
2925 spec->autocfg.speaker_pins[0] = 0x15;
2926 spec->autocfg.speaker_pins[0] = 0x16;
2929 static void alc880_uniwill_init_hook(struct hda_codec *codec)
2931 alc_automute_amp(codec);
2932 alc880_uniwill_mic_automute(codec);
2935 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2938 /* Looks like the unsol event is incompatible with the standard
2939 * definition. 4bit tag is placed at 28 bit!
2941 switch (res >> 28) {
2942 case ALC880_MIC_EVENT:
2943 alc880_uniwill_mic_automute(codec);
2946 alc_automute_amp_unsol_event(codec, res);
2951 static void alc880_uniwill_p53_setup(struct hda_codec *codec)
2953 struct alc_spec *spec = codec->spec;
2955 spec->autocfg.hp_pins[0] = 0x14;
2956 spec->autocfg.speaker_pins[0] = 0x15;
2959 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2961 unsigned int present;
2963 present = snd_hda_codec_read(codec, 0x21, 0,
2964 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2965 present &= HDA_AMP_VOLMASK;
2966 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2967 HDA_AMP_VOLMASK, present);
2968 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2969 HDA_AMP_VOLMASK, present);
2972 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2975 /* Looks like the unsol event is incompatible with the standard
2976 * definition. 4bit tag is placed at 28 bit!
2978 if ((res >> 28) == ALC880_DCVOL_EVENT)
2979 alc880_uniwill_p53_dcvol_automute(codec);
2981 alc_automute_amp_unsol_event(codec, res);
2985 * F1734 pin configuration:
2986 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2988 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2989 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2990 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2991 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2992 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2993 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2995 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2996 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2997 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2998 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3000 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3001 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3002 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
3003 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3004 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3005 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3006 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3007 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3008 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3010 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
3011 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
3017 * ASUS pin configuration:
3018 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
3020 static struct hda_verb alc880_pin_asus_init_verbs[] = {
3021 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3022 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3023 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3024 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3026 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3027 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3028 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3029 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3030 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3031 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3032 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3033 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3035 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3036 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3037 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3038 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3039 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3040 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3041 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3042 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3043 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3048 /* Enable GPIO mask and set output */
3049 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
3050 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
3051 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
3053 /* Clevo m520g init */
3054 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
3055 /* headphone output */
3056 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3058 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3059 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3061 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3062 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3064 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3065 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3066 /* Mic1 (rear panel) */
3067 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3068 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3069 /* Mic2 (front panel) */
3070 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3071 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3073 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3074 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3075 /* change to EAPD mode */
3076 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3077 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3082 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
3083 /* change to EAPD mode */
3084 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3085 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3087 /* Headphone output */
3088 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3090 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3091 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
3093 /* Line In pin widget for input */
3094 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3095 /* CD pin widget for input */
3096 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3097 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3098 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3100 /* change to EAPD mode */
3101 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3102 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
3108 * LG m1 express dual
3111 * Rear Line-In/Out (blue): 0x14
3112 * Build-in Mic-In: 0x15
3114 * HP-Out (green): 0x1b
3115 * Mic-In/Out (red): 0x19
3119 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
3120 static hda_nid_t alc880_lg_dac_nids[3] = {
3124 /* seems analog CD is not working */
3125 static struct hda_input_mux alc880_lg_capture_source = {
3130 { "Internal Mic", 0x6 },
3134 /* 2,4,6 channel modes */
3135 static struct hda_verb alc880_lg_ch2_init[] = {
3136 /* set line-in and mic-in to input */
3137 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
3138 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3142 static struct hda_verb alc880_lg_ch4_init[] = {
3143 /* set line-in to out and mic-in to input */
3144 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3145 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3149 static struct hda_verb alc880_lg_ch6_init[] = {
3150 /* set line-in and mic-in to output */
3151 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3152 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3156 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
3157 { 2, alc880_lg_ch2_init },
3158 { 4, alc880_lg_ch4_init },
3159 { 6, alc880_lg_ch6_init },
3162 static struct snd_kcontrol_new alc880_lg_mixer[] = {
3163 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3164 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3165 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3166 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3167 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3168 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3169 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3170 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3171 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3172 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3173 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3174 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3175 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3176 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3178 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3179 .name = "Channel Mode",
3180 .info = alc_ch_mode_info,
3181 .get = alc_ch_mode_get,
3182 .put = alc_ch_mode_put,
3187 static struct hda_verb alc880_lg_init_verbs[] = {
3188 /* set capture source to mic-in */
3189 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3190 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3191 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3192 /* mute all amp mixer inputs */
3193 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3194 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3195 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3196 /* line-in to input */
3197 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3198 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3200 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3201 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3203 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3204 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3205 /* mic-in to input */
3206 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3207 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3208 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3210 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3211 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3212 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3214 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3218 /* toggle speaker-output according to the hp-jack state */
3219 static void alc880_lg_setup(struct hda_codec *codec)
3221 struct alc_spec *spec = codec->spec;
3223 spec->autocfg.hp_pins[0] = 0x1b;
3224 spec->autocfg.speaker_pins[0] = 0x17;
3233 * Built-in Mic-In: 0x19
3239 static struct hda_input_mux alc880_lg_lw_capture_source = {
3243 { "Internal Mic", 0x1 },
3248 #define alc880_lg_lw_modes alc880_threestack_modes
3250 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3251 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3252 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3253 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3254 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3255 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3256 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3257 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3258 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3259 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3260 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3261 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3262 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3263 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
3264 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
3266 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3267 .name = "Channel Mode",
3268 .info = alc_ch_mode_info,
3269 .get = alc_ch_mode_get,
3270 .put = alc_ch_mode_put,
3275 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3276 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3277 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3278 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3280 /* set capture source to mic-in */
3281 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3282 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3283 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3284 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3286 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3287 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3289 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3290 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3291 /* mic-in to input */
3292 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3293 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3295 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3296 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3298 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3302 /* toggle speaker-output according to the hp-jack state */
3303 static void alc880_lg_lw_setup(struct hda_codec *codec)
3305 struct alc_spec *spec = codec->spec;
3307 spec->autocfg.hp_pins[0] = 0x1b;
3308 spec->autocfg.speaker_pins[0] = 0x14;
3311 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3312 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3313 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3314 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3315 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3316 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3317 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3321 static struct hda_input_mux alc880_medion_rim_capture_source = {
3325 { "Internal Mic", 0x1 },
3329 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3330 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3332 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3333 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3335 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3336 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3337 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3338 /* Mic2 (as headphone out) for HP output */
3339 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3340 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3341 /* Internal Speaker */
3342 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3343 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3345 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3346 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3348 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3352 /* toggle speaker-output according to the hp-jack state */
3353 static void alc880_medion_rim_automute(struct hda_codec *codec)
3355 struct alc_spec *spec = codec->spec;
3356 alc_automute_amp(codec);
3358 if (spec->jack_present)
3359 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3361 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3364 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3367 /* Looks like the unsol event is incompatible with the standard
3368 * definition. 4bit tag is placed at 28 bit!
3370 if ((res >> 28) == ALC880_HP_EVENT)
3371 alc880_medion_rim_automute(codec);
3374 static void alc880_medion_rim_setup(struct hda_codec *codec)
3376 struct alc_spec *spec = codec->spec;
3378 spec->autocfg.hp_pins[0] = 0x14;
3379 spec->autocfg.speaker_pins[0] = 0x1b;
3382 #ifdef CONFIG_SND_HDA_POWER_SAVE
3383 static struct hda_amp_list alc880_loopbacks[] = {
3384 { 0x0b, HDA_INPUT, 0 },
3385 { 0x0b, HDA_INPUT, 1 },
3386 { 0x0b, HDA_INPUT, 2 },
3387 { 0x0b, HDA_INPUT, 3 },
3388 { 0x0b, HDA_INPUT, 4 },
3392 static struct hda_amp_list alc880_lg_loopbacks[] = {
3393 { 0x0b, HDA_INPUT, 1 },
3394 { 0x0b, HDA_INPUT, 6 },
3395 { 0x0b, HDA_INPUT, 7 },
3404 static int alc_init(struct hda_codec *codec)
3406 struct alc_spec *spec = codec->spec;
3410 alc_auto_init_amp(codec, spec->init_amp);
3412 for (i = 0; i < spec->num_init_verbs; i++)
3413 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3415 if (spec->init_hook)
3416 spec->init_hook(codec);
3421 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3423 struct alc_spec *spec = codec->spec;
3425 if (spec->unsol_event)
3426 spec->unsol_event(codec, res);
3429 #ifdef CONFIG_SND_HDA_POWER_SAVE
3430 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3432 struct alc_spec *spec = codec->spec;
3433 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3438 * Analog playback callbacks
3440 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3441 struct hda_codec *codec,
3442 struct snd_pcm_substream *substream)
3444 struct alc_spec *spec = codec->spec;
3445 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3449 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3450 struct hda_codec *codec,
3451 unsigned int stream_tag,
3452 unsigned int format,
3453 struct snd_pcm_substream *substream)
3455 struct alc_spec *spec = codec->spec;
3456 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3457 stream_tag, format, substream);
3460 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3461 struct hda_codec *codec,
3462 struct snd_pcm_substream *substream)
3464 struct alc_spec *spec = codec->spec;
3465 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3471 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3472 struct hda_codec *codec,
3473 struct snd_pcm_substream *substream)
3475 struct alc_spec *spec = codec->spec;
3476 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3479 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3480 struct hda_codec *codec,
3481 unsigned int stream_tag,
3482 unsigned int format,
3483 struct snd_pcm_substream *substream)
3485 struct alc_spec *spec = codec->spec;
3486 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3487 stream_tag, format, substream);
3490 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3491 struct hda_codec *codec,
3492 struct snd_pcm_substream *substream)
3494 struct alc_spec *spec = codec->spec;
3495 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3498 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3499 struct hda_codec *codec,
3500 struct snd_pcm_substream *substream)
3502 struct alc_spec *spec = codec->spec;
3503 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3509 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3510 struct hda_codec *codec,
3511 unsigned int stream_tag,
3512 unsigned int format,
3513 struct snd_pcm_substream *substream)
3515 struct alc_spec *spec = codec->spec;
3517 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3518 stream_tag, 0, format);
3522 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3523 struct hda_codec *codec,
3524 struct snd_pcm_substream *substream)
3526 struct alc_spec *spec = codec->spec;
3528 snd_hda_codec_cleanup_stream(codec,
3529 spec->adc_nids[substream->number + 1]);
3536 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3540 /* NID is set in alc_build_pcms */
3542 .open = alc880_playback_pcm_open,
3543 .prepare = alc880_playback_pcm_prepare,
3544 .cleanup = alc880_playback_pcm_cleanup
3548 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3552 /* NID is set in alc_build_pcms */
3555 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3559 /* NID is set in alc_build_pcms */
3562 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3563 .substreams = 2, /* can be overridden */
3566 /* NID is set in alc_build_pcms */
3568 .prepare = alc880_alt_capture_pcm_prepare,
3569 .cleanup = alc880_alt_capture_pcm_cleanup
3573 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3577 /* NID is set in alc_build_pcms */
3579 .open = alc880_dig_playback_pcm_open,
3580 .close = alc880_dig_playback_pcm_close,
3581 .prepare = alc880_dig_playback_pcm_prepare,
3582 .cleanup = alc880_dig_playback_pcm_cleanup
3586 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3590 /* NID is set in alc_build_pcms */
3593 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3594 static struct hda_pcm_stream alc_pcm_null_stream = {
3600 static int alc_build_pcms(struct hda_codec *codec)
3602 struct alc_spec *spec = codec->spec;
3603 struct hda_pcm *info = spec->pcm_rec;
3606 codec->num_pcms = 1;
3607 codec->pcm_info = info;
3609 if (spec->no_analog)
3612 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
3613 "%s Analog", codec->chip_name);
3614 info->name = spec->stream_name_analog;
3616 if (spec->stream_analog_playback) {
3617 if (snd_BUG_ON(!spec->multiout.dac_nids))
3619 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3620 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3622 if (spec->stream_analog_capture) {
3623 if (snd_BUG_ON(!spec->adc_nids))
3625 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3626 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3629 if (spec->channel_mode) {
3630 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3631 for (i = 0; i < spec->num_channel_mode; i++) {
3632 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3633 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3639 /* SPDIF for stream index #1 */
3640 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3641 snprintf(spec->stream_name_digital,
3642 sizeof(spec->stream_name_digital),
3643 "%s Digital", codec->chip_name);
3644 codec->num_pcms = 2;
3645 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3646 info = spec->pcm_rec + 1;
3647 info->name = spec->stream_name_digital;
3648 if (spec->dig_out_type)
3649 info->pcm_type = spec->dig_out_type;
3651 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3652 if (spec->multiout.dig_out_nid &&
3653 spec->stream_digital_playback) {
3654 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3655 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3657 if (spec->dig_in_nid &&
3658 spec->stream_digital_capture) {
3659 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3660 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3662 /* FIXME: do we need this for all Realtek codec models? */
3663 codec->spdif_status_reset = 1;
3666 if (spec->no_analog)
3669 /* If the use of more than one ADC is requested for the current
3670 * model, configure a second analog capture-only PCM.
3672 /* Additional Analaog capture for index #2 */
3673 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3674 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3675 codec->num_pcms = 3;
3676 info = spec->pcm_rec + 2;
3677 info->name = spec->stream_name_analog;
3678 if (spec->alt_dac_nid) {
3679 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3680 *spec->stream_analog_alt_playback;
3681 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3684 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3685 alc_pcm_null_stream;
3686 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3688 if (spec->num_adc_nids > 1) {
3689 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3690 *spec->stream_analog_alt_capture;
3691 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3693 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3694 spec->num_adc_nids - 1;
3696 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3697 alc_pcm_null_stream;
3698 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3705 static inline void alc_shutup(struct hda_codec *codec)
3707 snd_hda_shutup_pins(codec);
3710 static void alc_free_kctls(struct hda_codec *codec)
3712 struct alc_spec *spec = codec->spec;
3714 if (spec->kctls.list) {
3715 struct snd_kcontrol_new *kctl = spec->kctls.list;
3717 for (i = 0; i < spec->kctls.used; i++)
3718 kfree(kctl[i].name);
3720 snd_array_free(&spec->kctls);
3723 static void alc_free(struct hda_codec *codec)
3725 struct alc_spec *spec = codec->spec;
3731 alc_free_kctls(codec);
3733 snd_hda_detach_beep_device(codec);
3736 #ifdef CONFIG_SND_HDA_POWER_SAVE
3737 static void alc_power_eapd(struct hda_codec *codec)
3739 /* We currently only handle front, HP */
3740 switch (codec->vendor_id) {
3742 set_eapd(codec, 0x0f, 0);
3743 set_eapd(codec, 0x10, 0);
3756 set_eapd(codec, 0x14, 0);
3757 set_eapd(codec, 0x15, 0);
3762 static int alc_suspend(struct hda_codec *codec, pm_message_t state)
3764 struct alc_spec *spec = codec->spec;
3766 if (spec && spec->power_hook)
3767 spec->power_hook(codec);
3772 #ifdef SND_HDA_NEEDS_RESUME
3773 static int alc_resume(struct hda_codec *codec)
3775 codec->patch_ops.init(codec);
3776 snd_hda_codec_resume_amp(codec);
3777 snd_hda_codec_resume_cache(codec);
3784 static struct hda_codec_ops alc_patch_ops = {
3785 .build_controls = alc_build_controls,
3786 .build_pcms = alc_build_pcms,
3789 .unsol_event = alc_unsol_event,
3790 #ifdef SND_HDA_NEEDS_RESUME
3791 .resume = alc_resume,
3793 #ifdef CONFIG_SND_HDA_POWER_SAVE
3794 .suspend = alc_suspend,
3795 .check_power_status = alc_check_power_status,
3797 .reboot_notify = alc_shutup,
3802 * Test configuration for debugging
3804 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3807 #ifdef CONFIG_SND_DEBUG
3808 static hda_nid_t alc880_test_dac_nids[4] = {
3809 0x02, 0x03, 0x04, 0x05
3812 static struct hda_input_mux alc880_test_capture_source = {
3821 { "Surround", 0x6 },
3825 static struct hda_channel_mode alc880_test_modes[4] = {
3832 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3833 struct snd_ctl_elem_info *uinfo)
3835 static char *texts[] = {
3836 "N/A", "Line Out", "HP Out",
3837 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3839 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3841 uinfo->value.enumerated.items = 8;
3842 if (uinfo->value.enumerated.item >= 8)
3843 uinfo->value.enumerated.item = 7;
3844 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3848 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3849 struct snd_ctl_elem_value *ucontrol)
3851 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3852 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3853 unsigned int pin_ctl, item = 0;
3855 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3856 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3857 if (pin_ctl & AC_PINCTL_OUT_EN) {
3858 if (pin_ctl & AC_PINCTL_HP_EN)
3862 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3863 switch (pin_ctl & AC_PINCTL_VREFEN) {
3864 case AC_PINCTL_VREF_HIZ: item = 3; break;
3865 case AC_PINCTL_VREF_50: item = 4; break;
3866 case AC_PINCTL_VREF_GRD: item = 5; break;
3867 case AC_PINCTL_VREF_80: item = 6; break;
3868 case AC_PINCTL_VREF_100: item = 7; break;
3871 ucontrol->value.enumerated.item[0] = item;
3875 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3876 struct snd_ctl_elem_value *ucontrol)
3878 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3879 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3880 static unsigned int ctls[] = {
3881 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3882 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3883 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3884 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3885 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3886 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3888 unsigned int old_ctl, new_ctl;
3890 old_ctl = snd_hda_codec_read(codec, nid, 0,
3891 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3892 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3893 if (old_ctl != new_ctl) {
3895 snd_hda_codec_write_cache(codec, nid, 0,
3896 AC_VERB_SET_PIN_WIDGET_CONTROL,
3898 val = ucontrol->value.enumerated.item[0] >= 3 ?
3900 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3907 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3908 struct snd_ctl_elem_info *uinfo)
3910 static char *texts[] = {
3911 "Front", "Surround", "CLFE", "Side"
3913 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3915 uinfo->value.enumerated.items = 4;
3916 if (uinfo->value.enumerated.item >= 4)
3917 uinfo->value.enumerated.item = 3;
3918 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3922 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3923 struct snd_ctl_elem_value *ucontrol)
3925 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3926 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3929 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3930 ucontrol->value.enumerated.item[0] = sel & 3;
3934 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3935 struct snd_ctl_elem_value *ucontrol)
3937 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3938 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3941 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3942 if (ucontrol->value.enumerated.item[0] != sel) {
3943 sel = ucontrol->value.enumerated.item[0] & 3;
3944 snd_hda_codec_write_cache(codec, nid, 0,
3945 AC_VERB_SET_CONNECT_SEL, sel);
3951 #define PIN_CTL_TEST(xname,nid) { \
3952 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3954 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
3955 .info = alc_test_pin_ctl_info, \
3956 .get = alc_test_pin_ctl_get, \
3957 .put = alc_test_pin_ctl_put, \
3958 .private_value = nid \
3961 #define PIN_SRC_TEST(xname,nid) { \
3962 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3964 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
3965 .info = alc_test_pin_src_info, \
3966 .get = alc_test_pin_src_get, \
3967 .put = alc_test_pin_src_put, \
3968 .private_value = nid \
3971 static struct snd_kcontrol_new alc880_test_mixer[] = {
3972 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3973 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3974 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3975 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3976 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3977 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3978 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3979 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3980 PIN_CTL_TEST("Front Pin Mode", 0x14),
3981 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3982 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3983 PIN_CTL_TEST("Side Pin Mode", 0x17),
3984 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3985 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3986 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3987 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3988 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3989 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3990 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3991 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3992 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3993 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3994 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3995 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3996 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3997 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3998 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3999 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
4000 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
4001 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
4003 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4004 .name = "Channel Mode",
4005 .info = alc_ch_mode_info,
4006 .get = alc_ch_mode_get,
4007 .put = alc_ch_mode_put,
4012 static struct hda_verb alc880_test_init_verbs[] = {
4013 /* Unmute inputs of 0x0c - 0x0f */
4014 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4015 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4016 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4017 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4018 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4019 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4020 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4021 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4022 /* Vol output for 0x0c-0x0f */
4023 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4024 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4025 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4026 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4027 /* Set output pins 0x14-0x17 */
4028 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4029 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4030 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4031 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4032 /* Unmute output pins 0x14-0x17 */
4033 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4034 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4035 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4036 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4037 /* Set input pins 0x18-0x1c */
4038 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4039 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4040 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4041 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4042 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4043 /* Mute input pins 0x18-0x1b */
4044 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4045 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4046 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4047 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4049 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4050 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
4051 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4052 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
4053 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4054 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
4055 /* Analog input/passthru */
4056 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4057 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4058 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4059 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4060 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4068 static const char *alc880_models[ALC880_MODEL_LAST] = {
4069 [ALC880_3ST] = "3stack",
4070 [ALC880_TCL_S700] = "tcl",
4071 [ALC880_3ST_DIG] = "3stack-digout",
4072 [ALC880_CLEVO] = "clevo",
4073 [ALC880_5ST] = "5stack",
4074 [ALC880_5ST_DIG] = "5stack-digout",
4075 [ALC880_W810] = "w810",
4076 [ALC880_Z71V] = "z71v",
4077 [ALC880_6ST] = "6stack",
4078 [ALC880_6ST_DIG] = "6stack-digout",
4079 [ALC880_ASUS] = "asus",
4080 [ALC880_ASUS_W1V] = "asus-w1v",
4081 [ALC880_ASUS_DIG] = "asus-dig",
4082 [ALC880_ASUS_DIG2] = "asus-dig2",
4083 [ALC880_UNIWILL_DIG] = "uniwill",
4084 [ALC880_UNIWILL_P53] = "uniwill-p53",
4085 [ALC880_FUJITSU] = "fujitsu",
4086 [ALC880_F1734] = "F1734",
4088 [ALC880_LG_LW] = "lg-lw",
4089 [ALC880_MEDION_RIM] = "medion",
4090 #ifdef CONFIG_SND_DEBUG
4091 [ALC880_TEST] = "test",
4093 [ALC880_AUTO] = "auto",
4096 static struct snd_pci_quirk alc880_cfg_tbl[] = {
4097 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
4098 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
4099 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
4100 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
4101 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
4102 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
4103 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
4104 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
4105 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
4106 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
4107 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
4108 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
4109 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
4110 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
4111 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
4112 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
4113 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
4114 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
4115 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
4116 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
4117 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
4118 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
4119 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
4120 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
4121 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
4122 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
4123 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
4124 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
4125 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
4126 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
4127 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
4128 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
4129 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
4130 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
4131 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
4132 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
4133 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
4134 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
4135 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
4136 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
4137 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
4138 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
4139 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
4140 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
4141 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
4142 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
4143 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
4144 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
4145 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
4146 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
4147 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
4148 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
4149 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
4150 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
4151 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
4152 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
4153 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
4154 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
4155 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
4156 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
4157 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
4158 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
4159 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
4160 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
4161 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
4162 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
4163 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
4164 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
4166 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
4167 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
4168 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
4173 * ALC880 codec presets
4175 static struct alc_config_preset alc880_presets[] = {
4177 .mixers = { alc880_three_stack_mixer },
4178 .init_verbs = { alc880_volume_init_verbs,
4179 alc880_pin_3stack_init_verbs },
4180 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4181 .dac_nids = alc880_dac_nids,
4182 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4183 .channel_mode = alc880_threestack_modes,
4185 .input_mux = &alc880_capture_source,
4187 [ALC880_3ST_DIG] = {
4188 .mixers = { alc880_three_stack_mixer },
4189 .init_verbs = { alc880_volume_init_verbs,
4190 alc880_pin_3stack_init_verbs },
4191 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4192 .dac_nids = alc880_dac_nids,
4193 .dig_out_nid = ALC880_DIGOUT_NID,
4194 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4195 .channel_mode = alc880_threestack_modes,
4197 .input_mux = &alc880_capture_source,
4199 [ALC880_TCL_S700] = {
4200 .mixers = { alc880_tcl_s700_mixer },
4201 .init_verbs = { alc880_volume_init_verbs,
4202 alc880_pin_tcl_S700_init_verbs,
4203 alc880_gpio2_init_verbs },
4204 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4205 .dac_nids = alc880_dac_nids,
4206 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4207 .num_adc_nids = 1, /* single ADC */
4209 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4210 .channel_mode = alc880_2_jack_modes,
4211 .input_mux = &alc880_capture_source,
4214 .mixers = { alc880_three_stack_mixer,
4215 alc880_five_stack_mixer},
4216 .init_verbs = { alc880_volume_init_verbs,
4217 alc880_pin_5stack_init_verbs },
4218 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4219 .dac_nids = alc880_dac_nids,
4220 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4221 .channel_mode = alc880_fivestack_modes,
4222 .input_mux = &alc880_capture_source,
4224 [ALC880_5ST_DIG] = {
4225 .mixers = { alc880_three_stack_mixer,
4226 alc880_five_stack_mixer },
4227 .init_verbs = { alc880_volume_init_verbs,
4228 alc880_pin_5stack_init_verbs },
4229 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4230 .dac_nids = alc880_dac_nids,
4231 .dig_out_nid = ALC880_DIGOUT_NID,
4232 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4233 .channel_mode = alc880_fivestack_modes,
4234 .input_mux = &alc880_capture_source,
4237 .mixers = { alc880_six_stack_mixer },
4238 .init_verbs = { alc880_volume_init_verbs,
4239 alc880_pin_6stack_init_verbs },
4240 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4241 .dac_nids = alc880_6st_dac_nids,
4242 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4243 .channel_mode = alc880_sixstack_modes,
4244 .input_mux = &alc880_6stack_capture_source,
4246 [ALC880_6ST_DIG] = {
4247 .mixers = { alc880_six_stack_mixer },
4248 .init_verbs = { alc880_volume_init_verbs,
4249 alc880_pin_6stack_init_verbs },
4250 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4251 .dac_nids = alc880_6st_dac_nids,
4252 .dig_out_nid = ALC880_DIGOUT_NID,
4253 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4254 .channel_mode = alc880_sixstack_modes,
4255 .input_mux = &alc880_6stack_capture_source,
4258 .mixers = { alc880_w810_base_mixer },
4259 .init_verbs = { alc880_volume_init_verbs,
4260 alc880_pin_w810_init_verbs,
4261 alc880_gpio2_init_verbs },
4262 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
4263 .dac_nids = alc880_w810_dac_nids,
4264 .dig_out_nid = ALC880_DIGOUT_NID,
4265 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4266 .channel_mode = alc880_w810_modes,
4267 .input_mux = &alc880_capture_source,
4270 .mixers = { alc880_z71v_mixer },
4271 .init_verbs = { alc880_volume_init_verbs,
4272 alc880_pin_z71v_init_verbs },
4273 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
4274 .dac_nids = alc880_z71v_dac_nids,
4275 .dig_out_nid = ALC880_DIGOUT_NID,
4277 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4278 .channel_mode = alc880_2_jack_modes,
4279 .input_mux = &alc880_capture_source,
4282 .mixers = { alc880_f1734_mixer },
4283 .init_verbs = { alc880_volume_init_verbs,
4284 alc880_pin_f1734_init_verbs },
4285 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
4286 .dac_nids = alc880_f1734_dac_nids,
4288 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4289 .channel_mode = alc880_2_jack_modes,
4290 .input_mux = &alc880_f1734_capture_source,
4291 .unsol_event = alc880_uniwill_p53_unsol_event,
4292 .setup = alc880_uniwill_p53_setup,
4293 .init_hook = alc_automute_amp,
4296 .mixers = { alc880_asus_mixer },
4297 .init_verbs = { alc880_volume_init_verbs,
4298 alc880_pin_asus_init_verbs,
4299 alc880_gpio1_init_verbs },
4300 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4301 .dac_nids = alc880_asus_dac_nids,
4302 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4303 .channel_mode = alc880_asus_modes,
4305 .input_mux = &alc880_capture_source,
4307 [ALC880_ASUS_DIG] = {
4308 .mixers = { alc880_asus_mixer },
4309 .init_verbs = { alc880_volume_init_verbs,
4310 alc880_pin_asus_init_verbs,
4311 alc880_gpio1_init_verbs },
4312 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4313 .dac_nids = alc880_asus_dac_nids,
4314 .dig_out_nid = ALC880_DIGOUT_NID,
4315 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4316 .channel_mode = alc880_asus_modes,
4318 .input_mux = &alc880_capture_source,
4320 [ALC880_ASUS_DIG2] = {
4321 .mixers = { alc880_asus_mixer },
4322 .init_verbs = { alc880_volume_init_verbs,
4323 alc880_pin_asus_init_verbs,
4324 alc880_gpio2_init_verbs }, /* use GPIO2 */
4325 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4326 .dac_nids = alc880_asus_dac_nids,
4327 .dig_out_nid = ALC880_DIGOUT_NID,
4328 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4329 .channel_mode = alc880_asus_modes,
4331 .input_mux = &alc880_capture_source,
4333 [ALC880_ASUS_W1V] = {
4334 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4335 .init_verbs = { alc880_volume_init_verbs,
4336 alc880_pin_asus_init_verbs,
4337 alc880_gpio1_init_verbs },
4338 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4339 .dac_nids = alc880_asus_dac_nids,
4340 .dig_out_nid = ALC880_DIGOUT_NID,
4341 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4342 .channel_mode = alc880_asus_modes,
4344 .input_mux = &alc880_capture_source,
4346 [ALC880_UNIWILL_DIG] = {
4347 .mixers = { alc880_asus_mixer },
4348 .init_verbs = { alc880_volume_init_verbs,
4349 alc880_pin_asus_init_verbs },
4350 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4351 .dac_nids = alc880_asus_dac_nids,
4352 .dig_out_nid = ALC880_DIGOUT_NID,
4353 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4354 .channel_mode = alc880_asus_modes,
4356 .input_mux = &alc880_capture_source,
4358 [ALC880_UNIWILL] = {
4359 .mixers = { alc880_uniwill_mixer },
4360 .init_verbs = { alc880_volume_init_verbs,
4361 alc880_uniwill_init_verbs },
4362 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4363 .dac_nids = alc880_asus_dac_nids,
4364 .dig_out_nid = ALC880_DIGOUT_NID,
4365 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4366 .channel_mode = alc880_threestack_modes,
4368 .input_mux = &alc880_capture_source,
4369 .unsol_event = alc880_uniwill_unsol_event,
4370 .setup = alc880_uniwill_setup,
4371 .init_hook = alc880_uniwill_init_hook,
4373 [ALC880_UNIWILL_P53] = {
4374 .mixers = { alc880_uniwill_p53_mixer },
4375 .init_verbs = { alc880_volume_init_verbs,
4376 alc880_uniwill_p53_init_verbs },
4377 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4378 .dac_nids = alc880_asus_dac_nids,
4379 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4380 .channel_mode = alc880_threestack_modes,
4381 .input_mux = &alc880_capture_source,
4382 .unsol_event = alc880_uniwill_p53_unsol_event,
4383 .setup = alc880_uniwill_p53_setup,
4384 .init_hook = alc_automute_amp,
4386 [ALC880_FUJITSU] = {
4387 .mixers = { alc880_fujitsu_mixer },
4388 .init_verbs = { alc880_volume_init_verbs,
4389 alc880_uniwill_p53_init_verbs,
4390 alc880_beep_init_verbs },
4391 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4392 .dac_nids = alc880_dac_nids,
4393 .dig_out_nid = ALC880_DIGOUT_NID,
4394 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4395 .channel_mode = alc880_2_jack_modes,
4396 .input_mux = &alc880_capture_source,
4397 .unsol_event = alc880_uniwill_p53_unsol_event,
4398 .setup = alc880_uniwill_p53_setup,
4399 .init_hook = alc_automute_amp,
4402 .mixers = { alc880_three_stack_mixer },
4403 .init_verbs = { alc880_volume_init_verbs,
4404 alc880_pin_clevo_init_verbs },
4405 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4406 .dac_nids = alc880_dac_nids,
4408 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4409 .channel_mode = alc880_threestack_modes,
4411 .input_mux = &alc880_capture_source,
4414 .mixers = { alc880_lg_mixer },
4415 .init_verbs = { alc880_volume_init_verbs,
4416 alc880_lg_init_verbs },
4417 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4418 .dac_nids = alc880_lg_dac_nids,
4419 .dig_out_nid = ALC880_DIGOUT_NID,
4420 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4421 .channel_mode = alc880_lg_ch_modes,
4423 .input_mux = &alc880_lg_capture_source,
4424 .unsol_event = alc_automute_amp_unsol_event,
4425 .setup = alc880_lg_setup,
4426 .init_hook = alc_automute_amp,
4427 #ifdef CONFIG_SND_HDA_POWER_SAVE
4428 .loopbacks = alc880_lg_loopbacks,
4432 .mixers = { alc880_lg_lw_mixer },
4433 .init_verbs = { alc880_volume_init_verbs,
4434 alc880_lg_lw_init_verbs },
4435 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4436 .dac_nids = alc880_dac_nids,
4437 .dig_out_nid = ALC880_DIGOUT_NID,
4438 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4439 .channel_mode = alc880_lg_lw_modes,
4440 .input_mux = &alc880_lg_lw_capture_source,
4441 .unsol_event = alc_automute_amp_unsol_event,
4442 .setup = alc880_lg_lw_setup,
4443 .init_hook = alc_automute_amp,
4445 [ALC880_MEDION_RIM] = {
4446 .mixers = { alc880_medion_rim_mixer },
4447 .init_verbs = { alc880_volume_init_verbs,
4448 alc880_medion_rim_init_verbs,
4449 alc_gpio2_init_verbs },
4450 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4451 .dac_nids = alc880_dac_nids,
4452 .dig_out_nid = ALC880_DIGOUT_NID,
4453 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4454 .channel_mode = alc880_2_jack_modes,
4455 .input_mux = &alc880_medion_rim_capture_source,
4456 .unsol_event = alc880_medion_rim_unsol_event,
4457 .setup = alc880_medion_rim_setup,
4458 .init_hook = alc880_medion_rim_automute,
4460 #ifdef CONFIG_SND_DEBUG
4462 .mixers = { alc880_test_mixer },
4463 .init_verbs = { alc880_test_init_verbs },
4464 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4465 .dac_nids = alc880_test_dac_nids,
4466 .dig_out_nid = ALC880_DIGOUT_NID,
4467 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4468 .channel_mode = alc880_test_modes,
4469 .input_mux = &alc880_test_capture_source,
4475 * Automatic parse of I/O pins from the BIOS configuration
4480 ALC_CTL_WIDGET_MUTE,
4483 static struct snd_kcontrol_new alc880_control_templates[] = {
4484 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4485 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4486 HDA_BIND_MUTE(NULL, 0, 0, 0),
4489 /* add dynamic controls */
4490 static int add_control(struct alc_spec *spec, int type, const char *name,
4493 struct snd_kcontrol_new *knew;
4495 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4496 knew = snd_array_new(&spec->kctls);
4499 *knew = alc880_control_templates[type];
4500 knew->name = kstrdup(name, GFP_KERNEL);
4503 if (get_amp_nid_(val))
4504 knew->subdevice = HDA_SUBDEV_AMP_FLAG;
4505 knew->private_value = val;
4509 static int add_control_with_pfx(struct alc_spec *spec, int type,
4510 const char *pfx, const char *dir,
4511 const char *sfx, unsigned long val)
4514 snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx);
4515 return add_control(spec, type, name, val);
4518 #define add_pb_vol_ctrl(spec, type, pfx, val) \
4519 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", val)
4520 #define add_pb_sw_ctrl(spec, type, pfx, val) \
4521 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", val)
4523 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4524 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4525 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4526 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4527 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4528 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4529 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4530 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4531 #define ALC880_PIN_CD_NID 0x1c
4533 /* fill in the dac_nids table from the parsed pin configuration */
4534 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4535 const struct auto_pin_cfg *cfg)
4541 memset(assigned, 0, sizeof(assigned));
4542 spec->multiout.dac_nids = spec->private_dac_nids;
4544 /* check the pins hardwired to audio widget */
4545 for (i = 0; i < cfg->line_outs; i++) {
4546 nid = cfg->line_out_pins[i];
4547 if (alc880_is_fixed_pin(nid)) {
4548 int idx = alc880_fixed_pin_idx(nid);
4549 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4553 /* left pins can be connect to any audio widget */
4554 for (i = 0; i < cfg->line_outs; i++) {
4555 nid = cfg->line_out_pins[i];
4556 if (alc880_is_fixed_pin(nid))
4558 /* search for an empty channel */
4559 for (j = 0; j < cfg->line_outs; j++) {
4561 spec->multiout.dac_nids[i] =
4562 alc880_idx_to_dac(j);
4568 spec->multiout.num_dacs = cfg->line_outs;
4572 /* add playback controls from the parsed DAC table */
4573 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4574 const struct auto_pin_cfg *cfg)
4576 static const char *chname[4] = {
4577 "Front", "Surround", NULL /*CLFE*/, "Side"
4582 for (i = 0; i < cfg->line_outs; i++) {
4583 if (!spec->multiout.dac_nids[i])
4585 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4588 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4590 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4594 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4596 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4600 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4602 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4606 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4608 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4614 if (cfg->line_outs == 1 &&
4615 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
4619 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4620 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4624 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4625 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4634 /* add playback controls for speaker and HP outputs */
4635 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4644 if (alc880_is_fixed_pin(pin)) {
4645 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4646 /* specify the DAC as the extra output */
4647 if (!spec->multiout.hp_nid)
4648 spec->multiout.hp_nid = nid;
4650 spec->multiout.extra_out_nid[0] = nid;
4651 /* control HP volume/switch on the output mixer amp */
4652 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4653 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4654 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4657 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4658 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4661 } else if (alc880_is_multi_pin(pin)) {
4662 /* set manual connection */
4663 /* we have only a switch on HP-out PIN */
4664 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
4665 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4672 /* create input playback/capture controls for the given pin */
4673 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4674 const char *ctlname,
4675 int idx, hda_nid_t mix_nid)
4679 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
4680 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4683 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
4684 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4690 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
4692 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
4693 return (pincap & AC_PINCAP_IN) != 0;
4696 /* create playback/capture controls for input pins */
4697 static int alc_auto_create_input_ctls(struct hda_codec *codec,
4698 const struct auto_pin_cfg *cfg,
4700 hda_nid_t cap1, hda_nid_t cap2)
4702 struct alc_spec *spec = codec->spec;
4703 struct hda_input_mux *imux = &spec->private_imux[0];
4706 for (i = 0; i < AUTO_PIN_LAST; i++) {
4709 pin = cfg->input_pins[i];
4710 if (!alc_is_input_pin(codec, pin))
4714 idx = get_connection_index(codec, mixer, pin);
4716 err = new_analog_input(spec, pin,
4717 auto_pin_cfg_labels[i],
4726 idx = get_connection_index(codec, cap1, pin);
4727 if (idx < 0 && cap2)
4728 idx = get_connection_index(codec, cap2, pin);
4730 imux->items[imux->num_items].label =
4731 auto_pin_cfg_labels[i];
4732 imux->items[imux->num_items].index = idx;
4739 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
4740 const struct auto_pin_cfg *cfg)
4742 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
4745 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4746 unsigned int pin_type)
4748 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4751 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4755 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4756 hda_nid_t nid, int pin_type,
4759 alc_set_pin_output(codec, nid, pin_type);
4760 /* need the manual connection? */
4761 if (alc880_is_multi_pin(nid)) {
4762 struct alc_spec *spec = codec->spec;
4763 int idx = alc880_multi_pin_idx(nid);
4764 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4765 AC_VERB_SET_CONNECT_SEL,
4766 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4770 static int get_pin_type(int line_out_type)
4772 if (line_out_type == AUTO_PIN_HP_OUT)
4778 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4780 struct alc_spec *spec = codec->spec;
4783 for (i = 0; i < spec->autocfg.line_outs; i++) {
4784 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4785 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4786 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4790 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4792 struct alc_spec *spec = codec->spec;
4795 pin = spec->autocfg.speaker_pins[0];
4796 if (pin) /* connect to front */
4797 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4798 pin = spec->autocfg.hp_pins[0];
4799 if (pin) /* connect to front */
4800 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4803 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4805 struct alc_spec *spec = codec->spec;
4808 for (i = 0; i < AUTO_PIN_LAST; i++) {
4809 hda_nid_t nid = spec->autocfg.input_pins[i];
4810 if (alc_is_input_pin(codec, nid)) {
4811 alc_set_input_pin(codec, nid, i);
4812 if (nid != ALC880_PIN_CD_NID &&
4813 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
4814 snd_hda_codec_write(codec, nid, 0,
4815 AC_VERB_SET_AMP_GAIN_MUTE,
4821 static void alc880_auto_init_input_src(struct hda_codec *codec)
4823 struct alc_spec *spec = codec->spec;
4826 for (c = 0; c < spec->num_adc_nids; c++) {
4827 unsigned int mux_idx;
4828 const struct hda_input_mux *imux;
4829 mux_idx = c >= spec->num_mux_defs ? 0 : c;
4830 imux = &spec->input_mux[mux_idx];
4831 if (!imux->num_items && mux_idx > 0)
4832 imux = &spec->input_mux[0];
4834 snd_hda_codec_write(codec, spec->adc_nids[c], 0,
4835 AC_VERB_SET_CONNECT_SEL,
4836 imux->items[0].index);
4840 /* parse the BIOS configuration and set up the alc_spec */
4841 /* return 1 if successful, 0 if the proper config is not found,
4842 * or a negative error code
4844 static int alc880_parse_auto_config(struct hda_codec *codec)
4846 struct alc_spec *spec = codec->spec;
4848 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4850 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4854 if (!spec->autocfg.line_outs)
4855 return 0; /* can't find valid BIOS pin config */
4857 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4860 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4863 err = alc880_auto_create_extra_out(spec,
4864 spec->autocfg.speaker_pins[0],
4868 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4872 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
4876 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4878 /* check multiple SPDIF-out (for recent codecs) */
4879 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4881 err = snd_hda_get_connections(codec,
4882 spec->autocfg.dig_out_pins[i],
4887 spec->multiout.dig_out_nid = dig_nid;
4889 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4890 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
4892 spec->slave_dig_outs[i - 1] = dig_nid;
4895 if (spec->autocfg.dig_in_pin)
4896 spec->dig_in_nid = ALC880_DIGIN_NID;
4898 if (spec->kctls.list)
4899 add_mixer(spec, spec->kctls.list);
4901 add_verb(spec, alc880_volume_init_verbs);
4903 spec->num_mux_defs = 1;
4904 spec->input_mux = &spec->private_imux[0];
4906 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
4911 /* additional initialization for auto-configuration model */
4912 static void alc880_auto_init(struct hda_codec *codec)
4914 struct alc_spec *spec = codec->spec;
4915 alc880_auto_init_multi_out(codec);
4916 alc880_auto_init_extra_out(codec);
4917 alc880_auto_init_analog_input(codec);
4918 alc880_auto_init_input_src(codec);
4919 if (spec->unsol_event)
4920 alc_inithook(codec);
4923 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
4924 * one of two digital mic pins, e.g. on ALC272
4926 static void fixup_automic_adc(struct hda_codec *codec)
4928 struct alc_spec *spec = codec->spec;
4931 for (i = 0; i < spec->num_adc_nids; i++) {
4932 hda_nid_t cap = spec->capsrc_nids ?
4933 spec->capsrc_nids[i] : spec->adc_nids[i];
4936 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
4939 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
4942 spec->int_mic.mux_idx = iidx;
4943 spec->ext_mic.mux_idx = eidx;
4944 if (spec->capsrc_nids)
4945 spec->capsrc_nids += i;
4946 spec->adc_nids += i;
4947 spec->num_adc_nids = 1;
4950 snd_printd(KERN_INFO "hda_codec: %s: "
4951 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
4952 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
4953 spec->auto_mic = 0; /* disable auto-mic to be sure */
4956 /* choose the ADC/MUX containing the input pin and initialize the setup */
4957 static void fixup_single_adc(struct hda_codec *codec)
4959 struct alc_spec *spec = codec->spec;
4963 /* search for the input pin; there must be only one */
4964 for (i = 0; i < AUTO_PIN_LAST; i++) {
4965 if (spec->autocfg.input_pins[i]) {
4966 pin = spec->autocfg.input_pins[i];
4973 /* set the default connection to that pin */
4974 for (i = 0; i < spec->num_adc_nids; i++) {
4975 hda_nid_t cap = spec->capsrc_nids ?
4976 spec->capsrc_nids[i] : spec->adc_nids[i];
4979 idx = get_connection_index(codec, cap, pin);
4982 /* use only this ADC */
4983 if (spec->capsrc_nids)
4984 spec->capsrc_nids += i;
4985 spec->adc_nids += i;
4986 spec->num_adc_nids = 1;
4987 /* select or unmute this route */
4988 if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) {
4989 snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx,
4992 snd_hda_codec_write_cache(codec, cap, 0,
4993 AC_VERB_SET_CONNECT_SEL, idx);
4999 static void set_capture_mixer(struct hda_codec *codec)
5001 struct alc_spec *spec = codec->spec;
5002 static struct snd_kcontrol_new *caps[2][3] = {
5003 { alc_capture_mixer_nosrc1,
5004 alc_capture_mixer_nosrc2,
5005 alc_capture_mixer_nosrc3 },
5006 { alc_capture_mixer1,
5008 alc_capture_mixer3 },
5010 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
5013 fixup_automic_adc(codec);
5014 else if (spec->input_mux) {
5015 if (spec->input_mux->num_items > 1)
5017 else if (spec->input_mux->num_items == 1)
5018 fixup_single_adc(codec);
5020 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
5024 /* fill adc_nids (and capsrc_nids) containing all active input pins */
5025 static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids,
5028 struct alc_spec *spec = codec->spec;
5030 hda_nid_t fallback_adc = 0, fallback_cap = 0;
5032 for (n = 0; n < num_nids; n++) {
5034 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
5038 if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN)
5041 nconns = snd_hda_get_connections(codec, cap, conn,
5045 nconns = snd_hda_get_connections(codec, cap, conn,
5050 if (!fallback_adc) {
5054 for (i = 0; i < AUTO_PIN_LAST; i++) {
5055 hda_nid_t nid = spec->autocfg.input_pins[i];
5058 for (j = 0; j < nconns; j++) {
5065 if (i >= AUTO_PIN_LAST) {
5066 int num_adcs = spec->num_adc_nids;
5067 spec->private_adc_nids[num_adcs] = adc;
5068 spec->private_capsrc_nids[num_adcs] = cap;
5069 spec->num_adc_nids++;
5070 spec->adc_nids = spec->private_adc_nids;
5072 spec->capsrc_nids = spec->private_capsrc_nids;
5075 if (!spec->num_adc_nids) {
5076 printk(KERN_WARNING "hda_codec: %s: no valid ADC found;"
5077 " using fallback 0x%x\n",
5078 codec->chip_name, fallback_adc);
5079 spec->private_adc_nids[0] = fallback_adc;
5080 spec->adc_nids = spec->private_adc_nids;
5081 if (fallback_adc != fallback_cap) {
5082 spec->private_capsrc_nids[0] = fallback_cap;
5083 spec->capsrc_nids = spec->private_adc_nids;
5088 #ifdef CONFIG_SND_HDA_INPUT_BEEP
5089 #define set_beep_amp(spec, nid, idx, dir) \
5090 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
5092 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
5096 * OK, here we have finally the patch for ALC880
5099 static int patch_alc880(struct hda_codec *codec)
5101 struct alc_spec *spec;
5105 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5111 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
5114 if (board_config < 0) {
5115 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
5117 board_config = ALC880_AUTO;
5120 if (board_config == ALC880_AUTO) {
5121 /* automatic parse from the BIOS config */
5122 err = alc880_parse_auto_config(codec);
5128 "hda_codec: Cannot set up configuration "
5129 "from BIOS. Using 3-stack mode...\n");
5130 board_config = ALC880_3ST;
5134 err = snd_hda_attach_beep_device(codec, 0x1);
5140 if (board_config != ALC880_AUTO)
5141 setup_preset(codec, &alc880_presets[board_config]);
5143 spec->stream_analog_playback = &alc880_pcm_analog_playback;
5144 spec->stream_analog_capture = &alc880_pcm_analog_capture;
5145 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
5147 spec->stream_digital_playback = &alc880_pcm_digital_playback;
5148 spec->stream_digital_capture = &alc880_pcm_digital_capture;
5150 if (!spec->adc_nids && spec->input_mux) {
5151 /* check whether NID 0x07 is valid */
5152 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
5154 wcap = get_wcaps_type(wcap);
5155 if (wcap != AC_WID_AUD_IN) {
5156 spec->adc_nids = alc880_adc_nids_alt;
5157 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
5159 spec->adc_nids = alc880_adc_nids;
5160 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
5163 set_capture_mixer(codec);
5164 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
5166 spec->vmaster_nid = 0x0c;
5168 codec->patch_ops = alc_patch_ops;
5169 if (board_config == ALC880_AUTO)
5170 spec->init_hook = alc880_auto_init;
5171 #ifdef CONFIG_SND_HDA_POWER_SAVE
5172 if (!spec->loopback.amplist)
5173 spec->loopback.amplist = alc880_loopbacks;
5184 static hda_nid_t alc260_dac_nids[1] = {
5189 static hda_nid_t alc260_adc_nids[1] = {
5194 static hda_nid_t alc260_adc_nids_alt[1] = {
5199 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
5200 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
5202 static hda_nid_t alc260_dual_adc_nids[2] = {
5207 #define ALC260_DIGOUT_NID 0x03
5208 #define ALC260_DIGIN_NID 0x06
5210 static struct hda_input_mux alc260_capture_source = {
5214 { "Front Mic", 0x1 },
5220 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
5221 * headphone jack and the internal CD lines since these are the only pins at
5222 * which audio can appear. For flexibility, also allow the option of
5223 * recording the mixer output on the second ADC (ADC0 doesn't have a
5224 * connection to the mixer output).
5226 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
5230 { "Mic/Line", 0x0 },
5232 { "Headphone", 0x2 },
5238 { "Mic/Line", 0x0 },
5240 { "Headphone", 0x2 },
5247 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
5248 * the Fujitsu S702x, but jacks are marked differently.
5250 static struct hda_input_mux alc260_acer_capture_sources[2] = {
5257 { "Headphone", 0x5 },
5266 { "Headphone", 0x6 },
5272 /* Maxdata Favorit 100XS */
5273 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
5277 { "Line/Mic", 0x0 },
5284 { "Line/Mic", 0x0 },
5292 * This is just place-holder, so there's something for alc_build_pcms to look
5293 * at when it calculates the maximum number of channels. ALC260 has no mixer
5294 * element which allows changing the channel mode, so the verb list is
5297 static struct hda_channel_mode alc260_modes[1] = {
5302 /* Mixer combinations
5304 * basic: base_output + input + pc_beep + capture
5305 * HP: base_output + input + capture_alt
5306 * HP_3013: hp_3013 + input + capture
5307 * fujitsu: fujitsu + capture
5308 * acer: acer + capture
5311 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
5312 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5313 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5314 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5315 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5316 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5317 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5321 static struct snd_kcontrol_new alc260_input_mixer[] = {
5322 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5323 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5324 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5325 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5326 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5327 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5328 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
5329 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
5333 /* update HP, line and mono out pins according to the master switch */
5334 static void alc260_hp_master_update(struct hda_codec *codec,
5335 hda_nid_t hp, hda_nid_t line,
5338 struct alc_spec *spec = codec->spec;
5339 unsigned int val = spec->master_sw ? PIN_HP : 0;
5340 /* change HP and line-out pins */
5341 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5343 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5345 /* mono (speaker) depending on the HP jack sense */
5346 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5347 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5351 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5352 struct snd_ctl_elem_value *ucontrol)
5354 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5355 struct alc_spec *spec = codec->spec;
5356 *ucontrol->value.integer.value = spec->master_sw;
5360 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
5361 struct snd_ctl_elem_value *ucontrol)
5363 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5364 struct alc_spec *spec = codec->spec;
5365 int val = !!*ucontrol->value.integer.value;
5366 hda_nid_t hp, line, mono;
5368 if (val == spec->master_sw)
5370 spec->master_sw = val;
5371 hp = (kcontrol->private_value >> 16) & 0xff;
5372 line = (kcontrol->private_value >> 8) & 0xff;
5373 mono = kcontrol->private_value & 0xff;
5374 alc260_hp_master_update(codec, hp, line, mono);
5378 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5380 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5381 .name = "Master Playback Switch",
5382 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5383 .info = snd_ctl_boolean_mono_info,
5384 .get = alc260_hp_master_sw_get,
5385 .put = alc260_hp_master_sw_put,
5386 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5388 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5389 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5390 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5391 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5392 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5394 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5398 static struct hda_verb alc260_hp_unsol_verbs[] = {
5399 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5403 static void alc260_hp_automute(struct hda_codec *codec)
5405 struct alc_spec *spec = codec->spec;
5407 spec->jack_present = snd_hda_jack_detect(codec, 0x10);
5408 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5411 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5413 if ((res >> 26) == ALC880_HP_EVENT)
5414 alc260_hp_automute(codec);
5417 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5419 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5420 .name = "Master Playback Switch",
5421 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5422 .info = snd_ctl_boolean_mono_info,
5423 .get = alc260_hp_master_sw_get,
5424 .put = alc260_hp_master_sw_put,
5425 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5427 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5428 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5429 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
5430 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
5431 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5432 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5433 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5434 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
5438 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
5439 .ops = &snd_hda_bind_vol,
5441 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
5442 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
5443 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
5448 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
5449 .ops = &snd_hda_bind_sw,
5451 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
5452 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
5457 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
5458 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
5459 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
5460 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
5461 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5465 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
5466 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5470 static void alc260_hp_3013_automute(struct hda_codec *codec)
5472 struct alc_spec *spec = codec->spec;
5474 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
5475 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
5478 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
5481 if ((res >> 26) == ALC880_HP_EVENT)
5482 alc260_hp_3013_automute(codec);
5485 static void alc260_hp_3012_automute(struct hda_codec *codec)
5487 unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT;
5489 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5491 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5493 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5497 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
5500 if ((res >> 26) == ALC880_HP_EVENT)
5501 alc260_hp_3012_automute(codec);
5504 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
5505 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
5507 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
5508 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5509 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
5510 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5511 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5512 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5513 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
5514 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
5515 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
5516 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5517 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
5521 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
5522 * versions of the ALC260 don't act on requests to enable mic bias from NID
5523 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5524 * datasheet doesn't mention this restriction. At this stage it's not clear
5525 * whether this behaviour is intentional or is a hardware bug in chip
5526 * revisions available in early 2006. Therefore for now allow the
5527 * "Headphone Jack Mode" control to span all choices, but if it turns out
5528 * that the lack of mic bias for this NID is intentional we could change the
5529 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5531 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5532 * don't appear to make the mic bias available from the "line" jack, even
5533 * though the NID used for this jack (0x14) can supply it. The theory is
5534 * that perhaps Acer have included blocking capacitors between the ALC260
5535 * and the output jack. If this turns out to be the case for all such
5536 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5537 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5539 * The C20x Tablet series have a mono internal speaker which is controlled
5540 * via the chip's Mono sum widget and pin complex, so include the necessary
5541 * controls for such models. On models without a "mono speaker" the control
5542 * won't do anything.
5544 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5545 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5546 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5547 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5548 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5550 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5552 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5553 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5554 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5555 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5556 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5557 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5558 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5559 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5563 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5565 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
5566 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5567 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5568 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5569 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5570 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5571 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5575 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5576 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5578 static struct snd_kcontrol_new alc260_will_mixer[] = {
5579 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5580 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5581 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5582 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5583 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5584 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5585 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5586 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5587 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5588 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5592 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5593 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5595 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5596 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5597 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5598 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5599 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5600 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5601 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
5602 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
5603 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5604 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5605 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5610 * initialization verbs
5612 static struct hda_verb alc260_init_verbs[] = {
5613 /* Line In pin widget for input */
5614 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5615 /* CD pin widget for input */
5616 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5617 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5618 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5619 /* Mic2 (front panel) pin widget for input and vref at 80% */
5620 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5621 /* LINE-2 is used for line-out in rear */
5622 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5623 /* select line-out */
5624 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
5626 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5628 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5630 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5631 /* mute capture amp left and right */
5632 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5633 /* set connection select to line in (default select for this ADC) */
5634 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5635 /* mute capture amp left and right */
5636 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5637 /* set connection select to line in (default select for this ADC) */
5638 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
5639 /* set vol=0 Line-Out mixer amp left and right */
5640 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5641 /* unmute pin widget amp left and right (no gain on this amp) */
5642 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5643 /* set vol=0 HP mixer amp left and right */
5644 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5645 /* unmute pin widget amp left and right (no gain on this amp) */
5646 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5647 /* set vol=0 Mono mixer amp left and right */
5648 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5649 /* unmute pin widget amp left and right (no gain on this amp) */
5650 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5651 /* unmute LINE-2 out pin */
5652 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5653 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5656 /* mute analog inputs */
5657 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5658 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5659 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5660 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5661 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5662 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5663 /* mute Front out path */
5664 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5665 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5666 /* mute Headphone out path */
5667 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5668 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5669 /* mute Mono out path */
5670 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5671 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5675 #if 0 /* should be identical with alc260_init_verbs? */
5676 static struct hda_verb alc260_hp_init_verbs[] = {
5677 /* Headphone and output */
5678 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5680 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5681 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5682 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5683 /* Mic2 (front panel) pin widget for input and vref at 80% */
5684 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5685 /* Line In pin widget for input */
5686 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5687 /* Line-2 pin widget for output */
5688 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5689 /* CD pin widget for input */
5690 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5691 /* unmute amp left and right */
5692 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5693 /* set connection select to line in (default select for this ADC) */
5694 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5695 /* unmute Line-Out mixer amp left and right (volume = 0) */
5696 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5697 /* mute pin widget amp left and right (no gain on this amp) */
5698 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5699 /* unmute HP mixer amp left and right (volume = 0) */
5700 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5701 /* mute pin widget amp left and right (no gain on this amp) */
5702 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5703 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5706 /* mute analog inputs */
5707 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5708 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5709 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5710 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5711 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5712 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5713 /* Unmute Front out path */
5714 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5715 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5716 /* Unmute Headphone out path */
5717 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5718 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5719 /* Unmute Mono out path */
5720 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5721 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5726 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5727 /* Line out and output */
5728 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5730 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5731 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5732 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5733 /* Mic2 (front panel) pin widget for input and vref at 80% */
5734 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5735 /* Line In pin widget for input */
5736 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5737 /* Headphone pin widget for output */
5738 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5739 /* CD pin widget for input */
5740 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5741 /* unmute amp left and right */
5742 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5743 /* set connection select to line in (default select for this ADC) */
5744 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5745 /* unmute Line-Out mixer amp left and right (volume = 0) */
5746 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5747 /* mute pin widget amp left and right (no gain on this amp) */
5748 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5749 /* unmute HP mixer amp left and right (volume = 0) */
5750 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5751 /* mute pin widget amp left and right (no gain on this amp) */
5752 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5753 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5756 /* mute analog inputs */
5757 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5758 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5759 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5760 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5761 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5762 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5763 /* Unmute Front out path */
5764 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5765 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5766 /* Unmute Headphone out path */
5767 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5768 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5769 /* Unmute Mono out path */
5770 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5771 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5775 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5776 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5777 * audio = 0x16, internal speaker = 0x10.
5779 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5780 /* Disable all GPIOs */
5781 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5782 /* Internal speaker is connected to headphone pin */
5783 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5784 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5785 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5786 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5787 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5788 /* Ensure all other unused pins are disabled and muted. */
5789 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5790 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5791 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5792 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5793 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5794 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5795 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5796 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5798 /* Disable digital (SPDIF) pins */
5799 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5800 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5802 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5803 * when acting as an output.
5805 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5807 /* Start with output sum widgets muted and their output gains at min */
5808 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5809 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5810 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5811 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5812 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5813 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5814 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5815 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5816 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5818 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5819 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5820 /* Unmute Line1 pin widget output buffer since it starts as an output.
5821 * If the pin mode is changed by the user the pin mode control will
5822 * take care of enabling the pin's input/output buffers as needed.
5823 * Therefore there's no need to enable the input buffer at this
5826 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5827 /* Unmute input buffer of pin widget used for Line-in (no equiv
5830 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5832 /* Mute capture amp left and right */
5833 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5834 /* Set ADC connection select to match default mixer setting - line
5837 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5839 /* Do the same for the second ADC: mute capture input amp and
5840 * set ADC connection to line in (on mic1 pin)
5842 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5843 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5845 /* Mute all inputs to mixer widget (even unconnected ones) */
5846 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5847 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5848 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5849 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5850 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5851 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5852 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5853 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5858 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5859 * similar laptops (adapted from Fujitsu init verbs).
5861 static struct hda_verb alc260_acer_init_verbs[] = {
5862 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5863 * the headphone jack. Turn this on and rely on the standard mute
5864 * methods whenever the user wants to turn these outputs off.
5866 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5867 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5868 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5869 /* Internal speaker/Headphone jack is connected to Line-out pin */
5870 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5871 /* Internal microphone/Mic jack is connected to Mic1 pin */
5872 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5873 /* Line In jack is connected to Line1 pin */
5874 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5875 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5876 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5877 /* Ensure all other unused pins are disabled and muted. */
5878 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5879 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5880 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5881 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5882 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5883 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5884 /* Disable digital (SPDIF) pins */
5885 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5886 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5888 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5889 * bus when acting as outputs.
5891 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5892 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5894 /* Start with output sum widgets muted and their output gains at min */
5895 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5896 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5897 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5898 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5899 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5900 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5901 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5902 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5903 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5905 /* Unmute Line-out pin widget amp left and right
5906 * (no equiv mixer ctrl)
5908 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5909 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5910 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5911 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5912 * inputs. If the pin mode is changed by the user the pin mode control
5913 * will take care of enabling the pin's input/output buffers as needed.
5914 * Therefore there's no need to enable the input buffer at this
5917 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5918 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5920 /* Mute capture amp left and right */
5921 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5922 /* Set ADC connection select to match default mixer setting - mic
5925 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5927 /* Do similar with the second ADC: mute capture input amp and
5928 * set ADC connection to mic to match ALSA's default state.
5930 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5931 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5933 /* Mute all inputs to mixer widget (even unconnected ones) */
5934 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5935 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5936 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5937 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5938 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5939 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5940 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5941 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5946 /* Initialisation sequence for Maxdata Favorit 100XS
5947 * (adapted from Acer init verbs).
5949 static struct hda_verb alc260_favorit100_init_verbs[] = {
5950 /* GPIO 0 enables the output jack.
5951 * Turn this on and rely on the standard mute
5952 * methods whenever the user wants to turn these outputs off.
5954 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5955 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5956 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5957 /* Line/Mic input jack is connected to Mic1 pin */
5958 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5959 /* Ensure all other unused pins are disabled and muted. */
5960 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5961 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5962 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5963 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5964 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5965 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5966 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5967 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5968 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5969 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5970 /* Disable digital (SPDIF) pins */
5971 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5972 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5974 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5975 * bus when acting as outputs.
5977 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5978 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5980 /* Start with output sum widgets muted and their output gains at min */
5981 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5982 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5983 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5984 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5985 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5986 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5987 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5988 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5989 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5991 /* Unmute Line-out pin widget amp left and right
5992 * (no equiv mixer ctrl)
5994 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5995 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5996 * inputs. If the pin mode is changed by the user the pin mode control
5997 * will take care of enabling the pin's input/output buffers as needed.
5998 * Therefore there's no need to enable the input buffer at this
6001 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6003 /* Mute capture amp left and right */
6004 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6005 /* Set ADC connection select to match default mixer setting - mic
6008 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6010 /* Do similar with the second ADC: mute capture input amp and
6011 * set ADC connection to mic to match ALSA's default state.
6013 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6014 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6016 /* Mute all inputs to mixer widget (even unconnected ones) */
6017 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6018 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6019 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6020 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6021 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6022 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6023 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6024 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6029 static struct hda_verb alc260_will_verbs[] = {
6030 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6031 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
6032 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
6033 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6034 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6035 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
6039 static struct hda_verb alc260_replacer_672v_verbs[] = {
6040 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6041 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6042 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
6044 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6045 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6046 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6048 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6052 /* toggle speaker-output according to the hp-jack state */
6053 static void alc260_replacer_672v_automute(struct hda_codec *codec)
6055 unsigned int present;
6057 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
6058 present = snd_hda_jack_detect(codec, 0x0f);
6060 snd_hda_codec_write_cache(codec, 0x01, 0,
6061 AC_VERB_SET_GPIO_DATA, 1);
6062 snd_hda_codec_write_cache(codec, 0x0f, 0,
6063 AC_VERB_SET_PIN_WIDGET_CONTROL,
6066 snd_hda_codec_write_cache(codec, 0x01, 0,
6067 AC_VERB_SET_GPIO_DATA, 0);
6068 snd_hda_codec_write_cache(codec, 0x0f, 0,
6069 AC_VERB_SET_PIN_WIDGET_CONTROL,
6074 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
6077 if ((res >> 26) == ALC880_HP_EVENT)
6078 alc260_replacer_672v_automute(codec);
6081 static struct hda_verb alc260_hp_dc7600_verbs[] = {
6082 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
6083 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6084 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6085 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6086 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6087 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6088 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6089 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6090 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6091 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6095 /* Test configuration for debugging, modelled after the ALC880 test
6098 #ifdef CONFIG_SND_DEBUG
6099 static hda_nid_t alc260_test_dac_nids[1] = {
6102 static hda_nid_t alc260_test_adc_nids[2] = {
6105 /* For testing the ALC260, each input MUX needs its own definition since
6106 * the signal assignments are different. This assumes that the first ADC
6109 static struct hda_input_mux alc260_test_capture_sources[2] = {
6113 { "MIC1 pin", 0x0 },
6114 { "MIC2 pin", 0x1 },
6115 { "LINE1 pin", 0x2 },
6116 { "LINE2 pin", 0x3 },
6118 { "LINE-OUT pin", 0x5 },
6119 { "HP-OUT pin", 0x6 },
6125 { "MIC1 pin", 0x0 },
6126 { "MIC2 pin", 0x1 },
6127 { "LINE1 pin", 0x2 },
6128 { "LINE2 pin", 0x3 },
6131 { "LINE-OUT pin", 0x6 },
6132 { "HP-OUT pin", 0x7 },
6136 static struct snd_kcontrol_new alc260_test_mixer[] = {
6137 /* Output driver widgets */
6138 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
6139 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
6140 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6141 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
6142 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6143 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
6145 /* Modes for retasking pin widgets
6146 * Note: the ALC260 doesn't seem to act on requests to enable mic
6147 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
6148 * mention this restriction. At this stage it's not clear whether
6149 * this behaviour is intentional or is a hardware bug in chip
6150 * revisions available at least up until early 2006. Therefore for
6151 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
6152 * choices, but if it turns out that the lack of mic bias for these
6153 * NIDs is intentional we could change their modes from
6154 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6156 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
6157 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
6158 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
6159 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
6160 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
6161 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
6163 /* Loopback mixer controls */
6164 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
6165 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
6166 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
6167 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
6168 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
6169 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
6170 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
6171 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
6172 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6173 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6174 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
6175 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
6176 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
6177 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
6179 /* Controls for GPIO pins, assuming they are configured as outputs */
6180 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
6181 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
6182 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
6183 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
6185 /* Switches to allow the digital IO pins to be enabled. The datasheet
6186 * is ambigious as to which NID is which; testing on laptops which
6187 * make this output available should provide clarification.
6189 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
6190 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
6192 /* A switch allowing EAPD to be enabled. Some laptops seem to use
6193 * this output to turn on an external amplifier.
6195 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
6196 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
6200 static struct hda_verb alc260_test_init_verbs[] = {
6201 /* Enable all GPIOs as outputs with an initial value of 0 */
6202 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
6203 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6204 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
6206 /* Enable retasking pins as output, initially without power amp */
6207 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6208 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6209 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6210 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6211 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6212 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6214 /* Disable digital (SPDIF) pins initially, but users can enable
6215 * them via a mixer switch. In the case of SPDIF-out, this initverb
6216 * payload also sets the generation to 0, output to be in "consumer"
6217 * PCM format, copyright asserted, no pre-emphasis and no validity
6220 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6221 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6223 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
6224 * OUT1 sum bus when acting as an output.
6226 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6227 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
6228 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6229 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
6231 /* Start with output sum widgets muted and their output gains at min */
6232 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6233 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6234 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6235 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6236 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6237 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6238 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6239 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6240 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6242 /* Unmute retasking pin widget output buffers since the default
6243 * state appears to be output. As the pin mode is changed by the
6244 * user the pin mode control will take care of enabling the pin's
6245 * input/output buffers as needed.
6247 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6248 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6249 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6250 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6251 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6252 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6253 /* Also unmute the mono-out pin widget */
6254 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6256 /* Mute capture amp left and right */
6257 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6258 /* Set ADC connection select to match default mixer setting (mic1
6261 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6263 /* Do the same for the second ADC: mute capture input amp and
6264 * set ADC connection to mic1 pin
6266 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6267 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6269 /* Mute all inputs to mixer widget (even unconnected ones) */
6270 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6271 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6272 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6273 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6274 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6275 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6276 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6277 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6283 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
6284 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
6286 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
6287 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
6290 * for BIOS auto-configuration
6293 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
6294 const char *pfx, int *vol_bits)
6297 unsigned long vol_val, sw_val;
6300 if (nid >= 0x0f && nid < 0x11) {
6301 nid_vol = nid - 0x7;
6302 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6303 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6304 } else if (nid == 0x11) {
6305 nid_vol = nid - 0x7;
6306 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
6307 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
6308 } else if (nid >= 0x12 && nid <= 0x15) {
6310 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6311 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6315 if (!(*vol_bits & (1 << nid_vol))) {
6316 /* first control for the volume widget */
6317 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val);
6320 *vol_bits |= (1 << nid_vol);
6322 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val);
6328 /* add playback controls from the parsed DAC table */
6329 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6330 const struct auto_pin_cfg *cfg)
6336 spec->multiout.num_dacs = 1;
6337 spec->multiout.dac_nids = spec->private_dac_nids;
6338 spec->multiout.dac_nids[0] = 0x02;
6340 nid = cfg->line_out_pins[0];
6343 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6345 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6349 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6354 nid = cfg->speaker_pins[0];
6356 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6361 nid = cfg->hp_pins[0];
6363 err = alc260_add_playback_controls(spec, nid, "Headphone",
6371 /* create playback/capture controls for input pins */
6372 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6373 const struct auto_pin_cfg *cfg)
6375 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
6378 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6379 hda_nid_t nid, int pin_type,
6382 alc_set_pin_output(codec, nid, pin_type);
6383 /* need the manual connection? */
6385 int idx = nid - 0x12;
6386 snd_hda_codec_write(codec, idx + 0x0b, 0,
6387 AC_VERB_SET_CONNECT_SEL, sel_idx);
6391 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6393 struct alc_spec *spec = codec->spec;
6396 nid = spec->autocfg.line_out_pins[0];
6398 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6399 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6402 nid = spec->autocfg.speaker_pins[0];
6404 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6406 nid = spec->autocfg.hp_pins[0];
6408 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6411 #define ALC260_PIN_CD_NID 0x16
6412 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6414 struct alc_spec *spec = codec->spec;
6417 for (i = 0; i < AUTO_PIN_LAST; i++) {
6418 hda_nid_t nid = spec->autocfg.input_pins[i];
6420 alc_set_input_pin(codec, nid, i);
6421 if (nid != ALC260_PIN_CD_NID &&
6422 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6423 snd_hda_codec_write(codec, nid, 0,
6424 AC_VERB_SET_AMP_GAIN_MUTE,
6430 #define alc260_auto_init_input_src alc880_auto_init_input_src
6433 * generic initialization of ADC, input mixers and output mixers
6435 static struct hda_verb alc260_volume_init_verbs[] = {
6437 * Unmute ADC0-1 and set the default input to mic-in
6439 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6440 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6441 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6442 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6444 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6446 * Note: PASD motherboards uses the Line In 2 as the input for
6447 * front panel mic (mic 2)
6449 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6450 /* mute analog inputs */
6451 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6452 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6453 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6454 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6455 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6458 * Set up output mixers (0x08 - 0x0a)
6460 /* set vol=0 to output mixers */
6461 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6462 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6463 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6464 /* set up input amps for analog loopback */
6465 /* Amp Indices: DAC = 0, mixer = 1 */
6466 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6467 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6468 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6469 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6470 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6471 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6476 static int alc260_parse_auto_config(struct hda_codec *codec)
6478 struct alc_spec *spec = codec->spec;
6480 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
6482 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
6486 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
6489 if (!spec->kctls.list)
6490 return 0; /* can't find valid BIOS pin config */
6491 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
6495 spec->multiout.max_channels = 2;
6497 if (spec->autocfg.dig_outs)
6498 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6499 if (spec->kctls.list)
6500 add_mixer(spec, spec->kctls.list);
6502 add_verb(spec, alc260_volume_init_verbs);
6504 spec->num_mux_defs = 1;
6505 spec->input_mux = &spec->private_imux[0];
6507 alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0);
6512 /* additional initialization for auto-configuration model */
6513 static void alc260_auto_init(struct hda_codec *codec)
6515 struct alc_spec *spec = codec->spec;
6516 alc260_auto_init_multi_out(codec);
6517 alc260_auto_init_analog_input(codec);
6518 alc260_auto_init_input_src(codec);
6519 if (spec->unsol_event)
6520 alc_inithook(codec);
6523 #ifdef CONFIG_SND_HDA_POWER_SAVE
6524 static struct hda_amp_list alc260_loopbacks[] = {
6525 { 0x07, HDA_INPUT, 0 },
6526 { 0x07, HDA_INPUT, 1 },
6527 { 0x07, HDA_INPUT, 2 },
6528 { 0x07, HDA_INPUT, 3 },
6529 { 0x07, HDA_INPUT, 4 },
6535 * ALC260 configurations
6537 static const char *alc260_models[ALC260_MODEL_LAST] = {
6538 [ALC260_BASIC] = "basic",
6540 [ALC260_HP_3013] = "hp-3013",
6541 [ALC260_HP_DC7600] = "hp-dc7600",
6542 [ALC260_FUJITSU_S702X] = "fujitsu",
6543 [ALC260_ACER] = "acer",
6544 [ALC260_WILL] = "will",
6545 [ALC260_REPLACER_672V] = "replacer",
6546 [ALC260_FAVORIT100] = "favorit100",
6547 #ifdef CONFIG_SND_DEBUG
6548 [ALC260_TEST] = "test",
6550 [ALC260_AUTO] = "auto",
6553 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6554 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6555 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
6556 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6557 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6558 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6559 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */
6560 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6561 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6562 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6563 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6564 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6565 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6566 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6567 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6568 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6569 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6570 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6571 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6572 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6573 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6577 static struct alc_config_preset alc260_presets[] = {
6579 .mixers = { alc260_base_output_mixer,
6580 alc260_input_mixer },
6581 .init_verbs = { alc260_init_verbs },
6582 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6583 .dac_nids = alc260_dac_nids,
6584 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6585 .adc_nids = alc260_dual_adc_nids,
6586 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6587 .channel_mode = alc260_modes,
6588 .input_mux = &alc260_capture_source,
6591 .mixers = { alc260_hp_output_mixer,
6592 alc260_input_mixer },
6593 .init_verbs = { alc260_init_verbs,
6594 alc260_hp_unsol_verbs },
6595 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6596 .dac_nids = alc260_dac_nids,
6597 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6598 .adc_nids = alc260_adc_nids_alt,
6599 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6600 .channel_mode = alc260_modes,
6601 .input_mux = &alc260_capture_source,
6602 .unsol_event = alc260_hp_unsol_event,
6603 .init_hook = alc260_hp_automute,
6605 [ALC260_HP_DC7600] = {
6606 .mixers = { alc260_hp_dc7600_mixer,
6607 alc260_input_mixer },
6608 .init_verbs = { alc260_init_verbs,
6609 alc260_hp_dc7600_verbs },
6610 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6611 .dac_nids = alc260_dac_nids,
6612 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6613 .adc_nids = alc260_adc_nids_alt,
6614 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6615 .channel_mode = alc260_modes,
6616 .input_mux = &alc260_capture_source,
6617 .unsol_event = alc260_hp_3012_unsol_event,
6618 .init_hook = alc260_hp_3012_automute,
6620 [ALC260_HP_3013] = {
6621 .mixers = { alc260_hp_3013_mixer,
6622 alc260_input_mixer },
6623 .init_verbs = { alc260_hp_3013_init_verbs,
6624 alc260_hp_3013_unsol_verbs },
6625 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6626 .dac_nids = alc260_dac_nids,
6627 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6628 .adc_nids = alc260_adc_nids_alt,
6629 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6630 .channel_mode = alc260_modes,
6631 .input_mux = &alc260_capture_source,
6632 .unsol_event = alc260_hp_3013_unsol_event,
6633 .init_hook = alc260_hp_3013_automute,
6635 [ALC260_FUJITSU_S702X] = {
6636 .mixers = { alc260_fujitsu_mixer },
6637 .init_verbs = { alc260_fujitsu_init_verbs },
6638 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6639 .dac_nids = alc260_dac_nids,
6640 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6641 .adc_nids = alc260_dual_adc_nids,
6642 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6643 .channel_mode = alc260_modes,
6644 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
6645 .input_mux = alc260_fujitsu_capture_sources,
6648 .mixers = { alc260_acer_mixer },
6649 .init_verbs = { alc260_acer_init_verbs },
6650 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6651 .dac_nids = alc260_dac_nids,
6652 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6653 .adc_nids = alc260_dual_adc_nids,
6654 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6655 .channel_mode = alc260_modes,
6656 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
6657 .input_mux = alc260_acer_capture_sources,
6659 [ALC260_FAVORIT100] = {
6660 .mixers = { alc260_favorit100_mixer },
6661 .init_verbs = { alc260_favorit100_init_verbs },
6662 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6663 .dac_nids = alc260_dac_nids,
6664 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6665 .adc_nids = alc260_dual_adc_nids,
6666 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6667 .channel_mode = alc260_modes,
6668 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
6669 .input_mux = alc260_favorit100_capture_sources,
6672 .mixers = { alc260_will_mixer },
6673 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6674 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6675 .dac_nids = alc260_dac_nids,
6676 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6677 .adc_nids = alc260_adc_nids,
6678 .dig_out_nid = ALC260_DIGOUT_NID,
6679 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6680 .channel_mode = alc260_modes,
6681 .input_mux = &alc260_capture_source,
6683 [ALC260_REPLACER_672V] = {
6684 .mixers = { alc260_replacer_672v_mixer },
6685 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6686 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6687 .dac_nids = alc260_dac_nids,
6688 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6689 .adc_nids = alc260_adc_nids,
6690 .dig_out_nid = ALC260_DIGOUT_NID,
6691 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6692 .channel_mode = alc260_modes,
6693 .input_mux = &alc260_capture_source,
6694 .unsol_event = alc260_replacer_672v_unsol_event,
6695 .init_hook = alc260_replacer_672v_automute,
6697 #ifdef CONFIG_SND_DEBUG
6699 .mixers = { alc260_test_mixer },
6700 .init_verbs = { alc260_test_init_verbs },
6701 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6702 .dac_nids = alc260_test_dac_nids,
6703 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6704 .adc_nids = alc260_test_adc_nids,
6705 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6706 .channel_mode = alc260_modes,
6707 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6708 .input_mux = alc260_test_capture_sources,
6713 static int patch_alc260(struct hda_codec *codec)
6715 struct alc_spec *spec;
6716 int err, board_config;
6718 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6724 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6727 if (board_config < 0) {
6728 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6730 board_config = ALC260_AUTO;
6733 if (board_config == ALC260_AUTO) {
6734 /* automatic parse from the BIOS config */
6735 err = alc260_parse_auto_config(codec);
6741 "hda_codec: Cannot set up configuration "
6742 "from BIOS. Using base mode...\n");
6743 board_config = ALC260_BASIC;
6747 err = snd_hda_attach_beep_device(codec, 0x1);
6753 if (board_config != ALC260_AUTO)
6754 setup_preset(codec, &alc260_presets[board_config]);
6756 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6757 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6759 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6760 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6762 if (!spec->adc_nids && spec->input_mux) {
6763 /* check whether NID 0x04 is valid */
6764 unsigned int wcap = get_wcaps(codec, 0x04);
6765 wcap = get_wcaps_type(wcap);
6767 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6768 spec->adc_nids = alc260_adc_nids_alt;
6769 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6771 spec->adc_nids = alc260_adc_nids;
6772 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6775 set_capture_mixer(codec);
6776 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6778 spec->vmaster_nid = 0x08;
6780 codec->patch_ops = alc_patch_ops;
6781 if (board_config == ALC260_AUTO)
6782 spec->init_hook = alc260_auto_init;
6783 #ifdef CONFIG_SND_HDA_POWER_SAVE
6784 if (!spec->loopback.amplist)
6785 spec->loopback.amplist = alc260_loopbacks;
6793 * ALC882/883/885/888/889 support
6795 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6796 * configuration. Each pin widget can choose any input DACs and a mixer.
6797 * Each ADC is connected from a mixer of all inputs. This makes possible
6798 * 6-channel independent captures.
6800 * In addition, an independent DAC for the multi-playback (not used in this
6803 #define ALC882_DIGOUT_NID 0x06
6804 #define ALC882_DIGIN_NID 0x0a
6805 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
6806 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
6807 #define ALC1200_DIGOUT_NID 0x10
6810 static struct hda_channel_mode alc882_ch_modes[1] = {
6815 static hda_nid_t alc882_dac_nids[4] = {
6816 /* front, rear, clfe, rear_surr */
6817 0x02, 0x03, 0x04, 0x05
6819 #define alc883_dac_nids alc882_dac_nids
6822 #define alc882_adc_nids alc880_adc_nids
6823 #define alc882_adc_nids_alt alc880_adc_nids_alt
6824 #define alc883_adc_nids alc882_adc_nids_alt
6825 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
6826 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
6827 #define alc889_adc_nids alc880_adc_nids
6829 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6830 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6831 #define alc883_capsrc_nids alc882_capsrc_nids_alt
6832 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
6833 #define alc889_capsrc_nids alc882_capsrc_nids
6836 /* FIXME: should be a matrix-type input source selection */
6838 static struct hda_input_mux alc882_capture_source = {
6842 { "Front Mic", 0x1 },
6848 #define alc883_capture_source alc882_capture_source
6850 static struct hda_input_mux alc889_capture_source = {
6853 { "Front Mic", 0x0 },
6859 static struct hda_input_mux mb5_capture_source = {
6868 static struct hda_input_mux macmini3_capture_source = {
6876 static struct hda_input_mux alc883_3stack_6ch_intel = {
6880 { "Front Mic", 0x0 },
6886 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6894 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6904 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6912 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
6916 { "Front Mic", 0x1 },
6921 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
6929 static struct hda_input_mux alc889A_mb31_capture_source = {
6933 /* Front Mic (0x01) unused */
6935 /* Line 2 (0x03) unused */
6936 /* CD (0x04) unused? */
6943 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6950 static struct hda_verb alc882_3ST_ch2_init[] = {
6951 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6952 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6953 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6954 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6961 static struct hda_verb alc882_3ST_ch4_init[] = {
6962 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6963 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6964 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6965 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6966 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6973 static struct hda_verb alc882_3ST_ch6_init[] = {
6974 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6975 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6976 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6977 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6978 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6979 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6983 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
6984 { 2, alc882_3ST_ch2_init },
6985 { 4, alc882_3ST_ch4_init },
6986 { 6, alc882_3ST_ch6_init },
6989 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
6994 static struct hda_verb alc883_3ST_ch2_clevo_init[] = {
6995 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
6996 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6997 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6998 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6999 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7006 static struct hda_verb alc883_3ST_ch4_clevo_init[] = {
7007 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7008 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7009 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7010 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7011 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7012 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7019 static struct hda_verb alc883_3ST_ch6_clevo_init[] = {
7020 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7021 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7022 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7023 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7024 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7025 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7026 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7030 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
7031 { 2, alc883_3ST_ch2_clevo_init },
7032 { 4, alc883_3ST_ch4_clevo_init },
7033 { 6, alc883_3ST_ch6_clevo_init },
7040 static struct hda_verb alc882_sixstack_ch6_init[] = {
7041 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7042 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7043 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7044 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7051 static struct hda_verb alc882_sixstack_ch8_init[] = {
7052 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7053 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7054 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7055 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7059 static struct hda_channel_mode alc882_sixstack_modes[2] = {
7060 { 6, alc882_sixstack_ch6_init },
7061 { 8, alc882_sixstack_ch8_init },
7065 /* Macbook Air 2,1 */
7067 static struct hda_channel_mode alc885_mba21_ch_modes[1] = {
7072 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
7078 static struct hda_verb alc885_mbp_ch2_init[] = {
7079 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7080 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7081 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7088 static struct hda_verb alc885_mbp_ch4_init[] = {
7089 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7090 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7091 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7092 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7093 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7097 static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
7098 { 2, alc885_mbp_ch2_init },
7099 { 4, alc885_mbp_ch4_init },
7104 * Speakers/Woofer/HP = Front
7107 static struct hda_verb alc885_mb5_ch2_init[] = {
7108 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7109 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7115 * Speakers/HP = Front
7119 static struct hda_verb alc885_mb5_ch6_init[] = {
7120 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7121 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7122 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7126 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
7127 { 2, alc885_mb5_ch2_init },
7128 { 6, alc885_mb5_ch6_init },
7131 #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes
7136 static struct hda_verb alc883_4ST_ch2_init[] = {
7137 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7138 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7139 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7140 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7141 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7142 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7149 static struct hda_verb alc883_4ST_ch4_init[] = {
7150 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7151 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7152 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7153 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7154 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7155 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7156 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7163 static struct hda_verb alc883_4ST_ch6_init[] = {
7164 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7165 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7166 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7167 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7168 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7169 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7170 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7171 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7178 static struct hda_verb alc883_4ST_ch8_init[] = {
7179 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7180 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7181 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7182 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7183 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7184 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7185 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7186 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7187 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7191 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
7192 { 2, alc883_4ST_ch2_init },
7193 { 4, alc883_4ST_ch4_init },
7194 { 6, alc883_4ST_ch6_init },
7195 { 8, alc883_4ST_ch8_init },
7202 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7203 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7204 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7205 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7206 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7213 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7214 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7215 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7216 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7217 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7218 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7225 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7226 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7227 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7228 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7229 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7230 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7231 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7235 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7236 { 2, alc883_3ST_ch2_intel_init },
7237 { 4, alc883_3ST_ch4_intel_init },
7238 { 6, alc883_3ST_ch6_intel_init },
7244 static struct hda_verb alc889_ch2_intel_init[] = {
7245 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7246 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
7247 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
7248 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
7249 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7250 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7257 static struct hda_verb alc889_ch6_intel_init[] = {
7258 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7259 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7260 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7261 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7262 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7263 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7270 static struct hda_verb alc889_ch8_intel_init[] = {
7271 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7272 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7273 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7274 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7275 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
7276 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7277 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7281 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
7282 { 2, alc889_ch2_intel_init },
7283 { 6, alc889_ch6_intel_init },
7284 { 8, alc889_ch8_intel_init },
7290 static struct hda_verb alc883_sixstack_ch6_init[] = {
7291 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7292 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7293 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7294 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7301 static struct hda_verb alc883_sixstack_ch8_init[] = {
7302 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7303 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7304 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7305 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7309 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7310 { 6, alc883_sixstack_ch6_init },
7311 { 8, alc883_sixstack_ch8_init },
7315 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7316 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7318 static struct snd_kcontrol_new alc882_base_mixer[] = {
7319 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7320 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7321 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7322 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7323 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7324 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7325 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7326 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7327 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7328 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7329 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7330 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7331 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7332 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7333 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7334 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7335 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7336 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7337 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7338 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7339 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7343 /* Macbook Air 2,1 same control for HP and internal Speaker */
7345 static struct snd_kcontrol_new alc885_mba21_mixer[] = {
7346 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7347 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT),
7352 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
7353 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7354 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7355 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7356 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
7357 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7358 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7359 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7360 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7361 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7362 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
7363 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7367 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7368 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7369 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7370 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7371 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7372 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7373 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7374 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7375 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7376 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7377 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7378 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7379 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7380 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7381 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
7385 static struct snd_kcontrol_new alc885_macmini3_mixer[] = {
7386 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7387 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7388 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7389 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7390 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7391 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7392 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7393 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7394 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
7395 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
7396 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7400 static struct snd_kcontrol_new alc885_imac91_mixer[] = {
7401 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7402 HDA_BIND_MUTE ("Line-Out Playback Switch", 0x0c, 0x02, HDA_INPUT),
7403 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
7404 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7405 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7406 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7407 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7408 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7409 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7414 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
7415 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7416 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7417 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7418 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7419 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7420 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7421 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7422 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7423 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7427 static struct snd_kcontrol_new alc882_targa_mixer[] = {
7428 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7429 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7430 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7431 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7432 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7433 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7434 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7435 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7436 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7437 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7438 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7439 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7440 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7444 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
7445 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
7447 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
7448 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7449 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7450 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7451 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
7452 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7453 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7454 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7455 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7456 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
7457 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
7458 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7459 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7460 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7464 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
7465 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7466 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7467 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7468 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7469 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7470 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7471 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7472 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7473 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7474 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7478 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
7480 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7481 .name = "Channel Mode",
7482 .info = alc_ch_mode_info,
7483 .get = alc_ch_mode_get,
7484 .put = alc_ch_mode_put,
7489 static struct hda_verb alc882_base_init_verbs[] = {
7490 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7491 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7492 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7494 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7495 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7497 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7498 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7500 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7501 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7503 /* Front Pin: output 0 (0x0c) */
7504 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7505 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7506 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7507 /* Rear Pin: output 1 (0x0d) */
7508 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7509 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7510 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7511 /* CLFE Pin: output 2 (0x0e) */
7512 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7513 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7514 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7515 /* Side Pin: output 3 (0x0f) */
7516 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7517 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7518 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7519 /* Mic (rear) pin: input vref at 80% */
7520 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7521 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7522 /* Front Mic pin: input vref at 80% */
7523 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7524 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7525 /* Line In pin: input */
7526 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7527 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7528 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7529 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7530 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7531 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7532 /* CD pin widget for input */
7533 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7535 /* FIXME: use matrix-type input source selection */
7536 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7538 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7540 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7541 /* ADC2: mute amp left and right */
7542 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7543 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7544 /* ADC3: mute amp left and right */
7545 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7546 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7551 static struct hda_verb alc882_adc1_init_verbs[] = {
7552 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7553 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7554 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7555 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7556 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7557 /* ADC1: mute amp left and right */
7558 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7559 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7563 static struct hda_verb alc882_eapd_verbs[] = {
7564 /* change to EAPD mode */
7565 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7566 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
7570 static struct hda_verb alc889_eapd_verbs[] = {
7571 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
7572 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
7576 static struct hda_verb alc_hp15_unsol_verbs[] = {
7577 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7578 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7582 static struct hda_verb alc885_init_verbs[] = {
7583 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7584 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7585 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7587 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7588 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7590 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7591 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7593 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7594 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7596 /* Front HP Pin: output 0 (0x0c) */
7597 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7598 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7599 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7600 /* Front Pin: output 0 (0x0c) */
7601 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7602 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7603 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7604 /* Rear Pin: output 1 (0x0d) */
7605 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7606 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7607 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
7608 /* CLFE Pin: output 2 (0x0e) */
7609 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7610 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7611 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7612 /* Side Pin: output 3 (0x0f) */
7613 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7614 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7615 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7616 /* Mic (rear) pin: input vref at 80% */
7617 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7618 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7619 /* Front Mic pin: input vref at 80% */
7620 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7621 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7622 /* Line In pin: input */
7623 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7624 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7626 /* Mixer elements: 0x18, , 0x1a, 0x1b */
7628 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7630 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7632 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7633 /* ADC2: mute amp left and right */
7634 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7635 /* ADC3: mute amp left and right */
7636 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7641 static struct hda_verb alc885_init_input_verbs[] = {
7642 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7643 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7644 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7649 /* Unmute Selector 24h and set the default input to front mic */
7650 static struct hda_verb alc889_init_input_verbs[] = {
7651 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
7652 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7657 #define alc883_init_verbs alc882_base_init_verbs
7660 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
7661 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7662 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7663 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
7664 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7665 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7666 /* FIXME: this looks suspicious...
7667 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
7668 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
7673 static struct hda_verb alc882_macpro_init_verbs[] = {
7674 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7675 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7676 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7677 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7678 /* Front Pin: output 0 (0x0c) */
7679 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7680 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7681 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7682 /* Front Mic pin: input vref at 80% */
7683 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7684 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7685 /* Speaker: output */
7686 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7687 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7688 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
7689 /* Headphone output (output 0 - 0x0c) */
7690 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7691 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7692 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7694 /* FIXME: use matrix-type input source selection */
7695 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7696 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7697 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7698 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7699 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7700 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7702 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7703 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7704 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7705 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7707 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7708 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7709 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7710 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7711 /* ADC1: mute amp left and right */
7712 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7713 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7714 /* ADC2: mute amp left and right */
7715 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7716 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7717 /* ADC3: mute amp left and right */
7718 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7719 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7725 static struct hda_verb alc885_mb5_init_verbs[] = {
7727 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7728 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7729 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7730 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7732 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7733 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7734 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7735 /* Surround mixer */
7736 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7737 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7738 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7740 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7741 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7742 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7744 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7745 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7746 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7747 /* Front Pin (0x0c) */
7748 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7749 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7750 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7751 /* LFE Pin (0x0e) */
7752 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7753 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7754 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7756 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7757 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7758 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7759 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7760 /* Front Mic pin: input vref at 80% */
7761 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7762 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7764 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7765 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7767 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7768 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7769 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7770 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7775 static struct hda_verb alc885_macmini3_init_verbs[] = {
7777 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7778 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7779 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7780 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7782 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7783 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7784 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7785 /* Surround mixer */
7786 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7787 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7788 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7790 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7791 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7792 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7794 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7795 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7796 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7797 /* Front Pin (0x0c) */
7798 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7799 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7800 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7801 /* LFE Pin (0x0e) */
7802 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7803 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7804 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7806 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7807 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7808 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7809 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7811 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7812 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7814 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7815 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7816 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7817 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7822 static struct hda_verb alc885_mba21_init_verbs[] = {
7823 /*Internal and HP Speaker Mixer*/
7824 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7825 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7826 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7827 /*Internal Speaker Pin (0x0c)*/
7828 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
7829 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7830 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7831 /* HP Pin: output 0 (0x0e) */
7832 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7833 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7834 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7835 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
7836 /* Line in (is hp when jack connected)*/
7837 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
7838 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7844 /* Macbook Pro rev3 */
7845 static struct hda_verb alc885_mbp3_init_verbs[] = {
7846 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7847 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7848 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7849 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7851 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7852 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7853 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7855 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7856 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7857 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7858 /* Front Pin: output 0 (0x0c) */
7859 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7860 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7861 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7862 /* HP Pin: output 0 (0x0e) */
7863 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7864 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7865 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
7866 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7867 /* Mic (rear) pin: input vref at 80% */
7868 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7869 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7870 /* Front Mic pin: input vref at 80% */
7871 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7872 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7873 /* Line In pin: use output 1 when in LineOut mode */
7874 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7875 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7876 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7878 /* FIXME: use matrix-type input source selection */
7879 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7880 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7881 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7882 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7883 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7884 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7886 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7887 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7888 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7889 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7891 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7892 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7893 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7894 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7895 /* ADC1: mute amp left and right */
7896 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7897 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7898 /* ADC2: mute amp left and right */
7899 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7900 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7901 /* ADC3: mute amp left and right */
7902 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7903 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7909 static struct hda_verb alc885_imac91_init_verbs[] = {
7910 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
7911 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7912 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7913 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7915 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7916 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7917 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7918 /* HP Pin: output 0 (0x0c) */
7919 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7920 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7921 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7922 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7923 /* Internal Speakers: output 0 (0x0d) */
7924 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7925 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7926 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7927 /* Mic (rear) pin: input vref at 80% */
7928 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7929 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7930 /* Front Mic pin: input vref at 80% */
7931 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7932 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7933 /* Line In pin: use output 1 when in LineOut mode */
7934 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7935 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7936 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7938 /* FIXME: use matrix-type input source selection */
7939 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7940 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7941 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7942 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7943 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7944 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7946 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7947 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7948 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7949 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7951 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7952 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7953 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7954 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7955 /* ADC1: mute amp left and right */
7956 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7957 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7958 /* ADC2: mute amp left and right */
7959 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7960 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7961 /* ADC3: mute amp left and right */
7962 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7963 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7968 /* iMac 24 mixer. */
7969 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
7970 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7971 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
7975 /* iMac 24 init verbs. */
7976 static struct hda_verb alc885_imac24_init_verbs[] = {
7977 /* Internal speakers: output 0 (0x0c) */
7978 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7979 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7980 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7981 /* Internal speakers: output 0 (0x0c) */
7982 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7983 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7984 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7985 /* Headphone: output 0 (0x0c) */
7986 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7987 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7988 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7989 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7990 /* Front Mic: input vref at 80% */
7991 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7992 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7996 /* Toggle speaker-output according to the hp-jack state */
7997 static void alc885_imac24_setup(struct hda_codec *codec)
7999 struct alc_spec *spec = codec->spec;
8001 spec->autocfg.hp_pins[0] = 0x14;
8002 spec->autocfg.speaker_pins[0] = 0x18;
8003 spec->autocfg.speaker_pins[1] = 0x1a;
8006 #define alc885_mb5_setup alc885_imac24_setup
8007 #define alc885_macmini3_setup alc885_imac24_setup
8009 /* Macbook Air 2,1 */
8010 static void alc885_mba21_setup(struct hda_codec *codec)
8012 struct alc_spec *spec = codec->spec;
8014 spec->autocfg.hp_pins[0] = 0x14;
8015 spec->autocfg.speaker_pins[0] = 0x18;
8020 static void alc885_mbp3_setup(struct hda_codec *codec)
8022 struct alc_spec *spec = codec->spec;
8024 spec->autocfg.hp_pins[0] = 0x15;
8025 spec->autocfg.speaker_pins[0] = 0x14;
8028 static void alc885_imac91_setup(struct hda_codec *codec)
8030 struct alc_spec *spec = codec->spec;
8032 spec->autocfg.hp_pins[0] = 0x14;
8033 spec->autocfg.speaker_pins[0] = 0x15;
8034 spec->autocfg.speaker_pins[1] = 0x1a;
8037 static struct hda_verb alc882_targa_verbs[] = {
8038 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8039 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8041 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8042 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8044 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8045 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8046 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8048 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8052 /* toggle speaker-output according to the hp-jack state */
8053 static void alc882_targa_automute(struct hda_codec *codec)
8055 struct alc_spec *spec = codec->spec;
8056 alc_automute_amp(codec);
8057 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
8058 spec->jack_present ? 1 : 3);
8061 static void alc882_targa_setup(struct hda_codec *codec)
8063 struct alc_spec *spec = codec->spec;
8065 spec->autocfg.hp_pins[0] = 0x14;
8066 spec->autocfg.speaker_pins[0] = 0x1b;
8069 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
8071 if ((res >> 26) == ALC880_HP_EVENT)
8072 alc882_targa_automute(codec);
8075 static struct hda_verb alc882_asus_a7j_verbs[] = {
8076 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8077 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8079 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8080 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8081 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8083 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8084 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8085 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8087 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8088 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8089 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8093 static struct hda_verb alc882_asus_a7m_verbs[] = {
8094 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8095 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8097 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8098 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8099 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8101 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8102 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8103 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8105 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8106 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8107 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8111 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
8113 unsigned int gpiostate, gpiomask, gpiodir;
8115 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
8116 AC_VERB_GET_GPIO_DATA, 0);
8119 gpiostate |= (1 << pin);
8121 gpiostate &= ~(1 << pin);
8123 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
8124 AC_VERB_GET_GPIO_MASK, 0);
8125 gpiomask |= (1 << pin);
8127 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
8128 AC_VERB_GET_GPIO_DIRECTION, 0);
8129 gpiodir |= (1 << pin);
8132 snd_hda_codec_write(codec, codec->afg, 0,
8133 AC_VERB_SET_GPIO_MASK, gpiomask);
8134 snd_hda_codec_write(codec, codec->afg, 0,
8135 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
8139 snd_hda_codec_write(codec, codec->afg, 0,
8140 AC_VERB_SET_GPIO_DATA, gpiostate);
8143 /* set up GPIO at initialization */
8144 static void alc885_macpro_init_hook(struct hda_codec *codec)
8146 alc882_gpio_mute(codec, 0, 0);
8147 alc882_gpio_mute(codec, 1, 0);
8150 /* set up GPIO and update auto-muting at initialization */
8151 static void alc885_imac24_init_hook(struct hda_codec *codec)
8153 alc885_macpro_init_hook(codec);
8154 alc_automute_amp(codec);
8158 * generic initialization of ADC, input mixers and output mixers
8160 static struct hda_verb alc883_auto_init_verbs[] = {
8162 * Unmute ADC0-2 and set the default input to mic-in
8164 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8165 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8166 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8167 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8170 * Set up output mixers (0x0c - 0x0f)
8172 /* set vol=0 to output mixers */
8173 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8174 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8175 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8176 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8177 /* set up input amps for analog loopback */
8178 /* Amp Indices: DAC = 0, mixer = 1 */
8179 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8180 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8181 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8182 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8183 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8184 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8185 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8186 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8187 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8188 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8190 /* FIXME: use matrix-type input source selection */
8191 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8193 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8195 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8199 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
8200 static struct hda_verb alc889A_mb31_ch2_init[] = {
8201 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8202 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8203 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8204 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8208 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
8209 static struct hda_verb alc889A_mb31_ch4_init[] = {
8210 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8211 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8212 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8213 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8217 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
8218 static struct hda_verb alc889A_mb31_ch5_init[] = {
8219 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
8220 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8221 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8222 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8226 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
8227 static struct hda_verb alc889A_mb31_ch6_init[] = {
8228 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
8229 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
8230 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8231 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8235 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
8236 { 2, alc889A_mb31_ch2_init },
8237 { 4, alc889A_mb31_ch4_init },
8238 { 5, alc889A_mb31_ch5_init },
8239 { 6, alc889A_mb31_ch6_init },
8242 static struct hda_verb alc883_medion_eapd_verbs[] = {
8243 /* eanable EAPD on medion laptop */
8244 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8245 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
8249 #define alc883_base_mixer alc882_base_mixer
8251 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
8252 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8253 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8254 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8255 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8256 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8257 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8258 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8259 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8260 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8261 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8262 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8263 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8264 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8268 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
8269 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8270 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8271 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8272 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8273 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8274 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8275 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8276 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8277 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8278 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8282 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
8283 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8284 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8285 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8286 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8287 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8288 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8289 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8290 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8291 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8292 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8296 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
8297 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8298 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8299 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8300 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8301 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8302 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8303 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8304 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8305 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8306 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8307 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8308 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8309 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8313 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
8314 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8315 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8316 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8317 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8318 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8319 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8320 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8321 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8322 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8323 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8324 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8325 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8326 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8327 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8328 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8329 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8330 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8331 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8332 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8336 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
8337 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8338 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8339 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8340 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8341 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8343 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8344 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8345 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8346 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8347 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8348 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8349 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8350 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8351 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8352 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8353 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8354 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8355 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8356 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8360 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
8361 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8362 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8363 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8364 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8365 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8367 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8368 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8369 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8370 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8371 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
8372 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8373 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8374 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8375 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
8376 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT),
8377 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
8378 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8379 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8380 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8384 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
8385 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8386 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8387 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8388 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8389 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8390 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8391 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8392 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8393 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8394 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8395 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8396 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8397 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8398 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8399 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8400 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8401 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8402 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8403 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8407 static struct snd_kcontrol_new alc883_targa_mixer[] = {
8408 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8409 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8410 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8411 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8412 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8413 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8414 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8415 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8416 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8417 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8418 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8419 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8420 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8421 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8422 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8423 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8424 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8428 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
8429 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8430 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8431 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8432 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8433 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8434 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8435 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8436 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8437 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8438 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8439 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8440 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8444 static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
8445 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8446 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8447 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8448 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8449 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8453 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
8454 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8455 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8456 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8457 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8458 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8459 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8460 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8461 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8465 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
8466 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8467 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
8468 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8469 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8470 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8471 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8472 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8473 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8474 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8478 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
8479 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8480 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8481 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8482 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8483 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8484 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8485 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8486 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8487 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8491 static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = {
8492 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8493 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8494 HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8495 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
8496 HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT),
8497 HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT),
8501 static struct hda_verb alc883_medion_wim2160_verbs[] = {
8502 /* Unmute front mixer */
8503 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8504 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8506 /* Set speaker pin to front mixer */
8507 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8509 /* Init headphone pin */
8510 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8511 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8512 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8513 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8518 /* toggle speaker-output according to the hp-jack state */
8519 static void alc883_medion_wim2160_setup(struct hda_codec *codec)
8521 struct alc_spec *spec = codec->spec;
8523 spec->autocfg.hp_pins[0] = 0x1a;
8524 spec->autocfg.speaker_pins[0] = 0x15;
8527 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
8528 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8529 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8530 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8531 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8532 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8533 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8534 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8535 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8539 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
8540 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8541 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8542 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8543 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8544 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8545 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8546 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8547 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8548 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8552 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
8553 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8554 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8555 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8556 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
8557 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
8558 0x0d, 1, 0x0, HDA_OUTPUT),
8559 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
8560 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
8561 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
8562 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8563 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8564 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8565 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8566 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8567 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8568 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8569 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8570 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8571 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8572 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8573 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8577 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
8579 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8580 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8581 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8582 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8583 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
8585 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
8586 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
8587 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
8588 /* Output switches */
8589 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
8590 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
8591 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
8593 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
8594 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
8596 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8597 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8598 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8599 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8603 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
8604 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8605 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8606 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8607 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8608 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8609 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8613 static struct hda_bind_ctls alc883_bind_cap_vol = {
8614 .ops = &snd_hda_bind_vol,
8616 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8617 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8622 static struct hda_bind_ctls alc883_bind_cap_switch = {
8623 .ops = &snd_hda_bind_sw,
8625 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8626 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8631 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
8632 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8633 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8634 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8635 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8636 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8637 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8638 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8639 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8643 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
8644 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
8645 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
8647 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8648 /* .name = "Capture Source", */
8649 .name = "Input Source",
8651 .info = alc_mux_enum_info,
8652 .get = alc_mux_enum_get,
8653 .put = alc_mux_enum_put,
8658 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
8660 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8661 .name = "Channel Mode",
8662 .info = alc_ch_mode_info,
8663 .get = alc_ch_mode_get,
8664 .put = alc_ch_mode_put,
8669 /* toggle speaker-output according to the hp-jack state */
8670 static void alc883_mitac_setup(struct hda_codec *codec)
8672 struct alc_spec *spec = codec->spec;
8674 spec->autocfg.hp_pins[0] = 0x15;
8675 spec->autocfg.speaker_pins[0] = 0x14;
8676 spec->autocfg.speaker_pins[1] = 0x17;
8679 /* auto-toggle front mic */
8681 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8683 unsigned char bits = snd_hda_jack_detect(codec, 0x18) ? HDA_AMP_MUTE : 0;
8685 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8689 static struct hda_verb alc883_mitac_verbs[] = {
8691 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8692 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8694 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8695 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8697 /* enable unsolicited event */
8698 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8699 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8704 static struct hda_verb alc883_clevo_m540r_verbs[] = {
8706 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8707 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8709 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
8711 /* enable unsolicited event */
8713 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8714 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8720 static struct hda_verb alc883_clevo_m720_verbs[] = {
8722 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8723 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8725 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
8726 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8728 /* enable unsolicited event */
8729 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8730 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8735 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8737 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8738 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8740 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8741 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8743 /* enable unsolicited event */
8744 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8749 static struct hda_verb alc883_targa_verbs[] = {
8750 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8751 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8753 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8754 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8756 /* Connect Line-Out side jack (SPDIF) to Side */
8757 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8758 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8759 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8760 /* Connect Mic jack to CLFE */
8761 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8762 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8763 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
8764 /* Connect Line-in jack to Surround */
8765 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8766 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8767 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8768 /* Connect HP out jack to Front */
8769 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8770 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8771 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8773 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8778 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8779 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8780 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8781 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8785 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8786 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8787 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8788 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8789 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8793 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8794 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8795 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8796 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8797 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8798 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8802 static struct hda_verb alc883_haier_w66_verbs[] = {
8803 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8804 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8806 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8808 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8809 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8810 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8811 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8815 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8816 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8817 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8818 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8819 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8820 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8821 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8822 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8823 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8827 static struct hda_verb alc888_6st_dell_verbs[] = {
8828 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8832 static struct hda_verb alc883_vaiott_verbs[] = {
8834 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8835 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8837 /* enable unsolicited event */
8838 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8843 static void alc888_3st_hp_setup(struct hda_codec *codec)
8845 struct alc_spec *spec = codec->spec;
8847 spec->autocfg.hp_pins[0] = 0x1b;
8848 spec->autocfg.speaker_pins[0] = 0x14;
8849 spec->autocfg.speaker_pins[1] = 0x16;
8850 spec->autocfg.speaker_pins[2] = 0x18;
8853 static struct hda_verb alc888_3st_hp_verbs[] = {
8854 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8855 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8856 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8857 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8864 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8865 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8866 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8867 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8868 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8875 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8876 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8877 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8878 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8879 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8880 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8887 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8888 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8889 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8890 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8891 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8892 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8893 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8897 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8898 { 2, alc888_3st_hp_2ch_init },
8899 { 4, alc888_3st_hp_4ch_init },
8900 { 6, alc888_3st_hp_6ch_init },
8903 /* toggle front-jack and RCA according to the hp-jack state */
8904 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8906 unsigned int present = snd_hda_jack_detect(codec, 0x1b);
8908 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8909 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8910 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8911 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8914 /* toggle RCA according to the front-jack state */
8915 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8917 unsigned int present = snd_hda_jack_detect(codec, 0x14);
8919 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8920 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8923 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8926 if ((res >> 26) == ALC880_HP_EVENT)
8927 alc888_lenovo_ms7195_front_automute(codec);
8928 if ((res >> 26) == ALC880_FRONT_EVENT)
8929 alc888_lenovo_ms7195_rca_automute(codec);
8932 static struct hda_verb alc883_medion_md2_verbs[] = {
8933 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8934 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8936 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8938 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8942 /* toggle speaker-output according to the hp-jack state */
8943 static void alc883_medion_md2_setup(struct hda_codec *codec)
8945 struct alc_spec *spec = codec->spec;
8947 spec->autocfg.hp_pins[0] = 0x14;
8948 spec->autocfg.speaker_pins[0] = 0x15;
8951 /* toggle speaker-output according to the hp-jack state */
8952 #define alc883_targa_init_hook alc882_targa_init_hook
8953 #define alc883_targa_unsol_event alc882_targa_unsol_event
8955 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8957 unsigned int present;
8959 present = snd_hda_jack_detect(codec, 0x18);
8960 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8961 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8964 static void alc883_clevo_m720_setup(struct hda_codec *codec)
8966 struct alc_spec *spec = codec->spec;
8968 spec->autocfg.hp_pins[0] = 0x15;
8969 spec->autocfg.speaker_pins[0] = 0x14;
8972 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
8974 alc_automute_amp(codec);
8975 alc883_clevo_m720_mic_automute(codec);
8978 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8981 switch (res >> 26) {
8982 case ALC880_MIC_EVENT:
8983 alc883_clevo_m720_mic_automute(codec);
8986 alc_automute_amp_unsol_event(codec, res);
8991 /* toggle speaker-output according to the hp-jack state */
8992 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
8994 struct alc_spec *spec = codec->spec;
8996 spec->autocfg.hp_pins[0] = 0x14;
8997 spec->autocfg.speaker_pins[0] = 0x15;
9000 static void alc883_haier_w66_setup(struct hda_codec *codec)
9002 struct alc_spec *spec = codec->spec;
9004 spec->autocfg.hp_pins[0] = 0x1b;
9005 spec->autocfg.speaker_pins[0] = 0x14;
9008 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
9010 int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0;
9012 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9013 HDA_AMP_MUTE, bits);
9016 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
9018 int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0;
9020 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9021 HDA_AMP_MUTE, bits);
9022 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9023 HDA_AMP_MUTE, bits);
9026 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
9029 if ((res >> 26) == ALC880_HP_EVENT)
9030 alc883_lenovo_101e_all_automute(codec);
9031 if ((res >> 26) == ALC880_FRONT_EVENT)
9032 alc883_lenovo_101e_ispeaker_automute(codec);
9035 /* toggle speaker-output according to the hp-jack state */
9036 static void alc883_acer_aspire_setup(struct hda_codec *codec)
9038 struct alc_spec *spec = codec->spec;
9040 spec->autocfg.hp_pins[0] = 0x14;
9041 spec->autocfg.speaker_pins[0] = 0x15;
9042 spec->autocfg.speaker_pins[1] = 0x16;
9045 static struct hda_verb alc883_acer_eapd_verbs[] = {
9046 /* HP Pin: output 0 (0x0c) */
9047 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9048 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9049 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9050 /* Front Pin: output 0 (0x0c) */
9051 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9052 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9053 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9054 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
9055 /* eanable EAPD on medion laptop */
9056 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9057 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
9058 /* enable unsolicited event */
9059 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9063 static struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
9064 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9065 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
9066 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9070 static void alc888_6st_dell_setup(struct hda_codec *codec)
9072 struct alc_spec *spec = codec->spec;
9074 spec->autocfg.hp_pins[0] = 0x1b;
9075 spec->autocfg.speaker_pins[0] = 0x14;
9076 spec->autocfg.speaker_pins[1] = 0x15;
9077 spec->autocfg.speaker_pins[2] = 0x16;
9078 spec->autocfg.speaker_pins[3] = 0x17;
9081 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
9083 struct alc_spec *spec = codec->spec;
9085 spec->autocfg.hp_pins[0] = 0x1b;
9086 spec->autocfg.speaker_pins[0] = 0x14;
9087 spec->autocfg.speaker_pins[1] = 0x15;
9088 spec->autocfg.speaker_pins[2] = 0x16;
9089 spec->autocfg.speaker_pins[3] = 0x17;
9090 spec->autocfg.speaker_pins[4] = 0x1a;
9093 static void alc883_vaiott_setup(struct hda_codec *codec)
9095 struct alc_spec *spec = codec->spec;
9097 spec->autocfg.hp_pins[0] = 0x15;
9098 spec->autocfg.speaker_pins[0] = 0x14;
9099 spec->autocfg.speaker_pins[1] = 0x17;
9102 static struct hda_verb alc888_asus_m90v_verbs[] = {
9103 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9104 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9105 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9106 /* enable unsolicited event */
9107 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9108 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9112 static void alc883_mode2_setup(struct hda_codec *codec)
9114 struct alc_spec *spec = codec->spec;
9116 spec->autocfg.hp_pins[0] = 0x1b;
9117 spec->autocfg.speaker_pins[0] = 0x14;
9118 spec->autocfg.speaker_pins[1] = 0x15;
9119 spec->autocfg.speaker_pins[2] = 0x16;
9120 spec->ext_mic.pin = 0x18;
9121 spec->int_mic.pin = 0x19;
9122 spec->ext_mic.mux_idx = 0;
9123 spec->int_mic.mux_idx = 1;
9127 static struct hda_verb alc888_asus_eee1601_verbs[] = {
9128 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9129 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9130 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9131 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9132 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9133 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
9134 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
9135 /* enable unsolicited event */
9136 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9140 static void alc883_eee1601_inithook(struct hda_codec *codec)
9142 struct alc_spec *spec = codec->spec;
9144 spec->autocfg.hp_pins[0] = 0x14;
9145 spec->autocfg.speaker_pins[0] = 0x1b;
9146 alc_automute_pin(codec);
9149 static struct hda_verb alc889A_mb31_verbs[] = {
9150 /* Init rear pin (used as headphone output) */
9151 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
9152 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
9153 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9154 /* Init line pin (used as output in 4ch and 6ch mode) */
9155 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
9156 /* Init line 2 pin (used as headphone out by default) */
9157 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
9158 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
9162 /* Mute speakers according to the headphone jack state */
9163 static void alc889A_mb31_automute(struct hda_codec *codec)
9165 unsigned int present;
9167 /* Mute only in 2ch or 4ch mode */
9168 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
9170 present = snd_hda_jack_detect(codec, 0x15);
9171 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9172 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9173 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9174 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9178 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
9180 if ((res >> 26) == ALC880_HP_EVENT)
9181 alc889A_mb31_automute(codec);
9185 #ifdef CONFIG_SND_HDA_POWER_SAVE
9186 #define alc882_loopbacks alc880_loopbacks
9189 /* pcm configuration: identical with ALC880 */
9190 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
9191 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
9192 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
9193 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
9195 static hda_nid_t alc883_slave_dig_outs[] = {
9196 ALC1200_DIGOUT_NID, 0,
9199 static hda_nid_t alc1200_slave_dig_outs[] = {
9200 ALC883_DIGOUT_NID, 0,
9204 * configuration and preset
9206 static const char *alc882_models[ALC882_MODEL_LAST] = {
9207 [ALC882_3ST_DIG] = "3stack-dig",
9208 [ALC882_6ST_DIG] = "6stack-dig",
9209 [ALC882_ARIMA] = "arima",
9210 [ALC882_W2JC] = "w2jc",
9211 [ALC882_TARGA] = "targa",
9212 [ALC882_ASUS_A7J] = "asus-a7j",
9213 [ALC882_ASUS_A7M] = "asus-a7m",
9214 [ALC885_MACPRO] = "macpro",
9215 [ALC885_MB5] = "mb5",
9216 [ALC885_MACMINI3] = "macmini3",
9217 [ALC885_MBA21] = "mba21",
9218 [ALC885_MBP3] = "mbp3",
9219 [ALC885_IMAC24] = "imac24",
9220 [ALC885_IMAC91] = "imac91",
9221 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
9222 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
9223 [ALC883_3ST_6ch] = "3stack-6ch",
9224 [ALC883_6ST_DIG] = "alc883-6stack-dig",
9225 [ALC883_TARGA_DIG] = "targa-dig",
9226 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
9227 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
9228 [ALC883_ACER] = "acer",
9229 [ALC883_ACER_ASPIRE] = "acer-aspire",
9230 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
9231 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
9232 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
9233 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
9234 [ALC883_MEDION] = "medion",
9235 [ALC883_MEDION_MD2] = "medion-md2",
9236 [ALC883_MEDION_WIM2160] = "medion-wim2160",
9237 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
9238 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
9239 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
9240 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
9241 [ALC888_LENOVO_SKY] = "lenovo-sky",
9242 [ALC883_HAIER_W66] = "haier-w66",
9243 [ALC888_3ST_HP] = "3stack-hp",
9244 [ALC888_6ST_DELL] = "6stack-dell",
9245 [ALC883_MITAC] = "mitac",
9246 [ALC883_CLEVO_M540R] = "clevo-m540r",
9247 [ALC883_CLEVO_M720] = "clevo-m720",
9248 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
9249 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
9250 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
9251 [ALC889A_INTEL] = "intel-alc889a",
9252 [ALC889_INTEL] = "intel-x58",
9253 [ALC1200_ASUS_P5Q] = "asus-p5q",
9254 [ALC889A_MB31] = "mb31",
9255 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
9256 [ALC882_AUTO] = "auto",
9259 static struct snd_pci_quirk alc882_cfg_tbl[] = {
9260 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
9262 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
9263 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
9264 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
9265 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
9266 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
9267 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
9268 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
9269 ALC888_ACER_ASPIRE_4930G),
9270 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
9271 ALC888_ACER_ASPIRE_4930G),
9272 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
9273 ALC888_ACER_ASPIRE_8930G),
9274 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
9275 ALC888_ACER_ASPIRE_8930G),
9276 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
9277 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
9278 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
9279 ALC888_ACER_ASPIRE_6530G),
9280 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
9281 ALC888_ACER_ASPIRE_6530G),
9282 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
9283 ALC888_ACER_ASPIRE_7730G),
9284 /* default Acer -- disabled as it causes more problems.
9285 * model=auto should work fine now
9287 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
9289 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
9291 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
9292 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
9293 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
9294 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
9295 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
9296 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
9298 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
9299 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
9300 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
9301 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
9302 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
9303 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
9304 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
9305 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
9306 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
9307 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
9308 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
9310 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
9311 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
9312 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
9313 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
9314 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
9315 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
9316 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
9317 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
9318 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
9320 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
9321 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
9322 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
9323 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
9324 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
9325 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
9326 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
9327 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
9328 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
9329 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
9330 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
9331 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
9332 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
9333 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
9334 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
9335 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
9336 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
9337 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
9338 SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG),
9339 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
9340 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
9341 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
9342 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
9343 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
9344 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
9345 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
9346 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
9347 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
9348 SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG),
9349 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
9350 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
9352 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
9353 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
9354 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
9355 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
9356 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
9357 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
9358 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
9359 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
9360 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9361 ALC883_FUJITSU_PI2515),
9362 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9363 ALC888_FUJITSU_XA3530),
9364 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
9365 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9366 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9367 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9368 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
9369 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
9370 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
9371 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
9372 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
9374 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
9375 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
9376 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
9377 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
9378 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
9379 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
9380 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG),
9385 /* codec SSID table for Intel Mac */
9386 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
9387 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
9388 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
9389 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
9390 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
9391 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
9392 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
9393 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
9394 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
9395 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
9396 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
9397 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
9398 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
9399 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
9400 * so apparently no perfect solution yet
9402 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
9403 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
9404 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3),
9408 static struct alc_config_preset alc882_presets[] = {
9409 [ALC882_3ST_DIG] = {
9410 .mixers = { alc882_base_mixer },
9411 .init_verbs = { alc882_base_init_verbs,
9412 alc882_adc1_init_verbs },
9413 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9414 .dac_nids = alc882_dac_nids,
9415 .dig_out_nid = ALC882_DIGOUT_NID,
9416 .dig_in_nid = ALC882_DIGIN_NID,
9417 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9418 .channel_mode = alc882_ch_modes,
9420 .input_mux = &alc882_capture_source,
9422 [ALC882_6ST_DIG] = {
9423 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9424 .init_verbs = { alc882_base_init_verbs,
9425 alc882_adc1_init_verbs },
9426 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9427 .dac_nids = alc882_dac_nids,
9428 .dig_out_nid = ALC882_DIGOUT_NID,
9429 .dig_in_nid = ALC882_DIGIN_NID,
9430 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9431 .channel_mode = alc882_sixstack_modes,
9432 .input_mux = &alc882_capture_source,
9435 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9436 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9437 alc882_eapd_verbs },
9438 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9439 .dac_nids = alc882_dac_nids,
9440 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9441 .channel_mode = alc882_sixstack_modes,
9442 .input_mux = &alc882_capture_source,
9445 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
9446 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9447 alc882_eapd_verbs, alc880_gpio1_init_verbs },
9448 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9449 .dac_nids = alc882_dac_nids,
9450 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9451 .channel_mode = alc880_threestack_modes,
9453 .input_mux = &alc882_capture_source,
9454 .dig_out_nid = ALC882_DIGOUT_NID,
9457 .mixers = { alc885_mba21_mixer },
9458 .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs },
9460 .dac_nids = alc882_dac_nids,
9461 .channel_mode = alc885_mba21_ch_modes,
9462 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
9463 .input_mux = &alc882_capture_source,
9464 .unsol_event = alc_automute_amp_unsol_event,
9465 .setup = alc885_mba21_setup,
9466 .init_hook = alc_automute_amp,
9469 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
9470 .init_verbs = { alc885_mbp3_init_verbs,
9471 alc880_gpio1_init_verbs },
9473 .dac_nids = alc882_dac_nids,
9475 .channel_mode = alc885_mbp_4ch_modes,
9476 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9477 .input_mux = &alc882_capture_source,
9478 .dig_out_nid = ALC882_DIGOUT_NID,
9479 .dig_in_nid = ALC882_DIGIN_NID,
9480 .unsol_event = alc_automute_amp_unsol_event,
9481 .setup = alc885_mbp3_setup,
9482 .init_hook = alc_automute_amp,
9485 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
9486 .init_verbs = { alc885_mb5_init_verbs,
9487 alc880_gpio1_init_verbs },
9488 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9489 .dac_nids = alc882_dac_nids,
9490 .channel_mode = alc885_mb5_6ch_modes,
9491 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
9492 .input_mux = &mb5_capture_source,
9493 .dig_out_nid = ALC882_DIGOUT_NID,
9494 .dig_in_nid = ALC882_DIGIN_NID,
9495 .unsol_event = alc_automute_amp_unsol_event,
9496 .setup = alc885_mb5_setup,
9497 .init_hook = alc_automute_amp,
9499 [ALC885_MACMINI3] = {
9500 .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer },
9501 .init_verbs = { alc885_macmini3_init_verbs,
9502 alc880_gpio1_init_verbs },
9503 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9504 .dac_nids = alc882_dac_nids,
9505 .channel_mode = alc885_macmini3_6ch_modes,
9506 .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes),
9507 .input_mux = &macmini3_capture_source,
9508 .dig_out_nid = ALC882_DIGOUT_NID,
9509 .dig_in_nid = ALC882_DIGIN_NID,
9510 .unsol_event = alc_automute_amp_unsol_event,
9511 .setup = alc885_macmini3_setup,
9512 .init_hook = alc_automute_amp,
9515 .mixers = { alc882_macpro_mixer },
9516 .init_verbs = { alc882_macpro_init_verbs },
9517 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9518 .dac_nids = alc882_dac_nids,
9519 .dig_out_nid = ALC882_DIGOUT_NID,
9520 .dig_in_nid = ALC882_DIGIN_NID,
9521 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9522 .channel_mode = alc882_ch_modes,
9523 .input_mux = &alc882_capture_source,
9524 .init_hook = alc885_macpro_init_hook,
9527 .mixers = { alc885_imac24_mixer },
9528 .init_verbs = { alc885_imac24_init_verbs },
9529 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9530 .dac_nids = alc882_dac_nids,
9531 .dig_out_nid = ALC882_DIGOUT_NID,
9532 .dig_in_nid = ALC882_DIGIN_NID,
9533 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9534 .channel_mode = alc882_ch_modes,
9535 .input_mux = &alc882_capture_source,
9536 .unsol_event = alc_automute_amp_unsol_event,
9537 .setup = alc885_imac24_setup,
9538 .init_hook = alc885_imac24_init_hook,
9541 .mixers = { alc885_imac91_mixer, alc882_chmode_mixer },
9542 .init_verbs = { alc885_imac91_init_verbs,
9543 alc880_gpio1_init_verbs },
9544 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9545 .dac_nids = alc882_dac_nids,
9546 .channel_mode = alc885_mbp_4ch_modes,
9547 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9548 .input_mux = &alc882_capture_source,
9549 .dig_out_nid = ALC882_DIGOUT_NID,
9550 .dig_in_nid = ALC882_DIGIN_NID,
9551 .unsol_event = alc_automute_amp_unsol_event,
9552 .setup = alc885_imac91_setup,
9553 .init_hook = alc_automute_amp,
9556 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
9557 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9558 alc880_gpio3_init_verbs, alc882_targa_verbs},
9559 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9560 .dac_nids = alc882_dac_nids,
9561 .dig_out_nid = ALC882_DIGOUT_NID,
9562 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9563 .adc_nids = alc882_adc_nids,
9564 .capsrc_nids = alc882_capsrc_nids,
9565 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9566 .channel_mode = alc882_3ST_6ch_modes,
9568 .input_mux = &alc882_capture_source,
9569 .unsol_event = alc882_targa_unsol_event,
9570 .setup = alc882_targa_setup,
9571 .init_hook = alc882_targa_automute,
9573 [ALC882_ASUS_A7J] = {
9574 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
9575 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9576 alc882_asus_a7j_verbs},
9577 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9578 .dac_nids = alc882_dac_nids,
9579 .dig_out_nid = ALC882_DIGOUT_NID,
9580 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9581 .adc_nids = alc882_adc_nids,
9582 .capsrc_nids = alc882_capsrc_nids,
9583 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9584 .channel_mode = alc882_3ST_6ch_modes,
9586 .input_mux = &alc882_capture_source,
9588 [ALC882_ASUS_A7M] = {
9589 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
9590 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9591 alc882_eapd_verbs, alc880_gpio1_init_verbs,
9592 alc882_asus_a7m_verbs },
9593 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9594 .dac_nids = alc882_dac_nids,
9595 .dig_out_nid = ALC882_DIGOUT_NID,
9596 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9597 .channel_mode = alc880_threestack_modes,
9599 .input_mux = &alc882_capture_source,
9601 [ALC883_3ST_2ch_DIG] = {
9602 .mixers = { alc883_3ST_2ch_mixer },
9603 .init_verbs = { alc883_init_verbs },
9604 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9605 .dac_nids = alc883_dac_nids,
9606 .dig_out_nid = ALC883_DIGOUT_NID,
9607 .dig_in_nid = ALC883_DIGIN_NID,
9608 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9609 .channel_mode = alc883_3ST_2ch_modes,
9610 .input_mux = &alc883_capture_source,
9612 [ALC883_3ST_6ch_DIG] = {
9613 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9614 .init_verbs = { alc883_init_verbs },
9615 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9616 .dac_nids = alc883_dac_nids,
9617 .dig_out_nid = ALC883_DIGOUT_NID,
9618 .dig_in_nid = ALC883_DIGIN_NID,
9619 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9620 .channel_mode = alc883_3ST_6ch_modes,
9622 .input_mux = &alc883_capture_source,
9624 [ALC883_3ST_6ch] = {
9625 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9626 .init_verbs = { alc883_init_verbs },
9627 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9628 .dac_nids = alc883_dac_nids,
9629 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9630 .channel_mode = alc883_3ST_6ch_modes,
9632 .input_mux = &alc883_capture_source,
9634 [ALC883_3ST_6ch_INTEL] = {
9635 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
9636 .init_verbs = { alc883_init_verbs },
9637 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9638 .dac_nids = alc883_dac_nids,
9639 .dig_out_nid = ALC883_DIGOUT_NID,
9640 .dig_in_nid = ALC883_DIGIN_NID,
9641 .slave_dig_outs = alc883_slave_dig_outs,
9642 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
9643 .channel_mode = alc883_3ST_6ch_intel_modes,
9645 .input_mux = &alc883_3stack_6ch_intel,
9648 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9649 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
9650 alc_hp15_unsol_verbs },
9651 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9652 .dac_nids = alc883_dac_nids,
9653 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9654 .adc_nids = alc889_adc_nids,
9655 .dig_out_nid = ALC883_DIGOUT_NID,
9656 .dig_in_nid = ALC883_DIGIN_NID,
9657 .slave_dig_outs = alc883_slave_dig_outs,
9658 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9659 .channel_mode = alc889_8ch_intel_modes,
9660 .capsrc_nids = alc889_capsrc_nids,
9661 .input_mux = &alc889_capture_source,
9662 .setup = alc889_automute_setup,
9663 .init_hook = alc_automute_amp,
9664 .unsol_event = alc_automute_amp_unsol_event,
9668 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9669 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
9670 alc889_eapd_verbs, alc_hp15_unsol_verbs},
9671 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9672 .dac_nids = alc883_dac_nids,
9673 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9674 .adc_nids = alc889_adc_nids,
9675 .dig_out_nid = ALC883_DIGOUT_NID,
9676 .dig_in_nid = ALC883_DIGIN_NID,
9677 .slave_dig_outs = alc883_slave_dig_outs,
9678 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9679 .channel_mode = alc889_8ch_intel_modes,
9680 .capsrc_nids = alc889_capsrc_nids,
9681 .input_mux = &alc889_capture_source,
9682 .setup = alc889_automute_setup,
9683 .init_hook = alc889_intel_init_hook,
9684 .unsol_event = alc_automute_amp_unsol_event,
9687 [ALC883_6ST_DIG] = {
9688 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9689 .init_verbs = { alc883_init_verbs },
9690 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9691 .dac_nids = alc883_dac_nids,
9692 .dig_out_nid = ALC883_DIGOUT_NID,
9693 .dig_in_nid = ALC883_DIGIN_NID,
9694 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9695 .channel_mode = alc883_sixstack_modes,
9696 .input_mux = &alc883_capture_source,
9698 [ALC883_TARGA_DIG] = {
9699 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
9700 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9701 alc883_targa_verbs},
9702 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9703 .dac_nids = alc883_dac_nids,
9704 .dig_out_nid = ALC883_DIGOUT_NID,
9705 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9706 .channel_mode = alc883_3ST_6ch_modes,
9708 .input_mux = &alc883_capture_source,
9709 .unsol_event = alc883_targa_unsol_event,
9710 .setup = alc882_targa_setup,
9711 .init_hook = alc882_targa_automute,
9713 [ALC883_TARGA_2ch_DIG] = {
9714 .mixers = { alc883_targa_2ch_mixer},
9715 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9716 alc883_targa_verbs},
9717 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9718 .dac_nids = alc883_dac_nids,
9719 .adc_nids = alc883_adc_nids_alt,
9720 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9721 .capsrc_nids = alc883_capsrc_nids,
9722 .dig_out_nid = ALC883_DIGOUT_NID,
9723 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9724 .channel_mode = alc883_3ST_2ch_modes,
9725 .input_mux = &alc883_capture_source,
9726 .unsol_event = alc883_targa_unsol_event,
9727 .setup = alc882_targa_setup,
9728 .init_hook = alc882_targa_automute,
9730 [ALC883_TARGA_8ch_DIG] = {
9731 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
9732 alc883_chmode_mixer },
9733 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9734 alc883_targa_verbs },
9735 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9736 .dac_nids = alc883_dac_nids,
9737 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9738 .adc_nids = alc883_adc_nids_rev,
9739 .capsrc_nids = alc883_capsrc_nids_rev,
9740 .dig_out_nid = ALC883_DIGOUT_NID,
9741 .dig_in_nid = ALC883_DIGIN_NID,
9742 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
9743 .channel_mode = alc883_4ST_8ch_modes,
9745 .input_mux = &alc883_capture_source,
9746 .unsol_event = alc883_targa_unsol_event,
9747 .setup = alc882_targa_setup,
9748 .init_hook = alc882_targa_automute,
9751 .mixers = { alc883_base_mixer },
9752 /* On TravelMate laptops, GPIO 0 enables the internal speaker
9753 * and the headphone jack. Turn this on and rely on the
9754 * standard mute methods whenever the user wants to turn
9755 * these outputs off.
9757 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
9758 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9759 .dac_nids = alc883_dac_nids,
9760 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9761 .channel_mode = alc883_3ST_2ch_modes,
9762 .input_mux = &alc883_capture_source,
9764 [ALC883_ACER_ASPIRE] = {
9765 .mixers = { alc883_acer_aspire_mixer },
9766 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
9767 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9768 .dac_nids = alc883_dac_nids,
9769 .dig_out_nid = ALC883_DIGOUT_NID,
9770 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9771 .channel_mode = alc883_3ST_2ch_modes,
9772 .input_mux = &alc883_capture_source,
9773 .unsol_event = alc_automute_amp_unsol_event,
9774 .setup = alc883_acer_aspire_setup,
9775 .init_hook = alc_automute_amp,
9777 [ALC888_ACER_ASPIRE_4930G] = {
9778 .mixers = { alc888_base_mixer,
9779 alc883_chmode_mixer },
9780 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9781 alc888_acer_aspire_4930g_verbs },
9782 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9783 .dac_nids = alc883_dac_nids,
9784 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9785 .adc_nids = alc883_adc_nids_rev,
9786 .capsrc_nids = alc883_capsrc_nids_rev,
9787 .dig_out_nid = ALC883_DIGOUT_NID,
9788 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9789 .channel_mode = alc883_3ST_6ch_modes,
9791 .const_channel_count = 6,
9793 ARRAY_SIZE(alc888_2_capture_sources),
9794 .input_mux = alc888_2_capture_sources,
9795 .unsol_event = alc_automute_amp_unsol_event,
9796 .setup = alc888_acer_aspire_4930g_setup,
9797 .init_hook = alc_automute_amp,
9799 [ALC888_ACER_ASPIRE_6530G] = {
9800 .mixers = { alc888_acer_aspire_6530_mixer },
9801 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9802 alc888_acer_aspire_6530g_verbs },
9803 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9804 .dac_nids = alc883_dac_nids,
9805 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9806 .adc_nids = alc883_adc_nids_rev,
9807 .capsrc_nids = alc883_capsrc_nids_rev,
9808 .dig_out_nid = ALC883_DIGOUT_NID,
9809 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9810 .channel_mode = alc883_3ST_2ch_modes,
9812 ARRAY_SIZE(alc888_2_capture_sources),
9813 .input_mux = alc888_acer_aspire_6530_sources,
9814 .unsol_event = alc_automute_amp_unsol_event,
9815 .setup = alc888_acer_aspire_6530g_setup,
9816 .init_hook = alc_automute_amp,
9818 [ALC888_ACER_ASPIRE_8930G] = {
9819 .mixers = { alc889_acer_aspire_8930g_mixer,
9820 alc883_chmode_mixer },
9821 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9822 alc889_acer_aspire_8930g_verbs,
9824 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9825 .dac_nids = alc883_dac_nids,
9826 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9827 .adc_nids = alc889_adc_nids,
9828 .capsrc_nids = alc889_capsrc_nids,
9829 .dig_out_nid = ALC883_DIGOUT_NID,
9830 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9831 .channel_mode = alc883_3ST_6ch_modes,
9833 .const_channel_count = 6,
9835 ARRAY_SIZE(alc889_capture_sources),
9836 .input_mux = alc889_capture_sources,
9837 .unsol_event = alc_automute_amp_unsol_event,
9838 .setup = alc889_acer_aspire_8930g_setup,
9839 .init_hook = alc_automute_amp,
9840 #ifdef CONFIG_SND_HDA_POWER_SAVE
9841 .power_hook = alc_power_eapd,
9844 [ALC888_ACER_ASPIRE_7730G] = {
9845 .mixers = { alc883_3ST_6ch_mixer,
9846 alc883_chmode_mixer },
9847 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9848 alc888_acer_aspire_7730G_verbs },
9849 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9850 .dac_nids = alc883_dac_nids,
9851 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9852 .adc_nids = alc883_adc_nids_rev,
9853 .capsrc_nids = alc883_capsrc_nids_rev,
9854 .dig_out_nid = ALC883_DIGOUT_NID,
9855 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9856 .channel_mode = alc883_3ST_6ch_modes,
9858 .const_channel_count = 6,
9859 .input_mux = &alc883_capture_source,
9860 .unsol_event = alc_automute_amp_unsol_event,
9861 .setup = alc888_acer_aspire_6530g_setup,
9862 .init_hook = alc_automute_amp,
9865 .mixers = { alc883_fivestack_mixer,
9866 alc883_chmode_mixer },
9867 .init_verbs = { alc883_init_verbs,
9868 alc883_medion_eapd_verbs },
9869 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9870 .dac_nids = alc883_dac_nids,
9871 .adc_nids = alc883_adc_nids_alt,
9872 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9873 .capsrc_nids = alc883_capsrc_nids,
9874 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9875 .channel_mode = alc883_sixstack_modes,
9876 .input_mux = &alc883_capture_source,
9878 [ALC883_MEDION_MD2] = {
9879 .mixers = { alc883_medion_md2_mixer},
9880 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
9881 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9882 .dac_nids = alc883_dac_nids,
9883 .dig_out_nid = ALC883_DIGOUT_NID,
9884 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9885 .channel_mode = alc883_3ST_2ch_modes,
9886 .input_mux = &alc883_capture_source,
9887 .unsol_event = alc_automute_amp_unsol_event,
9888 .setup = alc883_medion_md2_setup,
9889 .init_hook = alc_automute_amp,
9891 [ALC883_MEDION_WIM2160] = {
9892 .mixers = { alc883_medion_wim2160_mixer },
9893 .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs },
9894 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9895 .dac_nids = alc883_dac_nids,
9896 .dig_out_nid = ALC883_DIGOUT_NID,
9897 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
9898 .adc_nids = alc883_adc_nids,
9899 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9900 .channel_mode = alc883_3ST_2ch_modes,
9901 .input_mux = &alc883_capture_source,
9902 .unsol_event = alc_automute_amp_unsol_event,
9903 .setup = alc883_medion_wim2160_setup,
9904 .init_hook = alc_automute_amp,
9906 [ALC883_LAPTOP_EAPD] = {
9907 .mixers = { alc883_base_mixer },
9908 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
9909 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9910 .dac_nids = alc883_dac_nids,
9911 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9912 .channel_mode = alc883_3ST_2ch_modes,
9913 .input_mux = &alc883_capture_source,
9915 [ALC883_CLEVO_M540R] = {
9916 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9917 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
9918 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9919 .dac_nids = alc883_dac_nids,
9920 .dig_out_nid = ALC883_DIGOUT_NID,
9921 .dig_in_nid = ALC883_DIGIN_NID,
9922 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
9923 .channel_mode = alc883_3ST_6ch_clevo_modes,
9925 .input_mux = &alc883_capture_source,
9926 /* This machine has the hardware HP auto-muting, thus
9927 * we need no software mute via unsol event
9930 [ALC883_CLEVO_M720] = {
9931 .mixers = { alc883_clevo_m720_mixer },
9932 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
9933 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9934 .dac_nids = alc883_dac_nids,
9935 .dig_out_nid = ALC883_DIGOUT_NID,
9936 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9937 .channel_mode = alc883_3ST_2ch_modes,
9938 .input_mux = &alc883_capture_source,
9939 .unsol_event = alc883_clevo_m720_unsol_event,
9940 .setup = alc883_clevo_m720_setup,
9941 .init_hook = alc883_clevo_m720_init_hook,
9943 [ALC883_LENOVO_101E_2ch] = {
9944 .mixers = { alc883_lenovo_101e_2ch_mixer},
9945 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
9946 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9947 .dac_nids = alc883_dac_nids,
9948 .adc_nids = alc883_adc_nids_alt,
9949 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9950 .capsrc_nids = alc883_capsrc_nids,
9951 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9952 .channel_mode = alc883_3ST_2ch_modes,
9953 .input_mux = &alc883_lenovo_101e_capture_source,
9954 .unsol_event = alc883_lenovo_101e_unsol_event,
9955 .init_hook = alc883_lenovo_101e_all_automute,
9957 [ALC883_LENOVO_NB0763] = {
9958 .mixers = { alc883_lenovo_nb0763_mixer },
9959 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
9960 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9961 .dac_nids = alc883_dac_nids,
9962 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9963 .channel_mode = alc883_3ST_2ch_modes,
9965 .input_mux = &alc883_lenovo_nb0763_capture_source,
9966 .unsol_event = alc_automute_amp_unsol_event,
9967 .setup = alc883_medion_md2_setup,
9968 .init_hook = alc_automute_amp,
9970 [ALC888_LENOVO_MS7195_DIG] = {
9971 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9972 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
9973 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9974 .dac_nids = alc883_dac_nids,
9975 .dig_out_nid = ALC883_DIGOUT_NID,
9976 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9977 .channel_mode = alc883_3ST_6ch_modes,
9979 .input_mux = &alc883_capture_source,
9980 .unsol_event = alc883_lenovo_ms7195_unsol_event,
9981 .init_hook = alc888_lenovo_ms7195_front_automute,
9983 [ALC883_HAIER_W66] = {
9984 .mixers = { alc883_targa_2ch_mixer},
9985 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
9986 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9987 .dac_nids = alc883_dac_nids,
9988 .dig_out_nid = ALC883_DIGOUT_NID,
9989 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9990 .channel_mode = alc883_3ST_2ch_modes,
9991 .input_mux = &alc883_capture_source,
9992 .unsol_event = alc_automute_amp_unsol_event,
9993 .setup = alc883_haier_w66_setup,
9994 .init_hook = alc_automute_amp,
9997 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9998 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
9999 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10000 .dac_nids = alc883_dac_nids,
10001 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
10002 .channel_mode = alc888_3st_hp_modes,
10004 .input_mux = &alc883_capture_source,
10005 .unsol_event = alc_automute_amp_unsol_event,
10006 .setup = alc888_3st_hp_setup,
10007 .init_hook = alc_automute_amp,
10009 [ALC888_6ST_DELL] = {
10010 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10011 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
10012 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10013 .dac_nids = alc883_dac_nids,
10014 .dig_out_nid = ALC883_DIGOUT_NID,
10015 .dig_in_nid = ALC883_DIGIN_NID,
10016 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10017 .channel_mode = alc883_sixstack_modes,
10018 .input_mux = &alc883_capture_source,
10019 .unsol_event = alc_automute_amp_unsol_event,
10020 .setup = alc888_6st_dell_setup,
10021 .init_hook = alc_automute_amp,
10024 .mixers = { alc883_mitac_mixer },
10025 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
10026 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10027 .dac_nids = alc883_dac_nids,
10028 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10029 .channel_mode = alc883_3ST_2ch_modes,
10030 .input_mux = &alc883_capture_source,
10031 .unsol_event = alc_automute_amp_unsol_event,
10032 .setup = alc883_mitac_setup,
10033 .init_hook = alc_automute_amp,
10035 [ALC883_FUJITSU_PI2515] = {
10036 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
10037 .init_verbs = { alc883_init_verbs,
10038 alc883_2ch_fujitsu_pi2515_verbs},
10039 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10040 .dac_nids = alc883_dac_nids,
10041 .dig_out_nid = ALC883_DIGOUT_NID,
10042 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10043 .channel_mode = alc883_3ST_2ch_modes,
10044 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10045 .unsol_event = alc_automute_amp_unsol_event,
10046 .setup = alc883_2ch_fujitsu_pi2515_setup,
10047 .init_hook = alc_automute_amp,
10049 [ALC888_FUJITSU_XA3530] = {
10050 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
10051 .init_verbs = { alc883_init_verbs,
10052 alc888_fujitsu_xa3530_verbs },
10053 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10054 .dac_nids = alc883_dac_nids,
10055 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10056 .adc_nids = alc883_adc_nids_rev,
10057 .capsrc_nids = alc883_capsrc_nids_rev,
10058 .dig_out_nid = ALC883_DIGOUT_NID,
10059 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
10060 .channel_mode = alc888_4ST_8ch_intel_modes,
10062 ARRAY_SIZE(alc888_2_capture_sources),
10063 .input_mux = alc888_2_capture_sources,
10064 .unsol_event = alc_automute_amp_unsol_event,
10065 .setup = alc888_fujitsu_xa3530_setup,
10066 .init_hook = alc_automute_amp,
10068 [ALC888_LENOVO_SKY] = {
10069 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
10070 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
10071 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10072 .dac_nids = alc883_dac_nids,
10073 .dig_out_nid = ALC883_DIGOUT_NID,
10074 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10075 .channel_mode = alc883_sixstack_modes,
10077 .input_mux = &alc883_lenovo_sky_capture_source,
10078 .unsol_event = alc_automute_amp_unsol_event,
10079 .setup = alc888_lenovo_sky_setup,
10080 .init_hook = alc_automute_amp,
10082 [ALC888_ASUS_M90V] = {
10083 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10084 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
10085 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10086 .dac_nids = alc883_dac_nids,
10087 .dig_out_nid = ALC883_DIGOUT_NID,
10088 .dig_in_nid = ALC883_DIGIN_NID,
10089 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10090 .channel_mode = alc883_3ST_6ch_modes,
10092 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10093 .unsol_event = alc_sku_unsol_event,
10094 .setup = alc883_mode2_setup,
10095 .init_hook = alc_inithook,
10097 [ALC888_ASUS_EEE1601] = {
10098 .mixers = { alc883_asus_eee1601_mixer },
10099 .cap_mixer = alc883_asus_eee1601_cap_mixer,
10100 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
10101 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10102 .dac_nids = alc883_dac_nids,
10103 .dig_out_nid = ALC883_DIGOUT_NID,
10104 .dig_in_nid = ALC883_DIGIN_NID,
10105 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10106 .channel_mode = alc883_3ST_2ch_modes,
10108 .input_mux = &alc883_asus_eee1601_capture_source,
10109 .unsol_event = alc_sku_unsol_event,
10110 .init_hook = alc883_eee1601_inithook,
10112 [ALC1200_ASUS_P5Q] = {
10113 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10114 .init_verbs = { alc883_init_verbs },
10115 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10116 .dac_nids = alc883_dac_nids,
10117 .dig_out_nid = ALC1200_DIGOUT_NID,
10118 .dig_in_nid = ALC883_DIGIN_NID,
10119 .slave_dig_outs = alc1200_slave_dig_outs,
10120 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10121 .channel_mode = alc883_sixstack_modes,
10122 .input_mux = &alc883_capture_source,
10125 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
10126 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
10127 alc880_gpio1_init_verbs },
10128 .adc_nids = alc883_adc_nids,
10129 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10130 .capsrc_nids = alc883_capsrc_nids,
10131 .dac_nids = alc883_dac_nids,
10132 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10133 .channel_mode = alc889A_mb31_6ch_modes,
10134 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
10135 .input_mux = &alc889A_mb31_capture_source,
10136 .dig_out_nid = ALC883_DIGOUT_NID,
10137 .unsol_event = alc889A_mb31_unsol_event,
10138 .init_hook = alc889A_mb31_automute,
10140 [ALC883_SONY_VAIO_TT] = {
10141 .mixers = { alc883_vaiott_mixer },
10142 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
10143 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10144 .dac_nids = alc883_dac_nids,
10145 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10146 .channel_mode = alc883_3ST_2ch_modes,
10147 .input_mux = &alc883_capture_source,
10148 .unsol_event = alc_automute_amp_unsol_event,
10149 .setup = alc883_vaiott_setup,
10150 .init_hook = alc_automute_amp,
10159 PINFIX_ABIT_AW9D_MAX
10162 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
10163 { 0x15, 0x01080104 }, /* side */
10164 { 0x16, 0x01011012 }, /* rear */
10165 { 0x17, 0x01016011 }, /* clfe */
10169 static const struct alc_fixup alc882_fixups[] = {
10170 [PINFIX_ABIT_AW9D_MAX] = {
10171 .pins = alc882_abit_aw9d_pinfix
10175 static struct snd_pci_quirk alc882_fixup_tbl[] = {
10176 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
10181 * BIOS auto configuration
10183 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
10184 const struct auto_pin_cfg *cfg)
10186 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
10189 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
10190 hda_nid_t nid, int pin_type,
10193 /* set as output */
10194 struct alc_spec *spec = codec->spec;
10197 alc_set_pin_output(codec, nid, pin_type);
10198 if (dac_idx >= spec->multiout.num_dacs)
10200 if (spec->multiout.dac_nids[dac_idx] == 0x25)
10203 idx = spec->multiout.dac_nids[dac_idx] - 2;
10204 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
10208 static void alc882_auto_init_multi_out(struct hda_codec *codec)
10210 struct alc_spec *spec = codec->spec;
10213 for (i = 0; i <= HDA_SIDE; i++) {
10214 hda_nid_t nid = spec->autocfg.line_out_pins[i];
10215 int pin_type = get_pin_type(spec->autocfg.line_out_type);
10217 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
10222 static void alc882_auto_init_hp_out(struct hda_codec *codec)
10224 struct alc_spec *spec = codec->spec;
10227 pin = spec->autocfg.hp_pins[0];
10228 if (pin) /* connect to front */
10230 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
10231 pin = spec->autocfg.speaker_pins[0];
10233 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
10236 static void alc882_auto_init_analog_input(struct hda_codec *codec)
10238 struct alc_spec *spec = codec->spec;
10241 for (i = 0; i < AUTO_PIN_LAST; i++) {
10242 hda_nid_t nid = spec->autocfg.input_pins[i];
10245 alc_set_input_pin(codec, nid, i);
10246 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
10247 snd_hda_codec_write(codec, nid, 0,
10248 AC_VERB_SET_AMP_GAIN_MUTE,
10253 static void alc882_auto_init_input_src(struct hda_codec *codec)
10255 struct alc_spec *spec = codec->spec;
10258 for (c = 0; c < spec->num_adc_nids; c++) {
10259 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
10260 hda_nid_t nid = spec->capsrc_nids[c];
10261 unsigned int mux_idx;
10262 const struct hda_input_mux *imux;
10263 int conns, mute, idx, item;
10265 conns = snd_hda_get_connections(codec, nid, conn_list,
10266 ARRAY_SIZE(conn_list));
10269 mux_idx = c >= spec->num_mux_defs ? 0 : c;
10270 imux = &spec->input_mux[mux_idx];
10271 if (!imux->num_items && mux_idx > 0)
10272 imux = &spec->input_mux[0];
10273 for (idx = 0; idx < conns; idx++) {
10274 /* if the current connection is the selected one,
10275 * unmute it as default - otherwise mute it
10277 mute = AMP_IN_MUTE(idx);
10278 for (item = 0; item < imux->num_items; item++) {
10279 if (imux->items[item].index == idx) {
10280 if (spec->cur_mux[c] == item)
10281 mute = AMP_IN_UNMUTE(idx);
10285 /* check if we have a selector or mixer
10286 * we could check for the widget type instead, but
10287 * just check for Amp-In presence (in case of mixer
10288 * without amp-in there is something wrong, this
10289 * function shouldn't be used or capsrc nid is wrong)
10291 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
10292 snd_hda_codec_write(codec, nid, 0,
10293 AC_VERB_SET_AMP_GAIN_MUTE,
10295 else if (mute != AMP_IN_MUTE(idx))
10296 snd_hda_codec_write(codec, nid, 0,
10297 AC_VERB_SET_CONNECT_SEL,
10303 /* add mic boosts if needed */
10304 static int alc_auto_add_mic_boost(struct hda_codec *codec)
10306 struct alc_spec *spec = codec->spec;
10310 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
10311 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
10312 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10314 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10318 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
10319 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
10320 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10322 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10329 /* almost identical with ALC880 parser... */
10330 static int alc882_parse_auto_config(struct hda_codec *codec)
10332 struct alc_spec *spec = codec->spec;
10333 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
10336 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10340 if (!spec->autocfg.line_outs)
10341 return 0; /* can't find valid BIOS pin config */
10343 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
10346 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
10349 err = alc880_auto_create_extra_out(spec,
10350 spec->autocfg.speaker_pins[0],
10354 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
10358 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
10362 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10364 /* check multiple SPDIF-out (for recent codecs) */
10365 for (i = 0; i < spec->autocfg.dig_outs; i++) {
10367 err = snd_hda_get_connections(codec,
10368 spec->autocfg.dig_out_pins[i],
10373 spec->multiout.dig_out_nid = dig_nid;
10375 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
10376 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
10378 spec->slave_dig_outs[i - 1] = dig_nid;
10381 if (spec->autocfg.dig_in_pin)
10382 spec->dig_in_nid = ALC880_DIGIN_NID;
10384 if (spec->kctls.list)
10385 add_mixer(spec, spec->kctls.list);
10387 add_verb(spec, alc883_auto_init_verbs);
10388 /* if ADC 0x07 is available, initialize it, too */
10389 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
10390 add_verb(spec, alc882_adc1_init_verbs);
10392 spec->num_mux_defs = 1;
10393 spec->input_mux = &spec->private_imux[0];
10395 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
10397 err = alc_auto_add_mic_boost(codec);
10401 return 1; /* config found */
10404 /* additional initialization for auto-configuration model */
10405 static void alc882_auto_init(struct hda_codec *codec)
10407 struct alc_spec *spec = codec->spec;
10408 alc882_auto_init_multi_out(codec);
10409 alc882_auto_init_hp_out(codec);
10410 alc882_auto_init_analog_input(codec);
10411 alc882_auto_init_input_src(codec);
10412 if (spec->unsol_event)
10413 alc_inithook(codec);
10416 static int patch_alc882(struct hda_codec *codec)
10418 struct alc_spec *spec;
10419 int err, board_config;
10421 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10425 codec->spec = spec;
10427 switch (codec->vendor_id) {
10432 /* ALC883 and variants */
10433 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10437 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
10441 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
10442 board_config = snd_hda_check_board_codec_sid_config(codec,
10443 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
10445 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
10446 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
10448 board_config = ALC882_AUTO;
10451 if (board_config == ALC882_AUTO)
10452 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 1);
10454 if (board_config == ALC882_AUTO) {
10455 /* automatic parse from the BIOS config */
10456 err = alc882_parse_auto_config(codec);
10462 "hda_codec: Cannot set up configuration "
10463 "from BIOS. Using base mode...\n");
10464 board_config = ALC882_3ST_DIG;
10468 err = snd_hda_attach_beep_device(codec, 0x1);
10474 if (board_config != ALC882_AUTO)
10475 setup_preset(codec, &alc882_presets[board_config]);
10477 spec->stream_analog_playback = &alc882_pcm_analog_playback;
10478 spec->stream_analog_capture = &alc882_pcm_analog_capture;
10479 /* FIXME: setup DAC5 */
10480 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
10481 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
10483 spec->stream_digital_playback = &alc882_pcm_digital_playback;
10484 spec->stream_digital_capture = &alc882_pcm_digital_capture;
10486 if (codec->vendor_id == 0x10ec0888)
10487 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
10489 if (!spec->adc_nids && spec->input_mux) {
10491 spec->num_adc_nids = 0;
10492 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
10493 const struct hda_input_mux *imux = spec->input_mux;
10495 hda_nid_t items[16];
10496 hda_nid_t nid = alc882_adc_nids[i];
10497 unsigned int wcap = get_wcaps(codec, nid);
10499 wcap = get_wcaps_type(wcap);
10500 if (wcap != AC_WID_AUD_IN)
10502 spec->private_adc_nids[spec->num_adc_nids] = nid;
10503 err = snd_hda_get_connections(codec, nid, &cap, 1);
10506 err = snd_hda_get_connections(codec, cap, items,
10507 ARRAY_SIZE(items));
10510 for (j = 0; j < imux->num_items; j++)
10511 if (imux->items[j].index >= err)
10513 if (j < imux->num_items)
10515 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
10516 spec->num_adc_nids++;
10518 spec->adc_nids = spec->private_adc_nids;
10519 spec->capsrc_nids = spec->private_capsrc_nids;
10522 set_capture_mixer(codec);
10523 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10525 if (board_config == ALC882_AUTO)
10526 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 0);
10528 spec->vmaster_nid = 0x0c;
10530 codec->patch_ops = alc_patch_ops;
10531 if (board_config == ALC882_AUTO)
10532 spec->init_hook = alc882_auto_init;
10533 #ifdef CONFIG_SND_HDA_POWER_SAVE
10534 if (!spec->loopback.amplist)
10535 spec->loopback.amplist = alc882_loopbacks;
10546 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
10547 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
10549 #define alc262_dac_nids alc260_dac_nids
10550 #define alc262_adc_nids alc882_adc_nids
10551 #define alc262_adc_nids_alt alc882_adc_nids_alt
10552 #define alc262_capsrc_nids alc882_capsrc_nids
10553 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
10555 #define alc262_modes alc260_modes
10556 #define alc262_capture_source alc882_capture_source
10558 static hda_nid_t alc262_dmic_adc_nids[1] = {
10563 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
10565 static struct snd_kcontrol_new alc262_base_mixer[] = {
10566 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10567 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10568 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10569 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10570 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10571 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10572 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10573 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10574 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10575 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10576 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10577 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10578 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
10579 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10580 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
10581 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
10585 /* update HP, line and mono-out pins according to the master switch */
10586 static void alc262_hp_master_update(struct hda_codec *codec)
10588 struct alc_spec *spec = codec->spec;
10589 int val = spec->master_sw;
10591 /* HP & line-out */
10592 snd_hda_codec_write_cache(codec, 0x1b, 0,
10593 AC_VERB_SET_PIN_WIDGET_CONTROL,
10595 snd_hda_codec_write_cache(codec, 0x15, 0,
10596 AC_VERB_SET_PIN_WIDGET_CONTROL,
10598 /* mono (speaker) depending on the HP jack sense */
10599 val = val && !spec->jack_present;
10600 snd_hda_codec_write_cache(codec, 0x16, 0,
10601 AC_VERB_SET_PIN_WIDGET_CONTROL,
10602 val ? PIN_OUT : 0);
10605 static void alc262_hp_bpc_automute(struct hda_codec *codec)
10607 struct alc_spec *spec = codec->spec;
10609 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
10610 alc262_hp_master_update(codec);
10613 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
10615 if ((res >> 26) != ALC880_HP_EVENT)
10617 alc262_hp_bpc_automute(codec);
10620 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
10622 struct alc_spec *spec = codec->spec;
10624 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
10625 alc262_hp_master_update(codec);
10628 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
10631 if ((res >> 26) != ALC880_HP_EVENT)
10633 alc262_hp_wildwest_automute(codec);
10636 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
10638 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
10639 struct snd_ctl_elem_value *ucontrol)
10641 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10642 struct alc_spec *spec = codec->spec;
10643 int val = !!*ucontrol->value.integer.value;
10645 if (val == spec->master_sw)
10647 spec->master_sw = val;
10648 alc262_hp_master_update(codec);
10652 #define ALC262_HP_MASTER_SWITCH \
10654 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10655 .name = "Master Playback Switch", \
10656 .info = snd_ctl_boolean_mono_info, \
10657 .get = alc262_hp_master_sw_get, \
10658 .put = alc262_hp_master_sw_put, \
10661 .iface = NID_MAPPING, \
10662 .name = "Master Playback Switch", \
10663 .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \
10667 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
10668 ALC262_HP_MASTER_SWITCH,
10669 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10670 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10671 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10672 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10674 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10676 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10677 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10678 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10679 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10680 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10681 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10682 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10683 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10684 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10685 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10686 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
10687 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
10691 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
10692 ALC262_HP_MASTER_SWITCH,
10693 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10694 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10695 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10696 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10697 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10699 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10701 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
10702 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
10703 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
10704 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10705 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10706 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10707 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10711 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
10712 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10713 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10714 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
10718 /* mute/unmute internal speaker according to the hp jack and mute state */
10719 static void alc262_hp_t5735_setup(struct hda_codec *codec)
10721 struct alc_spec *spec = codec->spec;
10723 spec->autocfg.hp_pins[0] = 0x15;
10724 spec->autocfg.speaker_pins[0] = 0x14;
10727 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
10728 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10729 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10730 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10731 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10732 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10733 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10734 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10738 static struct hda_verb alc262_hp_t5735_verbs[] = {
10739 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10740 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10742 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10746 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
10747 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10748 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10749 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
10750 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
10751 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10752 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10756 static struct hda_verb alc262_hp_rp5700_verbs[] = {
10757 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10758 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10759 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10760 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10761 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10762 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10763 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10764 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10765 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10766 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10770 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
10777 /* bind hp and internal speaker mute (with plug check) as master switch */
10778 static void alc262_hippo_master_update(struct hda_codec *codec)
10780 struct alc_spec *spec = codec->spec;
10781 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10782 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10783 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10787 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
10788 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
10789 HDA_AMP_MUTE, mute);
10790 /* mute internal speaker per jack sense */
10791 if (spec->jack_present)
10792 mute = HDA_AMP_MUTE;
10794 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
10795 HDA_AMP_MUTE, mute);
10796 if (speaker_nid && speaker_nid != line_nid)
10797 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
10798 HDA_AMP_MUTE, mute);
10801 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
10803 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
10804 struct snd_ctl_elem_value *ucontrol)
10806 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10807 struct alc_spec *spec = codec->spec;
10808 int val = !!*ucontrol->value.integer.value;
10810 if (val == spec->master_sw)
10812 spec->master_sw = val;
10813 alc262_hippo_master_update(codec);
10817 #define ALC262_HIPPO_MASTER_SWITCH \
10819 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10820 .name = "Master Playback Switch", \
10821 .info = snd_ctl_boolean_mono_info, \
10822 .get = alc262_hippo_master_sw_get, \
10823 .put = alc262_hippo_master_sw_put, \
10826 .iface = NID_MAPPING, \
10827 .name = "Master Playback Switch", \
10828 .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \
10829 (SUBDEV_SPEAKER(0) << 16), \
10832 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
10833 ALC262_HIPPO_MASTER_SWITCH,
10834 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10835 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10836 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10837 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10838 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10839 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10840 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10841 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10842 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10843 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10844 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10845 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10849 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
10850 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10851 ALC262_HIPPO_MASTER_SWITCH,
10852 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10853 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10854 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10855 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10856 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10857 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10858 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10859 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10860 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10861 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10865 /* mute/unmute internal speaker according to the hp jack and mute state */
10866 static void alc262_hippo_automute(struct hda_codec *codec)
10868 struct alc_spec *spec = codec->spec;
10869 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10871 spec->jack_present = snd_hda_jack_detect(codec, hp_nid);
10872 alc262_hippo_master_update(codec);
10875 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
10877 if ((res >> 26) != ALC880_HP_EVENT)
10879 alc262_hippo_automute(codec);
10882 static void alc262_hippo_setup(struct hda_codec *codec)
10884 struct alc_spec *spec = codec->spec;
10886 spec->autocfg.hp_pins[0] = 0x15;
10887 spec->autocfg.speaker_pins[0] = 0x14;
10890 static void alc262_hippo1_setup(struct hda_codec *codec)
10892 struct alc_spec *spec = codec->spec;
10894 spec->autocfg.hp_pins[0] = 0x1b;
10895 spec->autocfg.speaker_pins[0] = 0x14;
10899 static struct snd_kcontrol_new alc262_sony_mixer[] = {
10900 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10901 ALC262_HIPPO_MASTER_SWITCH,
10902 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10903 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10904 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10905 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10909 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
10910 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10911 ALC262_HIPPO_MASTER_SWITCH,
10912 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10913 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10914 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10915 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10916 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10920 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
10921 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10922 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10923 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
10924 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
10925 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10926 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10927 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10928 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10929 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10930 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10931 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10932 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10936 static struct hda_verb alc262_tyan_verbs[] = {
10937 /* Headphone automute */
10938 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10939 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10940 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10942 /* P11 AUX_IN, white 4-pin connector */
10943 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10944 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
10945 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
10946 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
10951 /* unsolicited event for HP jack sensing */
10952 static void alc262_tyan_setup(struct hda_codec *codec)
10954 struct alc_spec *spec = codec->spec;
10956 spec->autocfg.hp_pins[0] = 0x1b;
10957 spec->autocfg.speaker_pins[0] = 0x15;
10961 #define alc262_capture_mixer alc882_capture_mixer
10962 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
10965 * generic initialization of ADC, input mixers and output mixers
10967 static struct hda_verb alc262_init_verbs[] = {
10969 * Unmute ADC0-2 and set the default input to mic-in
10971 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10972 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10973 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10974 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10975 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10976 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10978 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10980 * Note: PASD motherboards uses the Line In 2 as the input for
10981 * front panel mic (mic 2)
10983 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10984 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10985 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10986 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10987 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10988 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10991 * Set up output mixers (0x0c - 0x0e)
10993 /* set vol=0 to output mixers */
10994 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10995 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10996 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10997 /* set up input amps for analog loopback */
10998 /* Amp Indices: DAC = 0, mixer = 1 */
10999 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11000 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11001 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11002 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11003 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11004 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11006 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11007 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11008 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11009 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11010 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11011 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11013 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11014 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11015 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11016 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11017 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11019 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11020 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11022 /* FIXME: use matrix-type input source selection */
11023 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11024 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11025 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11026 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11027 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11028 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11030 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11031 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11032 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11033 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11035 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11036 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11037 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11038 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11043 static struct hda_verb alc262_eapd_verbs[] = {
11044 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11045 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11049 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
11050 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11051 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11052 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11054 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11055 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11059 static struct hda_verb alc262_sony_unsol_verbs[] = {
11060 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11061 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11062 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
11064 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11065 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11069 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
11070 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11071 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11072 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11073 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11074 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11078 static struct hda_verb alc262_toshiba_s06_verbs[] = {
11079 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11080 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11081 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11082 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11083 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
11084 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11085 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11086 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11090 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
11092 struct alc_spec *spec = codec->spec;
11094 spec->autocfg.hp_pins[0] = 0x15;
11095 spec->autocfg.speaker_pins[0] = 0x14;
11096 spec->ext_mic.pin = 0x18;
11097 spec->ext_mic.mux_idx = 0;
11098 spec->int_mic.pin = 0x12;
11099 spec->int_mic.mux_idx = 9;
11100 spec->auto_mic = 1;
11106 * 0x16 = internal speaker
11107 * 0x18 = external mic
11110 static struct snd_kcontrol_new alc262_nec_mixer[] = {
11111 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
11112 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
11114 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11115 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11116 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11118 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11119 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11123 static struct hda_verb alc262_nec_verbs[] = {
11124 /* Unmute Speaker */
11125 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11128 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11129 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11131 /* External mic to headphone */
11132 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11133 /* External mic to speaker */
11134 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11140 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
11141 * 0x1b = port replicator headphone out
11144 #define ALC_HP_EVENT 0x37
11146 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
11147 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11148 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11149 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11150 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11154 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
11155 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11156 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11160 static struct hda_verb alc262_lenovo_3000_init_verbs[] = {
11161 /* Front Mic pin: input vref at 50% */
11162 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
11163 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11167 static struct hda_input_mux alc262_fujitsu_capture_source = {
11171 { "Int Mic", 0x1 },
11176 static struct hda_input_mux alc262_HP_capture_source = {
11180 { "Front Mic", 0x1 },
11187 static struct hda_input_mux alc262_HP_D7000_capture_source = {
11191 { "Front Mic", 0x2 },
11197 /* mute/unmute internal speaker according to the hp jacks and mute state */
11198 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
11200 struct alc_spec *spec = codec->spec;
11203 if (force || !spec->sense_updated) {
11204 spec->jack_present = snd_hda_jack_detect(codec, 0x14) ||
11205 snd_hda_jack_detect(codec, 0x1b);
11206 spec->sense_updated = 1;
11208 /* unmute internal speaker only if both HPs are unplugged and
11209 * master switch is on
11211 if (spec->jack_present)
11212 mute = HDA_AMP_MUTE;
11214 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11215 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11216 HDA_AMP_MUTE, mute);
11219 /* unsolicited event for HP jack sensing */
11220 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
11223 if ((res >> 26) != ALC_HP_EVENT)
11225 alc262_fujitsu_automute(codec, 1);
11228 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
11230 alc262_fujitsu_automute(codec, 1);
11233 /* bind volumes of both NID 0x0c and 0x0d */
11234 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
11235 .ops = &snd_hda_bind_vol,
11237 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
11238 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
11243 /* mute/unmute internal speaker according to the hp jack and mute state */
11244 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
11246 struct alc_spec *spec = codec->spec;
11249 if (force || !spec->sense_updated) {
11250 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
11251 spec->sense_updated = 1;
11253 if (spec->jack_present) {
11254 /* mute internal speaker */
11255 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11256 HDA_AMP_MUTE, HDA_AMP_MUTE);
11257 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11258 HDA_AMP_MUTE, HDA_AMP_MUTE);
11260 /* unmute internal speaker if necessary */
11261 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
11262 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11263 HDA_AMP_MUTE, mute);
11264 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11265 HDA_AMP_MUTE, mute);
11269 /* unsolicited event for HP jack sensing */
11270 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
11273 if ((res >> 26) != ALC_HP_EVENT)
11275 alc262_lenovo_3000_automute(codec, 1);
11278 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
11279 int dir, int idx, long *valp)
11283 for (i = 0; i < 2; i++, valp++)
11284 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
11286 *valp ? 0 : HDA_AMP_MUTE);
11290 /* bind hp and internal speaker mute (with plug check) */
11291 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
11292 struct snd_ctl_elem_value *ucontrol)
11294 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11295 long *valp = ucontrol->value.integer.value;
11298 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
11299 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11301 alc262_fujitsu_automute(codec, 0);
11305 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
11306 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11308 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11309 .name = "Master Playback Switch",
11310 .subdevice = HDA_SUBDEV_AMP_FLAG,
11311 .info = snd_hda_mixer_amp_switch_info,
11312 .get = snd_hda_mixer_amp_switch_get,
11313 .put = alc262_fujitsu_master_sw_put,
11314 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11317 .iface = NID_MAPPING,
11318 .name = "Master Playback Switch",
11319 .private_value = 0x1b,
11321 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11322 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11323 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11324 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11325 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11326 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11327 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11328 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11332 /* bind hp and internal speaker mute (with plug check) */
11333 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
11334 struct snd_ctl_elem_value *ucontrol)
11336 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11337 long *valp = ucontrol->value.integer.value;
11340 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11342 alc262_lenovo_3000_automute(codec, 0);
11346 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
11347 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11349 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11350 .name = "Master Playback Switch",
11351 .subdevice = HDA_SUBDEV_AMP_FLAG,
11352 .info = snd_hda_mixer_amp_switch_info,
11353 .get = snd_hda_mixer_amp_switch_get,
11354 .put = alc262_lenovo_3000_master_sw_put,
11355 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
11357 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11358 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11359 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11360 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11361 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11362 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11363 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11364 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11368 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
11369 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11370 ALC262_HIPPO_MASTER_SWITCH,
11371 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11372 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11373 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11374 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11375 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11376 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11380 /* additional init verbs for Benq laptops */
11381 static struct hda_verb alc262_EAPD_verbs[] = {
11382 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11383 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
11387 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
11388 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11389 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11391 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11392 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
11396 /* Samsung Q1 Ultra Vista model setup */
11397 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
11398 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11399 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11400 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11401 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11402 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
11403 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
11407 static struct hda_verb alc262_ultra_verbs[] = {
11409 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11410 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11411 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11413 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11414 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11415 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11416 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11418 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11419 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11420 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11421 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11422 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11424 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11425 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11426 /* ADC, choose mic */
11427 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11428 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11429 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11430 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11431 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11432 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11433 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11434 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11435 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11436 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
11440 /* mute/unmute internal speaker according to the hp jack and mute state */
11441 static void alc262_ultra_automute(struct hda_codec *codec)
11443 struct alc_spec *spec = codec->spec;
11447 /* auto-mute only when HP is used as HP */
11448 if (!spec->cur_mux[0]) {
11449 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11450 if (spec->jack_present)
11451 mute = HDA_AMP_MUTE;
11453 /* mute/unmute internal speaker */
11454 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11455 HDA_AMP_MUTE, mute);
11456 /* mute/unmute HP */
11457 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11458 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
11461 /* unsolicited event for HP jack sensing */
11462 static void alc262_ultra_unsol_event(struct hda_codec *codec,
11465 if ((res >> 26) != ALC880_HP_EVENT)
11467 alc262_ultra_automute(codec);
11470 static struct hda_input_mux alc262_ultra_capture_source = {
11474 { "Headphone", 0x7 },
11478 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
11479 struct snd_ctl_elem_value *ucontrol)
11481 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11482 struct alc_spec *spec = codec->spec;
11485 ret = alc_mux_enum_put(kcontrol, ucontrol);
11488 /* reprogram the HP pin as mic or HP according to the input source */
11489 snd_hda_codec_write_cache(codec, 0x15, 0,
11490 AC_VERB_SET_PIN_WIDGET_CONTROL,
11491 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
11492 alc262_ultra_automute(codec); /* mute/unmute HP */
11496 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
11497 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
11498 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
11500 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11501 .name = "Capture Source",
11502 .info = alc_mux_enum_info,
11503 .get = alc_mux_enum_get,
11504 .put = alc262_ultra_mux_enum_put,
11507 .iface = NID_MAPPING,
11508 .name = "Capture Source",
11509 .private_value = 0x15,
11514 /* We use two mixers depending on the output pin; 0x16 is a mono output
11515 * and thus it's bound with a different mixer.
11516 * This function returns which mixer amp should be used.
11518 static int alc262_check_volbit(hda_nid_t nid)
11522 else if (nid == 0x16)
11528 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
11529 const char *pfx, int *vbits)
11534 vbit = alc262_check_volbit(nid);
11537 if (*vbits & vbit) /* a volume control for this mixer already there */
11541 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
11543 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
11544 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, val);
11547 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
11555 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
11557 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
11558 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val);
11561 /* add playback controls from the parsed DAC table */
11562 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
11563 const struct auto_pin_cfg *cfg)
11569 spec->multiout.num_dacs = 1; /* only use one dac */
11570 spec->multiout.dac_nids = spec->private_dac_nids;
11571 spec->multiout.dac_nids[0] = 2;
11573 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
11575 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11579 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx);
11582 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker");
11585 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone");
11589 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
11590 alc262_check_volbit(cfg->speaker_pins[0]) |
11591 alc262_check_volbit(cfg->hp_pins[0]);
11592 if (vbits == 1 || vbits == 2)
11593 pfx = "Master"; /* only one mixer is used */
11594 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11599 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits);
11602 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker",
11606 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone",
11613 #define alc262_auto_create_input_ctls \
11614 alc882_auto_create_input_ctls
11617 * generic initialization of ADC, input mixers and output mixers
11619 static struct hda_verb alc262_volume_init_verbs[] = {
11621 * Unmute ADC0-2 and set the default input to mic-in
11623 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11624 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11625 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11626 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11627 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11628 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11630 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11632 * Note: PASD motherboards uses the Line In 2 as the input for
11633 * front panel mic (mic 2)
11635 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11636 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11637 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11638 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11639 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11640 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11643 * Set up output mixers (0x0c - 0x0f)
11645 /* set vol=0 to output mixers */
11646 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11647 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11648 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11650 /* set up input amps for analog loopback */
11651 /* Amp Indices: DAC = 0, mixer = 1 */
11652 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11653 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11654 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11655 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11656 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11657 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11659 /* FIXME: use matrix-type input source selection */
11660 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11661 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11662 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11663 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11664 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11665 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11667 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11668 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11669 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11670 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11672 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11673 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11674 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11675 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11680 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
11682 * Unmute ADC0-2 and set the default input to mic-in
11684 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11685 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11686 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11687 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11688 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11689 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11691 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11693 * Note: PASD motherboards uses the Line In 2 as the input for
11694 * front panel mic (mic 2)
11696 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11697 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11698 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11699 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11700 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11701 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11702 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11703 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11706 * Set up output mixers (0x0c - 0x0e)
11708 /* set vol=0 to output mixers */
11709 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11710 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11711 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11713 /* set up input amps for analog loopback */
11714 /* Amp Indices: DAC = 0, mixer = 1 */
11715 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11716 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11717 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11718 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11719 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11720 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11722 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11723 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11724 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11726 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11727 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11729 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11730 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11732 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11733 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11734 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11735 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11736 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11738 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11739 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11740 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11741 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11742 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11743 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11746 /* FIXME: use matrix-type input source selection */
11747 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
11748 /* Input mixer1: only unmute Mic */
11749 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11750 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11751 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11752 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11753 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11754 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11755 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11756 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11757 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11759 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11760 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11761 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11762 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11763 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11764 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11765 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11766 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11767 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11769 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11770 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11771 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11772 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11773 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11774 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11775 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11776 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11777 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11779 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11784 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
11786 * Unmute ADC0-2 and set the default input to mic-in
11788 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11789 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11790 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11791 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11792 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11793 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11795 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11797 * Note: PASD motherboards uses the Line In 2 as the input for front
11798 * panel mic (mic 2)
11800 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11801 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11802 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11803 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11804 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11805 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11806 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11807 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11808 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11810 * Set up output mixers (0x0c - 0x0e)
11812 /* set vol=0 to output mixers */
11813 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11814 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11815 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11817 /* set up input amps for analog loopback */
11818 /* Amp Indices: DAC = 0, mixer = 1 */
11819 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11820 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11821 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11822 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11823 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11824 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11827 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
11828 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
11829 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
11830 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
11831 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11832 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
11833 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
11835 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11836 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11838 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11839 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11841 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
11842 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11843 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11844 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
11845 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11846 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11848 /* FIXME: use matrix-type input source selection */
11849 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11850 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11851 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
11852 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
11853 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
11854 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
11855 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
11856 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11857 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
11859 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11860 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11861 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11862 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11863 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11864 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11865 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11867 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11868 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11869 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11870 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11871 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11872 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11873 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11875 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11880 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
11882 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
11883 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11884 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
11886 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
11887 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11888 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11889 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11891 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
11892 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11893 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11898 #ifdef CONFIG_SND_HDA_POWER_SAVE
11899 #define alc262_loopbacks alc880_loopbacks
11902 /* pcm configuration: identical with ALC880 */
11903 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
11904 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
11905 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
11906 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
11909 * BIOS auto configuration
11911 static int alc262_parse_auto_config(struct hda_codec *codec)
11913 struct alc_spec *spec = codec->spec;
11915 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
11917 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11921 if (!spec->autocfg.line_outs) {
11922 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11923 spec->multiout.max_channels = 2;
11924 spec->no_analog = 1;
11927 return 0; /* can't find valid BIOS pin config */
11929 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
11932 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
11936 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11939 if (spec->autocfg.dig_outs) {
11940 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
11941 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11943 if (spec->autocfg.dig_in_pin)
11944 spec->dig_in_nid = ALC262_DIGIN_NID;
11946 if (spec->kctls.list)
11947 add_mixer(spec, spec->kctls.list);
11949 add_verb(spec, alc262_volume_init_verbs);
11950 spec->num_mux_defs = 1;
11951 spec->input_mux = &spec->private_imux[0];
11953 err = alc_auto_add_mic_boost(codec);
11957 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
11962 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
11963 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
11964 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
11965 #define alc262_auto_init_input_src alc882_auto_init_input_src
11968 /* init callback for auto-configuration model -- overriding the default init */
11969 static void alc262_auto_init(struct hda_codec *codec)
11971 struct alc_spec *spec = codec->spec;
11972 alc262_auto_init_multi_out(codec);
11973 alc262_auto_init_hp_out(codec);
11974 alc262_auto_init_analog_input(codec);
11975 alc262_auto_init_input_src(codec);
11976 if (spec->unsol_event)
11977 alc_inithook(codec);
11981 * configuration and preset
11983 static const char *alc262_models[ALC262_MODEL_LAST] = {
11984 [ALC262_BASIC] = "basic",
11985 [ALC262_HIPPO] = "hippo",
11986 [ALC262_HIPPO_1] = "hippo_1",
11987 [ALC262_FUJITSU] = "fujitsu",
11988 [ALC262_HP_BPC] = "hp-bpc",
11989 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
11990 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
11991 [ALC262_HP_RP5700] = "hp-rp5700",
11992 [ALC262_BENQ_ED8] = "benq",
11993 [ALC262_BENQ_T31] = "benq-t31",
11994 [ALC262_SONY_ASSAMD] = "sony-assamd",
11995 [ALC262_TOSHIBA_S06] = "toshiba-s06",
11996 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
11997 [ALC262_ULTRA] = "ultra",
11998 [ALC262_LENOVO_3000] = "lenovo-3000",
11999 [ALC262_NEC] = "nec",
12000 [ALC262_TYAN] = "tyan",
12001 [ALC262_AUTO] = "auto",
12004 static struct snd_pci_quirk alc262_cfg_tbl[] = {
12005 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
12006 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
12007 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
12009 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
12011 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
12013 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
12014 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
12015 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
12016 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
12017 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
12018 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
12019 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
12020 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
12021 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
12022 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
12023 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
12024 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
12025 ALC262_HP_TC_T5735),
12026 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
12027 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12028 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
12029 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12030 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
12031 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
12032 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
12033 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
12034 #if 0 /* disable the quirk since model=auto works better in recent versions */
12035 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
12036 ALC262_SONY_ASSAMD),
12038 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
12039 ALC262_TOSHIBA_RX1),
12040 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
12041 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
12042 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
12043 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
12044 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
12046 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
12047 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
12048 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
12049 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
12050 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
12054 static struct alc_config_preset alc262_presets[] = {
12056 .mixers = { alc262_base_mixer },
12057 .init_verbs = { alc262_init_verbs },
12058 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12059 .dac_nids = alc262_dac_nids,
12061 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12062 .channel_mode = alc262_modes,
12063 .input_mux = &alc262_capture_source,
12066 .mixers = { alc262_hippo_mixer },
12067 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
12068 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12069 .dac_nids = alc262_dac_nids,
12071 .dig_out_nid = ALC262_DIGOUT_NID,
12072 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12073 .channel_mode = alc262_modes,
12074 .input_mux = &alc262_capture_source,
12075 .unsol_event = alc262_hippo_unsol_event,
12076 .setup = alc262_hippo_setup,
12077 .init_hook = alc262_hippo_automute,
12079 [ALC262_HIPPO_1] = {
12080 .mixers = { alc262_hippo1_mixer },
12081 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
12082 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12083 .dac_nids = alc262_dac_nids,
12085 .dig_out_nid = ALC262_DIGOUT_NID,
12086 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12087 .channel_mode = alc262_modes,
12088 .input_mux = &alc262_capture_source,
12089 .unsol_event = alc262_hippo_unsol_event,
12090 .setup = alc262_hippo1_setup,
12091 .init_hook = alc262_hippo_automute,
12093 [ALC262_FUJITSU] = {
12094 .mixers = { alc262_fujitsu_mixer },
12095 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12096 alc262_fujitsu_unsol_verbs },
12097 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12098 .dac_nids = alc262_dac_nids,
12100 .dig_out_nid = ALC262_DIGOUT_NID,
12101 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12102 .channel_mode = alc262_modes,
12103 .input_mux = &alc262_fujitsu_capture_source,
12104 .unsol_event = alc262_fujitsu_unsol_event,
12105 .init_hook = alc262_fujitsu_init_hook,
12107 [ALC262_HP_BPC] = {
12108 .mixers = { alc262_HP_BPC_mixer },
12109 .init_verbs = { alc262_HP_BPC_init_verbs },
12110 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12111 .dac_nids = alc262_dac_nids,
12113 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12114 .channel_mode = alc262_modes,
12115 .input_mux = &alc262_HP_capture_source,
12116 .unsol_event = alc262_hp_bpc_unsol_event,
12117 .init_hook = alc262_hp_bpc_automute,
12119 [ALC262_HP_BPC_D7000_WF] = {
12120 .mixers = { alc262_HP_BPC_WildWest_mixer },
12121 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12122 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12123 .dac_nids = alc262_dac_nids,
12125 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12126 .channel_mode = alc262_modes,
12127 .input_mux = &alc262_HP_D7000_capture_source,
12128 .unsol_event = alc262_hp_wildwest_unsol_event,
12129 .init_hook = alc262_hp_wildwest_automute,
12131 [ALC262_HP_BPC_D7000_WL] = {
12132 .mixers = { alc262_HP_BPC_WildWest_mixer,
12133 alc262_HP_BPC_WildWest_option_mixer },
12134 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12135 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12136 .dac_nids = alc262_dac_nids,
12138 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12139 .channel_mode = alc262_modes,
12140 .input_mux = &alc262_HP_D7000_capture_source,
12141 .unsol_event = alc262_hp_wildwest_unsol_event,
12142 .init_hook = alc262_hp_wildwest_automute,
12144 [ALC262_HP_TC_T5735] = {
12145 .mixers = { alc262_hp_t5735_mixer },
12146 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
12147 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12148 .dac_nids = alc262_dac_nids,
12150 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12151 .channel_mode = alc262_modes,
12152 .input_mux = &alc262_capture_source,
12153 .unsol_event = alc_sku_unsol_event,
12154 .setup = alc262_hp_t5735_setup,
12155 .init_hook = alc_inithook,
12157 [ALC262_HP_RP5700] = {
12158 .mixers = { alc262_hp_rp5700_mixer },
12159 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
12160 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12161 .dac_nids = alc262_dac_nids,
12162 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12163 .channel_mode = alc262_modes,
12164 .input_mux = &alc262_hp_rp5700_capture_source,
12166 [ALC262_BENQ_ED8] = {
12167 .mixers = { alc262_base_mixer },
12168 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
12169 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12170 .dac_nids = alc262_dac_nids,
12172 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12173 .channel_mode = alc262_modes,
12174 .input_mux = &alc262_capture_source,
12176 [ALC262_SONY_ASSAMD] = {
12177 .mixers = { alc262_sony_mixer },
12178 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
12179 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12180 .dac_nids = alc262_dac_nids,
12182 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12183 .channel_mode = alc262_modes,
12184 .input_mux = &alc262_capture_source,
12185 .unsol_event = alc262_hippo_unsol_event,
12186 .setup = alc262_hippo_setup,
12187 .init_hook = alc262_hippo_automute,
12189 [ALC262_BENQ_T31] = {
12190 .mixers = { alc262_benq_t31_mixer },
12191 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
12192 alc_hp15_unsol_verbs },
12193 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12194 .dac_nids = alc262_dac_nids,
12196 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12197 .channel_mode = alc262_modes,
12198 .input_mux = &alc262_capture_source,
12199 .unsol_event = alc262_hippo_unsol_event,
12200 .setup = alc262_hippo_setup,
12201 .init_hook = alc262_hippo_automute,
12204 .mixers = { alc262_ultra_mixer },
12205 .cap_mixer = alc262_ultra_capture_mixer,
12206 .init_verbs = { alc262_ultra_verbs },
12207 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12208 .dac_nids = alc262_dac_nids,
12209 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12210 .channel_mode = alc262_modes,
12211 .input_mux = &alc262_ultra_capture_source,
12212 .adc_nids = alc262_adc_nids, /* ADC0 */
12213 .capsrc_nids = alc262_capsrc_nids,
12214 .num_adc_nids = 1, /* single ADC */
12215 .unsol_event = alc262_ultra_unsol_event,
12216 .init_hook = alc262_ultra_automute,
12218 [ALC262_LENOVO_3000] = {
12219 .mixers = { alc262_lenovo_3000_mixer },
12220 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12221 alc262_lenovo_3000_unsol_verbs,
12222 alc262_lenovo_3000_init_verbs },
12223 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12224 .dac_nids = alc262_dac_nids,
12226 .dig_out_nid = ALC262_DIGOUT_NID,
12227 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12228 .channel_mode = alc262_modes,
12229 .input_mux = &alc262_fujitsu_capture_source,
12230 .unsol_event = alc262_lenovo_3000_unsol_event,
12233 .mixers = { alc262_nec_mixer },
12234 .init_verbs = { alc262_nec_verbs },
12235 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12236 .dac_nids = alc262_dac_nids,
12238 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12239 .channel_mode = alc262_modes,
12240 .input_mux = &alc262_capture_source,
12242 [ALC262_TOSHIBA_S06] = {
12243 .mixers = { alc262_toshiba_s06_mixer },
12244 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
12245 alc262_eapd_verbs },
12246 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12247 .capsrc_nids = alc262_dmic_capsrc_nids,
12248 .dac_nids = alc262_dac_nids,
12249 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
12250 .num_adc_nids = 1, /* single ADC */
12251 .dig_out_nid = ALC262_DIGOUT_NID,
12252 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12253 .channel_mode = alc262_modes,
12254 .unsol_event = alc_sku_unsol_event,
12255 .setup = alc262_toshiba_s06_setup,
12256 .init_hook = alc_inithook,
12258 [ALC262_TOSHIBA_RX1] = {
12259 .mixers = { alc262_toshiba_rx1_mixer },
12260 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
12261 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12262 .dac_nids = alc262_dac_nids,
12264 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12265 .channel_mode = alc262_modes,
12266 .input_mux = &alc262_capture_source,
12267 .unsol_event = alc262_hippo_unsol_event,
12268 .setup = alc262_hippo_setup,
12269 .init_hook = alc262_hippo_automute,
12272 .mixers = { alc262_tyan_mixer },
12273 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
12274 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12275 .dac_nids = alc262_dac_nids,
12277 .dig_out_nid = ALC262_DIGOUT_NID,
12278 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12279 .channel_mode = alc262_modes,
12280 .input_mux = &alc262_capture_source,
12281 .unsol_event = alc_automute_amp_unsol_event,
12282 .setup = alc262_tyan_setup,
12283 .init_hook = alc_automute_amp,
12287 static int patch_alc262(struct hda_codec *codec)
12289 struct alc_spec *spec;
12293 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12297 codec->spec = spec;
12299 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
12304 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12305 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
12306 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12307 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
12311 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
12313 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
12317 if (board_config < 0) {
12318 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12320 board_config = ALC262_AUTO;
12323 if (board_config == ALC262_AUTO) {
12324 /* automatic parse from the BIOS config */
12325 err = alc262_parse_auto_config(codec);
12331 "hda_codec: Cannot set up configuration "
12332 "from BIOS. Using base mode...\n");
12333 board_config = ALC262_BASIC;
12337 if (!spec->no_analog) {
12338 err = snd_hda_attach_beep_device(codec, 0x1);
12345 if (board_config != ALC262_AUTO)
12346 setup_preset(codec, &alc262_presets[board_config]);
12348 spec->stream_analog_playback = &alc262_pcm_analog_playback;
12349 spec->stream_analog_capture = &alc262_pcm_analog_capture;
12351 spec->stream_digital_playback = &alc262_pcm_digital_playback;
12352 spec->stream_digital_capture = &alc262_pcm_digital_capture;
12354 if (!spec->adc_nids && spec->input_mux) {
12356 /* check whether the digital-mic has to be supported */
12357 for (i = 0; i < spec->input_mux->num_items; i++) {
12358 if (spec->input_mux->items[i].index >= 9)
12361 if (i < spec->input_mux->num_items) {
12362 /* use only ADC0 */
12363 spec->adc_nids = alc262_dmic_adc_nids;
12364 spec->num_adc_nids = 1;
12365 spec->capsrc_nids = alc262_dmic_capsrc_nids;
12367 /* all analog inputs */
12368 /* check whether NID 0x07 is valid */
12369 unsigned int wcap = get_wcaps(codec, 0x07);
12372 wcap = get_wcaps_type(wcap);
12373 if (wcap != AC_WID_AUD_IN) {
12374 spec->adc_nids = alc262_adc_nids_alt;
12375 spec->num_adc_nids =
12376 ARRAY_SIZE(alc262_adc_nids_alt);
12377 spec->capsrc_nids = alc262_capsrc_nids_alt;
12379 spec->adc_nids = alc262_adc_nids;
12380 spec->num_adc_nids =
12381 ARRAY_SIZE(alc262_adc_nids);
12382 spec->capsrc_nids = alc262_capsrc_nids;
12386 if (!spec->cap_mixer && !spec->no_analog)
12387 set_capture_mixer(codec);
12388 if (!spec->no_analog)
12389 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12391 spec->vmaster_nid = 0x0c;
12393 codec->patch_ops = alc_patch_ops;
12394 if (board_config == ALC262_AUTO)
12395 spec->init_hook = alc262_auto_init;
12396 #ifdef CONFIG_SND_HDA_POWER_SAVE
12397 if (!spec->loopback.amplist)
12398 spec->loopback.amplist = alc262_loopbacks;
12405 * ALC268 channel source setting (2 channel)
12407 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
12408 #define alc268_modes alc260_modes
12410 static hda_nid_t alc268_dac_nids[2] = {
12415 static hda_nid_t alc268_adc_nids[2] = {
12420 static hda_nid_t alc268_adc_nids_alt[1] = {
12425 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
12427 static struct snd_kcontrol_new alc268_base_mixer[] = {
12428 /* output mixer control */
12429 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12430 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12431 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12432 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12433 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12434 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12435 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12439 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
12440 /* output mixer control */
12441 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12442 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12443 ALC262_HIPPO_MASTER_SWITCH,
12444 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12445 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12446 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12450 /* bind Beep switches of both NID 0x0f and 0x10 */
12451 static struct hda_bind_ctls alc268_bind_beep_sw = {
12452 .ops = &snd_hda_bind_sw,
12454 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
12455 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
12460 static struct snd_kcontrol_new alc268_beep_mixer[] = {
12461 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
12462 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
12466 static struct hda_verb alc268_eapd_verbs[] = {
12467 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12468 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12472 /* Toshiba specific */
12473 static struct hda_verb alc268_toshiba_verbs[] = {
12474 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12478 /* Acer specific */
12479 /* bind volumes of both NID 0x02 and 0x03 */
12480 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
12481 .ops = &snd_hda_bind_vol,
12483 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12484 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12489 /* mute/unmute internal speaker according to the hp jack and mute state */
12490 static void alc268_acer_automute(struct hda_codec *codec, int force)
12492 struct alc_spec *spec = codec->spec;
12495 if (force || !spec->sense_updated) {
12496 spec->jack_present = snd_hda_jack_detect(codec, 0x14);
12497 spec->sense_updated = 1;
12499 if (spec->jack_present)
12500 mute = HDA_AMP_MUTE; /* mute internal speaker */
12501 else /* unmute internal speaker if necessary */
12502 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
12503 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12504 HDA_AMP_MUTE, mute);
12508 /* bind hp and internal speaker mute (with plug check) */
12509 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
12510 struct snd_ctl_elem_value *ucontrol)
12512 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12513 long *valp = ucontrol->value.integer.value;
12516 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
12518 alc268_acer_automute(codec, 0);
12522 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
12523 /* output mixer control */
12524 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12526 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12527 .name = "Master Playback Switch",
12528 .subdevice = HDA_SUBDEV_AMP_FLAG,
12529 .info = snd_hda_mixer_amp_switch_info,
12530 .get = snd_hda_mixer_amp_switch_get,
12531 .put = alc268_acer_master_sw_put,
12532 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12534 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
12538 static struct snd_kcontrol_new alc268_acer_mixer[] = {
12539 /* output mixer control */
12540 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12542 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12543 .name = "Master Playback Switch",
12544 .subdevice = HDA_SUBDEV_AMP_FLAG,
12545 .info = snd_hda_mixer_amp_switch_info,
12546 .get = snd_hda_mixer_amp_switch_get,
12547 .put = alc268_acer_master_sw_put,
12548 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12550 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12551 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12552 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12556 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
12557 /* output mixer control */
12558 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12560 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12561 .name = "Master Playback Switch",
12562 .subdevice = HDA_SUBDEV_AMP_FLAG,
12563 .info = snd_hda_mixer_amp_switch_info,
12564 .get = snd_hda_mixer_amp_switch_get,
12565 .put = alc268_acer_master_sw_put,
12566 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12568 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12569 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12573 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
12574 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12575 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12576 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12577 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12578 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
12579 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
12583 static struct hda_verb alc268_acer_verbs[] = {
12584 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
12585 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12586 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12587 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12588 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12589 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12590 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12594 /* unsolicited event for HP jack sensing */
12595 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
12596 #define alc268_toshiba_setup alc262_hippo_setup
12597 #define alc268_toshiba_automute alc262_hippo_automute
12599 static void alc268_acer_unsol_event(struct hda_codec *codec,
12602 if ((res >> 26) != ALC880_HP_EVENT)
12604 alc268_acer_automute(codec, 1);
12607 static void alc268_acer_init_hook(struct hda_codec *codec)
12609 alc268_acer_automute(codec, 1);
12612 /* toggle speaker-output according to the hp-jack state */
12613 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
12615 unsigned int present;
12616 unsigned char bits;
12618 present = snd_hda_jack_detect(codec, 0x15);
12619 bits = present ? HDA_AMP_MUTE : 0;
12620 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
12621 HDA_AMP_MUTE, bits);
12622 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
12623 HDA_AMP_MUTE, bits);
12626 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
12629 switch (res >> 26) {
12630 case ALC880_HP_EVENT:
12631 alc268_aspire_one_speaker_automute(codec);
12633 case ALC880_MIC_EVENT:
12634 alc_mic_automute(codec);
12639 static void alc268_acer_lc_setup(struct hda_codec *codec)
12641 struct alc_spec *spec = codec->spec;
12642 spec->ext_mic.pin = 0x18;
12643 spec->ext_mic.mux_idx = 0;
12644 spec->int_mic.pin = 0x12;
12645 spec->int_mic.mux_idx = 6;
12646 spec->auto_mic = 1;
12649 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
12651 alc268_aspire_one_speaker_automute(codec);
12652 alc_mic_automute(codec);
12655 static struct snd_kcontrol_new alc268_dell_mixer[] = {
12656 /* output mixer control */
12657 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12658 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12659 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12660 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12661 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12662 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12666 static struct hda_verb alc268_dell_verbs[] = {
12667 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12668 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12669 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12670 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12674 /* mute/unmute internal speaker according to the hp jack and mute state */
12675 static void alc268_dell_setup(struct hda_codec *codec)
12677 struct alc_spec *spec = codec->spec;
12679 spec->autocfg.hp_pins[0] = 0x15;
12680 spec->autocfg.speaker_pins[0] = 0x14;
12681 spec->ext_mic.pin = 0x18;
12682 spec->ext_mic.mux_idx = 0;
12683 spec->int_mic.pin = 0x19;
12684 spec->int_mic.mux_idx = 1;
12685 spec->auto_mic = 1;
12688 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
12689 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12690 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12691 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12692 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12693 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12694 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
12695 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
12696 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
12700 static struct hda_verb alc267_quanta_il1_verbs[] = {
12701 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12702 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12706 static void alc267_quanta_il1_setup(struct hda_codec *codec)
12708 struct alc_spec *spec = codec->spec;
12709 spec->autocfg.hp_pins[0] = 0x15;
12710 spec->autocfg.speaker_pins[0] = 0x14;
12711 spec->ext_mic.pin = 0x18;
12712 spec->ext_mic.mux_idx = 0;
12713 spec->int_mic.pin = 0x19;
12714 spec->int_mic.mux_idx = 1;
12715 spec->auto_mic = 1;
12719 * generic initialization of ADC, input mixers and output mixers
12721 static struct hda_verb alc268_base_init_verbs[] = {
12722 /* Unmute DAC0-1 and set vol = 0 */
12723 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12724 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12727 * Set up output mixers (0x0c - 0x0e)
12729 /* set vol=0 to output mixers */
12730 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12731 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
12733 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12734 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12736 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12737 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
12738 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12739 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12740 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12741 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12742 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12743 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12745 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12746 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12747 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12748 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12749 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12751 /* set PCBEEP vol = 0, mute connections */
12752 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12753 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12754 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12756 /* Unmute Selector 23h,24h and set the default input to mic-in */
12758 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
12759 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12760 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
12761 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12767 * generic initialization of ADC, input mixers and output mixers
12769 static struct hda_verb alc268_volume_init_verbs[] = {
12770 /* set output DAC */
12771 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12772 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12774 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12775 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12776 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12777 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12778 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12780 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12781 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12782 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12784 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12785 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12787 /* set PCBEEP vol = 0, mute connections */
12788 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12789 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12790 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12795 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
12796 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12797 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12801 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
12802 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12803 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12808 static struct snd_kcontrol_new alc268_capture_mixer[] = {
12809 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12810 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12811 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
12812 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
12817 static struct hda_input_mux alc268_capture_source = {
12821 { "Front Mic", 0x1 },
12827 static struct hda_input_mux alc268_acer_capture_source = {
12831 { "Internal Mic", 0x1 },
12836 static struct hda_input_mux alc268_acer_dmic_capture_source = {
12840 { "Internal Mic", 0x6 },
12845 #ifdef CONFIG_SND_DEBUG
12846 static struct snd_kcontrol_new alc268_test_mixer[] = {
12847 /* Volume widgets */
12848 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12849 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12850 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12851 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
12852 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
12853 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
12854 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
12855 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
12856 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
12857 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
12858 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
12859 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
12860 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
12861 /* The below appears problematic on some hardwares */
12862 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
12863 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12864 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
12865 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
12866 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
12868 /* Modes for retasking pin widgets */
12869 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
12870 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
12871 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
12872 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
12874 /* Controls for GPIO pins, assuming they are configured as outputs */
12875 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
12876 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
12877 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
12878 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
12880 /* Switches to allow the digital SPDIF output pin to be enabled.
12881 * The ALC268 does not have an SPDIF input.
12883 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
12885 /* A switch allowing EAPD to be enabled. Some laptops seem to use
12886 * this output to turn on an external amplifier.
12888 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
12889 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
12895 /* create input playback/capture controls for the given pin */
12896 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12897 const char *ctlname, int idx)
12908 case 0x21: /* ALC269vb has this pin, too */
12914 if (spec->multiout.dac_nids[0] != dac &&
12915 spec->multiout.dac_nids[1] != dac) {
12916 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
12917 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
12921 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
12925 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12926 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
12928 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12929 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
12935 /* add playback controls from the parsed DAC table */
12936 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
12937 const struct auto_pin_cfg *cfg)
12942 spec->multiout.dac_nids = spec->private_dac_nids;
12944 nid = cfg->line_out_pins[0];
12947 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
12951 err = alc268_new_analog_output(spec, nid, name, 0);
12956 nid = cfg->speaker_pins[0];
12958 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
12959 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
12963 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
12967 nid = cfg->hp_pins[0];
12969 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
12974 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
12976 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
12977 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
12984 /* create playback/capture controls for input pins */
12985 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
12986 const struct auto_pin_cfg *cfg)
12988 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
12991 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
12992 hda_nid_t nid, int pin_type)
12996 alc_set_pin_output(codec, nid, pin_type);
12997 if (nid == 0x14 || nid == 0x16)
13001 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
13004 static void alc268_auto_init_multi_out(struct hda_codec *codec)
13006 struct alc_spec *spec = codec->spec;
13007 hda_nid_t nid = spec->autocfg.line_out_pins[0];
13009 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13010 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
13014 static void alc268_auto_init_hp_out(struct hda_codec *codec)
13016 struct alc_spec *spec = codec->spec;
13019 pin = spec->autocfg.hp_pins[0];
13021 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
13022 pin = spec->autocfg.speaker_pins[0];
13024 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
13027 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
13029 struct alc_spec *spec = codec->spec;
13030 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
13031 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
13032 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
13033 unsigned int dac_vol1, dac_vol2;
13035 if (line_nid == 0x1d || speaker_nid == 0x1d) {
13036 snd_hda_codec_write(codec, speaker_nid, 0,
13037 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
13038 /* mute mixer inputs from 0x1d */
13039 snd_hda_codec_write(codec, 0x0f, 0,
13040 AC_VERB_SET_AMP_GAIN_MUTE,
13042 snd_hda_codec_write(codec, 0x10, 0,
13043 AC_VERB_SET_AMP_GAIN_MUTE,
13046 /* unmute mixer inputs from 0x1d */
13047 snd_hda_codec_write(codec, 0x0f, 0,
13048 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13049 snd_hda_codec_write(codec, 0x10, 0,
13050 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13053 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
13054 if (line_nid == 0x14)
13055 dac_vol2 = AMP_OUT_ZERO;
13056 else if (line_nid == 0x15)
13057 dac_vol1 = AMP_OUT_ZERO;
13058 if (hp_nid == 0x14)
13059 dac_vol2 = AMP_OUT_ZERO;
13060 else if (hp_nid == 0x15)
13061 dac_vol1 = AMP_OUT_ZERO;
13062 if (line_nid != 0x16 || hp_nid != 0x16 ||
13063 spec->autocfg.line_out_pins[1] != 0x16 ||
13064 spec->autocfg.line_out_pins[2] != 0x16)
13065 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
13067 snd_hda_codec_write(codec, 0x02, 0,
13068 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
13069 snd_hda_codec_write(codec, 0x03, 0,
13070 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
13073 /* pcm configuration: identical with ALC880 */
13074 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
13075 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
13076 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
13077 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
13080 * BIOS auto configuration
13082 static int alc268_parse_auto_config(struct hda_codec *codec)
13084 struct alc_spec *spec = codec->spec;
13086 static hda_nid_t alc268_ignore[] = { 0 };
13088 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13092 if (!spec->autocfg.line_outs) {
13093 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
13094 spec->multiout.max_channels = 2;
13095 spec->no_analog = 1;
13098 return 0; /* can't find valid BIOS pin config */
13100 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
13103 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
13107 spec->multiout.max_channels = 2;
13110 /* digital only support output */
13111 if (spec->autocfg.dig_outs) {
13112 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
13113 spec->dig_out_type = spec->autocfg.dig_out_type[0];
13115 if (spec->kctls.list)
13116 add_mixer(spec, spec->kctls.list);
13118 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
13119 add_mixer(spec, alc268_beep_mixer);
13121 add_verb(spec, alc268_volume_init_verbs);
13122 spec->num_mux_defs = 2;
13123 spec->input_mux = &spec->private_imux[0];
13125 err = alc_auto_add_mic_boost(codec);
13129 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
13134 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
13136 /* init callback for auto-configuration model -- overriding the default init */
13137 static void alc268_auto_init(struct hda_codec *codec)
13139 struct alc_spec *spec = codec->spec;
13140 alc268_auto_init_multi_out(codec);
13141 alc268_auto_init_hp_out(codec);
13142 alc268_auto_init_mono_speaker_out(codec);
13143 alc268_auto_init_analog_input(codec);
13144 if (spec->unsol_event)
13145 alc_inithook(codec);
13149 * configuration and preset
13151 static const char *alc268_models[ALC268_MODEL_LAST] = {
13152 [ALC267_QUANTA_IL1] = "quanta-il1",
13153 [ALC268_3ST] = "3stack",
13154 [ALC268_TOSHIBA] = "toshiba",
13155 [ALC268_ACER] = "acer",
13156 [ALC268_ACER_DMIC] = "acer-dmic",
13157 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
13158 [ALC268_DELL] = "dell",
13159 [ALC268_ZEPTO] = "zepto",
13160 #ifdef CONFIG_SND_DEBUG
13161 [ALC268_TEST] = "test",
13163 [ALC268_AUTO] = "auto",
13166 static struct snd_pci_quirk alc268_cfg_tbl[] = {
13167 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
13168 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
13169 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
13170 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
13171 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
13172 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
13173 ALC268_ACER_ASPIRE_ONE),
13174 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
13175 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
13176 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
13177 /* almost compatible with toshiba but with optional digital outs;
13178 * auto-probing seems working fine
13180 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
13182 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
13183 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
13184 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
13185 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
13186 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
13187 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
13191 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
13192 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
13193 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
13194 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
13195 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
13200 static struct alc_config_preset alc268_presets[] = {
13201 [ALC267_QUANTA_IL1] = {
13202 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
13203 alc268_capture_nosrc_mixer },
13204 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13205 alc267_quanta_il1_verbs },
13206 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13207 .dac_nids = alc268_dac_nids,
13208 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13209 .adc_nids = alc268_adc_nids_alt,
13211 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13212 .channel_mode = alc268_modes,
13213 .unsol_event = alc_sku_unsol_event,
13214 .setup = alc267_quanta_il1_setup,
13215 .init_hook = alc_inithook,
13218 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13219 alc268_beep_mixer },
13220 .init_verbs = { alc268_base_init_verbs },
13221 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13222 .dac_nids = alc268_dac_nids,
13223 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13224 .adc_nids = alc268_adc_nids_alt,
13225 .capsrc_nids = alc268_capsrc_nids,
13227 .dig_out_nid = ALC268_DIGOUT_NID,
13228 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13229 .channel_mode = alc268_modes,
13230 .input_mux = &alc268_capture_source,
13232 [ALC268_TOSHIBA] = {
13233 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
13234 alc268_beep_mixer },
13235 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13236 alc268_toshiba_verbs },
13237 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13238 .dac_nids = alc268_dac_nids,
13239 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13240 .adc_nids = alc268_adc_nids_alt,
13241 .capsrc_nids = alc268_capsrc_nids,
13243 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13244 .channel_mode = alc268_modes,
13245 .input_mux = &alc268_capture_source,
13246 .unsol_event = alc268_toshiba_unsol_event,
13247 .setup = alc268_toshiba_setup,
13248 .init_hook = alc268_toshiba_automute,
13251 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
13252 alc268_beep_mixer },
13253 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13254 alc268_acer_verbs },
13255 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13256 .dac_nids = alc268_dac_nids,
13257 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13258 .adc_nids = alc268_adc_nids_alt,
13259 .capsrc_nids = alc268_capsrc_nids,
13261 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13262 .channel_mode = alc268_modes,
13263 .input_mux = &alc268_acer_capture_source,
13264 .unsol_event = alc268_acer_unsol_event,
13265 .init_hook = alc268_acer_init_hook,
13267 [ALC268_ACER_DMIC] = {
13268 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
13269 alc268_beep_mixer },
13270 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13271 alc268_acer_verbs },
13272 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13273 .dac_nids = alc268_dac_nids,
13274 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13275 .adc_nids = alc268_adc_nids_alt,
13276 .capsrc_nids = alc268_capsrc_nids,
13278 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13279 .channel_mode = alc268_modes,
13280 .input_mux = &alc268_acer_dmic_capture_source,
13281 .unsol_event = alc268_acer_unsol_event,
13282 .init_hook = alc268_acer_init_hook,
13284 [ALC268_ACER_ASPIRE_ONE] = {
13285 .mixers = { alc268_acer_aspire_one_mixer,
13287 alc268_capture_nosrc_mixer },
13288 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13289 alc268_acer_aspire_one_verbs },
13290 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13291 .dac_nids = alc268_dac_nids,
13292 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13293 .adc_nids = alc268_adc_nids_alt,
13294 .capsrc_nids = alc268_capsrc_nids,
13296 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13297 .channel_mode = alc268_modes,
13298 .unsol_event = alc268_acer_lc_unsol_event,
13299 .setup = alc268_acer_lc_setup,
13300 .init_hook = alc268_acer_lc_init_hook,
13303 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
13304 alc268_capture_nosrc_mixer },
13305 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13306 alc268_dell_verbs },
13307 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13308 .dac_nids = alc268_dac_nids,
13309 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13310 .adc_nids = alc268_adc_nids_alt,
13311 .capsrc_nids = alc268_capsrc_nids,
13313 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13314 .channel_mode = alc268_modes,
13315 .unsol_event = alc_sku_unsol_event,
13316 .setup = alc268_dell_setup,
13317 .init_hook = alc_inithook,
13320 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13321 alc268_beep_mixer },
13322 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13323 alc268_toshiba_verbs },
13324 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13325 .dac_nids = alc268_dac_nids,
13326 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13327 .adc_nids = alc268_adc_nids_alt,
13328 .capsrc_nids = alc268_capsrc_nids,
13330 .dig_out_nid = ALC268_DIGOUT_NID,
13331 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13332 .channel_mode = alc268_modes,
13333 .input_mux = &alc268_capture_source,
13334 .setup = alc268_toshiba_setup,
13335 .init_hook = alc268_toshiba_automute,
13337 #ifdef CONFIG_SND_DEBUG
13339 .mixers = { alc268_test_mixer, alc268_capture_mixer },
13340 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13341 alc268_volume_init_verbs },
13342 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13343 .dac_nids = alc268_dac_nids,
13344 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13345 .adc_nids = alc268_adc_nids_alt,
13346 .capsrc_nids = alc268_capsrc_nids,
13348 .dig_out_nid = ALC268_DIGOUT_NID,
13349 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13350 .channel_mode = alc268_modes,
13351 .input_mux = &alc268_capture_source,
13356 static int patch_alc268(struct hda_codec *codec)
13358 struct alc_spec *spec;
13360 int i, has_beep, err;
13362 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13366 codec->spec = spec;
13368 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
13372 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
13373 board_config = snd_hda_check_board_codec_sid_config(codec,
13374 ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
13376 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
13377 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13379 board_config = ALC268_AUTO;
13382 if (board_config == ALC268_AUTO) {
13383 /* automatic parse from the BIOS config */
13384 err = alc268_parse_auto_config(codec);
13390 "hda_codec: Cannot set up configuration "
13391 "from BIOS. Using base mode...\n");
13392 board_config = ALC268_3ST;
13396 if (board_config != ALC268_AUTO)
13397 setup_preset(codec, &alc268_presets[board_config]);
13399 spec->stream_analog_playback = &alc268_pcm_analog_playback;
13400 spec->stream_analog_capture = &alc268_pcm_analog_capture;
13401 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
13403 spec->stream_digital_playback = &alc268_pcm_digital_playback;
13406 for (i = 0; i < spec->num_mixers; i++) {
13407 if (spec->mixers[i] == alc268_beep_mixer) {
13414 err = snd_hda_attach_beep_device(codec, 0x1);
13419 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
13420 /* override the amp caps for beep generator */
13421 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
13422 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
13423 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
13424 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
13425 (0 << AC_AMPCAP_MUTE_SHIFT));
13428 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
13429 /* check whether NID 0x07 is valid */
13430 unsigned int wcap = get_wcaps(codec, 0x07);
13433 spec->capsrc_nids = alc268_capsrc_nids;
13435 wcap = get_wcaps_type(wcap);
13436 if (spec->auto_mic ||
13437 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
13438 spec->adc_nids = alc268_adc_nids_alt;
13439 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
13440 if (spec->auto_mic)
13441 fixup_automic_adc(codec);
13442 if (spec->auto_mic || spec->input_mux->num_items == 1)
13443 add_mixer(spec, alc268_capture_nosrc_mixer);
13445 add_mixer(spec, alc268_capture_alt_mixer);
13447 spec->adc_nids = alc268_adc_nids;
13448 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
13449 add_mixer(spec, alc268_capture_mixer);
13451 /* set default input source */
13452 for (i = 0; i < spec->num_adc_nids; i++)
13453 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
13454 0, AC_VERB_SET_CONNECT_SEL,
13455 i < spec->num_mux_defs ?
13456 spec->input_mux[i].items[0].index :
13457 spec->input_mux->items[0].index);
13460 spec->vmaster_nid = 0x02;
13462 codec->patch_ops = alc_patch_ops;
13463 if (board_config == ALC268_AUTO)
13464 spec->init_hook = alc268_auto_init;
13470 * ALC269 channel source setting (2 channel)
13472 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
13474 #define alc269_dac_nids alc260_dac_nids
13476 static hda_nid_t alc269_adc_nids[1] = {
13481 static hda_nid_t alc269_capsrc_nids[1] = {
13485 static hda_nid_t alc269vb_adc_nids[1] = {
13490 static hda_nid_t alc269vb_capsrc_nids[1] = {
13494 static hda_nid_t alc269_adc_candidates[] = {
13498 #define alc269_modes alc260_modes
13499 #define alc269_capture_source alc880_lg_lw_capture_source
13501 static struct snd_kcontrol_new alc269_base_mixer[] = {
13502 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13503 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13504 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13505 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13506 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13507 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13508 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13509 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13510 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13511 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13512 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13513 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
13517 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
13518 /* output mixer control */
13519 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13521 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13522 .name = "Master Playback Switch",
13523 .subdevice = HDA_SUBDEV_AMP_FLAG,
13524 .info = snd_hda_mixer_amp_switch_info,
13525 .get = snd_hda_mixer_amp_switch_get,
13526 .put = alc268_acer_master_sw_put,
13527 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13529 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13530 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13531 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13532 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13533 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13534 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13538 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
13539 /* output mixer control */
13540 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13542 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13543 .name = "Master Playback Switch",
13544 .subdevice = HDA_SUBDEV_AMP_FLAG,
13545 .info = snd_hda_mixer_amp_switch_info,
13546 .get = snd_hda_mixer_amp_switch_get,
13547 .put = alc268_acer_master_sw_put,
13548 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13550 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13551 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13552 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13553 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13554 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13555 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13556 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
13557 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
13558 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
13562 static struct snd_kcontrol_new alc269_laptop_mixer[] = {
13563 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13564 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13565 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13566 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13570 static struct snd_kcontrol_new alc269vb_laptop_mixer[] = {
13571 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13572 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13573 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
13574 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13578 /* capture mixer elements */
13579 static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = {
13580 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13581 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13582 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13583 HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT),
13587 static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = {
13588 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13589 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13590 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13594 static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = {
13595 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13596 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13597 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13598 HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT),
13602 static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = {
13603 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13604 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13605 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13610 #define alc269_fujitsu_mixer alc269_laptop_mixer
13612 static struct hda_verb alc269_quanta_fl1_verbs[] = {
13613 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13614 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13615 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13616 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13617 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13618 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13622 static struct hda_verb alc269_lifebook_verbs[] = {
13623 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13624 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
13625 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13626 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13627 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13628 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13629 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13630 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13631 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13632 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13636 /* toggle speaker-output according to the hp-jack state */
13637 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
13639 unsigned int present;
13640 unsigned char bits;
13642 present = snd_hda_jack_detect(codec, 0x15);
13643 bits = present ? HDA_AMP_MUTE : 0;
13644 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13645 HDA_AMP_MUTE, bits);
13646 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13647 HDA_AMP_MUTE, bits);
13649 snd_hda_codec_write(codec, 0x20, 0,
13650 AC_VERB_SET_COEF_INDEX, 0x0c);
13651 snd_hda_codec_write(codec, 0x20, 0,
13652 AC_VERB_SET_PROC_COEF, 0x680);
13654 snd_hda_codec_write(codec, 0x20, 0,
13655 AC_VERB_SET_COEF_INDEX, 0x0c);
13656 snd_hda_codec_write(codec, 0x20, 0,
13657 AC_VERB_SET_PROC_COEF, 0x480);
13660 /* toggle speaker-output according to the hp-jacks state */
13661 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
13663 unsigned int present;
13664 unsigned char bits;
13666 /* Check laptop headphone socket */
13667 present = snd_hda_jack_detect(codec, 0x15);
13669 /* Check port replicator headphone socket */
13670 present |= snd_hda_jack_detect(codec, 0x1a);
13672 bits = present ? HDA_AMP_MUTE : 0;
13673 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13674 HDA_AMP_MUTE, bits);
13675 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13676 HDA_AMP_MUTE, bits);
13678 snd_hda_codec_write(codec, 0x20, 0,
13679 AC_VERB_SET_COEF_INDEX, 0x0c);
13680 snd_hda_codec_write(codec, 0x20, 0,
13681 AC_VERB_SET_PROC_COEF, 0x680);
13683 snd_hda_codec_write(codec, 0x20, 0,
13684 AC_VERB_SET_COEF_INDEX, 0x0c);
13685 snd_hda_codec_write(codec, 0x20, 0,
13686 AC_VERB_SET_PROC_COEF, 0x480);
13689 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
13691 unsigned int present_laptop;
13692 unsigned int present_dock;
13694 present_laptop = snd_hda_jack_detect(codec, 0x18);
13695 present_dock = snd_hda_jack_detect(codec, 0x1b);
13697 /* Laptop mic port overrides dock mic port, design decision */
13699 snd_hda_codec_write(codec, 0x23, 0,
13700 AC_VERB_SET_CONNECT_SEL, 0x3);
13701 if (present_laptop)
13702 snd_hda_codec_write(codec, 0x23, 0,
13703 AC_VERB_SET_CONNECT_SEL, 0x0);
13704 if (!present_dock && !present_laptop)
13705 snd_hda_codec_write(codec, 0x23, 0,
13706 AC_VERB_SET_CONNECT_SEL, 0x1);
13709 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
13712 switch (res >> 26) {
13713 case ALC880_HP_EVENT:
13714 alc269_quanta_fl1_speaker_automute(codec);
13716 case ALC880_MIC_EVENT:
13717 alc_mic_automute(codec);
13722 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
13725 if ((res >> 26) == ALC880_HP_EVENT)
13726 alc269_lifebook_speaker_automute(codec);
13727 if ((res >> 26) == ALC880_MIC_EVENT)
13728 alc269_lifebook_mic_autoswitch(codec);
13731 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
13733 struct alc_spec *spec = codec->spec;
13734 spec->autocfg.hp_pins[0] = 0x15;
13735 spec->autocfg.speaker_pins[0] = 0x14;
13736 spec->ext_mic.pin = 0x18;
13737 spec->ext_mic.mux_idx = 0;
13738 spec->int_mic.pin = 0x19;
13739 spec->int_mic.mux_idx = 1;
13740 spec->auto_mic = 1;
13743 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
13745 alc269_quanta_fl1_speaker_automute(codec);
13746 alc_mic_automute(codec);
13749 static void alc269_lifebook_init_hook(struct hda_codec *codec)
13751 alc269_lifebook_speaker_automute(codec);
13752 alc269_lifebook_mic_autoswitch(codec);
13755 static struct hda_verb alc269_laptop_dmic_init_verbs[] = {
13756 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13757 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
13758 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13759 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13760 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13761 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13762 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13766 static struct hda_verb alc269_laptop_amic_init_verbs[] = {
13767 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13768 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
13769 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13770 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
13771 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13772 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13776 static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = {
13777 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
13778 {0x22, AC_VERB_SET_CONNECT_SEL, 0x06},
13779 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13780 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13781 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13782 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13783 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13787 static struct hda_verb alc269vb_laptop_amic_init_verbs[] = {
13788 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
13789 {0x22, AC_VERB_SET_CONNECT_SEL, 0x01},
13790 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13791 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13792 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13793 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13794 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13798 /* toggle speaker-output according to the hp-jack state */
13799 static void alc269_speaker_automute(struct hda_codec *codec)
13801 struct alc_spec *spec = codec->spec;
13802 unsigned int nid = spec->autocfg.hp_pins[0];
13803 unsigned int present;
13804 unsigned char bits;
13806 present = snd_hda_jack_detect(codec, nid);
13807 bits = present ? HDA_AMP_MUTE : 0;
13808 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13809 HDA_AMP_MUTE, bits);
13810 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13811 HDA_AMP_MUTE, bits);
13814 /* unsolicited event for HP jack sensing */
13815 static void alc269_laptop_unsol_event(struct hda_codec *codec,
13818 switch (res >> 26) {
13819 case ALC880_HP_EVENT:
13820 alc269_speaker_automute(codec);
13822 case ALC880_MIC_EVENT:
13823 alc_mic_automute(codec);
13828 static void alc269_laptop_amic_setup(struct hda_codec *codec)
13830 struct alc_spec *spec = codec->spec;
13831 spec->autocfg.hp_pins[0] = 0x15;
13832 spec->autocfg.speaker_pins[0] = 0x14;
13833 spec->ext_mic.pin = 0x18;
13834 spec->ext_mic.mux_idx = 0;
13835 spec->int_mic.pin = 0x19;
13836 spec->int_mic.mux_idx = 1;
13837 spec->auto_mic = 1;
13840 static void alc269_laptop_dmic_setup(struct hda_codec *codec)
13842 struct alc_spec *spec = codec->spec;
13843 spec->autocfg.hp_pins[0] = 0x15;
13844 spec->autocfg.speaker_pins[0] = 0x14;
13845 spec->ext_mic.pin = 0x18;
13846 spec->ext_mic.mux_idx = 0;
13847 spec->int_mic.pin = 0x12;
13848 spec->int_mic.mux_idx = 5;
13849 spec->auto_mic = 1;
13852 static void alc269vb_laptop_amic_setup(struct hda_codec *codec)
13854 struct alc_spec *spec = codec->spec;
13855 spec->autocfg.hp_pins[0] = 0x21;
13856 spec->autocfg.speaker_pins[0] = 0x14;
13857 spec->ext_mic.pin = 0x18;
13858 spec->ext_mic.mux_idx = 0;
13859 spec->int_mic.pin = 0x19;
13860 spec->int_mic.mux_idx = 1;
13861 spec->auto_mic = 1;
13864 static void alc269vb_laptop_dmic_setup(struct hda_codec *codec)
13866 struct alc_spec *spec = codec->spec;
13867 spec->autocfg.hp_pins[0] = 0x21;
13868 spec->autocfg.speaker_pins[0] = 0x14;
13869 spec->ext_mic.pin = 0x18;
13870 spec->ext_mic.mux_idx = 0;
13871 spec->int_mic.pin = 0x12;
13872 spec->int_mic.mux_idx = 6;
13873 spec->auto_mic = 1;
13876 static void alc269_laptop_inithook(struct hda_codec *codec)
13878 alc269_speaker_automute(codec);
13879 alc_mic_automute(codec);
13883 * generic initialization of ADC, input mixers and output mixers
13885 static struct hda_verb alc269_init_verbs[] = {
13887 * Unmute ADC0 and set the default input to mic-in
13889 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13892 * Set up output mixers (0x02 - 0x03)
13894 /* set vol=0 to output mixers */
13895 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13896 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13898 /* set up input amps for analog loopback */
13899 /* Amp Indices: DAC = 0, mixer = 1 */
13900 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13901 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13902 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13903 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13904 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13905 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13907 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13908 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13909 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13910 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13911 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13912 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13913 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13915 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13916 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13918 /* FIXME: use Mux-type input source selection */
13919 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13920 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13921 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
13924 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13928 static struct hda_verb alc269vb_init_verbs[] = {
13930 * Unmute ADC0 and set the default input to mic-in
13932 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13935 * Set up output mixers (0x02 - 0x03)
13937 /* set vol=0 to output mixers */
13938 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13939 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13941 /* set up input amps for analog loopback */
13942 /* Amp Indices: DAC = 0, mixer = 1 */
13943 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13944 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13945 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13946 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13947 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13948 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13950 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13951 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13952 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13953 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13954 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13955 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13956 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13958 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13959 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13961 /* FIXME: use Mux-type input source selection */
13962 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13963 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13964 {0x22, AC_VERB_SET_CONNECT_SEL, 0x00},
13967 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13971 #define alc269_auto_create_multi_out_ctls \
13972 alc268_auto_create_multi_out_ctls
13973 #define alc269_auto_create_input_ctls \
13974 alc268_auto_create_input_ctls
13976 #ifdef CONFIG_SND_HDA_POWER_SAVE
13977 #define alc269_loopbacks alc880_loopbacks
13980 /* pcm configuration: identical with ALC880 */
13981 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
13982 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
13983 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
13984 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
13986 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
13990 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13991 /* NID is set in alc_build_pcms */
13993 .open = alc880_playback_pcm_open,
13994 .prepare = alc880_playback_pcm_prepare,
13995 .cleanup = alc880_playback_pcm_cleanup
13999 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
14003 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14004 /* NID is set in alc_build_pcms */
14008 * BIOS auto configuration
14010 static int alc269_parse_auto_config(struct hda_codec *codec)
14012 struct alc_spec *spec = codec->spec;
14014 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
14016 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14021 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
14024 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
14028 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14030 if (spec->autocfg.dig_outs)
14031 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
14033 if (spec->kctls.list)
14034 add_mixer(spec, spec->kctls.list);
14036 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010) {
14037 add_verb(spec, alc269vb_init_verbs);
14038 alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21);
14040 add_verb(spec, alc269_init_verbs);
14041 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
14044 spec->num_mux_defs = 1;
14045 spec->input_mux = &spec->private_imux[0];
14046 fillup_priv_adc_nids(codec, alc269_adc_candidates,
14047 sizeof(alc269_adc_candidates));
14049 /* set default input source */
14050 snd_hda_codec_write_cache(codec, spec->capsrc_nids[0],
14051 0, AC_VERB_SET_CONNECT_SEL,
14052 spec->input_mux->items[0].index);
14054 err = alc_auto_add_mic_boost(codec);
14058 if (!spec->cap_mixer && !spec->no_analog)
14059 set_capture_mixer(codec);
14064 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
14065 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
14066 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
14069 /* init callback for auto-configuration model -- overriding the default init */
14070 static void alc269_auto_init(struct hda_codec *codec)
14072 struct alc_spec *spec = codec->spec;
14073 alc269_auto_init_multi_out(codec);
14074 alc269_auto_init_hp_out(codec);
14075 alc269_auto_init_analog_input(codec);
14076 if (spec->unsol_event)
14077 alc_inithook(codec);
14081 ALC269_FIXUP_SONY_VAIO,
14084 const static struct hda_verb alc269_sony_vaio_fixup_verbs[] = {
14085 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD},
14089 static const struct alc_fixup alc269_fixups[] = {
14090 [ALC269_FIXUP_SONY_VAIO] = {
14091 .verbs = alc269_sony_vaio_fixup_verbs
14095 static struct snd_pci_quirk alc269_fixup_tbl[] = {
14096 SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
14102 * configuration and preset
14104 static const char *alc269_models[ALC269_MODEL_LAST] = {
14105 [ALC269_BASIC] = "basic",
14106 [ALC269_QUANTA_FL1] = "quanta",
14107 [ALC269_AMIC] = "laptop-amic",
14108 [ALC269_DMIC] = "laptop-dmic",
14109 [ALC269_FUJITSU] = "fujitsu",
14110 [ALC269_LIFEBOOK] = "lifebook",
14111 [ALC269_AUTO] = "auto",
14114 static struct snd_pci_quirk alc269_cfg_tbl[] = {
14115 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
14116 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
14118 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC),
14119 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC),
14120 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC),
14121 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC),
14122 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC),
14123 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC),
14124 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC),
14125 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC),
14126 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC),
14127 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC),
14128 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC),
14129 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC),
14130 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC),
14131 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC),
14132 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC),
14133 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC),
14134 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC),
14135 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC),
14136 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC),
14137 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC),
14138 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC),
14139 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC),
14140 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC),
14141 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC),
14142 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC),
14143 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC),
14144 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC),
14145 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC),
14146 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC),
14147 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC),
14148 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC),
14149 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC),
14150 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC),
14151 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC),
14152 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC),
14153 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC),
14154 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
14156 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
14158 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC),
14159 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC),
14160 SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO),
14161 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
14162 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC),
14163 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
14164 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC),
14165 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC),
14166 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC),
14167 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC),
14171 static struct alc_config_preset alc269_presets[] = {
14173 .mixers = { alc269_base_mixer },
14174 .init_verbs = { alc269_init_verbs },
14175 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14176 .dac_nids = alc269_dac_nids,
14178 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14179 .channel_mode = alc269_modes,
14180 .input_mux = &alc269_capture_source,
14182 [ALC269_QUANTA_FL1] = {
14183 .mixers = { alc269_quanta_fl1_mixer },
14184 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
14185 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14186 .dac_nids = alc269_dac_nids,
14188 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14189 .channel_mode = alc269_modes,
14190 .input_mux = &alc269_capture_source,
14191 .unsol_event = alc269_quanta_fl1_unsol_event,
14192 .setup = alc269_quanta_fl1_setup,
14193 .init_hook = alc269_quanta_fl1_init_hook,
14196 .mixers = { alc269_laptop_mixer },
14197 .cap_mixer = alc269_laptop_analog_capture_mixer,
14198 .init_verbs = { alc269_init_verbs,
14199 alc269_laptop_amic_init_verbs },
14200 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14201 .dac_nids = alc269_dac_nids,
14203 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14204 .channel_mode = alc269_modes,
14205 .unsol_event = alc269_laptop_unsol_event,
14206 .setup = alc269_laptop_amic_setup,
14207 .init_hook = alc269_laptop_inithook,
14210 .mixers = { alc269_laptop_mixer },
14211 .cap_mixer = alc269_laptop_digital_capture_mixer,
14212 .init_verbs = { alc269_init_verbs,
14213 alc269_laptop_dmic_init_verbs },
14214 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14215 .dac_nids = alc269_dac_nids,
14217 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14218 .channel_mode = alc269_modes,
14219 .unsol_event = alc269_laptop_unsol_event,
14220 .setup = alc269_laptop_dmic_setup,
14221 .init_hook = alc269_laptop_inithook,
14223 [ALC269VB_AMIC] = {
14224 .mixers = { alc269vb_laptop_mixer },
14225 .cap_mixer = alc269vb_laptop_analog_capture_mixer,
14226 .init_verbs = { alc269vb_init_verbs,
14227 alc269vb_laptop_amic_init_verbs },
14228 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14229 .dac_nids = alc269_dac_nids,
14231 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14232 .channel_mode = alc269_modes,
14233 .unsol_event = alc269_laptop_unsol_event,
14234 .setup = alc269vb_laptop_amic_setup,
14235 .init_hook = alc269_laptop_inithook,
14237 [ALC269VB_DMIC] = {
14238 .mixers = { alc269vb_laptop_mixer },
14239 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
14240 .init_verbs = { alc269vb_init_verbs,
14241 alc269vb_laptop_dmic_init_verbs },
14242 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14243 .dac_nids = alc269_dac_nids,
14245 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14246 .channel_mode = alc269_modes,
14247 .unsol_event = alc269_laptop_unsol_event,
14248 .setup = alc269vb_laptop_dmic_setup,
14249 .init_hook = alc269_laptop_inithook,
14251 [ALC269_FUJITSU] = {
14252 .mixers = { alc269_fujitsu_mixer },
14253 .cap_mixer = alc269_laptop_digital_capture_mixer,
14254 .init_verbs = { alc269_init_verbs,
14255 alc269_laptop_dmic_init_verbs },
14256 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14257 .dac_nids = alc269_dac_nids,
14259 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14260 .channel_mode = alc269_modes,
14261 .unsol_event = alc269_laptop_unsol_event,
14262 .setup = alc269_laptop_dmic_setup,
14263 .init_hook = alc269_laptop_inithook,
14265 [ALC269_LIFEBOOK] = {
14266 .mixers = { alc269_lifebook_mixer },
14267 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
14268 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14269 .dac_nids = alc269_dac_nids,
14271 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14272 .channel_mode = alc269_modes,
14273 .input_mux = &alc269_capture_source,
14274 .unsol_event = alc269_lifebook_unsol_event,
14275 .init_hook = alc269_lifebook_init_hook,
14279 static int patch_alc269(struct hda_codec *codec)
14281 struct alc_spec *spec;
14284 int is_alc269vb = 0;
14286 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14290 codec->spec = spec;
14292 alc_fix_pll_init(codec, 0x20, 0x04, 15);
14294 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){
14295 kfree(codec->chip_name);
14296 codec->chip_name = kstrdup("ALC259", GFP_KERNEL);
14297 if (!codec->chip_name) {
14304 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
14308 if (board_config < 0) {
14309 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14311 board_config = ALC269_AUTO;
14314 if (board_config == ALC269_AUTO)
14315 alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 1);
14317 if (board_config == ALC269_AUTO) {
14318 /* automatic parse from the BIOS config */
14319 err = alc269_parse_auto_config(codec);
14325 "hda_codec: Cannot set up configuration "
14326 "from BIOS. Using base mode...\n");
14327 board_config = ALC269_BASIC;
14331 err = snd_hda_attach_beep_device(codec, 0x1);
14337 if (board_config != ALC269_AUTO)
14338 setup_preset(codec, &alc269_presets[board_config]);
14340 if (board_config == ALC269_QUANTA_FL1) {
14341 /* Due to a hardware problem on Lenovo Ideadpad, we need to
14342 * fix the sample rate of analog I/O to 44.1kHz
14344 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
14345 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
14347 spec->stream_analog_playback = &alc269_pcm_analog_playback;
14348 spec->stream_analog_capture = &alc269_pcm_analog_capture;
14350 spec->stream_digital_playback = &alc269_pcm_digital_playback;
14351 spec->stream_digital_capture = &alc269_pcm_digital_capture;
14353 if (!spec->adc_nids) { /* wasn't filled automatically? use default */
14354 if (!is_alc269vb) {
14355 spec->adc_nids = alc269_adc_nids;
14356 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
14357 spec->capsrc_nids = alc269_capsrc_nids;
14359 spec->adc_nids = alc269vb_adc_nids;
14360 spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids);
14361 spec->capsrc_nids = alc269vb_capsrc_nids;
14365 if (!spec->cap_mixer)
14366 set_capture_mixer(codec);
14367 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
14369 if (board_config == ALC269_AUTO)
14370 alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 0);
14372 spec->vmaster_nid = 0x02;
14374 codec->patch_ops = alc_patch_ops;
14375 if (board_config == ALC269_AUTO)
14376 spec->init_hook = alc269_auto_init;
14377 #ifdef CONFIG_SND_HDA_POWER_SAVE
14378 if (!spec->loopback.amplist)
14379 spec->loopback.amplist = alc269_loopbacks;
14386 * ALC861 channel source setting (2/6 channel selection for 3-stack)
14390 * set the path ways for 2 channel output
14391 * need to set the codec line out and mic 1 pin widgets to inputs
14393 static struct hda_verb alc861_threestack_ch2_init[] = {
14394 /* set pin widget 1Ah (line in) for input */
14395 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14396 /* set pin widget 18h (mic1/2) for input, for mic also enable
14399 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14401 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
14403 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14404 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
14410 * need to set the codec line out and mic 1 pin widgets to outputs
14412 static struct hda_verb alc861_threestack_ch6_init[] = {
14413 /* set pin widget 1Ah (line in) for output (Back Surround)*/
14414 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14415 /* set pin widget 18h (mic1) for output (CLFE)*/
14416 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14418 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
14419 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
14421 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
14423 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14424 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
14429 static struct hda_channel_mode alc861_threestack_modes[2] = {
14430 { 2, alc861_threestack_ch2_init },
14431 { 6, alc861_threestack_ch6_init },
14433 /* Set mic1 as input and unmute the mixer */
14434 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
14435 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14436 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14439 /* Set mic1 as output and mute mixer */
14440 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
14441 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14442 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14446 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
14447 { 2, alc861_uniwill_m31_ch2_init },
14448 { 4, alc861_uniwill_m31_ch4_init },
14451 /* Set mic1 and line-in as input and unmute the mixer */
14452 static struct hda_verb alc861_asus_ch2_init[] = {
14453 /* set pin widget 1Ah (line in) for input */
14454 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14455 /* set pin widget 18h (mic1/2) for input, for mic also enable
14458 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14460 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
14462 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14463 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
14467 /* Set mic1 nad line-in as output and mute mixer */
14468 static struct hda_verb alc861_asus_ch6_init[] = {
14469 /* set pin widget 1Ah (line in) for output (Back Surround)*/
14470 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14471 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
14472 /* set pin widget 18h (mic1) for output (CLFE)*/
14473 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14474 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
14475 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
14476 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
14478 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
14480 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14481 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
14486 static struct hda_channel_mode alc861_asus_modes[2] = {
14487 { 2, alc861_asus_ch2_init },
14488 { 6, alc861_asus_ch6_init },
14493 static struct snd_kcontrol_new alc861_base_mixer[] = {
14494 /* output mixer control */
14495 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14496 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14497 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14498 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14499 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
14501 /*Input mixer control */
14502 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14503 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14504 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14505 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14506 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14507 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14508 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14509 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14510 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14511 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14516 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
14517 /* output mixer control */
14518 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14519 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14520 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14521 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14522 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
14524 /* Input mixer control */
14525 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14526 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14527 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14528 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14529 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14530 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14531 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14532 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14533 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14534 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14537 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14538 .name = "Channel Mode",
14539 .info = alc_ch_mode_info,
14540 .get = alc_ch_mode_get,
14541 .put = alc_ch_mode_put,
14542 .private_value = ARRAY_SIZE(alc861_threestack_modes),
14547 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
14548 /* output mixer control */
14549 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14550 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14551 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14556 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
14557 /* output mixer control */
14558 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14559 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14560 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14561 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14562 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
14564 /* Input mixer control */
14565 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14566 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14567 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14568 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14569 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14570 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14571 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14572 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14573 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14574 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14577 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14578 .name = "Channel Mode",
14579 .info = alc_ch_mode_info,
14580 .get = alc_ch_mode_get,
14581 .put = alc_ch_mode_put,
14582 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
14587 static struct snd_kcontrol_new alc861_asus_mixer[] = {
14588 /* output mixer control */
14589 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14590 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14591 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14592 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14593 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
14595 /* Input mixer control */
14596 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14597 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14598 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14599 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14600 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14601 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14602 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14603 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14604 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14605 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
14608 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14609 .name = "Channel Mode",
14610 .info = alc_ch_mode_info,
14611 .get = alc_ch_mode_get,
14612 .put = alc_ch_mode_put,
14613 .private_value = ARRAY_SIZE(alc861_asus_modes),
14618 /* additional mixer */
14619 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
14620 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14621 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14626 * generic initialization of ADC, input mixers and output mixers
14628 static struct hda_verb alc861_base_init_verbs[] = {
14630 * Unmute ADC0 and set the default input to mic-in
14632 /* port-A for surround (rear panel) */
14633 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14634 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
14635 /* port-B for mic-in (rear panel) with vref */
14636 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14637 /* port-C for line-in (rear panel) */
14638 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14639 /* port-D for Front */
14640 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14641 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14642 /* port-E for HP out (front panel) */
14643 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14644 /* route front PCM to HP */
14645 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14646 /* port-F for mic-in (front panel) with vref */
14647 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14648 /* port-G for CLFE (rear panel) */
14649 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14650 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14651 /* port-H for side (rear panel) */
14652 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14653 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
14655 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14656 /* route front mic to ADC1*/
14657 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14658 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14660 /* Unmute DAC0~3 & spdif out*/
14661 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14662 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14663 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14664 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14665 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14667 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14668 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14669 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14670 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14671 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14673 /* Unmute Stereo Mixer 15 */
14674 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14675 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14676 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14677 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14679 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14680 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14681 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14682 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14683 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14684 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14685 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14686 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14687 /* hp used DAC 3 (Front) */
14688 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14689 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14694 static struct hda_verb alc861_threestack_init_verbs[] = {
14696 * Unmute ADC0 and set the default input to mic-in
14698 /* port-A for surround (rear panel) */
14699 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14700 /* port-B for mic-in (rear panel) with vref */
14701 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14702 /* port-C for line-in (rear panel) */
14703 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14704 /* port-D for Front */
14705 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14706 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14707 /* port-E for HP out (front panel) */
14708 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14709 /* route front PCM to HP */
14710 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14711 /* port-F for mic-in (front panel) with vref */
14712 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14713 /* port-G for CLFE (rear panel) */
14714 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14715 /* port-H for side (rear panel) */
14716 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14718 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14719 /* route front mic to ADC1*/
14720 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14721 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14722 /* Unmute DAC0~3 & spdif out*/
14723 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14724 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14725 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14726 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14727 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14729 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14730 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14731 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14732 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14733 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14735 /* Unmute Stereo Mixer 15 */
14736 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14737 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14738 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14739 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14741 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14742 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14743 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14744 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14745 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14746 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14747 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14748 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14749 /* hp used DAC 3 (Front) */
14750 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14751 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14755 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
14757 * Unmute ADC0 and set the default input to mic-in
14759 /* port-A for surround (rear panel) */
14760 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14761 /* port-B for mic-in (rear panel) with vref */
14762 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14763 /* port-C for line-in (rear panel) */
14764 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14765 /* port-D for Front */
14766 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14767 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14768 /* port-E for HP out (front panel) */
14769 /* this has to be set to VREF80 */
14770 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14771 /* route front PCM to HP */
14772 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14773 /* port-F for mic-in (front panel) with vref */
14774 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14775 /* port-G for CLFE (rear panel) */
14776 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14777 /* port-H for side (rear panel) */
14778 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14780 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14781 /* route front mic to ADC1*/
14782 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14783 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14784 /* Unmute DAC0~3 & spdif out*/
14785 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14786 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14787 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14788 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14789 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14791 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14792 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14793 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14794 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14795 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14797 /* Unmute Stereo Mixer 15 */
14798 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14799 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14800 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14801 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14803 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14804 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14805 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14806 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14807 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14808 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14809 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14810 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14811 /* hp used DAC 3 (Front) */
14812 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14813 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14817 static struct hda_verb alc861_asus_init_verbs[] = {
14819 * Unmute ADC0 and set the default input to mic-in
14821 /* port-A for surround (rear panel)
14822 * according to codec#0 this is the HP jack
14824 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
14825 /* route front PCM to HP */
14826 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
14827 /* port-B for mic-in (rear panel) with vref */
14828 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14829 /* port-C for line-in (rear panel) */
14830 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14831 /* port-D for Front */
14832 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14833 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14834 /* port-E for HP out (front panel) */
14835 /* this has to be set to VREF80 */
14836 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14837 /* route front PCM to HP */
14838 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14839 /* port-F for mic-in (front panel) with vref */
14840 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14841 /* port-G for CLFE (rear panel) */
14842 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14843 /* port-H for side (rear panel) */
14844 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14846 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14847 /* route front mic to ADC1*/
14848 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14849 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14850 /* Unmute DAC0~3 & spdif out*/
14851 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14852 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14853 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14854 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14855 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14856 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14857 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14858 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14859 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14860 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14862 /* Unmute Stereo Mixer 15 */
14863 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14864 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14865 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14866 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14868 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14869 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14870 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14871 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14872 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14873 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14874 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14875 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14876 /* hp used DAC 3 (Front) */
14877 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14878 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14882 /* additional init verbs for ASUS laptops */
14883 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
14884 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
14885 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
14890 * generic initialization of ADC, input mixers and output mixers
14892 static struct hda_verb alc861_auto_init_verbs[] = {
14894 * Unmute ADC0 and set the default input to mic-in
14896 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
14897 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14899 /* Unmute DAC0~3 & spdif out*/
14900 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14901 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14902 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14903 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14904 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14906 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14907 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14908 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14909 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14910 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14912 /* Unmute Stereo Mixer 15 */
14913 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14914 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14915 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14916 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
14918 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14919 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14920 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14921 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14922 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14923 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14924 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14925 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14927 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14928 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14929 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14930 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14931 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14932 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14933 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14934 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14936 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
14941 static struct hda_verb alc861_toshiba_init_verbs[] = {
14942 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14947 /* toggle speaker-output according to the hp-jack state */
14948 static void alc861_toshiba_automute(struct hda_codec *codec)
14950 unsigned int present = snd_hda_jack_detect(codec, 0x0f);
14952 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
14953 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14954 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
14955 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
14958 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
14961 if ((res >> 26) == ALC880_HP_EVENT)
14962 alc861_toshiba_automute(codec);
14965 /* pcm configuration: identical with ALC880 */
14966 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
14967 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
14968 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
14969 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
14972 #define ALC861_DIGOUT_NID 0x07
14974 static struct hda_channel_mode alc861_8ch_modes[1] = {
14978 static hda_nid_t alc861_dac_nids[4] = {
14979 /* front, surround, clfe, side */
14980 0x03, 0x06, 0x05, 0x04
14983 static hda_nid_t alc660_dac_nids[3] = {
14984 /* front, clfe, surround */
14988 static hda_nid_t alc861_adc_nids[1] = {
14993 static struct hda_input_mux alc861_capture_source = {
14997 { "Front Mic", 0x3 },
15004 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
15006 struct alc_spec *spec = codec->spec;
15007 hda_nid_t mix, srcs[5];
15010 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
15012 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
15015 for (i = 0; i < num; i++) {
15017 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
15018 if (type != AC_WID_AUD_OUT)
15020 for (j = 0; j < spec->multiout.num_dacs; j++)
15021 if (spec->multiout.dac_nids[j] == srcs[i])
15023 if (j >= spec->multiout.num_dacs)
15029 /* fill in the dac_nids table from the parsed pin configuration */
15030 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
15031 const struct auto_pin_cfg *cfg)
15033 struct alc_spec *spec = codec->spec;
15035 hda_nid_t nid, dac;
15037 spec->multiout.dac_nids = spec->private_dac_nids;
15038 for (i = 0; i < cfg->line_outs; i++) {
15039 nid = cfg->line_out_pins[i];
15040 dac = alc861_look_for_dac(codec, nid);
15043 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
15048 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
15049 hda_nid_t nid, unsigned int chs)
15051 return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx,
15052 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
15055 /* add playback controls from the parsed DAC table */
15056 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
15057 const struct auto_pin_cfg *cfg)
15059 struct alc_spec *spec = codec->spec;
15060 static const char *chname[4] = {
15061 "Front", "Surround", NULL /*CLFE*/, "Side"
15066 if (cfg->line_outs == 1) {
15067 const char *pfx = NULL;
15070 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
15073 nid = spec->multiout.dac_nids[0];
15074 return alc861_create_out_sw(codec, pfx, nid, 3);
15078 for (i = 0; i < cfg->line_outs; i++) {
15079 nid = spec->multiout.dac_nids[i];
15084 err = alc861_create_out_sw(codec, "Center", nid, 1);
15087 err = alc861_create_out_sw(codec, "LFE", nid, 2);
15091 err = alc861_create_out_sw(codec, chname[i], nid, 3);
15099 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
15101 struct alc_spec *spec = codec->spec;
15108 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
15109 nid = alc861_look_for_dac(codec, pin);
15111 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
15114 spec->multiout.hp_nid = nid;
15120 /* create playback/capture controls for input pins */
15121 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
15122 const struct auto_pin_cfg *cfg)
15124 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
15127 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
15129 int pin_type, hda_nid_t dac)
15131 hda_nid_t mix, srcs[5];
15134 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
15136 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15138 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
15140 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
15143 for (i = 0; i < num; i++) {
15145 if (srcs[i] == dac || srcs[i] == 0x15)
15146 mute = AMP_IN_UNMUTE(i);
15148 mute = AMP_IN_MUTE(i);
15149 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15154 static void alc861_auto_init_multi_out(struct hda_codec *codec)
15156 struct alc_spec *spec = codec->spec;
15159 for (i = 0; i < spec->autocfg.line_outs; i++) {
15160 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15161 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15163 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
15164 spec->multiout.dac_nids[i]);
15168 static void alc861_auto_init_hp_out(struct hda_codec *codec)
15170 struct alc_spec *spec = codec->spec;
15172 if (spec->autocfg.hp_outs)
15173 alc861_auto_set_output_and_unmute(codec,
15174 spec->autocfg.hp_pins[0],
15176 spec->multiout.hp_nid);
15177 if (spec->autocfg.speaker_outs)
15178 alc861_auto_set_output_and_unmute(codec,
15179 spec->autocfg.speaker_pins[0],
15181 spec->multiout.dac_nids[0]);
15184 static void alc861_auto_init_analog_input(struct hda_codec *codec)
15186 struct alc_spec *spec = codec->spec;
15189 for (i = 0; i < AUTO_PIN_LAST; i++) {
15190 hda_nid_t nid = spec->autocfg.input_pins[i];
15191 if (nid >= 0x0c && nid <= 0x11)
15192 alc_set_input_pin(codec, nid, i);
15196 /* parse the BIOS configuration and set up the alc_spec */
15197 /* return 1 if successful, 0 if the proper config is not found,
15198 * or a negative error code
15200 static int alc861_parse_auto_config(struct hda_codec *codec)
15202 struct alc_spec *spec = codec->spec;
15204 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
15206 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15210 if (!spec->autocfg.line_outs)
15211 return 0; /* can't find valid BIOS pin config */
15213 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
15216 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
15219 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
15222 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
15226 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15228 if (spec->autocfg.dig_outs)
15229 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
15231 if (spec->kctls.list)
15232 add_mixer(spec, spec->kctls.list);
15234 add_verb(spec, alc861_auto_init_verbs);
15236 spec->num_mux_defs = 1;
15237 spec->input_mux = &spec->private_imux[0];
15239 spec->adc_nids = alc861_adc_nids;
15240 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
15241 set_capture_mixer(codec);
15243 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0);
15248 /* additional initialization for auto-configuration model */
15249 static void alc861_auto_init(struct hda_codec *codec)
15251 struct alc_spec *spec = codec->spec;
15252 alc861_auto_init_multi_out(codec);
15253 alc861_auto_init_hp_out(codec);
15254 alc861_auto_init_analog_input(codec);
15255 if (spec->unsol_event)
15256 alc_inithook(codec);
15259 #ifdef CONFIG_SND_HDA_POWER_SAVE
15260 static struct hda_amp_list alc861_loopbacks[] = {
15261 { 0x15, HDA_INPUT, 0 },
15262 { 0x15, HDA_INPUT, 1 },
15263 { 0x15, HDA_INPUT, 2 },
15264 { 0x15, HDA_INPUT, 3 },
15271 * configuration and preset
15273 static const char *alc861_models[ALC861_MODEL_LAST] = {
15274 [ALC861_3ST] = "3stack",
15275 [ALC660_3ST] = "3stack-660",
15276 [ALC861_3ST_DIG] = "3stack-dig",
15277 [ALC861_6ST_DIG] = "6stack-dig",
15278 [ALC861_UNIWILL_M31] = "uniwill-m31",
15279 [ALC861_TOSHIBA] = "toshiba",
15280 [ALC861_ASUS] = "asus",
15281 [ALC861_ASUS_LAPTOP] = "asus-laptop",
15282 [ALC861_AUTO] = "auto",
15285 static struct snd_pci_quirk alc861_cfg_tbl[] = {
15286 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
15287 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
15288 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
15289 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
15290 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
15291 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
15292 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
15293 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
15294 * Any other models that need this preset?
15296 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
15297 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
15298 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
15299 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
15300 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
15301 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
15302 /* FIXME: the below seems conflict */
15303 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
15304 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
15305 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
15309 static struct alc_config_preset alc861_presets[] = {
15311 .mixers = { alc861_3ST_mixer },
15312 .init_verbs = { alc861_threestack_init_verbs },
15313 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15314 .dac_nids = alc861_dac_nids,
15315 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15316 .channel_mode = alc861_threestack_modes,
15318 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15319 .adc_nids = alc861_adc_nids,
15320 .input_mux = &alc861_capture_source,
15322 [ALC861_3ST_DIG] = {
15323 .mixers = { alc861_base_mixer },
15324 .init_verbs = { alc861_threestack_init_verbs },
15325 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15326 .dac_nids = alc861_dac_nids,
15327 .dig_out_nid = ALC861_DIGOUT_NID,
15328 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15329 .channel_mode = alc861_threestack_modes,
15331 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15332 .adc_nids = alc861_adc_nids,
15333 .input_mux = &alc861_capture_source,
15335 [ALC861_6ST_DIG] = {
15336 .mixers = { alc861_base_mixer },
15337 .init_verbs = { alc861_base_init_verbs },
15338 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15339 .dac_nids = alc861_dac_nids,
15340 .dig_out_nid = ALC861_DIGOUT_NID,
15341 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
15342 .channel_mode = alc861_8ch_modes,
15343 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15344 .adc_nids = alc861_adc_nids,
15345 .input_mux = &alc861_capture_source,
15348 .mixers = { alc861_3ST_mixer },
15349 .init_verbs = { alc861_threestack_init_verbs },
15350 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
15351 .dac_nids = alc660_dac_nids,
15352 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15353 .channel_mode = alc861_threestack_modes,
15355 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15356 .adc_nids = alc861_adc_nids,
15357 .input_mux = &alc861_capture_source,
15359 [ALC861_UNIWILL_M31] = {
15360 .mixers = { alc861_uniwill_m31_mixer },
15361 .init_verbs = { alc861_uniwill_m31_init_verbs },
15362 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15363 .dac_nids = alc861_dac_nids,
15364 .dig_out_nid = ALC861_DIGOUT_NID,
15365 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
15366 .channel_mode = alc861_uniwill_m31_modes,
15368 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15369 .adc_nids = alc861_adc_nids,
15370 .input_mux = &alc861_capture_source,
15372 [ALC861_TOSHIBA] = {
15373 .mixers = { alc861_toshiba_mixer },
15374 .init_verbs = { alc861_base_init_verbs,
15375 alc861_toshiba_init_verbs },
15376 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15377 .dac_nids = alc861_dac_nids,
15378 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
15379 .channel_mode = alc883_3ST_2ch_modes,
15380 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15381 .adc_nids = alc861_adc_nids,
15382 .input_mux = &alc861_capture_source,
15383 .unsol_event = alc861_toshiba_unsol_event,
15384 .init_hook = alc861_toshiba_automute,
15387 .mixers = { alc861_asus_mixer },
15388 .init_verbs = { alc861_asus_init_verbs },
15389 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15390 .dac_nids = alc861_dac_nids,
15391 .dig_out_nid = ALC861_DIGOUT_NID,
15392 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
15393 .channel_mode = alc861_asus_modes,
15396 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15397 .adc_nids = alc861_adc_nids,
15398 .input_mux = &alc861_capture_source,
15400 [ALC861_ASUS_LAPTOP] = {
15401 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
15402 .init_verbs = { alc861_asus_init_verbs,
15403 alc861_asus_laptop_init_verbs },
15404 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15405 .dac_nids = alc861_dac_nids,
15406 .dig_out_nid = ALC861_DIGOUT_NID,
15407 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
15408 .channel_mode = alc883_3ST_2ch_modes,
15410 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15411 .adc_nids = alc861_adc_nids,
15412 .input_mux = &alc861_capture_source,
15416 /* Pin config fixes */
15418 PINFIX_FSC_AMILO_PI1505,
15421 static struct alc_pincfg alc861_fsc_amilo_pi1505_pinfix[] = {
15422 { 0x0b, 0x0221101f }, /* HP */
15423 { 0x0f, 0x90170310 }, /* speaker */
15427 static const struct alc_fixup alc861_fixups[] = {
15428 [PINFIX_FSC_AMILO_PI1505] = {
15429 .pins = alc861_fsc_amilo_pi1505_pinfix
15433 static struct snd_pci_quirk alc861_fixup_tbl[] = {
15434 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
15438 static int patch_alc861(struct hda_codec *codec)
15440 struct alc_spec *spec;
15444 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15448 codec->spec = spec;
15450 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
15454 if (board_config < 0) {
15455 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15457 board_config = ALC861_AUTO;
15460 if (board_config == ALC861_AUTO)
15461 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 1);
15463 if (board_config == ALC861_AUTO) {
15464 /* automatic parse from the BIOS config */
15465 err = alc861_parse_auto_config(codec);
15471 "hda_codec: Cannot set up configuration "
15472 "from BIOS. Using base mode...\n");
15473 board_config = ALC861_3ST_DIG;
15477 err = snd_hda_attach_beep_device(codec, 0x23);
15483 if (board_config != ALC861_AUTO)
15484 setup_preset(codec, &alc861_presets[board_config]);
15486 spec->stream_analog_playback = &alc861_pcm_analog_playback;
15487 spec->stream_analog_capture = &alc861_pcm_analog_capture;
15489 spec->stream_digital_playback = &alc861_pcm_digital_playback;
15490 spec->stream_digital_capture = &alc861_pcm_digital_capture;
15492 if (!spec->cap_mixer)
15493 set_capture_mixer(codec);
15494 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
15496 spec->vmaster_nid = 0x03;
15498 if (board_config == ALC861_AUTO)
15499 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 0);
15501 codec->patch_ops = alc_patch_ops;
15502 if (board_config == ALC861_AUTO) {
15503 spec->init_hook = alc861_auto_init;
15504 #ifdef CONFIG_SND_HDA_POWER_SAVE
15505 spec->power_hook = alc_power_eapd;
15508 #ifdef CONFIG_SND_HDA_POWER_SAVE
15509 if (!spec->loopback.amplist)
15510 spec->loopback.amplist = alc861_loopbacks;
15517 * ALC861-VD support
15521 * In addition, an independent DAC
15523 #define ALC861VD_DIGOUT_NID 0x06
15525 static hda_nid_t alc861vd_dac_nids[4] = {
15526 /* front, surr, clfe, side surr */
15527 0x02, 0x03, 0x04, 0x05
15530 /* dac_nids for ALC660vd are in a different order - according to
15531 * Realtek's driver.
15532 * This should probably result in a different mixer for 6stack models
15533 * of ALC660vd codecs, but for now there is only 3stack mixer
15534 * - and it is the same as in 861vd.
15535 * adc_nids in ALC660vd are (is) the same as in 861vd
15537 static hda_nid_t alc660vd_dac_nids[3] = {
15538 /* front, rear, clfe, rear_surr */
15542 static hda_nid_t alc861vd_adc_nids[1] = {
15547 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
15550 /* FIXME: should be a matrix-type input source selection */
15551 static struct hda_input_mux alc861vd_capture_source = {
15555 { "Front Mic", 0x1 },
15561 static struct hda_input_mux alc861vd_dallas_capture_source = {
15564 { "Ext Mic", 0x0 },
15565 { "Int Mic", 0x1 },
15569 static struct hda_input_mux alc861vd_hp_capture_source = {
15572 { "Front Mic", 0x0 },
15573 { "ATAPI Mic", 0x1 },
15580 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
15587 static struct hda_verb alc861vd_6stack_ch6_init[] = {
15588 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15589 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15590 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15591 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15598 static struct hda_verb alc861vd_6stack_ch8_init[] = {
15599 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15600 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15601 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15602 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15606 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
15607 { 6, alc861vd_6stack_ch6_init },
15608 { 8, alc861vd_6stack_ch8_init },
15611 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
15613 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15614 .name = "Channel Mode",
15615 .info = alc_ch_mode_info,
15616 .get = alc_ch_mode_get,
15617 .put = alc_ch_mode_put,
15622 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15623 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15625 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
15626 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15627 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15629 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15630 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
15632 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
15634 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
15636 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
15637 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
15639 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
15640 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
15642 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15644 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15645 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15646 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15648 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15649 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15650 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15652 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15653 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15655 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15656 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15661 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
15662 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15663 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15665 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15667 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15668 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15669 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15671 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15672 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15673 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15675 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15676 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15678 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15679 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15684 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
15685 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15686 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
15687 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15689 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15691 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15692 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15693 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15695 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15696 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15697 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15699 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15700 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15705 /* Pin assignment: Speaker=0x14, HP = 0x15,
15706 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
15708 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
15709 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15710 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
15711 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15712 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15713 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
15714 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15715 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15716 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
15717 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15718 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15722 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
15723 * Front Mic=0x18, ATAPI Mic = 0x19,
15725 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
15726 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15727 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15728 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15729 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15730 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15731 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15732 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15733 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15739 * generic initialization of ADC, input mixers and output mixers
15741 static struct hda_verb alc861vd_volume_init_verbs[] = {
15743 * Unmute ADC0 and set the default input to mic-in
15745 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15746 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15748 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
15749 * the analog-loopback mixer widget
15751 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15752 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15753 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15754 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15755 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15756 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15758 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
15759 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15760 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15761 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15762 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15765 * Set up output mixers (0x02 - 0x05)
15767 /* set vol=0 to output mixers */
15768 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15769 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15770 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15771 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15773 /* set up input amps for analog loopback */
15774 /* Amp Indices: DAC = 0, mixer = 1 */
15775 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15776 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15777 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15778 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15779 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15780 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15781 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15782 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15788 * 3-stack pin configuration:
15789 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
15791 static struct hda_verb alc861vd_3stack_init_verbs[] = {
15793 * Set pin mode and muting
15795 /* set front pin widgets 0x14 for output */
15796 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15797 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15798 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15800 /* Mic (rear) pin: input vref at 80% */
15801 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15802 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15803 /* Front Mic pin: input vref at 80% */
15804 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15805 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15806 /* Line In pin: input */
15807 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15808 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15809 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15810 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15811 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15812 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15813 /* CD pin widget for input */
15814 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15820 * 6-stack pin configuration:
15822 static struct hda_verb alc861vd_6stack_init_verbs[] = {
15824 * Set pin mode and muting
15826 /* set front pin widgets 0x14 for output */
15827 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15828 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15829 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15831 /* Rear Pin: output 1 (0x0d) */
15832 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15833 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15834 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
15835 /* CLFE Pin: output 2 (0x0e) */
15836 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15837 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15838 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
15839 /* Side Pin: output 3 (0x0f) */
15840 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15841 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15842 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
15844 /* Mic (rear) pin: input vref at 80% */
15845 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15846 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15847 /* Front Mic pin: input vref at 80% */
15848 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15849 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15850 /* Line In pin: input */
15851 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15852 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15853 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15854 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15855 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15856 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15857 /* CD pin widget for input */
15858 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15863 static struct hda_verb alc861vd_eapd_verbs[] = {
15864 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15868 static struct hda_verb alc660vd_eapd_verbs[] = {
15869 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15870 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15874 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
15875 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15876 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15877 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
15878 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15879 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15883 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
15885 unsigned int present;
15886 unsigned char bits;
15888 present = snd_hda_jack_detect(codec, 0x18);
15889 bits = present ? HDA_AMP_MUTE : 0;
15891 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
15892 HDA_AMP_MUTE, bits);
15895 static void alc861vd_lenovo_setup(struct hda_codec *codec)
15897 struct alc_spec *spec = codec->spec;
15898 spec->autocfg.hp_pins[0] = 0x1b;
15899 spec->autocfg.speaker_pins[0] = 0x14;
15902 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
15904 alc_automute_amp(codec);
15905 alc861vd_lenovo_mic_automute(codec);
15908 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
15911 switch (res >> 26) {
15912 case ALC880_MIC_EVENT:
15913 alc861vd_lenovo_mic_automute(codec);
15916 alc_automute_amp_unsol_event(codec, res);
15921 static struct hda_verb alc861vd_dallas_verbs[] = {
15922 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15923 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15924 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15925 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15927 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15928 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15929 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15930 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15931 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15932 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15933 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15934 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15936 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15937 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15938 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15939 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15940 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15941 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15942 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15943 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15945 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15946 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15947 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15948 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15949 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15950 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15951 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15952 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15954 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15955 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15956 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15957 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15959 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15960 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15961 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15966 /* toggle speaker-output according to the hp-jack state */
15967 static void alc861vd_dallas_setup(struct hda_codec *codec)
15969 struct alc_spec *spec = codec->spec;
15971 spec->autocfg.hp_pins[0] = 0x15;
15972 spec->autocfg.speaker_pins[0] = 0x14;
15975 #ifdef CONFIG_SND_HDA_POWER_SAVE
15976 #define alc861vd_loopbacks alc880_loopbacks
15979 /* pcm configuration: identical with ALC880 */
15980 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
15981 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
15982 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
15983 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
15986 * configuration and preset
15988 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
15989 [ALC660VD_3ST] = "3stack-660",
15990 [ALC660VD_3ST_DIG] = "3stack-660-digout",
15991 [ALC660VD_ASUS_V1S] = "asus-v1s",
15992 [ALC861VD_3ST] = "3stack",
15993 [ALC861VD_3ST_DIG] = "3stack-digout",
15994 [ALC861VD_6ST_DIG] = "6stack-digout",
15995 [ALC861VD_LENOVO] = "lenovo",
15996 [ALC861VD_DALLAS] = "dallas",
15997 [ALC861VD_HP] = "hp",
15998 [ALC861VD_AUTO] = "auto",
16001 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
16002 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
16003 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
16004 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
16005 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
16006 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
16007 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
16008 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
16009 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
16010 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
16011 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
16012 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
16013 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
16014 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
16015 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
16016 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
16020 static struct alc_config_preset alc861vd_presets[] = {
16022 .mixers = { alc861vd_3st_mixer },
16023 .init_verbs = { alc861vd_volume_init_verbs,
16024 alc861vd_3stack_init_verbs },
16025 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16026 .dac_nids = alc660vd_dac_nids,
16027 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16028 .channel_mode = alc861vd_3stack_2ch_modes,
16029 .input_mux = &alc861vd_capture_source,
16031 [ALC660VD_3ST_DIG] = {
16032 .mixers = { alc861vd_3st_mixer },
16033 .init_verbs = { alc861vd_volume_init_verbs,
16034 alc861vd_3stack_init_verbs },
16035 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16036 .dac_nids = alc660vd_dac_nids,
16037 .dig_out_nid = ALC861VD_DIGOUT_NID,
16038 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16039 .channel_mode = alc861vd_3stack_2ch_modes,
16040 .input_mux = &alc861vd_capture_source,
16043 .mixers = { alc861vd_3st_mixer },
16044 .init_verbs = { alc861vd_volume_init_verbs,
16045 alc861vd_3stack_init_verbs },
16046 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16047 .dac_nids = alc861vd_dac_nids,
16048 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16049 .channel_mode = alc861vd_3stack_2ch_modes,
16050 .input_mux = &alc861vd_capture_source,
16052 [ALC861VD_3ST_DIG] = {
16053 .mixers = { alc861vd_3st_mixer },
16054 .init_verbs = { alc861vd_volume_init_verbs,
16055 alc861vd_3stack_init_verbs },
16056 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16057 .dac_nids = alc861vd_dac_nids,
16058 .dig_out_nid = ALC861VD_DIGOUT_NID,
16059 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16060 .channel_mode = alc861vd_3stack_2ch_modes,
16061 .input_mux = &alc861vd_capture_source,
16063 [ALC861VD_6ST_DIG] = {
16064 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
16065 .init_verbs = { alc861vd_volume_init_verbs,
16066 alc861vd_6stack_init_verbs },
16067 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16068 .dac_nids = alc861vd_dac_nids,
16069 .dig_out_nid = ALC861VD_DIGOUT_NID,
16070 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
16071 .channel_mode = alc861vd_6stack_modes,
16072 .input_mux = &alc861vd_capture_source,
16074 [ALC861VD_LENOVO] = {
16075 .mixers = { alc861vd_lenovo_mixer },
16076 .init_verbs = { alc861vd_volume_init_verbs,
16077 alc861vd_3stack_init_verbs,
16078 alc861vd_eapd_verbs,
16079 alc861vd_lenovo_unsol_verbs },
16080 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16081 .dac_nids = alc660vd_dac_nids,
16082 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16083 .channel_mode = alc861vd_3stack_2ch_modes,
16084 .input_mux = &alc861vd_capture_source,
16085 .unsol_event = alc861vd_lenovo_unsol_event,
16086 .setup = alc861vd_lenovo_setup,
16087 .init_hook = alc861vd_lenovo_init_hook,
16089 [ALC861VD_DALLAS] = {
16090 .mixers = { alc861vd_dallas_mixer },
16091 .init_verbs = { alc861vd_dallas_verbs },
16092 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16093 .dac_nids = alc861vd_dac_nids,
16094 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16095 .channel_mode = alc861vd_3stack_2ch_modes,
16096 .input_mux = &alc861vd_dallas_capture_source,
16097 .unsol_event = alc_automute_amp_unsol_event,
16098 .setup = alc861vd_dallas_setup,
16099 .init_hook = alc_automute_amp,
16102 .mixers = { alc861vd_hp_mixer },
16103 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
16104 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16105 .dac_nids = alc861vd_dac_nids,
16106 .dig_out_nid = ALC861VD_DIGOUT_NID,
16107 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16108 .channel_mode = alc861vd_3stack_2ch_modes,
16109 .input_mux = &alc861vd_hp_capture_source,
16110 .unsol_event = alc_automute_amp_unsol_event,
16111 .setup = alc861vd_dallas_setup,
16112 .init_hook = alc_automute_amp,
16114 [ALC660VD_ASUS_V1S] = {
16115 .mixers = { alc861vd_lenovo_mixer },
16116 .init_verbs = { alc861vd_volume_init_verbs,
16117 alc861vd_3stack_init_verbs,
16118 alc861vd_eapd_verbs,
16119 alc861vd_lenovo_unsol_verbs },
16120 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16121 .dac_nids = alc660vd_dac_nids,
16122 .dig_out_nid = ALC861VD_DIGOUT_NID,
16123 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16124 .channel_mode = alc861vd_3stack_2ch_modes,
16125 .input_mux = &alc861vd_capture_source,
16126 .unsol_event = alc861vd_lenovo_unsol_event,
16127 .setup = alc861vd_lenovo_setup,
16128 .init_hook = alc861vd_lenovo_init_hook,
16133 * BIOS auto configuration
16135 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
16136 const struct auto_pin_cfg *cfg)
16138 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0);
16142 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
16143 hda_nid_t nid, int pin_type, int dac_idx)
16145 alc_set_pin_output(codec, nid, pin_type);
16148 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
16150 struct alc_spec *spec = codec->spec;
16153 for (i = 0; i <= HDA_SIDE; i++) {
16154 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16155 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16157 alc861vd_auto_set_output_and_unmute(codec, nid,
16163 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
16165 struct alc_spec *spec = codec->spec;
16168 pin = spec->autocfg.hp_pins[0];
16169 if (pin) /* connect to front and use dac 0 */
16170 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
16171 pin = spec->autocfg.speaker_pins[0];
16173 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
16176 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
16178 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
16180 struct alc_spec *spec = codec->spec;
16183 for (i = 0; i < AUTO_PIN_LAST; i++) {
16184 hda_nid_t nid = spec->autocfg.input_pins[i];
16185 if (alc_is_input_pin(codec, nid)) {
16186 alc_set_input_pin(codec, nid, i);
16187 if (nid != ALC861VD_PIN_CD_NID &&
16188 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
16189 snd_hda_codec_write(codec, nid, 0,
16190 AC_VERB_SET_AMP_GAIN_MUTE,
16196 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
16198 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
16199 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
16201 /* add playback controls from the parsed DAC table */
16202 /* Based on ALC880 version. But ALC861VD has separate,
16203 * different NIDs for mute/unmute switch and volume control */
16204 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
16205 const struct auto_pin_cfg *cfg)
16207 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
16208 hda_nid_t nid_v, nid_s;
16211 for (i = 0; i < cfg->line_outs; i++) {
16212 if (!spec->multiout.dac_nids[i])
16214 nid_v = alc861vd_idx_to_mixer_vol(
16216 spec->multiout.dac_nids[i]));
16217 nid_s = alc861vd_idx_to_mixer_switch(
16219 spec->multiout.dac_nids[i]));
16223 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
16225 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
16229 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
16231 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
16235 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
16237 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
16241 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
16243 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
16249 if (cfg->line_outs == 1 &&
16250 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
16257 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
16258 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
16262 if (cfg->line_outs == 1 &&
16263 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
16265 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
16266 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
16275 /* add playback controls for speaker and HP outputs */
16276 /* Based on ALC880 version. But ALC861VD has separate,
16277 * different NIDs for mute/unmute switch and volume control */
16278 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
16279 hda_nid_t pin, const char *pfx)
16281 hda_nid_t nid_v, nid_s;
16287 if (alc880_is_fixed_pin(pin)) {
16288 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16289 /* specify the DAC as the extra output */
16290 if (!spec->multiout.hp_nid)
16291 spec->multiout.hp_nid = nid_v;
16293 spec->multiout.extra_out_nid[0] = nid_v;
16294 /* control HP volume/switch on the output mixer amp */
16295 nid_v = alc861vd_idx_to_mixer_vol(
16296 alc880_fixed_pin_idx(pin));
16297 nid_s = alc861vd_idx_to_mixer_switch(
16298 alc880_fixed_pin_idx(pin));
16300 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
16301 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
16304 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
16305 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
16308 } else if (alc880_is_multi_pin(pin)) {
16309 /* set manual connection */
16310 /* we have only a switch on HP-out PIN */
16311 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
16312 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
16319 /* parse the BIOS configuration and set up the alc_spec
16320 * return 1 if successful, 0 if the proper config is not found,
16321 * or a negative error code
16322 * Based on ALC880 version - had to change it to override
16323 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
16324 static int alc861vd_parse_auto_config(struct hda_codec *codec)
16326 struct alc_spec *spec = codec->spec;
16328 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
16330 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16334 if (!spec->autocfg.line_outs)
16335 return 0; /* can't find valid BIOS pin config */
16337 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
16340 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
16343 err = alc861vd_auto_create_extra_out(spec,
16344 spec->autocfg.speaker_pins[0],
16348 err = alc861vd_auto_create_extra_out(spec,
16349 spec->autocfg.hp_pins[0],
16353 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
16357 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16359 if (spec->autocfg.dig_outs)
16360 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
16362 if (spec->kctls.list)
16363 add_mixer(spec, spec->kctls.list);
16365 add_verb(spec, alc861vd_volume_init_verbs);
16367 spec->num_mux_defs = 1;
16368 spec->input_mux = &spec->private_imux[0];
16370 err = alc_auto_add_mic_boost(codec);
16374 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
16379 /* additional initialization for auto-configuration model */
16380 static void alc861vd_auto_init(struct hda_codec *codec)
16382 struct alc_spec *spec = codec->spec;
16383 alc861vd_auto_init_multi_out(codec);
16384 alc861vd_auto_init_hp_out(codec);
16385 alc861vd_auto_init_analog_input(codec);
16386 alc861vd_auto_init_input_src(codec);
16387 if (spec->unsol_event)
16388 alc_inithook(codec);
16392 ALC660VD_FIX_ASUS_GPIO1
16396 static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = {
16397 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
16398 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
16399 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
16403 static const struct alc_fixup alc861vd_fixups[] = {
16404 [ALC660VD_FIX_ASUS_GPIO1] = {
16405 .verbs = alc660vd_fix_asus_gpio1_verbs,
16409 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
16410 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
16414 static int patch_alc861vd(struct hda_codec *codec)
16416 struct alc_spec *spec;
16417 int err, board_config;
16419 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16423 codec->spec = spec;
16425 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
16429 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
16430 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
16432 board_config = ALC861VD_AUTO;
16435 if (board_config == ALC861VD_AUTO)
16436 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 1);
16438 if (board_config == ALC861VD_AUTO) {
16439 /* automatic parse from the BIOS config */
16440 err = alc861vd_parse_auto_config(codec);
16446 "hda_codec: Cannot set up configuration "
16447 "from BIOS. Using base mode...\n");
16448 board_config = ALC861VD_3ST;
16452 err = snd_hda_attach_beep_device(codec, 0x23);
16458 if (board_config != ALC861VD_AUTO)
16459 setup_preset(codec, &alc861vd_presets[board_config]);
16461 if (codec->vendor_id == 0x10ec0660) {
16462 /* always turn on EAPD */
16463 add_verb(spec, alc660vd_eapd_verbs);
16466 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
16467 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
16469 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
16470 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
16472 if (!spec->adc_nids) {
16473 spec->adc_nids = alc861vd_adc_nids;
16474 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
16476 if (!spec->capsrc_nids)
16477 spec->capsrc_nids = alc861vd_capsrc_nids;
16479 set_capture_mixer(codec);
16480 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
16482 spec->vmaster_nid = 0x02;
16484 if (board_config == ALC861VD_AUTO)
16485 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 0);
16487 codec->patch_ops = alc_patch_ops;
16489 if (board_config == ALC861VD_AUTO)
16490 spec->init_hook = alc861vd_auto_init;
16491 #ifdef CONFIG_SND_HDA_POWER_SAVE
16492 if (!spec->loopback.amplist)
16493 spec->loopback.amplist = alc861vd_loopbacks;
16502 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
16503 * configuration. Each pin widget can choose any input DACs and a mixer.
16504 * Each ADC is connected from a mixer of all inputs. This makes possible
16505 * 6-channel independent captures.
16507 * In addition, an independent DAC for the multi-playback (not used in this
16510 #define ALC662_DIGOUT_NID 0x06
16511 #define ALC662_DIGIN_NID 0x0a
16513 static hda_nid_t alc662_dac_nids[4] = {
16514 /* front, rear, clfe, rear_surr */
16518 static hda_nid_t alc272_dac_nids[2] = {
16522 static hda_nid_t alc662_adc_nids[2] = {
16527 static hda_nid_t alc272_adc_nids[1] = {
16532 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
16533 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
16537 /* FIXME: should be a matrix-type input source selection */
16538 static struct hda_input_mux alc662_capture_source = {
16542 { "Front Mic", 0x1 },
16548 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
16556 static struct hda_input_mux alc663_capture_source = {
16560 { "Front Mic", 0x1 },
16565 #if 0 /* set to 1 for testing other input sources below */
16566 static struct hda_input_mux alc272_nc10_capture_source = {
16569 { "Autoselect Mic", 0x0 },
16570 { "Internal Mic", 0x1 },
16571 { "In-0x02", 0x2 },
16572 { "In-0x03", 0x3 },
16573 { "In-0x04", 0x4 },
16574 { "In-0x05", 0x5 },
16575 { "In-0x06", 0x6 },
16576 { "In-0x07", 0x7 },
16577 { "In-0x08", 0x8 },
16578 { "In-0x09", 0x9 },
16579 { "In-0x0a", 0x0a },
16580 { "In-0x0b", 0x0b },
16581 { "In-0x0c", 0x0c },
16582 { "In-0x0d", 0x0d },
16583 { "In-0x0e", 0x0e },
16584 { "In-0x0f", 0x0f },
16592 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
16599 static struct hda_verb alc662_3ST_ch2_init[] = {
16600 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
16601 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
16602 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
16603 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
16610 static struct hda_verb alc662_3ST_ch6_init[] = {
16611 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16612 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
16613 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
16614 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16615 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
16616 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
16620 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
16621 { 2, alc662_3ST_ch2_init },
16622 { 6, alc662_3ST_ch6_init },
16628 static struct hda_verb alc662_sixstack_ch6_init[] = {
16629 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16630 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16631 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16638 static struct hda_verb alc662_sixstack_ch8_init[] = {
16639 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16640 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16641 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16645 static struct hda_channel_mode alc662_5stack_modes[2] = {
16646 { 2, alc662_sixstack_ch6_init },
16647 { 6, alc662_sixstack_ch8_init },
16650 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16651 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16654 static struct snd_kcontrol_new alc662_base_mixer[] = {
16655 /* output mixer control */
16656 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
16657 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16658 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
16659 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16660 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16661 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16662 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16663 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16664 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16666 /*Input mixer control */
16667 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
16668 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
16669 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
16670 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
16671 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
16672 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
16673 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
16674 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
16678 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
16679 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16680 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16681 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16682 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16683 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16684 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16685 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16686 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16687 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16688 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16689 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16693 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
16694 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16695 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16696 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16697 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16698 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16699 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16700 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16701 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16702 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16703 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16704 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16705 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16706 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16707 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16708 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16709 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16710 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16714 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
16715 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16716 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
16717 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16718 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
16719 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16720 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16721 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16722 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16723 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16727 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
16728 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16729 ALC262_HIPPO_MASTER_SWITCH,
16731 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
16732 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16733 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16735 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16736 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16737 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16741 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
16742 ALC262_HIPPO_MASTER_SWITCH,
16743 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16744 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16745 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16746 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16747 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
16748 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16749 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16750 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16751 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16755 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
16756 .ops = &snd_hda_bind_vol,
16758 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16759 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
16764 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
16765 .ops = &snd_hda_bind_sw,
16767 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16768 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16773 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
16774 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16775 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
16776 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16777 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16781 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
16782 .ops = &snd_hda_bind_sw,
16784 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16785 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16786 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16791 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
16792 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16793 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
16794 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16795 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16796 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16797 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16802 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
16803 .ops = &snd_hda_bind_sw,
16805 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16806 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16807 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16812 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
16813 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16814 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
16815 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16816 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16817 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16818 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16822 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
16823 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16824 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16825 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16826 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16827 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16828 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16829 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16833 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
16834 .ops = &snd_hda_bind_vol,
16836 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16837 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
16842 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
16843 .ops = &snd_hda_bind_sw,
16845 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16846 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
16851 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
16852 HDA_BIND_VOL("Master Playback Volume",
16853 &alc663_asus_two_bind_master_vol),
16854 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16855 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16856 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16857 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16858 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16862 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
16863 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16864 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16865 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16866 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16867 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16868 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16872 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
16873 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16874 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16875 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16876 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16877 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16879 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16880 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16881 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16882 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16886 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
16887 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16888 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16889 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16891 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16892 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16893 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16894 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16895 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16896 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16900 static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
16901 .ops = &snd_hda_bind_sw,
16903 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16904 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16905 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16906 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16907 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16912 static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
16913 .ops = &snd_hda_bind_sw,
16915 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16916 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16921 static struct snd_kcontrol_new alc663_mode7_mixer[] = {
16922 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16923 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16924 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16925 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16926 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16927 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16928 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16929 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16930 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16934 static struct snd_kcontrol_new alc663_mode8_mixer[] = {
16935 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16936 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16937 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16938 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16939 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16940 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16941 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16946 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
16948 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16949 .name = "Channel Mode",
16950 .info = alc_ch_mode_info,
16951 .get = alc_ch_mode_get,
16952 .put = alc_ch_mode_put,
16957 static struct hda_verb alc662_init_verbs[] = {
16958 /* ADC: mute amp left and right */
16959 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16960 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16962 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16963 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16964 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16965 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16966 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16967 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16969 /* Front Pin: output 0 (0x0c) */
16970 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16971 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16973 /* Rear Pin: output 1 (0x0d) */
16974 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16975 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16977 /* CLFE Pin: output 2 (0x0e) */
16978 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16979 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16981 /* Mic (rear) pin: input vref at 80% */
16982 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16983 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16984 /* Front Mic pin: input vref at 80% */
16985 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16986 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16987 /* Line In pin: input */
16988 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16989 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16990 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16991 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16992 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16993 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16994 /* CD pin widget for input */
16995 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16997 /* FIXME: use matrix-type input source selection */
16998 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
17000 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17001 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17003 /* always trun on EAPD */
17004 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
17005 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
17010 static struct hda_verb alc663_init_verbs[] = {
17011 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17012 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17013 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17014 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17015 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17016 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17020 static struct hda_verb alc272_init_verbs[] = {
17021 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17022 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17023 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17024 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17025 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17026 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17027 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17028 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17032 static struct hda_verb alc662_sue_init_verbs[] = {
17033 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
17034 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
17038 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
17039 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17040 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17044 /* Set Unsolicited Event*/
17045 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
17046 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17047 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17051 static struct hda_verb alc663_m51va_init_verbs[] = {
17052 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17053 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17054 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17055 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17056 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17057 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17058 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17059 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17060 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17064 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
17065 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17066 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17067 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17068 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17069 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17070 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17071 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17075 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
17076 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17077 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17078 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17079 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17080 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17081 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17082 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17083 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17087 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
17088 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17089 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17090 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17091 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17092 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17093 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17094 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17098 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
17099 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17100 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17101 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17102 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
17103 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17104 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17105 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
17106 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17107 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17108 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17109 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17110 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17114 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
17115 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17116 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17117 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17118 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17119 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17120 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17121 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17122 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17123 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17124 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17125 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17126 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17130 static struct hda_verb alc663_g71v_init_verbs[] = {
17131 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17132 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
17133 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
17135 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17136 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17137 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17139 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
17140 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
17141 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
17145 static struct hda_verb alc663_g50v_init_verbs[] = {
17146 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17147 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17148 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17150 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17151 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17155 static struct hda_verb alc662_ecs_init_verbs[] = {
17156 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
17157 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17158 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17159 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17163 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
17164 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17165 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17166 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17167 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17168 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17169 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17170 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17171 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17172 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17173 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17174 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17178 static struct hda_verb alc272_dell_init_verbs[] = {
17179 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17180 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17181 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17182 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17183 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17184 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17185 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17186 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17187 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17188 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17189 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17193 static struct hda_verb alc663_mode7_init_verbs[] = {
17194 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17195 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17196 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17197 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17198 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17199 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17200 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
17201 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17202 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17203 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17204 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17205 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17206 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17207 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17208 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17212 static struct hda_verb alc663_mode8_init_verbs[] = {
17213 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17214 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17215 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17216 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
17217 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17218 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17219 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17220 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17221 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17222 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17223 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17224 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17225 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17226 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17227 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17228 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17232 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
17233 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
17234 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
17238 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
17239 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
17240 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
17244 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
17246 unsigned int present;
17247 unsigned char bits;
17249 present = snd_hda_jack_detect(codec, 0x14);
17250 bits = present ? HDA_AMP_MUTE : 0;
17252 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17253 HDA_AMP_MUTE, bits);
17256 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
17258 unsigned int present;
17259 unsigned char bits;
17261 present = snd_hda_jack_detect(codec, 0x1b);
17262 bits = present ? HDA_AMP_MUTE : 0;
17264 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17265 HDA_AMP_MUTE, bits);
17266 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17267 HDA_AMP_MUTE, bits);
17270 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
17273 if ((res >> 26) == ALC880_HP_EVENT)
17274 alc662_lenovo_101e_all_automute(codec);
17275 if ((res >> 26) == ALC880_FRONT_EVENT)
17276 alc662_lenovo_101e_ispeaker_automute(codec);
17279 /* unsolicited event for HP jack sensing */
17280 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
17283 if ((res >> 26) == ALC880_MIC_EVENT)
17284 alc_mic_automute(codec);
17286 alc262_hippo_unsol_event(codec, res);
17289 static void alc662_eeepc_setup(struct hda_codec *codec)
17291 struct alc_spec *spec = codec->spec;
17293 alc262_hippo1_setup(codec);
17294 spec->ext_mic.pin = 0x18;
17295 spec->ext_mic.mux_idx = 0;
17296 spec->int_mic.pin = 0x19;
17297 spec->int_mic.mux_idx = 1;
17298 spec->auto_mic = 1;
17301 static void alc662_eeepc_inithook(struct hda_codec *codec)
17303 alc262_hippo_automute(codec);
17304 alc_mic_automute(codec);
17307 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
17309 struct alc_spec *spec = codec->spec;
17311 spec->autocfg.hp_pins[0] = 0x14;
17312 spec->autocfg.speaker_pins[0] = 0x1b;
17315 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
17317 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
17319 unsigned int present;
17320 unsigned char bits;
17322 present = snd_hda_jack_detect(codec, 0x21);
17323 bits = present ? HDA_AMP_MUTE : 0;
17324 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17325 HDA_AMP_MUTE, bits);
17326 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17327 HDA_AMP_MUTE, bits);
17330 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
17332 unsigned int present;
17333 unsigned char bits;
17335 present = snd_hda_jack_detect(codec, 0x21);
17336 bits = present ? HDA_AMP_MUTE : 0;
17337 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17338 HDA_AMP_MUTE, bits);
17339 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17340 HDA_AMP_MUTE, bits);
17341 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
17342 HDA_AMP_MUTE, bits);
17343 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
17344 HDA_AMP_MUTE, bits);
17347 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
17349 unsigned int present;
17350 unsigned char bits;
17352 present = snd_hda_jack_detect(codec, 0x15);
17353 bits = present ? HDA_AMP_MUTE : 0;
17354 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17355 HDA_AMP_MUTE, bits);
17356 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17357 HDA_AMP_MUTE, bits);
17358 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
17359 HDA_AMP_MUTE, bits);
17360 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
17361 HDA_AMP_MUTE, bits);
17364 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
17366 unsigned int present;
17367 unsigned char bits;
17369 present = snd_hda_jack_detect(codec, 0x1b);
17370 bits = present ? 0 : PIN_OUT;
17371 snd_hda_codec_write(codec, 0x14, 0,
17372 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
17375 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
17377 unsigned int present1, present2;
17379 present1 = snd_hda_jack_detect(codec, 0x21);
17380 present2 = snd_hda_jack_detect(codec, 0x15);
17382 if (present1 || present2) {
17383 snd_hda_codec_write_cache(codec, 0x14, 0,
17384 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17386 snd_hda_codec_write_cache(codec, 0x14, 0,
17387 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17391 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
17393 unsigned int present1, present2;
17395 present1 = snd_hda_jack_detect(codec, 0x1b);
17396 present2 = snd_hda_jack_detect(codec, 0x15);
17398 if (present1 || present2) {
17399 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17400 HDA_AMP_MUTE, HDA_AMP_MUTE);
17401 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17402 HDA_AMP_MUTE, HDA_AMP_MUTE);
17404 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17406 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17411 static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
17413 unsigned int present1, present2;
17415 present1 = snd_hda_codec_read(codec, 0x1b, 0,
17416 AC_VERB_GET_PIN_SENSE, 0)
17417 & AC_PINSENSE_PRESENCE;
17418 present2 = snd_hda_codec_read(codec, 0x21, 0,
17419 AC_VERB_GET_PIN_SENSE, 0)
17420 & AC_PINSENSE_PRESENCE;
17422 if (present1 || present2) {
17423 snd_hda_codec_write_cache(codec, 0x14, 0,
17424 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17425 snd_hda_codec_write_cache(codec, 0x17, 0,
17426 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17428 snd_hda_codec_write_cache(codec, 0x14, 0,
17429 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17430 snd_hda_codec_write_cache(codec, 0x17, 0,
17431 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17435 static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
17437 unsigned int present1, present2;
17439 present1 = snd_hda_codec_read(codec, 0x21, 0,
17440 AC_VERB_GET_PIN_SENSE, 0)
17441 & AC_PINSENSE_PRESENCE;
17442 present2 = snd_hda_codec_read(codec, 0x15, 0,
17443 AC_VERB_GET_PIN_SENSE, 0)
17444 & AC_PINSENSE_PRESENCE;
17446 if (present1 || present2) {
17447 snd_hda_codec_write_cache(codec, 0x14, 0,
17448 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17449 snd_hda_codec_write_cache(codec, 0x17, 0,
17450 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17452 snd_hda_codec_write_cache(codec, 0x14, 0,
17453 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17454 snd_hda_codec_write_cache(codec, 0x17, 0,
17455 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17459 static void alc663_m51va_unsol_event(struct hda_codec *codec,
17462 switch (res >> 26) {
17463 case ALC880_HP_EVENT:
17464 alc663_m51va_speaker_automute(codec);
17466 case ALC880_MIC_EVENT:
17467 alc_mic_automute(codec);
17472 static void alc663_m51va_setup(struct hda_codec *codec)
17474 struct alc_spec *spec = codec->spec;
17475 spec->ext_mic.pin = 0x18;
17476 spec->ext_mic.mux_idx = 0;
17477 spec->int_mic.pin = 0x12;
17478 spec->int_mic.mux_idx = 9;
17479 spec->auto_mic = 1;
17482 static void alc663_m51va_inithook(struct hda_codec *codec)
17484 alc663_m51va_speaker_automute(codec);
17485 alc_mic_automute(codec);
17488 /* ***************** Mode1 ******************************/
17489 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
17491 static void alc663_mode1_setup(struct hda_codec *codec)
17493 struct alc_spec *spec = codec->spec;
17494 spec->ext_mic.pin = 0x18;
17495 spec->ext_mic.mux_idx = 0;
17496 spec->int_mic.pin = 0x19;
17497 spec->int_mic.mux_idx = 1;
17498 spec->auto_mic = 1;
17501 #define alc663_mode1_inithook alc663_m51va_inithook
17503 /* ***************** Mode2 ******************************/
17504 static void alc662_mode2_unsol_event(struct hda_codec *codec,
17507 switch (res >> 26) {
17508 case ALC880_HP_EVENT:
17509 alc662_f5z_speaker_automute(codec);
17511 case ALC880_MIC_EVENT:
17512 alc_mic_automute(codec);
17517 #define alc662_mode2_setup alc663_mode1_setup
17519 static void alc662_mode2_inithook(struct hda_codec *codec)
17521 alc662_f5z_speaker_automute(codec);
17522 alc_mic_automute(codec);
17524 /* ***************** Mode3 ******************************/
17525 static void alc663_mode3_unsol_event(struct hda_codec *codec,
17528 switch (res >> 26) {
17529 case ALC880_HP_EVENT:
17530 alc663_two_hp_m1_speaker_automute(codec);
17532 case ALC880_MIC_EVENT:
17533 alc_mic_automute(codec);
17538 #define alc663_mode3_setup alc663_mode1_setup
17540 static void alc663_mode3_inithook(struct hda_codec *codec)
17542 alc663_two_hp_m1_speaker_automute(codec);
17543 alc_mic_automute(codec);
17545 /* ***************** Mode4 ******************************/
17546 static void alc663_mode4_unsol_event(struct hda_codec *codec,
17549 switch (res >> 26) {
17550 case ALC880_HP_EVENT:
17551 alc663_21jd_two_speaker_automute(codec);
17553 case ALC880_MIC_EVENT:
17554 alc_mic_automute(codec);
17559 #define alc663_mode4_setup alc663_mode1_setup
17561 static void alc663_mode4_inithook(struct hda_codec *codec)
17563 alc663_21jd_two_speaker_automute(codec);
17564 alc_mic_automute(codec);
17566 /* ***************** Mode5 ******************************/
17567 static void alc663_mode5_unsol_event(struct hda_codec *codec,
17570 switch (res >> 26) {
17571 case ALC880_HP_EVENT:
17572 alc663_15jd_two_speaker_automute(codec);
17574 case ALC880_MIC_EVENT:
17575 alc_mic_automute(codec);
17580 #define alc663_mode5_setup alc663_mode1_setup
17582 static void alc663_mode5_inithook(struct hda_codec *codec)
17584 alc663_15jd_two_speaker_automute(codec);
17585 alc_mic_automute(codec);
17587 /* ***************** Mode6 ******************************/
17588 static void alc663_mode6_unsol_event(struct hda_codec *codec,
17591 switch (res >> 26) {
17592 case ALC880_HP_EVENT:
17593 alc663_two_hp_m2_speaker_automute(codec);
17595 case ALC880_MIC_EVENT:
17596 alc_mic_automute(codec);
17601 #define alc663_mode6_setup alc663_mode1_setup
17603 static void alc663_mode6_inithook(struct hda_codec *codec)
17605 alc663_two_hp_m2_speaker_automute(codec);
17606 alc_mic_automute(codec);
17609 /* ***************** Mode7 ******************************/
17610 static void alc663_mode7_unsol_event(struct hda_codec *codec,
17613 switch (res >> 26) {
17614 case ALC880_HP_EVENT:
17615 alc663_two_hp_m7_speaker_automute(codec);
17617 case ALC880_MIC_EVENT:
17618 alc_mic_automute(codec);
17623 #define alc663_mode7_setup alc663_mode1_setup
17625 static void alc663_mode7_inithook(struct hda_codec *codec)
17627 alc663_two_hp_m7_speaker_automute(codec);
17628 alc_mic_automute(codec);
17631 /* ***************** Mode8 ******************************/
17632 static void alc663_mode8_unsol_event(struct hda_codec *codec,
17635 switch (res >> 26) {
17636 case ALC880_HP_EVENT:
17637 alc663_two_hp_m8_speaker_automute(codec);
17639 case ALC880_MIC_EVENT:
17640 alc_mic_automute(codec);
17645 #define alc663_mode8_setup alc663_m51va_setup
17647 static void alc663_mode8_inithook(struct hda_codec *codec)
17649 alc663_two_hp_m8_speaker_automute(codec);
17650 alc_mic_automute(codec);
17653 static void alc663_g71v_hp_automute(struct hda_codec *codec)
17655 unsigned int present;
17656 unsigned char bits;
17658 present = snd_hda_jack_detect(codec, 0x21);
17659 bits = present ? HDA_AMP_MUTE : 0;
17660 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17661 HDA_AMP_MUTE, bits);
17662 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17663 HDA_AMP_MUTE, bits);
17666 static void alc663_g71v_front_automute(struct hda_codec *codec)
17668 unsigned int present;
17669 unsigned char bits;
17671 present = snd_hda_jack_detect(codec, 0x15);
17672 bits = present ? HDA_AMP_MUTE : 0;
17673 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17674 HDA_AMP_MUTE, bits);
17677 static void alc663_g71v_unsol_event(struct hda_codec *codec,
17680 switch (res >> 26) {
17681 case ALC880_HP_EVENT:
17682 alc663_g71v_hp_automute(codec);
17684 case ALC880_FRONT_EVENT:
17685 alc663_g71v_front_automute(codec);
17687 case ALC880_MIC_EVENT:
17688 alc_mic_automute(codec);
17693 #define alc663_g71v_setup alc663_m51va_setup
17695 static void alc663_g71v_inithook(struct hda_codec *codec)
17697 alc663_g71v_front_automute(codec);
17698 alc663_g71v_hp_automute(codec);
17699 alc_mic_automute(codec);
17702 static void alc663_g50v_unsol_event(struct hda_codec *codec,
17705 switch (res >> 26) {
17706 case ALC880_HP_EVENT:
17707 alc663_m51va_speaker_automute(codec);
17709 case ALC880_MIC_EVENT:
17710 alc_mic_automute(codec);
17715 #define alc663_g50v_setup alc663_m51va_setup
17717 static void alc663_g50v_inithook(struct hda_codec *codec)
17719 alc663_m51va_speaker_automute(codec);
17720 alc_mic_automute(codec);
17723 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
17724 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17725 ALC262_HIPPO_MASTER_SWITCH,
17727 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
17728 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
17729 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
17731 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
17732 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17733 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17737 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
17738 /* Master Playback automatically created from Speaker and Headphone */
17739 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17740 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17741 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17742 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17744 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17745 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17746 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
17748 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17749 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17750 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
17754 #ifdef CONFIG_SND_HDA_POWER_SAVE
17755 #define alc662_loopbacks alc880_loopbacks
17759 /* pcm configuration: identical with ALC880 */
17760 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
17761 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
17762 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
17763 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
17766 * configuration and preset
17768 static const char *alc662_models[ALC662_MODEL_LAST] = {
17769 [ALC662_3ST_2ch_DIG] = "3stack-dig",
17770 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
17771 [ALC662_3ST_6ch] = "3stack-6ch",
17772 [ALC662_5ST_DIG] = "6stack-dig",
17773 [ALC662_LENOVO_101E] = "lenovo-101e",
17774 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
17775 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
17776 [ALC662_ECS] = "ecs",
17777 [ALC663_ASUS_M51VA] = "m51va",
17778 [ALC663_ASUS_G71V] = "g71v",
17779 [ALC663_ASUS_H13] = "h13",
17780 [ALC663_ASUS_G50V] = "g50v",
17781 [ALC663_ASUS_MODE1] = "asus-mode1",
17782 [ALC662_ASUS_MODE2] = "asus-mode2",
17783 [ALC663_ASUS_MODE3] = "asus-mode3",
17784 [ALC663_ASUS_MODE4] = "asus-mode4",
17785 [ALC663_ASUS_MODE5] = "asus-mode5",
17786 [ALC663_ASUS_MODE6] = "asus-mode6",
17787 [ALC663_ASUS_MODE7] = "asus-mode7",
17788 [ALC663_ASUS_MODE8] = "asus-mode8",
17789 [ALC272_DELL] = "dell",
17790 [ALC272_DELL_ZM1] = "dell-zm1",
17791 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
17792 [ALC662_AUTO] = "auto",
17795 static struct snd_pci_quirk alc662_cfg_tbl[] = {
17796 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
17797 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
17798 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
17799 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
17800 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
17801 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1),
17802 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
17803 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
17804 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
17805 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
17806 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
17807 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
17808 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
17809 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
17810 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
17811 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
17812 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
17813 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
17814 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
17815 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
17816 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
17817 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
17818 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
17819 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
17820 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
17821 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
17822 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
17823 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
17824 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
17825 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
17826 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
17827 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
17828 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
17829 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
17830 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
17831 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
17832 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
17833 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
17834 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
17835 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
17836 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
17837 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1),
17838 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
17839 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
17840 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
17841 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
17842 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
17843 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
17844 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
17845 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
17846 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
17847 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
17848 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
17849 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
17850 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
17851 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
17852 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
17853 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
17854 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
17855 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
17856 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
17857 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
17858 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
17859 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
17860 ALC662_3ST_6ch_DIG),
17861 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO),
17862 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
17863 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
17864 ALC662_3ST_6ch_DIG),
17865 SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13),
17866 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
17867 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
17868 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
17869 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
17870 ALC662_3ST_6ch_DIG),
17871 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
17873 SND_PCI_QUIRK(0x8086, 0xd604, "Intel mobo", ALC662_3ST_2ch_DIG),
17877 static struct alc_config_preset alc662_presets[] = {
17878 [ALC662_3ST_2ch_DIG] = {
17879 .mixers = { alc662_3ST_2ch_mixer },
17880 .init_verbs = { alc662_init_verbs },
17881 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17882 .dac_nids = alc662_dac_nids,
17883 .dig_out_nid = ALC662_DIGOUT_NID,
17884 .dig_in_nid = ALC662_DIGIN_NID,
17885 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17886 .channel_mode = alc662_3ST_2ch_modes,
17887 .input_mux = &alc662_capture_source,
17889 [ALC662_3ST_6ch_DIG] = {
17890 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17891 .init_verbs = { alc662_init_verbs },
17892 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17893 .dac_nids = alc662_dac_nids,
17894 .dig_out_nid = ALC662_DIGOUT_NID,
17895 .dig_in_nid = ALC662_DIGIN_NID,
17896 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17897 .channel_mode = alc662_3ST_6ch_modes,
17899 .input_mux = &alc662_capture_source,
17901 [ALC662_3ST_6ch] = {
17902 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17903 .init_verbs = { alc662_init_verbs },
17904 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17905 .dac_nids = alc662_dac_nids,
17906 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17907 .channel_mode = alc662_3ST_6ch_modes,
17909 .input_mux = &alc662_capture_source,
17911 [ALC662_5ST_DIG] = {
17912 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
17913 .init_verbs = { alc662_init_verbs },
17914 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17915 .dac_nids = alc662_dac_nids,
17916 .dig_out_nid = ALC662_DIGOUT_NID,
17917 .dig_in_nid = ALC662_DIGIN_NID,
17918 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
17919 .channel_mode = alc662_5stack_modes,
17920 .input_mux = &alc662_capture_source,
17922 [ALC662_LENOVO_101E] = {
17923 .mixers = { alc662_lenovo_101e_mixer },
17924 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
17925 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17926 .dac_nids = alc662_dac_nids,
17927 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17928 .channel_mode = alc662_3ST_2ch_modes,
17929 .input_mux = &alc662_lenovo_101e_capture_source,
17930 .unsol_event = alc662_lenovo_101e_unsol_event,
17931 .init_hook = alc662_lenovo_101e_all_automute,
17933 [ALC662_ASUS_EEEPC_P701] = {
17934 .mixers = { alc662_eeepc_p701_mixer },
17935 .init_verbs = { alc662_init_verbs,
17936 alc662_eeepc_sue_init_verbs },
17937 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17938 .dac_nids = alc662_dac_nids,
17939 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17940 .channel_mode = alc662_3ST_2ch_modes,
17941 .unsol_event = alc662_eeepc_unsol_event,
17942 .setup = alc662_eeepc_setup,
17943 .init_hook = alc662_eeepc_inithook,
17945 [ALC662_ASUS_EEEPC_EP20] = {
17946 .mixers = { alc662_eeepc_ep20_mixer,
17947 alc662_chmode_mixer },
17948 .init_verbs = { alc662_init_verbs,
17949 alc662_eeepc_ep20_sue_init_verbs },
17950 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17951 .dac_nids = alc662_dac_nids,
17952 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17953 .channel_mode = alc662_3ST_6ch_modes,
17954 .input_mux = &alc662_lenovo_101e_capture_source,
17955 .unsol_event = alc662_eeepc_unsol_event,
17956 .setup = alc662_eeepc_ep20_setup,
17957 .init_hook = alc662_eeepc_ep20_inithook,
17960 .mixers = { alc662_ecs_mixer },
17961 .init_verbs = { alc662_init_verbs,
17962 alc662_ecs_init_verbs },
17963 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17964 .dac_nids = alc662_dac_nids,
17965 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17966 .channel_mode = alc662_3ST_2ch_modes,
17967 .unsol_event = alc662_eeepc_unsol_event,
17968 .setup = alc662_eeepc_setup,
17969 .init_hook = alc662_eeepc_inithook,
17971 [ALC663_ASUS_M51VA] = {
17972 .mixers = { alc663_m51va_mixer },
17973 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17974 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17975 .dac_nids = alc662_dac_nids,
17976 .dig_out_nid = ALC662_DIGOUT_NID,
17977 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17978 .channel_mode = alc662_3ST_2ch_modes,
17979 .unsol_event = alc663_m51va_unsol_event,
17980 .setup = alc663_m51va_setup,
17981 .init_hook = alc663_m51va_inithook,
17983 [ALC663_ASUS_G71V] = {
17984 .mixers = { alc663_g71v_mixer },
17985 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
17986 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17987 .dac_nids = alc662_dac_nids,
17988 .dig_out_nid = ALC662_DIGOUT_NID,
17989 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17990 .channel_mode = alc662_3ST_2ch_modes,
17991 .unsol_event = alc663_g71v_unsol_event,
17992 .setup = alc663_g71v_setup,
17993 .init_hook = alc663_g71v_inithook,
17995 [ALC663_ASUS_H13] = {
17996 .mixers = { alc663_m51va_mixer },
17997 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17998 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17999 .dac_nids = alc662_dac_nids,
18000 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18001 .channel_mode = alc662_3ST_2ch_modes,
18002 .unsol_event = alc663_m51va_unsol_event,
18003 .init_hook = alc663_m51va_inithook,
18005 [ALC663_ASUS_G50V] = {
18006 .mixers = { alc663_g50v_mixer },
18007 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
18008 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18009 .dac_nids = alc662_dac_nids,
18010 .dig_out_nid = ALC662_DIGOUT_NID,
18011 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18012 .channel_mode = alc662_3ST_6ch_modes,
18013 .input_mux = &alc663_capture_source,
18014 .unsol_event = alc663_g50v_unsol_event,
18015 .setup = alc663_g50v_setup,
18016 .init_hook = alc663_g50v_inithook,
18018 [ALC663_ASUS_MODE1] = {
18019 .mixers = { alc663_m51va_mixer },
18020 .cap_mixer = alc662_auto_capture_mixer,
18021 .init_verbs = { alc662_init_verbs,
18022 alc663_21jd_amic_init_verbs },
18023 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18025 .dac_nids = alc662_dac_nids,
18026 .dig_out_nid = ALC662_DIGOUT_NID,
18027 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18028 .channel_mode = alc662_3ST_2ch_modes,
18029 .unsol_event = alc663_mode1_unsol_event,
18030 .setup = alc663_mode1_setup,
18031 .init_hook = alc663_mode1_inithook,
18033 [ALC662_ASUS_MODE2] = {
18034 .mixers = { alc662_1bjd_mixer },
18035 .cap_mixer = alc662_auto_capture_mixer,
18036 .init_verbs = { alc662_init_verbs,
18037 alc662_1bjd_amic_init_verbs },
18038 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18039 .dac_nids = alc662_dac_nids,
18040 .dig_out_nid = ALC662_DIGOUT_NID,
18041 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18042 .channel_mode = alc662_3ST_2ch_modes,
18043 .unsol_event = alc662_mode2_unsol_event,
18044 .setup = alc662_mode2_setup,
18045 .init_hook = alc662_mode2_inithook,
18047 [ALC663_ASUS_MODE3] = {
18048 .mixers = { alc663_two_hp_m1_mixer },
18049 .cap_mixer = alc662_auto_capture_mixer,
18050 .init_verbs = { alc662_init_verbs,
18051 alc663_two_hp_amic_m1_init_verbs },
18052 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18054 .dac_nids = alc662_dac_nids,
18055 .dig_out_nid = ALC662_DIGOUT_NID,
18056 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18057 .channel_mode = alc662_3ST_2ch_modes,
18058 .unsol_event = alc663_mode3_unsol_event,
18059 .setup = alc663_mode3_setup,
18060 .init_hook = alc663_mode3_inithook,
18062 [ALC663_ASUS_MODE4] = {
18063 .mixers = { alc663_asus_21jd_clfe_mixer },
18064 .cap_mixer = alc662_auto_capture_mixer,
18065 .init_verbs = { alc662_init_verbs,
18066 alc663_21jd_amic_init_verbs},
18067 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18069 .dac_nids = alc662_dac_nids,
18070 .dig_out_nid = ALC662_DIGOUT_NID,
18071 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18072 .channel_mode = alc662_3ST_2ch_modes,
18073 .unsol_event = alc663_mode4_unsol_event,
18074 .setup = alc663_mode4_setup,
18075 .init_hook = alc663_mode4_inithook,
18077 [ALC663_ASUS_MODE5] = {
18078 .mixers = { alc663_asus_15jd_clfe_mixer },
18079 .cap_mixer = alc662_auto_capture_mixer,
18080 .init_verbs = { alc662_init_verbs,
18081 alc663_15jd_amic_init_verbs },
18082 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18084 .dac_nids = alc662_dac_nids,
18085 .dig_out_nid = ALC662_DIGOUT_NID,
18086 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18087 .channel_mode = alc662_3ST_2ch_modes,
18088 .unsol_event = alc663_mode5_unsol_event,
18089 .setup = alc663_mode5_setup,
18090 .init_hook = alc663_mode5_inithook,
18092 [ALC663_ASUS_MODE6] = {
18093 .mixers = { alc663_two_hp_m2_mixer },
18094 .cap_mixer = alc662_auto_capture_mixer,
18095 .init_verbs = { alc662_init_verbs,
18096 alc663_two_hp_amic_m2_init_verbs },
18097 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18099 .dac_nids = alc662_dac_nids,
18100 .dig_out_nid = ALC662_DIGOUT_NID,
18101 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18102 .channel_mode = alc662_3ST_2ch_modes,
18103 .unsol_event = alc663_mode6_unsol_event,
18104 .setup = alc663_mode6_setup,
18105 .init_hook = alc663_mode6_inithook,
18107 [ALC663_ASUS_MODE7] = {
18108 .mixers = { alc663_mode7_mixer },
18109 .cap_mixer = alc662_auto_capture_mixer,
18110 .init_verbs = { alc662_init_verbs,
18111 alc663_mode7_init_verbs },
18112 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18114 .dac_nids = alc662_dac_nids,
18115 .dig_out_nid = ALC662_DIGOUT_NID,
18116 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18117 .channel_mode = alc662_3ST_2ch_modes,
18118 .unsol_event = alc663_mode7_unsol_event,
18119 .setup = alc663_mode7_setup,
18120 .init_hook = alc663_mode7_inithook,
18122 [ALC663_ASUS_MODE8] = {
18123 .mixers = { alc663_mode8_mixer },
18124 .cap_mixer = alc662_auto_capture_mixer,
18125 .init_verbs = { alc662_init_verbs,
18126 alc663_mode8_init_verbs },
18127 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18129 .dac_nids = alc662_dac_nids,
18130 .dig_out_nid = ALC662_DIGOUT_NID,
18131 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18132 .channel_mode = alc662_3ST_2ch_modes,
18133 .unsol_event = alc663_mode8_unsol_event,
18134 .setup = alc663_mode8_setup,
18135 .init_hook = alc663_mode8_inithook,
18138 .mixers = { alc663_m51va_mixer },
18139 .cap_mixer = alc272_auto_capture_mixer,
18140 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
18141 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18142 .dac_nids = alc662_dac_nids,
18143 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18144 .adc_nids = alc272_adc_nids,
18145 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
18146 .capsrc_nids = alc272_capsrc_nids,
18147 .channel_mode = alc662_3ST_2ch_modes,
18148 .unsol_event = alc663_m51va_unsol_event,
18149 .setup = alc663_m51va_setup,
18150 .init_hook = alc663_m51va_inithook,
18152 [ALC272_DELL_ZM1] = {
18153 .mixers = { alc663_m51va_mixer },
18154 .cap_mixer = alc662_auto_capture_mixer,
18155 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
18156 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18157 .dac_nids = alc662_dac_nids,
18158 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18159 .adc_nids = alc662_adc_nids,
18161 .capsrc_nids = alc662_capsrc_nids,
18162 .channel_mode = alc662_3ST_2ch_modes,
18163 .unsol_event = alc663_m51va_unsol_event,
18164 .setup = alc663_m51va_setup,
18165 .init_hook = alc663_m51va_inithook,
18167 [ALC272_SAMSUNG_NC10] = {
18168 .mixers = { alc272_nc10_mixer },
18169 .init_verbs = { alc662_init_verbs,
18170 alc663_21jd_amic_init_verbs },
18171 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18172 .dac_nids = alc272_dac_nids,
18173 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18174 .channel_mode = alc662_3ST_2ch_modes,
18175 /*.input_mux = &alc272_nc10_capture_source,*/
18176 .unsol_event = alc663_mode4_unsol_event,
18177 .setup = alc663_mode4_setup,
18178 .init_hook = alc663_mode4_inithook,
18184 * BIOS auto configuration
18187 /* convert from MIX nid to DAC */
18188 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
18192 else if (nid >= 0x0c && nid <= 0x0e)
18193 return nid - 0x0c + 0x02;
18198 /* get MIX nid connected to the given pin targeted to DAC */
18199 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
18205 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
18206 for (i = 0; i < num; i++) {
18207 if (alc662_mix_to_dac(mix[i]) == dac)
18213 /* look for an empty DAC slot */
18214 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
18216 struct alc_spec *spec = codec->spec;
18220 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
18223 for (i = 0; i < num; i++) {
18224 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
18227 for (j = 0; j < spec->multiout.num_dacs; j++)
18228 if (spec->multiout.dac_nids[j] == nid)
18230 if (j >= spec->multiout.num_dacs)
18236 /* fill in the dac_nids table from the parsed pin configuration */
18237 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
18238 const struct auto_pin_cfg *cfg)
18240 struct alc_spec *spec = codec->spec;
18244 spec->multiout.dac_nids = spec->private_dac_nids;
18245 for (i = 0; i < cfg->line_outs; i++) {
18246 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
18249 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
18254 static inline int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
18255 hda_nid_t nid, unsigned int chs)
18257 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
18258 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
18261 static inline int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
18262 hda_nid_t nid, unsigned int chs)
18264 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
18265 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
18268 #define alc662_add_stereo_vol(spec, pfx, nid) \
18269 alc662_add_vol_ctl(spec, pfx, nid, 3)
18270 #define alc662_add_stereo_sw(spec, pfx, nid) \
18271 alc662_add_sw_ctl(spec, pfx, nid, 3)
18273 /* add playback controls from the parsed DAC table */
18274 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
18275 const struct auto_pin_cfg *cfg)
18277 struct alc_spec *spec = codec->spec;
18278 static const char *chname[4] = {
18279 "Front", "Surround", NULL /*CLFE*/, "Side"
18281 hda_nid_t nid, mix;
18284 for (i = 0; i < cfg->line_outs; i++) {
18285 nid = spec->multiout.dac_nids[i];
18288 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
18293 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
18296 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
18299 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
18302 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
18307 if (cfg->line_outs == 1 &&
18308 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
18315 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
18318 if (cfg->line_outs == 1 &&
18319 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
18321 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
18329 /* add playback controls for speaker and HP outputs */
18330 /* return DAC nid if any new DAC is assigned */
18331 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
18334 struct alc_spec *spec = codec->spec;
18335 hda_nid_t nid, mix;
18340 nid = alc662_look_for_dac(codec, pin);
18342 /* the corresponding DAC is already occupied */
18343 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
18344 return 0; /* no way */
18345 /* create a switch only */
18346 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
18347 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
18350 mix = alc662_dac_to_mix(codec, pin, nid);
18353 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
18356 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
18362 /* create playback/capture controls for input pins */
18363 #define alc662_auto_create_input_ctls \
18364 alc882_auto_create_input_ctls
18366 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
18367 hda_nid_t nid, int pin_type,
18373 alc_set_pin_output(codec, nid, pin_type);
18374 /* need the manual connection? */
18375 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
18378 for (i = 0; i < num; i++) {
18379 if (alc662_mix_to_dac(srcs[i]) != dac)
18381 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
18386 static void alc662_auto_init_multi_out(struct hda_codec *codec)
18388 struct alc_spec *spec = codec->spec;
18389 int pin_type = get_pin_type(spec->autocfg.line_out_type);
18392 for (i = 0; i <= HDA_SIDE; i++) {
18393 hda_nid_t nid = spec->autocfg.line_out_pins[i];
18395 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
18396 spec->multiout.dac_nids[i]);
18400 static void alc662_auto_init_hp_out(struct hda_codec *codec)
18402 struct alc_spec *spec = codec->spec;
18405 pin = spec->autocfg.hp_pins[0];
18407 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
18408 spec->multiout.hp_nid);
18409 pin = spec->autocfg.speaker_pins[0];
18411 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
18412 spec->multiout.extra_out_nid[0]);
18415 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
18417 static void alc662_auto_init_analog_input(struct hda_codec *codec)
18419 struct alc_spec *spec = codec->spec;
18422 for (i = 0; i < AUTO_PIN_LAST; i++) {
18423 hda_nid_t nid = spec->autocfg.input_pins[i];
18424 if (alc_is_input_pin(codec, nid)) {
18425 alc_set_input_pin(codec, nid, i);
18426 if (nid != ALC662_PIN_CD_NID &&
18427 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
18428 snd_hda_codec_write(codec, nid, 0,
18429 AC_VERB_SET_AMP_GAIN_MUTE,
18435 #define alc662_auto_init_input_src alc882_auto_init_input_src
18437 static int alc662_parse_auto_config(struct hda_codec *codec)
18439 struct alc_spec *spec = codec->spec;
18441 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
18443 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
18447 if (!spec->autocfg.line_outs)
18448 return 0; /* can't find valid BIOS pin config */
18450 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
18453 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
18456 err = alc662_auto_create_extra_out(codec,
18457 spec->autocfg.speaker_pins[0],
18462 spec->multiout.extra_out_nid[0] = err;
18463 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
18468 spec->multiout.hp_nid = err;
18469 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
18473 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
18475 if (spec->autocfg.dig_outs)
18476 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
18478 if (spec->kctls.list)
18479 add_mixer(spec, spec->kctls.list);
18481 spec->num_mux_defs = 1;
18482 spec->input_mux = &spec->private_imux[0];
18484 add_verb(spec, alc662_init_verbs);
18485 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
18486 codec->vendor_id == 0x10ec0665)
18487 add_verb(spec, alc663_init_verbs);
18489 if (codec->vendor_id == 0x10ec0272)
18490 add_verb(spec, alc272_init_verbs);
18492 err = alc_auto_add_mic_boost(codec);
18496 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
18497 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
18498 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21);
18500 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
18505 /* additional initialization for auto-configuration model */
18506 static void alc662_auto_init(struct hda_codec *codec)
18508 struct alc_spec *spec = codec->spec;
18509 alc662_auto_init_multi_out(codec);
18510 alc662_auto_init_hp_out(codec);
18511 alc662_auto_init_analog_input(codec);
18512 alc662_auto_init_input_src(codec);
18513 if (spec->unsol_event)
18514 alc_inithook(codec);
18517 static int patch_alc662(struct hda_codec *codec)
18519 struct alc_spec *spec;
18520 int err, board_config;
18522 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
18526 codec->spec = spec;
18528 alc_fix_pll_init(codec, 0x20, 0x04, 15);
18530 if (alc_read_coef_idx(codec, 0)==0x8020){
18531 kfree(codec->chip_name);
18532 codec->chip_name = kstrdup("ALC661", GFP_KERNEL);
18533 if (!codec->chip_name) {
18539 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
18542 if (board_config < 0) {
18543 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
18545 board_config = ALC662_AUTO;
18548 if (board_config == ALC662_AUTO) {
18549 /* automatic parse from the BIOS config */
18550 err = alc662_parse_auto_config(codec);
18556 "hda_codec: Cannot set up configuration "
18557 "from BIOS. Using base mode...\n");
18558 board_config = ALC662_3ST_2ch_DIG;
18562 err = snd_hda_attach_beep_device(codec, 0x1);
18568 if (board_config != ALC662_AUTO)
18569 setup_preset(codec, &alc662_presets[board_config]);
18571 spec->stream_analog_playback = &alc662_pcm_analog_playback;
18572 spec->stream_analog_capture = &alc662_pcm_analog_capture;
18574 spec->stream_digital_playback = &alc662_pcm_digital_playback;
18575 spec->stream_digital_capture = &alc662_pcm_digital_capture;
18577 if (!spec->adc_nids) {
18578 spec->adc_nids = alc662_adc_nids;
18579 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
18581 if (!spec->capsrc_nids)
18582 spec->capsrc_nids = alc662_capsrc_nids;
18584 if (!spec->cap_mixer)
18585 set_capture_mixer(codec);
18587 switch (codec->vendor_id) {
18589 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
18594 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
18597 set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
18600 spec->vmaster_nid = 0x02;
18602 codec->patch_ops = alc_patch_ops;
18603 if (board_config == ALC662_AUTO)
18604 spec->init_hook = alc662_auto_init;
18605 #ifdef CONFIG_SND_HDA_POWER_SAVE
18606 if (!spec->loopback.amplist)
18607 spec->loopback.amplist = alc662_loopbacks;
18613 static int patch_alc888(struct hda_codec *codec)
18615 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
18616 kfree(codec->chip_name);
18617 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
18618 if (!codec->chip_name) {
18622 return patch_alc662(codec);
18624 return patch_alc882(codec);
18630 static struct hda_codec_preset snd_hda_preset_realtek[] = {
18631 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
18632 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
18633 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
18634 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
18635 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
18636 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
18637 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
18638 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
18639 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
18640 .patch = patch_alc861 },
18641 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
18642 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
18643 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
18644 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
18645 .patch = patch_alc882 },
18646 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
18647 .patch = patch_alc662 },
18648 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
18649 { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
18650 { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
18651 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
18652 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
18653 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
18654 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
18655 .patch = patch_alc882 },
18656 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
18657 .patch = patch_alc882 },
18658 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
18659 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
18660 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
18661 .patch = patch_alc882 },
18662 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
18663 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
18664 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
18665 {} /* terminator */
18668 MODULE_ALIAS("snd-hda-codec-id:10ec*");
18670 MODULE_LICENSE("GPL");
18671 MODULE_DESCRIPTION("Realtek HD-audio codec");
18673 static struct hda_codec_preset_list realtek_list = {
18674 .preset = snd_hda_preset_realtek,
18675 .owner = THIS_MODULE,
18678 static int __init patch_realtek_init(void)
18680 return snd_hda_add_codec_preset(&realtek_list);
18683 static void __exit patch_realtek_exit(void)
18685 snd_hda_delete_codec_preset(&realtek_list);
18688 module_init(patch_realtek_init)
18689 module_exit(patch_realtek_exit)