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)
1395 const struct alc_pincfg *cfg;
1397 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1401 fix += quirk->value;
1404 for (; cfg->nid; cfg++)
1405 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1408 add_verb(codec->spec, fix->verbs);
1411 static int alc_read_coef_idx(struct hda_codec *codec,
1412 unsigned int coef_idx)
1415 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX,
1417 val = snd_hda_codec_read(codec, 0x20, 0,
1418 AC_VERB_GET_PROC_COEF, 0);
1429 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1430 /* Mic-in jack as mic in */
1431 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1432 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1433 /* Line-in jack as Line in */
1434 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1435 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1436 /* Line-Out as Front */
1437 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1444 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1445 /* Mic-in jack as mic in */
1446 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1447 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1448 /* Line-in jack as Surround */
1449 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1450 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1451 /* Line-Out as Front */
1452 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1459 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1460 /* Mic-in jack as CLFE */
1461 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1462 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1463 /* Line-in jack as Surround */
1464 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1465 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1466 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1467 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1474 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1475 /* Mic-in jack as CLFE */
1476 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1477 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1478 /* Line-in jack as Surround */
1479 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1480 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1481 /* Line-Out as Side */
1482 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1486 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1487 { 2, alc888_4ST_ch2_intel_init },
1488 { 4, alc888_4ST_ch4_intel_init },
1489 { 6, alc888_4ST_ch6_intel_init },
1490 { 8, alc888_4ST_ch8_intel_init },
1494 * ALC888 Fujitsu Siemens Amillo xa3530
1497 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1498 /* Front Mic: set to PIN_IN (empty by default) */
1499 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1500 /* Connect Internal HP to Front */
1501 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1502 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1503 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1504 /* Connect Bass HP to Front */
1505 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1506 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1507 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1508 /* Connect Line-Out side jack (SPDIF) to Side */
1509 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1510 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1511 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1512 /* Connect Mic jack to CLFE */
1513 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1514 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1515 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1516 /* Connect Line-in jack to Surround */
1517 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1518 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1519 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1520 /* Connect HP out jack to Front */
1521 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1522 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1523 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1524 /* Enable unsolicited event for HP jack and Line-out jack */
1525 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1526 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1530 static void alc_automute_amp(struct hda_codec *codec)
1532 struct alc_spec *spec = codec->spec;
1537 spec->jack_present = 0;
1538 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
1539 nid = spec->autocfg.hp_pins[i];
1542 if (snd_hda_jack_detect(codec, nid)) {
1543 spec->jack_present = 1;
1548 mute = spec->jack_present ? HDA_AMP_MUTE : 0;
1549 /* Toggle internal speakers muting */
1550 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1551 nid = spec->autocfg.speaker_pins[i];
1554 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1555 HDA_AMP_MUTE, mute);
1559 static void alc_automute_amp_unsol_event(struct hda_codec *codec,
1562 if (codec->vendor_id == 0x10ec0880)
1566 if (res == ALC880_HP_EVENT)
1567 alc_automute_amp(codec);
1570 static void alc889_automute_setup(struct hda_codec *codec)
1572 struct alc_spec *spec = codec->spec;
1574 spec->autocfg.hp_pins[0] = 0x15;
1575 spec->autocfg.speaker_pins[0] = 0x14;
1576 spec->autocfg.speaker_pins[1] = 0x16;
1577 spec->autocfg.speaker_pins[2] = 0x17;
1578 spec->autocfg.speaker_pins[3] = 0x19;
1579 spec->autocfg.speaker_pins[4] = 0x1a;
1582 static void alc889_intel_init_hook(struct hda_codec *codec)
1584 alc889_coef_init(codec);
1585 alc_automute_amp(codec);
1588 static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec)
1590 struct alc_spec *spec = codec->spec;
1592 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
1593 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
1594 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
1595 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
1599 * ALC888 Acer Aspire 4930G model
1602 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1603 /* Front Mic: set to PIN_IN (empty by default) */
1604 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1605 /* Unselect Front Mic by default in input mixer 3 */
1606 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1607 /* Enable unsolicited event for HP jack */
1608 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1609 /* Connect Internal HP to front */
1610 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1611 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1612 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1613 /* Connect HP out to front */
1614 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1615 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1616 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1621 * ALC888 Acer Aspire 6530G model
1624 static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
1625 /* Route to built-in subwoofer as well as speakers */
1626 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1627 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1628 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1629 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1630 /* Bias voltage on for external mic port */
1631 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
1632 /* Front Mic: set to PIN_IN (empty by default) */
1633 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1634 /* Unselect Front Mic by default in input mixer 3 */
1635 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1636 /* Enable unsolicited event for HP jack */
1637 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1638 /* Enable speaker output */
1639 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1640 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1641 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
1642 /* Enable headphone output */
1643 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1644 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1645 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1646 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
1651 * ALC889 Acer Aspire 8930G model
1654 static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
1655 /* Front Mic: set to PIN_IN (empty by default) */
1656 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1657 /* Unselect Front Mic by default in input mixer 3 */
1658 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1659 /* Enable unsolicited event for HP jack */
1660 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1661 /* Connect Internal Front to Front */
1662 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1663 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1664 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1665 /* Connect Internal Rear to Rear */
1666 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1667 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1668 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
1669 /* Connect Internal CLFE to CLFE */
1670 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1671 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1672 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
1673 /* Connect HP out to Front */
1674 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1675 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1676 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1677 /* Enable all DACs */
1678 /* DAC DISABLE/MUTE 1? */
1679 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
1680 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
1681 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1682 /* DAC DISABLE/MUTE 2? */
1683 /* some bit here disables the other DACs. Init=0x4900 */
1684 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
1685 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1687 * This laptop has a stereo digital microphone. The mics are only 1cm apart
1688 * which makes the stereo useless. However, either the mic or the ALC889
1689 * makes the signal become a difference/sum signal instead of standard
1690 * stereo, which is annoying. So instead we flip this bit which makes the
1691 * codec replicate the sum signal to both channels, turning it into a
1694 /* DMIC_CONTROL? Init value = 0x0001 */
1695 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
1696 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
1700 static struct hda_input_mux alc888_2_capture_sources[2] = {
1701 /* Front mic only available on one ADC */
1708 { "Front Mic", 0xb },
1721 static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
1722 /* Interal mic only available on one ADC */
1729 { "Input Mix", 0xa },
1739 { "Input Mix", 0xa },
1744 static struct hda_input_mux alc889_capture_sources[3] = {
1745 /* Digital mic only available on first "ADC" */
1752 { "Front Mic", 0xb },
1753 { "Input Mix", 0xa },
1762 { "Input Mix", 0xa },
1771 { "Input Mix", 0xa },
1776 static struct snd_kcontrol_new alc888_base_mixer[] = {
1777 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1778 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1779 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1780 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1781 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1783 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1784 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1785 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1786 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1787 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1788 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1789 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1790 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1791 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1792 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1793 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1794 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1798 static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = {
1799 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1800 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1801 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1802 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1803 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1805 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1806 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1807 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1808 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1809 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1810 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1811 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1812 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1817 static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
1819 struct alc_spec *spec = codec->spec;
1821 spec->autocfg.hp_pins[0] = 0x15;
1822 spec->autocfg.speaker_pins[0] = 0x14;
1823 spec->autocfg.speaker_pins[1] = 0x16;
1824 spec->autocfg.speaker_pins[2] = 0x17;
1827 static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
1829 struct alc_spec *spec = codec->spec;
1831 spec->autocfg.hp_pins[0] = 0x15;
1832 spec->autocfg.speaker_pins[0] = 0x14;
1833 spec->autocfg.speaker_pins[1] = 0x16;
1834 spec->autocfg.speaker_pins[2] = 0x17;
1837 static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
1839 struct alc_spec *spec = codec->spec;
1841 spec->autocfg.hp_pins[0] = 0x15;
1842 spec->autocfg.speaker_pins[0] = 0x14;
1843 spec->autocfg.speaker_pins[1] = 0x16;
1844 spec->autocfg.speaker_pins[2] = 0x1b;
1848 * ALC880 3-stack model
1850 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1851 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1852 * F-Mic = 0x1b, HP = 0x19
1855 static hda_nid_t alc880_dac_nids[4] = {
1856 /* front, rear, clfe, rear_surr */
1857 0x02, 0x05, 0x04, 0x03
1860 static hda_nid_t alc880_adc_nids[3] = {
1865 /* The datasheet says the node 0x07 is connected from inputs,
1866 * but it shows zero connection in the real implementation on some devices.
1867 * Note: this is a 915GAV bug, fixed on 915GLV
1869 static hda_nid_t alc880_adc_nids_alt[2] = {
1874 #define ALC880_DIGOUT_NID 0x06
1875 #define ALC880_DIGIN_NID 0x0a
1877 static struct hda_input_mux alc880_capture_source = {
1881 { "Front Mic", 0x3 },
1887 /* channel source setting (2/6 channel selection for 3-stack) */
1889 static struct hda_verb alc880_threestack_ch2_init[] = {
1890 /* set line-in to input, mute it */
1891 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1892 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1893 /* set mic-in to input vref 80%, mute it */
1894 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1895 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1900 static struct hda_verb alc880_threestack_ch6_init[] = {
1901 /* set line-in to output, unmute it */
1902 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1903 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1904 /* set mic-in to output, unmute it */
1905 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1906 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1910 static struct hda_channel_mode alc880_threestack_modes[2] = {
1911 { 2, alc880_threestack_ch2_init },
1912 { 6, alc880_threestack_ch6_init },
1915 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1916 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1917 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1918 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1919 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1920 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1921 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1922 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1923 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1924 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1925 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1926 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1927 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1928 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1929 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1930 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1931 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1932 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1934 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1935 .name = "Channel Mode",
1936 .info = alc_ch_mode_info,
1937 .get = alc_ch_mode_get,
1938 .put = alc_ch_mode_put,
1943 /* capture mixer elements */
1944 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1945 struct snd_ctl_elem_info *uinfo)
1947 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1948 struct alc_spec *spec = codec->spec;
1951 mutex_lock(&codec->control_mutex);
1952 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1954 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
1955 mutex_unlock(&codec->control_mutex);
1959 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1960 unsigned int size, unsigned int __user *tlv)
1962 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1963 struct alc_spec *spec = codec->spec;
1966 mutex_lock(&codec->control_mutex);
1967 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1969 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1970 mutex_unlock(&codec->control_mutex);
1974 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
1975 struct snd_ctl_elem_value *ucontrol);
1977 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1978 struct snd_ctl_elem_value *ucontrol,
1981 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1982 struct alc_spec *spec = codec->spec;
1983 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1986 mutex_lock(&codec->control_mutex);
1987 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1989 err = func(kcontrol, ucontrol);
1990 mutex_unlock(&codec->control_mutex);
1994 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
1995 struct snd_ctl_elem_value *ucontrol)
1997 return alc_cap_getput_caller(kcontrol, ucontrol,
1998 snd_hda_mixer_amp_volume_get);
2001 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
2002 struct snd_ctl_elem_value *ucontrol)
2004 return alc_cap_getput_caller(kcontrol, ucontrol,
2005 snd_hda_mixer_amp_volume_put);
2008 /* capture mixer elements */
2009 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
2011 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
2012 struct snd_ctl_elem_value *ucontrol)
2014 return alc_cap_getput_caller(kcontrol, ucontrol,
2015 snd_hda_mixer_amp_switch_get);
2018 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
2019 struct snd_ctl_elem_value *ucontrol)
2021 return alc_cap_getput_caller(kcontrol, ucontrol,
2022 snd_hda_mixer_amp_switch_put);
2025 #define _DEFINE_CAPMIX(num) \
2027 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2028 .name = "Capture Switch", \
2029 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
2031 .info = alc_cap_sw_info, \
2032 .get = alc_cap_sw_get, \
2033 .put = alc_cap_sw_put, \
2036 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2037 .name = "Capture Volume", \
2038 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
2039 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
2040 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
2042 .info = alc_cap_vol_info, \
2043 .get = alc_cap_vol_get, \
2044 .put = alc_cap_vol_put, \
2045 .tlv = { .c = alc_cap_vol_tlv }, \
2048 #define _DEFINE_CAPSRC(num) \
2050 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2051 /* .name = "Capture Source", */ \
2052 .name = "Input Source", \
2054 .info = alc_mux_enum_info, \
2055 .get = alc_mux_enum_get, \
2056 .put = alc_mux_enum_put, \
2059 #define DEFINE_CAPMIX(num) \
2060 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2061 _DEFINE_CAPMIX(num), \
2062 _DEFINE_CAPSRC(num), \
2066 #define DEFINE_CAPMIX_NOSRC(num) \
2067 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2068 _DEFINE_CAPMIX(num), \
2072 /* up to three ADCs */
2076 DEFINE_CAPMIX_NOSRC(1);
2077 DEFINE_CAPMIX_NOSRC(2);
2078 DEFINE_CAPMIX_NOSRC(3);
2081 * ALC880 5-stack model
2083 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2085 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2086 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2089 /* additional mixers to alc880_three_stack_mixer */
2090 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2091 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2092 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2096 /* channel source setting (6/8 channel selection for 5-stack) */
2098 static struct hda_verb alc880_fivestack_ch6_init[] = {
2099 /* set line-in to input, mute it */
2100 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2101 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2106 static struct hda_verb alc880_fivestack_ch8_init[] = {
2107 /* set line-in to output, unmute it */
2108 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2109 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2113 static struct hda_channel_mode alc880_fivestack_modes[2] = {
2114 { 6, alc880_fivestack_ch6_init },
2115 { 8, alc880_fivestack_ch8_init },
2120 * ALC880 6-stack model
2122 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2123 * Side = 0x05 (0x0f)
2124 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2125 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2128 static hda_nid_t alc880_6st_dac_nids[4] = {
2129 /* front, rear, clfe, rear_surr */
2130 0x02, 0x03, 0x04, 0x05
2133 static struct hda_input_mux alc880_6stack_capture_source = {
2137 { "Front Mic", 0x1 },
2143 /* fixed 8-channels */
2144 static struct hda_channel_mode alc880_sixstack_modes[1] = {
2148 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2149 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2150 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2151 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2152 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2153 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2154 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2155 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2156 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2157 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2158 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2159 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2160 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2161 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2162 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2163 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2164 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2165 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2166 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2168 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2169 .name = "Channel Mode",
2170 .info = alc_ch_mode_info,
2171 .get = alc_ch_mode_get,
2172 .put = alc_ch_mode_put,
2181 * W810 has rear IO for:
2184 * Center/LFE (DAC 04)
2187 * The system also has a pair of internal speakers, and a headphone jack.
2188 * These are both connected to Line2 on the codec, hence to DAC 02.
2190 * There is a variable resistor to control the speaker or headphone
2191 * volume. This is a hardware-only device without a software API.
2193 * Plugging headphones in will disable the internal speakers. This is
2194 * implemented in hardware, not via the driver using jack sense. In
2195 * a similar fashion, plugging into the rear socket marked "front" will
2196 * disable both the speakers and headphones.
2198 * For input, there's a microphone jack, and an "audio in" jack.
2199 * These may not do anything useful with this driver yet, because I
2200 * haven't setup any initialization verbs for these yet...
2203 static hda_nid_t alc880_w810_dac_nids[3] = {
2204 /* front, rear/surround, clfe */
2208 /* fixed 6 channels */
2209 static struct hda_channel_mode alc880_w810_modes[1] = {
2213 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2214 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2215 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2216 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2217 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2218 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2219 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2220 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2221 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2222 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2223 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2231 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2232 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2236 static hda_nid_t alc880_z71v_dac_nids[1] = {
2239 #define ALC880_Z71V_HP_DAC 0x03
2241 /* fixed 2 channels */
2242 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2246 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2247 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2248 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2249 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2250 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2251 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2252 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2253 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2254 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2260 * ALC880 F1734 model
2262 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2263 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2266 static hda_nid_t alc880_f1734_dac_nids[1] = {
2269 #define ALC880_F1734_HP_DAC 0x02
2271 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2272 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2273 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2274 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2275 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2276 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2277 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2278 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2279 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2283 static struct hda_input_mux alc880_f1734_capture_source = {
2295 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2296 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2297 * Mic = 0x18, Line = 0x1a
2300 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2301 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2303 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2304 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2305 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2306 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2307 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2308 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2309 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2310 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2311 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2312 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2313 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2314 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2315 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2316 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2317 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2319 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2320 .name = "Channel Mode",
2321 .info = alc_ch_mode_info,
2322 .get = alc_ch_mode_get,
2323 .put = alc_ch_mode_put,
2329 * ALC880 ASUS W1V model
2331 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2332 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2333 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2336 /* additional mixers to alc880_asus_mixer */
2337 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2338 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2339 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2344 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2345 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2346 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2347 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2348 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2349 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2350 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2351 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2352 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2353 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2358 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2359 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2360 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2361 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2362 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2363 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2364 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2365 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2366 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2367 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2368 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2369 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2370 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2371 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2372 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2373 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2374 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2376 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2377 .name = "Channel Mode",
2378 .info = alc_ch_mode_info,
2379 .get = alc_ch_mode_get,
2380 .put = alc_ch_mode_put,
2385 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2386 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2387 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2388 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2389 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2390 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2391 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2392 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2393 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2394 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2395 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2399 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2400 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2401 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2402 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2403 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2404 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2405 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2410 * virtual master controls
2414 * slave controls for virtual master
2416 static const char *alc_slave_vols[] = {
2417 "Front Playback Volume",
2418 "Surround Playback Volume",
2419 "Center Playback Volume",
2420 "LFE Playback Volume",
2421 "Side Playback Volume",
2422 "Headphone Playback Volume",
2423 "Speaker Playback Volume",
2424 "Mono Playback Volume",
2425 "Line-Out Playback Volume",
2426 "PCM Playback Volume",
2430 static const char *alc_slave_sws[] = {
2431 "Front Playback Switch",
2432 "Surround Playback Switch",
2433 "Center Playback Switch",
2434 "LFE Playback Switch",
2435 "Side Playback Switch",
2436 "Headphone Playback Switch",
2437 "Speaker Playback Switch",
2438 "Mono Playback Switch",
2439 "IEC958 Playback Switch",
2440 "Line-Out Playback Switch",
2441 "PCM Playback Switch",
2446 * build control elements
2449 #define NID_MAPPING (-1)
2451 #define SUBDEV_SPEAKER_ (0 << 6)
2452 #define SUBDEV_HP_ (1 << 6)
2453 #define SUBDEV_LINE_ (2 << 6)
2454 #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f))
2455 #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f))
2456 #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f))
2458 static void alc_free_kctls(struct hda_codec *codec);
2460 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2461 /* additional beep mixers; the actual parameters are overwritten at build */
2462 static struct snd_kcontrol_new alc_beep_mixer[] = {
2463 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2464 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
2469 static int alc_build_controls(struct hda_codec *codec)
2471 struct alc_spec *spec = codec->spec;
2472 struct snd_kcontrol *kctl;
2473 struct snd_kcontrol_new *knew;
2478 for (i = 0; i < spec->num_mixers; i++) {
2479 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2483 if (spec->cap_mixer) {
2484 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2488 if (spec->multiout.dig_out_nid) {
2489 err = snd_hda_create_spdif_out_ctls(codec,
2490 spec->multiout.dig_out_nid);
2493 if (!spec->no_analog) {
2494 err = snd_hda_create_spdif_share_sw(codec,
2498 spec->multiout.share_spdif = 1;
2501 if (spec->dig_in_nid) {
2502 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2507 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2508 /* create beep controls if needed */
2509 if (spec->beep_amp) {
2510 struct snd_kcontrol_new *knew;
2511 for (knew = alc_beep_mixer; knew->name; knew++) {
2512 struct snd_kcontrol *kctl;
2513 kctl = snd_ctl_new1(knew, codec);
2516 kctl->private_value = spec->beep_amp;
2517 err = snd_hda_ctl_add(codec, 0, kctl);
2524 /* if we have no master control, let's create it */
2525 if (!spec->no_analog &&
2526 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2527 unsigned int vmaster_tlv[4];
2528 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2529 HDA_OUTPUT, vmaster_tlv);
2530 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2531 vmaster_tlv, alc_slave_vols);
2535 if (!spec->no_analog &&
2536 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2537 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2538 NULL, alc_slave_sws);
2543 /* assign Capture Source enums to NID */
2544 kctl = snd_hda_find_mixer_ctl(codec, "Capture Source");
2546 kctl = snd_hda_find_mixer_ctl(codec, "Input Source");
2547 for (i = 0; kctl && i < kctl->count; i++) {
2548 hda_nid_t *nids = spec->capsrc_nids;
2550 nids = spec->adc_nids;
2551 err = snd_hda_add_nid(codec, kctl, i, nids[i]);
2555 if (spec->cap_mixer) {
2556 const char *kname = kctl ? kctl->id.name : NULL;
2557 for (knew = spec->cap_mixer; knew->name; knew++) {
2558 if (kname && strcmp(knew->name, kname) == 0)
2560 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2561 for (i = 0; kctl && i < kctl->count; i++) {
2562 err = snd_hda_add_nid(codec, kctl, i,
2570 /* other nid->control mapping */
2571 for (i = 0; i < spec->num_mixers; i++) {
2572 for (knew = spec->mixers[i]; knew->name; knew++) {
2573 if (knew->iface != NID_MAPPING)
2575 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2578 u = knew->subdevice;
2579 for (j = 0; j < 4; j++, u >>= 8) {
2584 case SUBDEV_SPEAKER_:
2585 nid = spec->autocfg.speaker_pins[nid];
2588 nid = spec->autocfg.line_out_pins[nid];
2591 nid = spec->autocfg.hp_pins[nid];
2596 err = snd_hda_add_nid(codec, kctl, 0, nid);
2600 u = knew->private_value;
2601 for (j = 0; j < 4; j++, u >>= 8) {
2605 err = snd_hda_add_nid(codec, kctl, 0, nid);
2612 alc_free_kctls(codec); /* no longer needed */
2619 * initialize the codec volumes, etc
2623 * generic initialization of ADC, input mixers and output mixers
2625 static struct hda_verb alc880_volume_init_verbs[] = {
2627 * Unmute ADC0-2 and set the default input to mic-in
2629 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2630 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2631 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2632 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2633 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2634 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2636 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2638 * Note: PASD motherboards uses the Line In 2 as the input for front
2641 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2642 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2643 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2644 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2645 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2646 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2647 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2648 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2651 * Set up output mixers (0x0c - 0x0f)
2653 /* set vol=0 to output mixers */
2654 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2655 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2656 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2657 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2658 /* set up input amps for analog loopback */
2659 /* Amp Indices: DAC = 0, mixer = 1 */
2660 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2661 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2662 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2663 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2664 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2665 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2666 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2667 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2673 * 3-stack pin configuration:
2674 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2676 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2678 * preset connection lists of input pins
2679 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2681 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2682 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2683 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2686 * Set pin mode and muting
2688 /* set front pin widgets 0x14 for output */
2689 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2690 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2691 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2692 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2693 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2694 /* Mic2 (as headphone out) for HP output */
2695 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2696 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2697 /* Line In pin widget for input */
2698 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2699 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2700 /* Line2 (as front mic) pin widget for input and vref at 80% */
2701 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2702 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2703 /* CD pin widget for input */
2704 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2710 * 5-stack pin configuration:
2711 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2712 * line-in/side = 0x1a, f-mic = 0x1b
2714 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2716 * preset connection lists of input pins
2717 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2719 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2720 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2723 * Set pin mode and muting
2725 /* set pin widgets 0x14-0x17 for output */
2726 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2727 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2728 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2729 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2730 /* unmute pins for output (no gain on this amp) */
2731 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2732 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2733 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2734 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2736 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2737 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2738 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2739 /* Mic2 (as headphone out) for HP output */
2740 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2741 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2742 /* Line In pin widget for input */
2743 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2744 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2745 /* Line2 (as front mic) pin widget for input and vref at 80% */
2746 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2747 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2748 /* CD pin widget for input */
2749 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2755 * W810 pin configuration:
2756 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2758 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2759 /* hphone/speaker input selector: front DAC */
2760 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2762 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2763 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2764 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2765 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2766 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2767 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2769 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2770 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2776 * Z71V pin configuration:
2777 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2779 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2780 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2781 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2782 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2783 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2785 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2786 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2787 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2788 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2794 * 6-stack pin configuration:
2795 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2796 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2798 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2799 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2801 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2802 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2803 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2804 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2805 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2806 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2807 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2808 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2810 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2811 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2812 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2813 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2814 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2815 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2816 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2817 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2818 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2824 * Uniwill pin configuration:
2825 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2828 static struct hda_verb alc880_uniwill_init_verbs[] = {
2829 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2831 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2832 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2833 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2834 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2835 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2836 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2837 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2838 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2839 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2840 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2841 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2842 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2843 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2844 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2846 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2847 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2848 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2849 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2850 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2851 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2852 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2853 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2854 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2856 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2857 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2864 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2866 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2867 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2869 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2870 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2871 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2872 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2873 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2874 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2875 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2876 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2877 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2878 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2879 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2880 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2882 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2883 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2884 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2885 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2886 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2887 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2889 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2890 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2895 static struct hda_verb alc880_beep_init_verbs[] = {
2896 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2900 /* auto-toggle front mic */
2901 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2903 unsigned int present;
2906 present = snd_hda_jack_detect(codec, 0x18);
2907 bits = present ? HDA_AMP_MUTE : 0;
2908 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2911 static void alc880_uniwill_setup(struct hda_codec *codec)
2913 struct alc_spec *spec = codec->spec;
2915 spec->autocfg.hp_pins[0] = 0x14;
2916 spec->autocfg.speaker_pins[0] = 0x15;
2917 spec->autocfg.speaker_pins[0] = 0x16;
2920 static void alc880_uniwill_init_hook(struct hda_codec *codec)
2922 alc_automute_amp(codec);
2923 alc880_uniwill_mic_automute(codec);
2926 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2929 /* Looks like the unsol event is incompatible with the standard
2930 * definition. 4bit tag is placed at 28 bit!
2932 switch (res >> 28) {
2933 case ALC880_MIC_EVENT:
2934 alc880_uniwill_mic_automute(codec);
2937 alc_automute_amp_unsol_event(codec, res);
2942 static void alc880_uniwill_p53_setup(struct hda_codec *codec)
2944 struct alc_spec *spec = codec->spec;
2946 spec->autocfg.hp_pins[0] = 0x14;
2947 spec->autocfg.speaker_pins[0] = 0x15;
2950 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2952 unsigned int present;
2954 present = snd_hda_codec_read(codec, 0x21, 0,
2955 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2956 present &= HDA_AMP_VOLMASK;
2957 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2958 HDA_AMP_VOLMASK, present);
2959 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2960 HDA_AMP_VOLMASK, present);
2963 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2966 /* Looks like the unsol event is incompatible with the standard
2967 * definition. 4bit tag is placed at 28 bit!
2969 if ((res >> 28) == ALC880_DCVOL_EVENT)
2970 alc880_uniwill_p53_dcvol_automute(codec);
2972 alc_automute_amp_unsol_event(codec, res);
2976 * F1734 pin configuration:
2977 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2979 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2980 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2981 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2982 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2983 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2984 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2986 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2987 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2988 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2989 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2991 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2992 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2993 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2994 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2995 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2996 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2997 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2998 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2999 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3001 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
3002 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
3008 * ASUS pin configuration:
3009 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
3011 static struct hda_verb alc880_pin_asus_init_verbs[] = {
3012 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3013 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3014 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3015 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3017 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3018 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3019 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3020 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3021 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3022 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3023 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3024 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3026 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3027 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3028 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3029 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3030 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3031 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3032 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3033 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3034 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3039 /* Enable GPIO mask and set output */
3040 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
3041 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
3042 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
3044 /* Clevo m520g init */
3045 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
3046 /* headphone output */
3047 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3049 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3050 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3052 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3053 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3055 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3056 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3057 /* Mic1 (rear panel) */
3058 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3059 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3060 /* Mic2 (front panel) */
3061 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3062 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3064 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3065 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3066 /* change to EAPD mode */
3067 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3068 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3073 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
3074 /* change to EAPD mode */
3075 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3076 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3078 /* Headphone output */
3079 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3081 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3082 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
3084 /* Line In pin widget for input */
3085 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3086 /* CD pin widget for input */
3087 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3088 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3089 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3091 /* change to EAPD mode */
3092 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3093 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
3099 * LG m1 express dual
3102 * Rear Line-In/Out (blue): 0x14
3103 * Build-in Mic-In: 0x15
3105 * HP-Out (green): 0x1b
3106 * Mic-In/Out (red): 0x19
3110 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
3111 static hda_nid_t alc880_lg_dac_nids[3] = {
3115 /* seems analog CD is not working */
3116 static struct hda_input_mux alc880_lg_capture_source = {
3121 { "Internal Mic", 0x6 },
3125 /* 2,4,6 channel modes */
3126 static struct hda_verb alc880_lg_ch2_init[] = {
3127 /* set line-in and mic-in to input */
3128 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
3129 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3133 static struct hda_verb alc880_lg_ch4_init[] = {
3134 /* set line-in to out and mic-in to input */
3135 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3136 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3140 static struct hda_verb alc880_lg_ch6_init[] = {
3141 /* set line-in and mic-in to output */
3142 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3143 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3147 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
3148 { 2, alc880_lg_ch2_init },
3149 { 4, alc880_lg_ch4_init },
3150 { 6, alc880_lg_ch6_init },
3153 static struct snd_kcontrol_new alc880_lg_mixer[] = {
3154 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3155 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3156 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3157 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3158 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3159 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3160 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3161 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3162 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3163 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3164 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3165 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3166 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3167 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3169 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3170 .name = "Channel Mode",
3171 .info = alc_ch_mode_info,
3172 .get = alc_ch_mode_get,
3173 .put = alc_ch_mode_put,
3178 static struct hda_verb alc880_lg_init_verbs[] = {
3179 /* set capture source to mic-in */
3180 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3181 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3182 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3183 /* mute all amp mixer inputs */
3184 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3185 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3186 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3187 /* line-in to input */
3188 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3189 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3191 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3192 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3194 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3195 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3196 /* mic-in to input */
3197 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3198 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3199 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3201 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3202 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3203 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3205 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3209 /* toggle speaker-output according to the hp-jack state */
3210 static void alc880_lg_setup(struct hda_codec *codec)
3212 struct alc_spec *spec = codec->spec;
3214 spec->autocfg.hp_pins[0] = 0x1b;
3215 spec->autocfg.speaker_pins[0] = 0x17;
3224 * Built-in Mic-In: 0x19
3230 static struct hda_input_mux alc880_lg_lw_capture_source = {
3234 { "Internal Mic", 0x1 },
3239 #define alc880_lg_lw_modes alc880_threestack_modes
3241 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3242 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3243 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3244 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3245 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3246 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3247 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3248 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3249 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3250 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3251 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3252 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3253 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3254 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
3255 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
3257 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3258 .name = "Channel Mode",
3259 .info = alc_ch_mode_info,
3260 .get = alc_ch_mode_get,
3261 .put = alc_ch_mode_put,
3266 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3267 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3268 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3269 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3271 /* set capture source to mic-in */
3272 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3273 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3274 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3275 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3277 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3278 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3280 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3281 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3282 /* mic-in to input */
3283 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3284 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3286 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3287 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3289 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3293 /* toggle speaker-output according to the hp-jack state */
3294 static void alc880_lg_lw_setup(struct hda_codec *codec)
3296 struct alc_spec *spec = codec->spec;
3298 spec->autocfg.hp_pins[0] = 0x1b;
3299 spec->autocfg.speaker_pins[0] = 0x14;
3302 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3303 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3304 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3305 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3306 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3307 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3308 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3312 static struct hda_input_mux alc880_medion_rim_capture_source = {
3316 { "Internal Mic", 0x1 },
3320 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3321 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3323 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3324 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3326 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3327 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3328 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3329 /* Mic2 (as headphone out) for HP output */
3330 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3331 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3332 /* Internal Speaker */
3333 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3334 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3336 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3337 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3339 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3343 /* toggle speaker-output according to the hp-jack state */
3344 static void alc880_medion_rim_automute(struct hda_codec *codec)
3346 struct alc_spec *spec = codec->spec;
3347 alc_automute_amp(codec);
3349 if (spec->jack_present)
3350 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3352 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3355 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3358 /* Looks like the unsol event is incompatible with the standard
3359 * definition. 4bit tag is placed at 28 bit!
3361 if ((res >> 28) == ALC880_HP_EVENT)
3362 alc880_medion_rim_automute(codec);
3365 static void alc880_medion_rim_setup(struct hda_codec *codec)
3367 struct alc_spec *spec = codec->spec;
3369 spec->autocfg.hp_pins[0] = 0x14;
3370 spec->autocfg.speaker_pins[0] = 0x1b;
3373 #ifdef CONFIG_SND_HDA_POWER_SAVE
3374 static struct hda_amp_list alc880_loopbacks[] = {
3375 { 0x0b, HDA_INPUT, 0 },
3376 { 0x0b, HDA_INPUT, 1 },
3377 { 0x0b, HDA_INPUT, 2 },
3378 { 0x0b, HDA_INPUT, 3 },
3379 { 0x0b, HDA_INPUT, 4 },
3383 static struct hda_amp_list alc880_lg_loopbacks[] = {
3384 { 0x0b, HDA_INPUT, 1 },
3385 { 0x0b, HDA_INPUT, 6 },
3386 { 0x0b, HDA_INPUT, 7 },
3395 static int alc_init(struct hda_codec *codec)
3397 struct alc_spec *spec = codec->spec;
3401 alc_auto_init_amp(codec, spec->init_amp);
3403 for (i = 0; i < spec->num_init_verbs; i++)
3404 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3406 if (spec->init_hook)
3407 spec->init_hook(codec);
3412 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3414 struct alc_spec *spec = codec->spec;
3416 if (spec->unsol_event)
3417 spec->unsol_event(codec, res);
3420 #ifdef CONFIG_SND_HDA_POWER_SAVE
3421 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3423 struct alc_spec *spec = codec->spec;
3424 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3429 * Analog playback callbacks
3431 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3432 struct hda_codec *codec,
3433 struct snd_pcm_substream *substream)
3435 struct alc_spec *spec = codec->spec;
3436 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3440 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3441 struct hda_codec *codec,
3442 unsigned int stream_tag,
3443 unsigned int format,
3444 struct snd_pcm_substream *substream)
3446 struct alc_spec *spec = codec->spec;
3447 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3448 stream_tag, format, substream);
3451 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3452 struct hda_codec *codec,
3453 struct snd_pcm_substream *substream)
3455 struct alc_spec *spec = codec->spec;
3456 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3462 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3463 struct hda_codec *codec,
3464 struct snd_pcm_substream *substream)
3466 struct alc_spec *spec = codec->spec;
3467 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3470 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3471 struct hda_codec *codec,
3472 unsigned int stream_tag,
3473 unsigned int format,
3474 struct snd_pcm_substream *substream)
3476 struct alc_spec *spec = codec->spec;
3477 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3478 stream_tag, format, substream);
3481 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3482 struct hda_codec *codec,
3483 struct snd_pcm_substream *substream)
3485 struct alc_spec *spec = codec->spec;
3486 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3489 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3490 struct hda_codec *codec,
3491 struct snd_pcm_substream *substream)
3493 struct alc_spec *spec = codec->spec;
3494 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3500 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3501 struct hda_codec *codec,
3502 unsigned int stream_tag,
3503 unsigned int format,
3504 struct snd_pcm_substream *substream)
3506 struct alc_spec *spec = codec->spec;
3508 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3509 stream_tag, 0, format);
3513 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3514 struct hda_codec *codec,
3515 struct snd_pcm_substream *substream)
3517 struct alc_spec *spec = codec->spec;
3519 snd_hda_codec_cleanup_stream(codec,
3520 spec->adc_nids[substream->number + 1]);
3527 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3531 /* NID is set in alc_build_pcms */
3533 .open = alc880_playback_pcm_open,
3534 .prepare = alc880_playback_pcm_prepare,
3535 .cleanup = alc880_playback_pcm_cleanup
3539 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3543 /* NID is set in alc_build_pcms */
3546 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3550 /* NID is set in alc_build_pcms */
3553 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3554 .substreams = 2, /* can be overridden */
3557 /* NID is set in alc_build_pcms */
3559 .prepare = alc880_alt_capture_pcm_prepare,
3560 .cleanup = alc880_alt_capture_pcm_cleanup
3564 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3568 /* NID is set in alc_build_pcms */
3570 .open = alc880_dig_playback_pcm_open,
3571 .close = alc880_dig_playback_pcm_close,
3572 .prepare = alc880_dig_playback_pcm_prepare,
3573 .cleanup = alc880_dig_playback_pcm_cleanup
3577 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3581 /* NID is set in alc_build_pcms */
3584 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3585 static struct hda_pcm_stream alc_pcm_null_stream = {
3591 static int alc_build_pcms(struct hda_codec *codec)
3593 struct alc_spec *spec = codec->spec;
3594 struct hda_pcm *info = spec->pcm_rec;
3597 codec->num_pcms = 1;
3598 codec->pcm_info = info;
3600 if (spec->no_analog)
3603 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
3604 "%s Analog", codec->chip_name);
3605 info->name = spec->stream_name_analog;
3607 if (spec->stream_analog_playback) {
3608 if (snd_BUG_ON(!spec->multiout.dac_nids))
3610 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3611 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3613 if (spec->stream_analog_capture) {
3614 if (snd_BUG_ON(!spec->adc_nids))
3616 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3617 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3620 if (spec->channel_mode) {
3621 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3622 for (i = 0; i < spec->num_channel_mode; i++) {
3623 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3624 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3630 /* SPDIF for stream index #1 */
3631 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3632 snprintf(spec->stream_name_digital,
3633 sizeof(spec->stream_name_digital),
3634 "%s Digital", codec->chip_name);
3635 codec->num_pcms = 2;
3636 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3637 info = spec->pcm_rec + 1;
3638 info->name = spec->stream_name_digital;
3639 if (spec->dig_out_type)
3640 info->pcm_type = spec->dig_out_type;
3642 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3643 if (spec->multiout.dig_out_nid &&
3644 spec->stream_digital_playback) {
3645 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3646 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3648 if (spec->dig_in_nid &&
3649 spec->stream_digital_capture) {
3650 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3651 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3653 /* FIXME: do we need this for all Realtek codec models? */
3654 codec->spdif_status_reset = 1;
3657 if (spec->no_analog)
3660 /* If the use of more than one ADC is requested for the current
3661 * model, configure a second analog capture-only PCM.
3663 /* Additional Analaog capture for index #2 */
3664 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3665 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3666 codec->num_pcms = 3;
3667 info = spec->pcm_rec + 2;
3668 info->name = spec->stream_name_analog;
3669 if (spec->alt_dac_nid) {
3670 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3671 *spec->stream_analog_alt_playback;
3672 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3675 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3676 alc_pcm_null_stream;
3677 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3679 if (spec->num_adc_nids > 1) {
3680 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3681 *spec->stream_analog_alt_capture;
3682 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3684 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3685 spec->num_adc_nids - 1;
3687 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3688 alc_pcm_null_stream;
3689 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3696 static inline void alc_shutup(struct hda_codec *codec)
3698 snd_hda_shutup_pins(codec);
3701 static void alc_free_kctls(struct hda_codec *codec)
3703 struct alc_spec *spec = codec->spec;
3705 if (spec->kctls.list) {
3706 struct snd_kcontrol_new *kctl = spec->kctls.list;
3708 for (i = 0; i < spec->kctls.used; i++)
3709 kfree(kctl[i].name);
3711 snd_array_free(&spec->kctls);
3714 static void alc_free(struct hda_codec *codec)
3716 struct alc_spec *spec = codec->spec;
3722 alc_free_kctls(codec);
3724 snd_hda_detach_beep_device(codec);
3727 #ifdef CONFIG_SND_HDA_POWER_SAVE
3728 static void alc_power_eapd(struct hda_codec *codec)
3730 /* We currently only handle front, HP */
3731 switch (codec->vendor_id) {
3733 set_eapd(codec, 0x0f, 0);
3734 set_eapd(codec, 0x10, 0);
3747 set_eapd(codec, 0x14, 0);
3748 set_eapd(codec, 0x15, 0);
3753 static int alc_suspend(struct hda_codec *codec, pm_message_t state)
3755 struct alc_spec *spec = codec->spec;
3757 if (spec && spec->power_hook)
3758 spec->power_hook(codec);
3763 #ifdef SND_HDA_NEEDS_RESUME
3764 static int alc_resume(struct hda_codec *codec)
3766 codec->patch_ops.init(codec);
3767 snd_hda_codec_resume_amp(codec);
3768 snd_hda_codec_resume_cache(codec);
3775 static struct hda_codec_ops alc_patch_ops = {
3776 .build_controls = alc_build_controls,
3777 .build_pcms = alc_build_pcms,
3780 .unsol_event = alc_unsol_event,
3781 #ifdef SND_HDA_NEEDS_RESUME
3782 .resume = alc_resume,
3784 #ifdef CONFIG_SND_HDA_POWER_SAVE
3785 .suspend = alc_suspend,
3786 .check_power_status = alc_check_power_status,
3788 .reboot_notify = alc_shutup,
3793 * Test configuration for debugging
3795 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3798 #ifdef CONFIG_SND_DEBUG
3799 static hda_nid_t alc880_test_dac_nids[4] = {
3800 0x02, 0x03, 0x04, 0x05
3803 static struct hda_input_mux alc880_test_capture_source = {
3812 { "Surround", 0x6 },
3816 static struct hda_channel_mode alc880_test_modes[4] = {
3823 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3824 struct snd_ctl_elem_info *uinfo)
3826 static char *texts[] = {
3827 "N/A", "Line Out", "HP Out",
3828 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3830 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3832 uinfo->value.enumerated.items = 8;
3833 if (uinfo->value.enumerated.item >= 8)
3834 uinfo->value.enumerated.item = 7;
3835 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3839 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3840 struct snd_ctl_elem_value *ucontrol)
3842 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3843 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3844 unsigned int pin_ctl, item = 0;
3846 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3847 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3848 if (pin_ctl & AC_PINCTL_OUT_EN) {
3849 if (pin_ctl & AC_PINCTL_HP_EN)
3853 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3854 switch (pin_ctl & AC_PINCTL_VREFEN) {
3855 case AC_PINCTL_VREF_HIZ: item = 3; break;
3856 case AC_PINCTL_VREF_50: item = 4; break;
3857 case AC_PINCTL_VREF_GRD: item = 5; break;
3858 case AC_PINCTL_VREF_80: item = 6; break;
3859 case AC_PINCTL_VREF_100: item = 7; break;
3862 ucontrol->value.enumerated.item[0] = item;
3866 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3867 struct snd_ctl_elem_value *ucontrol)
3869 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3870 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3871 static unsigned int ctls[] = {
3872 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3873 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3874 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3875 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3876 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3877 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3879 unsigned int old_ctl, new_ctl;
3881 old_ctl = snd_hda_codec_read(codec, nid, 0,
3882 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3883 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3884 if (old_ctl != new_ctl) {
3886 snd_hda_codec_write_cache(codec, nid, 0,
3887 AC_VERB_SET_PIN_WIDGET_CONTROL,
3889 val = ucontrol->value.enumerated.item[0] >= 3 ?
3891 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3898 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3899 struct snd_ctl_elem_info *uinfo)
3901 static char *texts[] = {
3902 "Front", "Surround", "CLFE", "Side"
3904 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3906 uinfo->value.enumerated.items = 4;
3907 if (uinfo->value.enumerated.item >= 4)
3908 uinfo->value.enumerated.item = 3;
3909 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3913 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3914 struct snd_ctl_elem_value *ucontrol)
3916 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3917 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3920 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3921 ucontrol->value.enumerated.item[0] = sel & 3;
3925 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3926 struct snd_ctl_elem_value *ucontrol)
3928 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3929 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3932 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3933 if (ucontrol->value.enumerated.item[0] != sel) {
3934 sel = ucontrol->value.enumerated.item[0] & 3;
3935 snd_hda_codec_write_cache(codec, nid, 0,
3936 AC_VERB_SET_CONNECT_SEL, sel);
3942 #define PIN_CTL_TEST(xname,nid) { \
3943 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3945 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
3946 .info = alc_test_pin_ctl_info, \
3947 .get = alc_test_pin_ctl_get, \
3948 .put = alc_test_pin_ctl_put, \
3949 .private_value = nid \
3952 #define PIN_SRC_TEST(xname,nid) { \
3953 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3955 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
3956 .info = alc_test_pin_src_info, \
3957 .get = alc_test_pin_src_get, \
3958 .put = alc_test_pin_src_put, \
3959 .private_value = nid \
3962 static struct snd_kcontrol_new alc880_test_mixer[] = {
3963 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3964 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3965 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3966 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3967 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3968 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3969 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3970 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3971 PIN_CTL_TEST("Front Pin Mode", 0x14),
3972 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3973 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3974 PIN_CTL_TEST("Side Pin Mode", 0x17),
3975 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3976 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3977 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3978 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3979 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3980 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3981 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3982 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3983 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3984 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3985 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3986 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3987 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3988 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3989 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3990 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3991 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3992 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3994 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3995 .name = "Channel Mode",
3996 .info = alc_ch_mode_info,
3997 .get = alc_ch_mode_get,
3998 .put = alc_ch_mode_put,
4003 static struct hda_verb alc880_test_init_verbs[] = {
4004 /* Unmute inputs of 0x0c - 0x0f */
4005 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4006 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4007 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4008 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4009 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4010 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4011 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4012 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4013 /* Vol output for 0x0c-0x0f */
4014 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4015 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4016 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4017 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4018 /* Set output pins 0x14-0x17 */
4019 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4020 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4021 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4022 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4023 /* Unmute output pins 0x14-0x17 */
4024 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4025 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4026 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4027 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4028 /* Set input pins 0x18-0x1c */
4029 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4030 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4031 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4032 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4033 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4034 /* Mute input pins 0x18-0x1b */
4035 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4036 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4037 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4038 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4040 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4041 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
4042 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4043 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
4044 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4045 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
4046 /* Analog input/passthru */
4047 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4048 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4049 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4050 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4051 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4059 static const char *alc880_models[ALC880_MODEL_LAST] = {
4060 [ALC880_3ST] = "3stack",
4061 [ALC880_TCL_S700] = "tcl",
4062 [ALC880_3ST_DIG] = "3stack-digout",
4063 [ALC880_CLEVO] = "clevo",
4064 [ALC880_5ST] = "5stack",
4065 [ALC880_5ST_DIG] = "5stack-digout",
4066 [ALC880_W810] = "w810",
4067 [ALC880_Z71V] = "z71v",
4068 [ALC880_6ST] = "6stack",
4069 [ALC880_6ST_DIG] = "6stack-digout",
4070 [ALC880_ASUS] = "asus",
4071 [ALC880_ASUS_W1V] = "asus-w1v",
4072 [ALC880_ASUS_DIG] = "asus-dig",
4073 [ALC880_ASUS_DIG2] = "asus-dig2",
4074 [ALC880_UNIWILL_DIG] = "uniwill",
4075 [ALC880_UNIWILL_P53] = "uniwill-p53",
4076 [ALC880_FUJITSU] = "fujitsu",
4077 [ALC880_F1734] = "F1734",
4079 [ALC880_LG_LW] = "lg-lw",
4080 [ALC880_MEDION_RIM] = "medion",
4081 #ifdef CONFIG_SND_DEBUG
4082 [ALC880_TEST] = "test",
4084 [ALC880_AUTO] = "auto",
4087 static struct snd_pci_quirk alc880_cfg_tbl[] = {
4088 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
4089 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
4090 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
4091 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
4092 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
4093 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
4094 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
4095 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
4096 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
4097 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
4098 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
4099 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
4100 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
4101 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
4102 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
4103 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
4104 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
4105 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
4106 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
4107 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
4108 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
4109 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
4110 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
4111 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
4112 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
4113 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
4114 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
4115 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
4116 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
4117 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
4118 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
4119 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
4120 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
4121 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
4122 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
4123 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
4124 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
4125 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
4126 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
4127 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
4128 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
4129 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
4130 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
4131 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
4132 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
4133 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
4134 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
4135 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
4136 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
4137 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
4138 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
4139 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
4140 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
4141 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
4142 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
4143 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
4144 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
4145 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
4146 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
4147 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
4148 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
4149 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
4150 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
4151 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
4152 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
4153 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
4154 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
4155 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
4157 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
4158 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
4159 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
4164 * ALC880 codec presets
4166 static struct alc_config_preset alc880_presets[] = {
4168 .mixers = { alc880_three_stack_mixer },
4169 .init_verbs = { alc880_volume_init_verbs,
4170 alc880_pin_3stack_init_verbs },
4171 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4172 .dac_nids = alc880_dac_nids,
4173 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4174 .channel_mode = alc880_threestack_modes,
4176 .input_mux = &alc880_capture_source,
4178 [ALC880_3ST_DIG] = {
4179 .mixers = { alc880_three_stack_mixer },
4180 .init_verbs = { alc880_volume_init_verbs,
4181 alc880_pin_3stack_init_verbs },
4182 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4183 .dac_nids = alc880_dac_nids,
4184 .dig_out_nid = ALC880_DIGOUT_NID,
4185 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4186 .channel_mode = alc880_threestack_modes,
4188 .input_mux = &alc880_capture_source,
4190 [ALC880_TCL_S700] = {
4191 .mixers = { alc880_tcl_s700_mixer },
4192 .init_verbs = { alc880_volume_init_verbs,
4193 alc880_pin_tcl_S700_init_verbs,
4194 alc880_gpio2_init_verbs },
4195 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4196 .dac_nids = alc880_dac_nids,
4197 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4198 .num_adc_nids = 1, /* single ADC */
4200 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4201 .channel_mode = alc880_2_jack_modes,
4202 .input_mux = &alc880_capture_source,
4205 .mixers = { alc880_three_stack_mixer,
4206 alc880_five_stack_mixer},
4207 .init_verbs = { alc880_volume_init_verbs,
4208 alc880_pin_5stack_init_verbs },
4209 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4210 .dac_nids = alc880_dac_nids,
4211 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4212 .channel_mode = alc880_fivestack_modes,
4213 .input_mux = &alc880_capture_source,
4215 [ALC880_5ST_DIG] = {
4216 .mixers = { alc880_three_stack_mixer,
4217 alc880_five_stack_mixer },
4218 .init_verbs = { alc880_volume_init_verbs,
4219 alc880_pin_5stack_init_verbs },
4220 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4221 .dac_nids = alc880_dac_nids,
4222 .dig_out_nid = ALC880_DIGOUT_NID,
4223 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4224 .channel_mode = alc880_fivestack_modes,
4225 .input_mux = &alc880_capture_source,
4228 .mixers = { alc880_six_stack_mixer },
4229 .init_verbs = { alc880_volume_init_verbs,
4230 alc880_pin_6stack_init_verbs },
4231 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4232 .dac_nids = alc880_6st_dac_nids,
4233 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4234 .channel_mode = alc880_sixstack_modes,
4235 .input_mux = &alc880_6stack_capture_source,
4237 [ALC880_6ST_DIG] = {
4238 .mixers = { alc880_six_stack_mixer },
4239 .init_verbs = { alc880_volume_init_verbs,
4240 alc880_pin_6stack_init_verbs },
4241 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4242 .dac_nids = alc880_6st_dac_nids,
4243 .dig_out_nid = ALC880_DIGOUT_NID,
4244 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4245 .channel_mode = alc880_sixstack_modes,
4246 .input_mux = &alc880_6stack_capture_source,
4249 .mixers = { alc880_w810_base_mixer },
4250 .init_verbs = { alc880_volume_init_verbs,
4251 alc880_pin_w810_init_verbs,
4252 alc880_gpio2_init_verbs },
4253 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
4254 .dac_nids = alc880_w810_dac_nids,
4255 .dig_out_nid = ALC880_DIGOUT_NID,
4256 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4257 .channel_mode = alc880_w810_modes,
4258 .input_mux = &alc880_capture_source,
4261 .mixers = { alc880_z71v_mixer },
4262 .init_verbs = { alc880_volume_init_verbs,
4263 alc880_pin_z71v_init_verbs },
4264 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
4265 .dac_nids = alc880_z71v_dac_nids,
4266 .dig_out_nid = ALC880_DIGOUT_NID,
4268 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4269 .channel_mode = alc880_2_jack_modes,
4270 .input_mux = &alc880_capture_source,
4273 .mixers = { alc880_f1734_mixer },
4274 .init_verbs = { alc880_volume_init_verbs,
4275 alc880_pin_f1734_init_verbs },
4276 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
4277 .dac_nids = alc880_f1734_dac_nids,
4279 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4280 .channel_mode = alc880_2_jack_modes,
4281 .input_mux = &alc880_f1734_capture_source,
4282 .unsol_event = alc880_uniwill_p53_unsol_event,
4283 .setup = alc880_uniwill_p53_setup,
4284 .init_hook = alc_automute_amp,
4287 .mixers = { alc880_asus_mixer },
4288 .init_verbs = { alc880_volume_init_verbs,
4289 alc880_pin_asus_init_verbs,
4290 alc880_gpio1_init_verbs },
4291 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4292 .dac_nids = alc880_asus_dac_nids,
4293 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4294 .channel_mode = alc880_asus_modes,
4296 .input_mux = &alc880_capture_source,
4298 [ALC880_ASUS_DIG] = {
4299 .mixers = { alc880_asus_mixer },
4300 .init_verbs = { alc880_volume_init_verbs,
4301 alc880_pin_asus_init_verbs,
4302 alc880_gpio1_init_verbs },
4303 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4304 .dac_nids = alc880_asus_dac_nids,
4305 .dig_out_nid = ALC880_DIGOUT_NID,
4306 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4307 .channel_mode = alc880_asus_modes,
4309 .input_mux = &alc880_capture_source,
4311 [ALC880_ASUS_DIG2] = {
4312 .mixers = { alc880_asus_mixer },
4313 .init_verbs = { alc880_volume_init_verbs,
4314 alc880_pin_asus_init_verbs,
4315 alc880_gpio2_init_verbs }, /* use GPIO2 */
4316 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4317 .dac_nids = alc880_asus_dac_nids,
4318 .dig_out_nid = ALC880_DIGOUT_NID,
4319 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4320 .channel_mode = alc880_asus_modes,
4322 .input_mux = &alc880_capture_source,
4324 [ALC880_ASUS_W1V] = {
4325 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4326 .init_verbs = { alc880_volume_init_verbs,
4327 alc880_pin_asus_init_verbs,
4328 alc880_gpio1_init_verbs },
4329 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4330 .dac_nids = alc880_asus_dac_nids,
4331 .dig_out_nid = ALC880_DIGOUT_NID,
4332 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4333 .channel_mode = alc880_asus_modes,
4335 .input_mux = &alc880_capture_source,
4337 [ALC880_UNIWILL_DIG] = {
4338 .mixers = { alc880_asus_mixer },
4339 .init_verbs = { alc880_volume_init_verbs,
4340 alc880_pin_asus_init_verbs },
4341 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4342 .dac_nids = alc880_asus_dac_nids,
4343 .dig_out_nid = ALC880_DIGOUT_NID,
4344 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4345 .channel_mode = alc880_asus_modes,
4347 .input_mux = &alc880_capture_source,
4349 [ALC880_UNIWILL] = {
4350 .mixers = { alc880_uniwill_mixer },
4351 .init_verbs = { alc880_volume_init_verbs,
4352 alc880_uniwill_init_verbs },
4353 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4354 .dac_nids = alc880_asus_dac_nids,
4355 .dig_out_nid = ALC880_DIGOUT_NID,
4356 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4357 .channel_mode = alc880_threestack_modes,
4359 .input_mux = &alc880_capture_source,
4360 .unsol_event = alc880_uniwill_unsol_event,
4361 .setup = alc880_uniwill_setup,
4362 .init_hook = alc880_uniwill_init_hook,
4364 [ALC880_UNIWILL_P53] = {
4365 .mixers = { alc880_uniwill_p53_mixer },
4366 .init_verbs = { alc880_volume_init_verbs,
4367 alc880_uniwill_p53_init_verbs },
4368 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4369 .dac_nids = alc880_asus_dac_nids,
4370 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4371 .channel_mode = alc880_threestack_modes,
4372 .input_mux = &alc880_capture_source,
4373 .unsol_event = alc880_uniwill_p53_unsol_event,
4374 .setup = alc880_uniwill_p53_setup,
4375 .init_hook = alc_automute_amp,
4377 [ALC880_FUJITSU] = {
4378 .mixers = { alc880_fujitsu_mixer },
4379 .init_verbs = { alc880_volume_init_verbs,
4380 alc880_uniwill_p53_init_verbs,
4381 alc880_beep_init_verbs },
4382 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4383 .dac_nids = alc880_dac_nids,
4384 .dig_out_nid = ALC880_DIGOUT_NID,
4385 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4386 .channel_mode = alc880_2_jack_modes,
4387 .input_mux = &alc880_capture_source,
4388 .unsol_event = alc880_uniwill_p53_unsol_event,
4389 .setup = alc880_uniwill_p53_setup,
4390 .init_hook = alc_automute_amp,
4393 .mixers = { alc880_three_stack_mixer },
4394 .init_verbs = { alc880_volume_init_verbs,
4395 alc880_pin_clevo_init_verbs },
4396 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4397 .dac_nids = alc880_dac_nids,
4399 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4400 .channel_mode = alc880_threestack_modes,
4402 .input_mux = &alc880_capture_source,
4405 .mixers = { alc880_lg_mixer },
4406 .init_verbs = { alc880_volume_init_verbs,
4407 alc880_lg_init_verbs },
4408 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4409 .dac_nids = alc880_lg_dac_nids,
4410 .dig_out_nid = ALC880_DIGOUT_NID,
4411 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4412 .channel_mode = alc880_lg_ch_modes,
4414 .input_mux = &alc880_lg_capture_source,
4415 .unsol_event = alc_automute_amp_unsol_event,
4416 .setup = alc880_lg_setup,
4417 .init_hook = alc_automute_amp,
4418 #ifdef CONFIG_SND_HDA_POWER_SAVE
4419 .loopbacks = alc880_lg_loopbacks,
4423 .mixers = { alc880_lg_lw_mixer },
4424 .init_verbs = { alc880_volume_init_verbs,
4425 alc880_lg_lw_init_verbs },
4426 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4427 .dac_nids = alc880_dac_nids,
4428 .dig_out_nid = ALC880_DIGOUT_NID,
4429 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4430 .channel_mode = alc880_lg_lw_modes,
4431 .input_mux = &alc880_lg_lw_capture_source,
4432 .unsol_event = alc_automute_amp_unsol_event,
4433 .setup = alc880_lg_lw_setup,
4434 .init_hook = alc_automute_amp,
4436 [ALC880_MEDION_RIM] = {
4437 .mixers = { alc880_medion_rim_mixer },
4438 .init_verbs = { alc880_volume_init_verbs,
4439 alc880_medion_rim_init_verbs,
4440 alc_gpio2_init_verbs },
4441 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4442 .dac_nids = alc880_dac_nids,
4443 .dig_out_nid = ALC880_DIGOUT_NID,
4444 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4445 .channel_mode = alc880_2_jack_modes,
4446 .input_mux = &alc880_medion_rim_capture_source,
4447 .unsol_event = alc880_medion_rim_unsol_event,
4448 .setup = alc880_medion_rim_setup,
4449 .init_hook = alc880_medion_rim_automute,
4451 #ifdef CONFIG_SND_DEBUG
4453 .mixers = { alc880_test_mixer },
4454 .init_verbs = { alc880_test_init_verbs },
4455 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4456 .dac_nids = alc880_test_dac_nids,
4457 .dig_out_nid = ALC880_DIGOUT_NID,
4458 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4459 .channel_mode = alc880_test_modes,
4460 .input_mux = &alc880_test_capture_source,
4466 * Automatic parse of I/O pins from the BIOS configuration
4471 ALC_CTL_WIDGET_MUTE,
4474 static struct snd_kcontrol_new alc880_control_templates[] = {
4475 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4476 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4477 HDA_BIND_MUTE(NULL, 0, 0, 0),
4480 /* add dynamic controls */
4481 static int add_control(struct alc_spec *spec, int type, const char *name,
4484 struct snd_kcontrol_new *knew;
4486 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4487 knew = snd_array_new(&spec->kctls);
4490 *knew = alc880_control_templates[type];
4491 knew->name = kstrdup(name, GFP_KERNEL);
4494 if (get_amp_nid_(val))
4495 knew->subdevice = HDA_SUBDEV_AMP_FLAG;
4496 knew->private_value = val;
4500 static int add_control_with_pfx(struct alc_spec *spec, int type,
4501 const char *pfx, const char *dir,
4502 const char *sfx, unsigned long val)
4505 snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx);
4506 return add_control(spec, type, name, val);
4509 #define add_pb_vol_ctrl(spec, type, pfx, val) \
4510 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", val)
4511 #define add_pb_sw_ctrl(spec, type, pfx, val) \
4512 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", val)
4514 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4515 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4516 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4517 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4518 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4519 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4520 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4521 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4522 #define ALC880_PIN_CD_NID 0x1c
4524 /* fill in the dac_nids table from the parsed pin configuration */
4525 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4526 const struct auto_pin_cfg *cfg)
4532 memset(assigned, 0, sizeof(assigned));
4533 spec->multiout.dac_nids = spec->private_dac_nids;
4535 /* check the pins hardwired to audio widget */
4536 for (i = 0; i < cfg->line_outs; i++) {
4537 nid = cfg->line_out_pins[i];
4538 if (alc880_is_fixed_pin(nid)) {
4539 int idx = alc880_fixed_pin_idx(nid);
4540 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4544 /* left pins can be connect to any 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))
4549 /* search for an empty channel */
4550 for (j = 0; j < cfg->line_outs; j++) {
4552 spec->multiout.dac_nids[i] =
4553 alc880_idx_to_dac(j);
4559 spec->multiout.num_dacs = cfg->line_outs;
4563 /* add playback controls from the parsed DAC table */
4564 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4565 const struct auto_pin_cfg *cfg)
4567 static const char *chname[4] = {
4568 "Front", "Surround", NULL /*CLFE*/, "Side"
4573 for (i = 0; i < cfg->line_outs; i++) {
4574 if (!spec->multiout.dac_nids[i])
4576 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4579 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4581 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4585 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4587 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4591 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4593 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4597 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4599 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4605 if (cfg->line_outs == 1 &&
4606 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
4610 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4611 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4615 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4616 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4625 /* add playback controls for speaker and HP outputs */
4626 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4635 if (alc880_is_fixed_pin(pin)) {
4636 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4637 /* specify the DAC as the extra output */
4638 if (!spec->multiout.hp_nid)
4639 spec->multiout.hp_nid = nid;
4641 spec->multiout.extra_out_nid[0] = nid;
4642 /* control HP volume/switch on the output mixer amp */
4643 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4644 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4645 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4648 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4649 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4652 } else if (alc880_is_multi_pin(pin)) {
4653 /* set manual connection */
4654 /* we have only a switch on HP-out PIN */
4655 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
4656 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4663 /* create input playback/capture controls for the given pin */
4664 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4665 const char *ctlname,
4666 int idx, hda_nid_t mix_nid)
4670 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
4671 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4674 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
4675 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4681 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
4683 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
4684 return (pincap & AC_PINCAP_IN) != 0;
4687 /* create playback/capture controls for input pins */
4688 static int alc_auto_create_input_ctls(struct hda_codec *codec,
4689 const struct auto_pin_cfg *cfg,
4691 hda_nid_t cap1, hda_nid_t cap2)
4693 struct alc_spec *spec = codec->spec;
4694 struct hda_input_mux *imux = &spec->private_imux[0];
4697 for (i = 0; i < AUTO_PIN_LAST; i++) {
4700 pin = cfg->input_pins[i];
4701 if (!alc_is_input_pin(codec, pin))
4705 idx = get_connection_index(codec, mixer, pin);
4707 err = new_analog_input(spec, pin,
4708 auto_pin_cfg_labels[i],
4717 idx = get_connection_index(codec, cap1, pin);
4718 if (idx < 0 && cap2)
4719 idx = get_connection_index(codec, cap2, pin);
4721 imux->items[imux->num_items].label =
4722 auto_pin_cfg_labels[i];
4723 imux->items[imux->num_items].index = idx;
4730 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
4731 const struct auto_pin_cfg *cfg)
4733 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
4736 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4737 unsigned int pin_type)
4739 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4742 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4746 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4747 hda_nid_t nid, int pin_type,
4750 alc_set_pin_output(codec, nid, pin_type);
4751 /* need the manual connection? */
4752 if (alc880_is_multi_pin(nid)) {
4753 struct alc_spec *spec = codec->spec;
4754 int idx = alc880_multi_pin_idx(nid);
4755 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4756 AC_VERB_SET_CONNECT_SEL,
4757 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4761 static int get_pin_type(int line_out_type)
4763 if (line_out_type == AUTO_PIN_HP_OUT)
4769 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4771 struct alc_spec *spec = codec->spec;
4774 for (i = 0; i < spec->autocfg.line_outs; i++) {
4775 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4776 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4777 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4781 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4783 struct alc_spec *spec = codec->spec;
4786 pin = spec->autocfg.speaker_pins[0];
4787 if (pin) /* connect to front */
4788 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4789 pin = spec->autocfg.hp_pins[0];
4790 if (pin) /* connect to front */
4791 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4794 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4796 struct alc_spec *spec = codec->spec;
4799 for (i = 0; i < AUTO_PIN_LAST; i++) {
4800 hda_nid_t nid = spec->autocfg.input_pins[i];
4801 if (alc_is_input_pin(codec, nid)) {
4802 alc_set_input_pin(codec, nid, i);
4803 if (nid != ALC880_PIN_CD_NID &&
4804 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
4805 snd_hda_codec_write(codec, nid, 0,
4806 AC_VERB_SET_AMP_GAIN_MUTE,
4812 static void alc880_auto_init_input_src(struct hda_codec *codec)
4814 struct alc_spec *spec = codec->spec;
4817 for (c = 0; c < spec->num_adc_nids; c++) {
4818 unsigned int mux_idx;
4819 const struct hda_input_mux *imux;
4820 mux_idx = c >= spec->num_mux_defs ? 0 : c;
4821 imux = &spec->input_mux[mux_idx];
4822 if (!imux->num_items && mux_idx > 0)
4823 imux = &spec->input_mux[0];
4825 snd_hda_codec_write(codec, spec->adc_nids[c], 0,
4826 AC_VERB_SET_CONNECT_SEL,
4827 imux->items[0].index);
4831 /* parse the BIOS configuration and set up the alc_spec */
4832 /* return 1 if successful, 0 if the proper config is not found,
4833 * or a negative error code
4835 static int alc880_parse_auto_config(struct hda_codec *codec)
4837 struct alc_spec *spec = codec->spec;
4839 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4841 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4845 if (!spec->autocfg.line_outs)
4846 return 0; /* can't find valid BIOS pin config */
4848 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4851 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4854 err = alc880_auto_create_extra_out(spec,
4855 spec->autocfg.speaker_pins[0],
4859 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4863 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
4867 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4869 /* check multiple SPDIF-out (for recent codecs) */
4870 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4872 err = snd_hda_get_connections(codec,
4873 spec->autocfg.dig_out_pins[i],
4878 spec->multiout.dig_out_nid = dig_nid;
4880 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4881 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
4883 spec->slave_dig_outs[i - 1] = dig_nid;
4886 if (spec->autocfg.dig_in_pin)
4887 spec->dig_in_nid = ALC880_DIGIN_NID;
4889 if (spec->kctls.list)
4890 add_mixer(spec, spec->kctls.list);
4892 add_verb(spec, alc880_volume_init_verbs);
4894 spec->num_mux_defs = 1;
4895 spec->input_mux = &spec->private_imux[0];
4897 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
4902 /* additional initialization for auto-configuration model */
4903 static void alc880_auto_init(struct hda_codec *codec)
4905 struct alc_spec *spec = codec->spec;
4906 alc880_auto_init_multi_out(codec);
4907 alc880_auto_init_extra_out(codec);
4908 alc880_auto_init_analog_input(codec);
4909 alc880_auto_init_input_src(codec);
4910 if (spec->unsol_event)
4911 alc_inithook(codec);
4914 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
4915 * one of two digital mic pins, e.g. on ALC272
4917 static void fixup_automic_adc(struct hda_codec *codec)
4919 struct alc_spec *spec = codec->spec;
4922 for (i = 0; i < spec->num_adc_nids; i++) {
4923 hda_nid_t cap = spec->capsrc_nids ?
4924 spec->capsrc_nids[i] : spec->adc_nids[i];
4927 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
4930 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
4933 spec->int_mic.mux_idx = iidx;
4934 spec->ext_mic.mux_idx = eidx;
4935 if (spec->capsrc_nids)
4936 spec->capsrc_nids += i;
4937 spec->adc_nids += i;
4938 spec->num_adc_nids = 1;
4941 snd_printd(KERN_INFO "hda_codec: %s: "
4942 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
4943 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
4944 spec->auto_mic = 0; /* disable auto-mic to be sure */
4947 /* choose the ADC/MUX containing the input pin and initialize the setup */
4948 static void fixup_single_adc(struct hda_codec *codec)
4950 struct alc_spec *spec = codec->spec;
4954 /* search for the input pin; there must be only one */
4955 for (i = 0; i < AUTO_PIN_LAST; i++) {
4956 if (spec->autocfg.input_pins[i]) {
4957 pin = spec->autocfg.input_pins[i];
4964 /* set the default connection to that pin */
4965 for (i = 0; i < spec->num_adc_nids; i++) {
4966 hda_nid_t cap = spec->capsrc_nids ?
4967 spec->capsrc_nids[i] : spec->adc_nids[i];
4970 idx = get_connection_index(codec, cap, pin);
4973 /* use only this ADC */
4974 if (spec->capsrc_nids)
4975 spec->capsrc_nids += i;
4976 spec->adc_nids += i;
4977 spec->num_adc_nids = 1;
4978 /* select or unmute this route */
4979 if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) {
4980 snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx,
4983 snd_hda_codec_write_cache(codec, cap, 0,
4984 AC_VERB_SET_CONNECT_SEL, idx);
4990 static void set_capture_mixer(struct hda_codec *codec)
4992 struct alc_spec *spec = codec->spec;
4993 static struct snd_kcontrol_new *caps[2][3] = {
4994 { alc_capture_mixer_nosrc1,
4995 alc_capture_mixer_nosrc2,
4996 alc_capture_mixer_nosrc3 },
4997 { alc_capture_mixer1,
4999 alc_capture_mixer3 },
5001 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
5004 fixup_automic_adc(codec);
5005 else if (spec->input_mux) {
5006 if (spec->input_mux->num_items > 1)
5008 else if (spec->input_mux->num_items == 1)
5009 fixup_single_adc(codec);
5011 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
5015 /* fill adc_nids (and capsrc_nids) containing all active input pins */
5016 static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids,
5019 struct alc_spec *spec = codec->spec;
5021 hda_nid_t fallback_adc = 0, fallback_cap = 0;
5023 for (n = 0; n < num_nids; n++) {
5025 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
5029 if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN)
5032 nconns = snd_hda_get_connections(codec, cap, conn,
5036 nconns = snd_hda_get_connections(codec, cap, conn,
5041 if (!fallback_adc) {
5045 for (i = 0; i < AUTO_PIN_LAST; i++) {
5046 hda_nid_t nid = spec->autocfg.input_pins[i];
5049 for (j = 0; j < nconns; j++) {
5056 if (i >= AUTO_PIN_LAST) {
5057 int num_adcs = spec->num_adc_nids;
5058 spec->private_adc_nids[num_adcs] = adc;
5059 spec->private_capsrc_nids[num_adcs] = cap;
5060 spec->num_adc_nids++;
5061 spec->adc_nids = spec->private_adc_nids;
5063 spec->capsrc_nids = spec->private_capsrc_nids;
5066 if (!spec->num_adc_nids) {
5067 printk(KERN_WARNING "hda_codec: %s: no valid ADC found;"
5068 " using fallback 0x%x\n",
5069 codec->chip_name, fallback_adc);
5070 spec->private_adc_nids[0] = fallback_adc;
5071 spec->adc_nids = spec->private_adc_nids;
5072 if (fallback_adc != fallback_cap) {
5073 spec->private_capsrc_nids[0] = fallback_cap;
5074 spec->capsrc_nids = spec->private_adc_nids;
5079 #ifdef CONFIG_SND_HDA_INPUT_BEEP
5080 #define set_beep_amp(spec, nid, idx, dir) \
5081 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
5083 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
5087 * OK, here we have finally the patch for ALC880
5090 static int patch_alc880(struct hda_codec *codec)
5092 struct alc_spec *spec;
5096 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5102 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
5105 if (board_config < 0) {
5106 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
5108 board_config = ALC880_AUTO;
5111 if (board_config == ALC880_AUTO) {
5112 /* automatic parse from the BIOS config */
5113 err = alc880_parse_auto_config(codec);
5119 "hda_codec: Cannot set up configuration "
5120 "from BIOS. Using 3-stack mode...\n");
5121 board_config = ALC880_3ST;
5125 err = snd_hda_attach_beep_device(codec, 0x1);
5131 if (board_config != ALC880_AUTO)
5132 setup_preset(codec, &alc880_presets[board_config]);
5134 spec->stream_analog_playback = &alc880_pcm_analog_playback;
5135 spec->stream_analog_capture = &alc880_pcm_analog_capture;
5136 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
5138 spec->stream_digital_playback = &alc880_pcm_digital_playback;
5139 spec->stream_digital_capture = &alc880_pcm_digital_capture;
5141 if (!spec->adc_nids && spec->input_mux) {
5142 /* check whether NID 0x07 is valid */
5143 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
5145 wcap = get_wcaps_type(wcap);
5146 if (wcap != AC_WID_AUD_IN) {
5147 spec->adc_nids = alc880_adc_nids_alt;
5148 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
5150 spec->adc_nids = alc880_adc_nids;
5151 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
5154 set_capture_mixer(codec);
5155 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
5157 spec->vmaster_nid = 0x0c;
5159 codec->patch_ops = alc_patch_ops;
5160 if (board_config == ALC880_AUTO)
5161 spec->init_hook = alc880_auto_init;
5162 #ifdef CONFIG_SND_HDA_POWER_SAVE
5163 if (!spec->loopback.amplist)
5164 spec->loopback.amplist = alc880_loopbacks;
5175 static hda_nid_t alc260_dac_nids[1] = {
5180 static hda_nid_t alc260_adc_nids[1] = {
5185 static hda_nid_t alc260_adc_nids_alt[1] = {
5190 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
5191 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
5193 static hda_nid_t alc260_dual_adc_nids[2] = {
5198 #define ALC260_DIGOUT_NID 0x03
5199 #define ALC260_DIGIN_NID 0x06
5201 static struct hda_input_mux alc260_capture_source = {
5205 { "Front Mic", 0x1 },
5211 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
5212 * headphone jack and the internal CD lines since these are the only pins at
5213 * which audio can appear. For flexibility, also allow the option of
5214 * recording the mixer output on the second ADC (ADC0 doesn't have a
5215 * connection to the mixer output).
5217 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
5221 { "Mic/Line", 0x0 },
5223 { "Headphone", 0x2 },
5229 { "Mic/Line", 0x0 },
5231 { "Headphone", 0x2 },
5238 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
5239 * the Fujitsu S702x, but jacks are marked differently.
5241 static struct hda_input_mux alc260_acer_capture_sources[2] = {
5248 { "Headphone", 0x5 },
5257 { "Headphone", 0x6 },
5263 /* Maxdata Favorit 100XS */
5264 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
5268 { "Line/Mic", 0x0 },
5275 { "Line/Mic", 0x0 },
5283 * This is just place-holder, so there's something for alc_build_pcms to look
5284 * at when it calculates the maximum number of channels. ALC260 has no mixer
5285 * element which allows changing the channel mode, so the verb list is
5288 static struct hda_channel_mode alc260_modes[1] = {
5293 /* Mixer combinations
5295 * basic: base_output + input + pc_beep + capture
5296 * HP: base_output + input + capture_alt
5297 * HP_3013: hp_3013 + input + capture
5298 * fujitsu: fujitsu + capture
5299 * acer: acer + capture
5302 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
5303 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5304 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5305 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5306 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5307 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5308 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5312 static struct snd_kcontrol_new alc260_input_mixer[] = {
5313 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5314 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5315 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5316 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5317 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5318 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5319 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
5320 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
5324 /* update HP, line and mono out pins according to the master switch */
5325 static void alc260_hp_master_update(struct hda_codec *codec,
5326 hda_nid_t hp, hda_nid_t line,
5329 struct alc_spec *spec = codec->spec;
5330 unsigned int val = spec->master_sw ? PIN_HP : 0;
5331 /* change HP and line-out pins */
5332 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5334 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5336 /* mono (speaker) depending on the HP jack sense */
5337 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5338 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5342 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5343 struct snd_ctl_elem_value *ucontrol)
5345 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5346 struct alc_spec *spec = codec->spec;
5347 *ucontrol->value.integer.value = spec->master_sw;
5351 static int alc260_hp_master_sw_put(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 int val = !!*ucontrol->value.integer.value;
5357 hda_nid_t hp, line, mono;
5359 if (val == spec->master_sw)
5361 spec->master_sw = val;
5362 hp = (kcontrol->private_value >> 16) & 0xff;
5363 line = (kcontrol->private_value >> 8) & 0xff;
5364 mono = kcontrol->private_value & 0xff;
5365 alc260_hp_master_update(codec, hp, line, mono);
5369 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5371 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5372 .name = "Master Playback Switch",
5373 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5374 .info = snd_ctl_boolean_mono_info,
5375 .get = alc260_hp_master_sw_get,
5376 .put = alc260_hp_master_sw_put,
5377 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5379 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5380 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5381 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5382 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5383 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5385 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5389 static struct hda_verb alc260_hp_unsol_verbs[] = {
5390 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5394 static void alc260_hp_automute(struct hda_codec *codec)
5396 struct alc_spec *spec = codec->spec;
5398 spec->jack_present = snd_hda_jack_detect(codec, 0x10);
5399 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5402 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5404 if ((res >> 26) == ALC880_HP_EVENT)
5405 alc260_hp_automute(codec);
5408 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5410 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5411 .name = "Master Playback Switch",
5412 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5413 .info = snd_ctl_boolean_mono_info,
5414 .get = alc260_hp_master_sw_get,
5415 .put = alc260_hp_master_sw_put,
5416 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5418 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5419 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5420 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
5421 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
5422 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5423 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5424 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5425 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
5429 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
5430 .ops = &snd_hda_bind_vol,
5432 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
5433 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
5434 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
5439 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
5440 .ops = &snd_hda_bind_sw,
5442 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
5443 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
5448 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
5449 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
5450 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
5451 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
5452 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5456 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
5457 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5461 static void alc260_hp_3013_automute(struct hda_codec *codec)
5463 struct alc_spec *spec = codec->spec;
5465 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
5466 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
5469 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
5472 if ((res >> 26) == ALC880_HP_EVENT)
5473 alc260_hp_3013_automute(codec);
5476 static void alc260_hp_3012_automute(struct hda_codec *codec)
5478 unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT;
5480 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5482 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5484 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5488 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
5491 if ((res >> 26) == ALC880_HP_EVENT)
5492 alc260_hp_3012_automute(codec);
5495 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
5496 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
5498 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
5499 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5500 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
5501 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5502 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5503 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5504 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
5505 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
5506 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
5507 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5508 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
5512 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
5513 * versions of the ALC260 don't act on requests to enable mic bias from NID
5514 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5515 * datasheet doesn't mention this restriction. At this stage it's not clear
5516 * whether this behaviour is intentional or is a hardware bug in chip
5517 * revisions available in early 2006. Therefore for now allow the
5518 * "Headphone Jack Mode" control to span all choices, but if it turns out
5519 * that the lack of mic bias for this NID is intentional we could change the
5520 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5522 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5523 * don't appear to make the mic bias available from the "line" jack, even
5524 * though the NID used for this jack (0x14) can supply it. The theory is
5525 * that perhaps Acer have included blocking capacitors between the ALC260
5526 * and the output jack. If this turns out to be the case for all such
5527 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5528 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5530 * The C20x Tablet series have a mono internal speaker which is controlled
5531 * via the chip's Mono sum widget and pin complex, so include the necessary
5532 * controls for such models. On models without a "mono speaker" the control
5533 * won't do anything.
5535 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5536 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5537 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5538 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5539 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5541 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5543 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5544 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5545 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5546 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5547 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5548 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5549 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5550 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5554 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5556 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
5557 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5558 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5559 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5560 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5561 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5562 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5566 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5567 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5569 static struct snd_kcontrol_new alc260_will_mixer[] = {
5570 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5571 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5572 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5573 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5574 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5575 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5576 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5577 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5578 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5579 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5583 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5584 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5586 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5587 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5588 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5589 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5590 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5591 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5592 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
5593 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
5594 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5595 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5596 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5601 * initialization verbs
5603 static struct hda_verb alc260_init_verbs[] = {
5604 /* Line In pin widget for input */
5605 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5606 /* CD pin widget for input */
5607 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5608 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5609 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5610 /* Mic2 (front panel) pin widget for input and vref at 80% */
5611 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5612 /* LINE-2 is used for line-out in rear */
5613 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5614 /* select line-out */
5615 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
5617 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5619 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5621 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5622 /* mute capture amp left and right */
5623 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5624 /* set connection select to line in (default select for this ADC) */
5625 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5626 /* mute capture amp left and right */
5627 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5628 /* set connection select to line in (default select for this ADC) */
5629 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
5630 /* set vol=0 Line-Out mixer amp left and right */
5631 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5632 /* unmute pin widget amp left and right (no gain on this amp) */
5633 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5634 /* set vol=0 HP mixer amp left and right */
5635 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5636 /* unmute pin widget amp left and right (no gain on this amp) */
5637 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5638 /* set vol=0 Mono mixer amp left and right */
5639 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5640 /* unmute pin widget amp left and right (no gain on this amp) */
5641 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5642 /* unmute LINE-2 out pin */
5643 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5644 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5647 /* mute analog inputs */
5648 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5649 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5650 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5651 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5652 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5653 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5654 /* mute Front out path */
5655 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5656 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5657 /* mute Headphone out path */
5658 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5659 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5660 /* mute Mono out path */
5661 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5662 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5666 #if 0 /* should be identical with alc260_init_verbs? */
5667 static struct hda_verb alc260_hp_init_verbs[] = {
5668 /* Headphone and output */
5669 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5671 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5672 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5673 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5674 /* Mic2 (front panel) pin widget for input and vref at 80% */
5675 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5676 /* Line In pin widget for input */
5677 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5678 /* Line-2 pin widget for output */
5679 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5680 /* CD pin widget for input */
5681 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5682 /* unmute amp left and right */
5683 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5684 /* set connection select to line in (default select for this ADC) */
5685 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5686 /* unmute Line-Out mixer amp left and right (volume = 0) */
5687 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5688 /* mute pin widget amp left and right (no gain on this amp) */
5689 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5690 /* unmute HP mixer amp left and right (volume = 0) */
5691 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5692 /* mute pin widget amp left and right (no gain on this amp) */
5693 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5694 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5697 /* mute analog inputs */
5698 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5699 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5700 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5701 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5702 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5703 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5704 /* Unmute Front out path */
5705 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5706 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5707 /* Unmute Headphone out path */
5708 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5709 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5710 /* Unmute Mono out path */
5711 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5712 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5717 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5718 /* Line out and output */
5719 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5721 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5722 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5723 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5724 /* Mic2 (front panel) pin widget for input and vref at 80% */
5725 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5726 /* Line In pin widget for input */
5727 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5728 /* Headphone pin widget for output */
5729 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5730 /* CD pin widget for input */
5731 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5732 /* unmute amp left and right */
5733 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5734 /* set connection select to line in (default select for this ADC) */
5735 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5736 /* unmute Line-Out mixer amp left and right (volume = 0) */
5737 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5738 /* mute pin widget amp left and right (no gain on this amp) */
5739 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5740 /* unmute HP mixer amp left and right (volume = 0) */
5741 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5742 /* mute pin widget amp left and right (no gain on this amp) */
5743 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5744 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5747 /* mute analog inputs */
5748 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5749 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5750 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5751 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5752 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5753 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5754 /* Unmute Front out path */
5755 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5756 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5757 /* Unmute Headphone out path */
5758 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5759 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5760 /* Unmute Mono out path */
5761 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5762 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5766 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5767 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5768 * audio = 0x16, internal speaker = 0x10.
5770 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5771 /* Disable all GPIOs */
5772 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5773 /* Internal speaker is connected to headphone pin */
5774 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5775 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5776 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5777 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5778 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5779 /* Ensure all other unused pins are disabled and muted. */
5780 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5781 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5782 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5783 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5784 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5785 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5786 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5787 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5789 /* Disable digital (SPDIF) pins */
5790 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5791 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5793 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5794 * when acting as an output.
5796 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5798 /* Start with output sum widgets muted and their output gains at min */
5799 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5800 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5801 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5802 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5803 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5804 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5805 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5806 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5807 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5809 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5810 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5811 /* Unmute Line1 pin widget output buffer since it starts as an output.
5812 * If the pin mode is changed by the user the pin mode control will
5813 * take care of enabling the pin's input/output buffers as needed.
5814 * Therefore there's no need to enable the input buffer at this
5817 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5818 /* Unmute input buffer of pin widget used for Line-in (no equiv
5821 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5823 /* Mute capture amp left and right */
5824 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5825 /* Set ADC connection select to match default mixer setting - line
5828 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5830 /* Do the same for the second ADC: mute capture input amp and
5831 * set ADC connection to line in (on mic1 pin)
5833 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5834 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5836 /* Mute all inputs to mixer widget (even unconnected ones) */
5837 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5838 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5839 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5840 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5841 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5842 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5843 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5844 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5849 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5850 * similar laptops (adapted from Fujitsu init verbs).
5852 static struct hda_verb alc260_acer_init_verbs[] = {
5853 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5854 * the headphone jack. Turn this on and rely on the standard mute
5855 * methods whenever the user wants to turn these outputs off.
5857 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5858 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5859 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5860 /* Internal speaker/Headphone jack is connected to Line-out pin */
5861 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5862 /* Internal microphone/Mic jack is connected to Mic1 pin */
5863 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5864 /* Line In jack is connected to Line1 pin */
5865 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5866 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5867 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5868 /* Ensure all other unused pins are disabled and muted. */
5869 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5870 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5871 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5872 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5873 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5874 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5875 /* Disable digital (SPDIF) pins */
5876 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5877 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5879 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5880 * bus when acting as outputs.
5882 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5883 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5885 /* Start with output sum widgets muted and their output gains at min */
5886 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5887 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5888 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5889 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5890 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5891 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5892 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5893 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5894 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5896 /* Unmute Line-out pin widget amp left and right
5897 * (no equiv mixer ctrl)
5899 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5900 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5901 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5902 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5903 * inputs. If the pin mode is changed by the user the pin mode control
5904 * will take care of enabling the pin's input/output buffers as needed.
5905 * Therefore there's no need to enable the input buffer at this
5908 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5909 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5911 /* Mute capture amp left and right */
5912 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5913 /* Set ADC connection select to match default mixer setting - mic
5916 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5918 /* Do similar with the second ADC: mute capture input amp and
5919 * set ADC connection to mic to match ALSA's default state.
5921 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5922 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5924 /* Mute all inputs to mixer widget (even unconnected ones) */
5925 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5926 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5927 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5928 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5929 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5930 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5931 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5932 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5937 /* Initialisation sequence for Maxdata Favorit 100XS
5938 * (adapted from Acer init verbs).
5940 static struct hda_verb alc260_favorit100_init_verbs[] = {
5941 /* GPIO 0 enables the output jack.
5942 * Turn this on and rely on the standard mute
5943 * methods whenever the user wants to turn these outputs off.
5945 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5946 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5947 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5948 /* Line/Mic input jack is connected to Mic1 pin */
5949 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5950 /* Ensure all other unused pins are disabled and muted. */
5951 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5952 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5953 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5954 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5955 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5956 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5957 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5958 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5959 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5960 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5961 /* Disable digital (SPDIF) pins */
5962 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5963 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5965 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5966 * bus when acting as outputs.
5968 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5969 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5971 /* Start with output sum widgets muted and their output gains at min */
5972 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5973 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5974 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5975 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5976 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5977 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5978 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5979 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5980 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5982 /* Unmute Line-out pin widget amp left and right
5983 * (no equiv mixer ctrl)
5985 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5986 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5987 * inputs. If the pin mode is changed by the user the pin mode control
5988 * will take care of enabling the pin's input/output buffers as needed.
5989 * Therefore there's no need to enable the input buffer at this
5992 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5994 /* Mute capture amp left and right */
5995 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5996 /* Set ADC connection select to match default mixer setting - mic
5999 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6001 /* Do similar with the second ADC: mute capture input amp and
6002 * set ADC connection to mic to match ALSA's default state.
6004 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6005 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6007 /* Mute all inputs to mixer widget (even unconnected ones) */
6008 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6009 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6010 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6011 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6012 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6013 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6014 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6015 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6020 static struct hda_verb alc260_will_verbs[] = {
6021 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6022 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
6023 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
6024 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6025 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6026 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
6030 static struct hda_verb alc260_replacer_672v_verbs[] = {
6031 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6032 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6033 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
6035 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6036 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6037 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6039 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6043 /* toggle speaker-output according to the hp-jack state */
6044 static void alc260_replacer_672v_automute(struct hda_codec *codec)
6046 unsigned int present;
6048 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
6049 present = snd_hda_jack_detect(codec, 0x0f);
6051 snd_hda_codec_write_cache(codec, 0x01, 0,
6052 AC_VERB_SET_GPIO_DATA, 1);
6053 snd_hda_codec_write_cache(codec, 0x0f, 0,
6054 AC_VERB_SET_PIN_WIDGET_CONTROL,
6057 snd_hda_codec_write_cache(codec, 0x01, 0,
6058 AC_VERB_SET_GPIO_DATA, 0);
6059 snd_hda_codec_write_cache(codec, 0x0f, 0,
6060 AC_VERB_SET_PIN_WIDGET_CONTROL,
6065 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
6068 if ((res >> 26) == ALC880_HP_EVENT)
6069 alc260_replacer_672v_automute(codec);
6072 static struct hda_verb alc260_hp_dc7600_verbs[] = {
6073 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
6074 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6075 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6076 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6077 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6078 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6079 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6080 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6081 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6082 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6086 /* Test configuration for debugging, modelled after the ALC880 test
6089 #ifdef CONFIG_SND_DEBUG
6090 static hda_nid_t alc260_test_dac_nids[1] = {
6093 static hda_nid_t alc260_test_adc_nids[2] = {
6096 /* For testing the ALC260, each input MUX needs its own definition since
6097 * the signal assignments are different. This assumes that the first ADC
6100 static struct hda_input_mux alc260_test_capture_sources[2] = {
6104 { "MIC1 pin", 0x0 },
6105 { "MIC2 pin", 0x1 },
6106 { "LINE1 pin", 0x2 },
6107 { "LINE2 pin", 0x3 },
6109 { "LINE-OUT pin", 0x5 },
6110 { "HP-OUT pin", 0x6 },
6116 { "MIC1 pin", 0x0 },
6117 { "MIC2 pin", 0x1 },
6118 { "LINE1 pin", 0x2 },
6119 { "LINE2 pin", 0x3 },
6122 { "LINE-OUT pin", 0x6 },
6123 { "HP-OUT pin", 0x7 },
6127 static struct snd_kcontrol_new alc260_test_mixer[] = {
6128 /* Output driver widgets */
6129 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
6130 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
6131 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6132 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
6133 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6134 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
6136 /* Modes for retasking pin widgets
6137 * Note: the ALC260 doesn't seem to act on requests to enable mic
6138 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
6139 * mention this restriction. At this stage it's not clear whether
6140 * this behaviour is intentional or is a hardware bug in chip
6141 * revisions available at least up until early 2006. Therefore for
6142 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
6143 * choices, but if it turns out that the lack of mic bias for these
6144 * NIDs is intentional we could change their modes from
6145 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6147 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
6148 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
6149 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
6150 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
6151 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
6152 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
6154 /* Loopback mixer controls */
6155 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
6156 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
6157 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
6158 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
6159 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
6160 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
6161 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
6162 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
6163 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6164 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6165 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
6166 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
6167 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
6168 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
6170 /* Controls for GPIO pins, assuming they are configured as outputs */
6171 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
6172 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
6173 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
6174 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
6176 /* Switches to allow the digital IO pins to be enabled. The datasheet
6177 * is ambigious as to which NID is which; testing on laptops which
6178 * make this output available should provide clarification.
6180 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
6181 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
6183 /* A switch allowing EAPD to be enabled. Some laptops seem to use
6184 * this output to turn on an external amplifier.
6186 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
6187 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
6191 static struct hda_verb alc260_test_init_verbs[] = {
6192 /* Enable all GPIOs as outputs with an initial value of 0 */
6193 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
6194 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6195 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
6197 /* Enable retasking pins as output, initially without power amp */
6198 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6199 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6200 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6201 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6202 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6203 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6205 /* Disable digital (SPDIF) pins initially, but users can enable
6206 * them via a mixer switch. In the case of SPDIF-out, this initverb
6207 * payload also sets the generation to 0, output to be in "consumer"
6208 * PCM format, copyright asserted, no pre-emphasis and no validity
6211 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6212 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6214 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
6215 * OUT1 sum bus when acting as an output.
6217 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6218 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
6219 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6220 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
6222 /* Start with output sum widgets muted and their output gains at min */
6223 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6224 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6225 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6226 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6227 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6228 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6229 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6230 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6231 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6233 /* Unmute retasking pin widget output buffers since the default
6234 * state appears to be output. As the pin mode is changed by the
6235 * user the pin mode control will take care of enabling the pin's
6236 * input/output buffers as needed.
6238 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6239 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6240 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6241 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6242 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6243 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6244 /* Also unmute the mono-out pin widget */
6245 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6247 /* Mute capture amp left and right */
6248 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6249 /* Set ADC connection select to match default mixer setting (mic1
6252 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6254 /* Do the same for the second ADC: mute capture input amp and
6255 * set ADC connection to mic1 pin
6257 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6258 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6260 /* Mute all inputs to mixer widget (even unconnected ones) */
6261 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6262 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6263 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6264 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6265 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6266 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6267 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6268 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6274 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
6275 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
6277 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
6278 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
6281 * for BIOS auto-configuration
6284 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
6285 const char *pfx, int *vol_bits)
6288 unsigned long vol_val, sw_val;
6291 if (nid >= 0x0f && nid < 0x11) {
6292 nid_vol = nid - 0x7;
6293 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6294 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6295 } else if (nid == 0x11) {
6296 nid_vol = nid - 0x7;
6297 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
6298 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
6299 } else if (nid >= 0x12 && nid <= 0x15) {
6301 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6302 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6306 if (!(*vol_bits & (1 << nid_vol))) {
6307 /* first control for the volume widget */
6308 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val);
6311 *vol_bits |= (1 << nid_vol);
6313 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val);
6319 /* add playback controls from the parsed DAC table */
6320 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6321 const struct auto_pin_cfg *cfg)
6327 spec->multiout.num_dacs = 1;
6328 spec->multiout.dac_nids = spec->private_dac_nids;
6329 spec->multiout.dac_nids[0] = 0x02;
6331 nid = cfg->line_out_pins[0];
6334 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6336 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6340 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6345 nid = cfg->speaker_pins[0];
6347 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6352 nid = cfg->hp_pins[0];
6354 err = alc260_add_playback_controls(spec, nid, "Headphone",
6362 /* create playback/capture controls for input pins */
6363 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6364 const struct auto_pin_cfg *cfg)
6366 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
6369 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6370 hda_nid_t nid, int pin_type,
6373 alc_set_pin_output(codec, nid, pin_type);
6374 /* need the manual connection? */
6376 int idx = nid - 0x12;
6377 snd_hda_codec_write(codec, idx + 0x0b, 0,
6378 AC_VERB_SET_CONNECT_SEL, sel_idx);
6382 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6384 struct alc_spec *spec = codec->spec;
6387 nid = spec->autocfg.line_out_pins[0];
6389 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6390 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6393 nid = spec->autocfg.speaker_pins[0];
6395 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6397 nid = spec->autocfg.hp_pins[0];
6399 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6402 #define ALC260_PIN_CD_NID 0x16
6403 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6405 struct alc_spec *spec = codec->spec;
6408 for (i = 0; i < AUTO_PIN_LAST; i++) {
6409 hda_nid_t nid = spec->autocfg.input_pins[i];
6411 alc_set_input_pin(codec, nid, i);
6412 if (nid != ALC260_PIN_CD_NID &&
6413 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6414 snd_hda_codec_write(codec, nid, 0,
6415 AC_VERB_SET_AMP_GAIN_MUTE,
6421 #define alc260_auto_init_input_src alc880_auto_init_input_src
6424 * generic initialization of ADC, input mixers and output mixers
6426 static struct hda_verb alc260_volume_init_verbs[] = {
6428 * Unmute ADC0-1 and set the default input to mic-in
6430 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6431 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6432 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6433 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6435 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6437 * Note: PASD motherboards uses the Line In 2 as the input for
6438 * front panel mic (mic 2)
6440 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6441 /* mute analog inputs */
6442 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6443 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6444 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6445 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6446 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6449 * Set up output mixers (0x08 - 0x0a)
6451 /* set vol=0 to output mixers */
6452 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6453 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6454 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6455 /* set up input amps for analog loopback */
6456 /* Amp Indices: DAC = 0, mixer = 1 */
6457 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6458 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6459 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6460 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6461 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6462 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6467 static int alc260_parse_auto_config(struct hda_codec *codec)
6469 struct alc_spec *spec = codec->spec;
6471 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
6473 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
6477 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
6480 if (!spec->kctls.list)
6481 return 0; /* can't find valid BIOS pin config */
6482 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
6486 spec->multiout.max_channels = 2;
6488 if (spec->autocfg.dig_outs)
6489 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6490 if (spec->kctls.list)
6491 add_mixer(spec, spec->kctls.list);
6493 add_verb(spec, alc260_volume_init_verbs);
6495 spec->num_mux_defs = 1;
6496 spec->input_mux = &spec->private_imux[0];
6498 alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0);
6503 /* additional initialization for auto-configuration model */
6504 static void alc260_auto_init(struct hda_codec *codec)
6506 struct alc_spec *spec = codec->spec;
6507 alc260_auto_init_multi_out(codec);
6508 alc260_auto_init_analog_input(codec);
6509 alc260_auto_init_input_src(codec);
6510 if (spec->unsol_event)
6511 alc_inithook(codec);
6514 #ifdef CONFIG_SND_HDA_POWER_SAVE
6515 static struct hda_amp_list alc260_loopbacks[] = {
6516 { 0x07, HDA_INPUT, 0 },
6517 { 0x07, HDA_INPUT, 1 },
6518 { 0x07, HDA_INPUT, 2 },
6519 { 0x07, HDA_INPUT, 3 },
6520 { 0x07, HDA_INPUT, 4 },
6526 * ALC260 configurations
6528 static const char *alc260_models[ALC260_MODEL_LAST] = {
6529 [ALC260_BASIC] = "basic",
6531 [ALC260_HP_3013] = "hp-3013",
6532 [ALC260_HP_DC7600] = "hp-dc7600",
6533 [ALC260_FUJITSU_S702X] = "fujitsu",
6534 [ALC260_ACER] = "acer",
6535 [ALC260_WILL] = "will",
6536 [ALC260_REPLACER_672V] = "replacer",
6537 [ALC260_FAVORIT100] = "favorit100",
6538 #ifdef CONFIG_SND_DEBUG
6539 [ALC260_TEST] = "test",
6541 [ALC260_AUTO] = "auto",
6544 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6545 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6546 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
6547 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6548 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6549 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6550 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */
6551 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6552 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6553 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6554 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6555 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6556 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6557 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6558 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6559 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6560 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6561 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6562 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6563 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6564 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6568 static struct alc_config_preset alc260_presets[] = {
6570 .mixers = { alc260_base_output_mixer,
6571 alc260_input_mixer },
6572 .init_verbs = { alc260_init_verbs },
6573 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6574 .dac_nids = alc260_dac_nids,
6575 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6576 .adc_nids = alc260_dual_adc_nids,
6577 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6578 .channel_mode = alc260_modes,
6579 .input_mux = &alc260_capture_source,
6582 .mixers = { alc260_hp_output_mixer,
6583 alc260_input_mixer },
6584 .init_verbs = { alc260_init_verbs,
6585 alc260_hp_unsol_verbs },
6586 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6587 .dac_nids = alc260_dac_nids,
6588 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6589 .adc_nids = alc260_adc_nids_alt,
6590 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6591 .channel_mode = alc260_modes,
6592 .input_mux = &alc260_capture_source,
6593 .unsol_event = alc260_hp_unsol_event,
6594 .init_hook = alc260_hp_automute,
6596 [ALC260_HP_DC7600] = {
6597 .mixers = { alc260_hp_dc7600_mixer,
6598 alc260_input_mixer },
6599 .init_verbs = { alc260_init_verbs,
6600 alc260_hp_dc7600_verbs },
6601 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6602 .dac_nids = alc260_dac_nids,
6603 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6604 .adc_nids = alc260_adc_nids_alt,
6605 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6606 .channel_mode = alc260_modes,
6607 .input_mux = &alc260_capture_source,
6608 .unsol_event = alc260_hp_3012_unsol_event,
6609 .init_hook = alc260_hp_3012_automute,
6611 [ALC260_HP_3013] = {
6612 .mixers = { alc260_hp_3013_mixer,
6613 alc260_input_mixer },
6614 .init_verbs = { alc260_hp_3013_init_verbs,
6615 alc260_hp_3013_unsol_verbs },
6616 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6617 .dac_nids = alc260_dac_nids,
6618 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6619 .adc_nids = alc260_adc_nids_alt,
6620 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6621 .channel_mode = alc260_modes,
6622 .input_mux = &alc260_capture_source,
6623 .unsol_event = alc260_hp_3013_unsol_event,
6624 .init_hook = alc260_hp_3013_automute,
6626 [ALC260_FUJITSU_S702X] = {
6627 .mixers = { alc260_fujitsu_mixer },
6628 .init_verbs = { alc260_fujitsu_init_verbs },
6629 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6630 .dac_nids = alc260_dac_nids,
6631 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6632 .adc_nids = alc260_dual_adc_nids,
6633 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6634 .channel_mode = alc260_modes,
6635 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
6636 .input_mux = alc260_fujitsu_capture_sources,
6639 .mixers = { alc260_acer_mixer },
6640 .init_verbs = { alc260_acer_init_verbs },
6641 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6642 .dac_nids = alc260_dac_nids,
6643 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6644 .adc_nids = alc260_dual_adc_nids,
6645 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6646 .channel_mode = alc260_modes,
6647 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
6648 .input_mux = alc260_acer_capture_sources,
6650 [ALC260_FAVORIT100] = {
6651 .mixers = { alc260_favorit100_mixer },
6652 .init_verbs = { alc260_favorit100_init_verbs },
6653 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6654 .dac_nids = alc260_dac_nids,
6655 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6656 .adc_nids = alc260_dual_adc_nids,
6657 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6658 .channel_mode = alc260_modes,
6659 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
6660 .input_mux = alc260_favorit100_capture_sources,
6663 .mixers = { alc260_will_mixer },
6664 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6665 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6666 .dac_nids = alc260_dac_nids,
6667 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6668 .adc_nids = alc260_adc_nids,
6669 .dig_out_nid = ALC260_DIGOUT_NID,
6670 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6671 .channel_mode = alc260_modes,
6672 .input_mux = &alc260_capture_source,
6674 [ALC260_REPLACER_672V] = {
6675 .mixers = { alc260_replacer_672v_mixer },
6676 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6677 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6678 .dac_nids = alc260_dac_nids,
6679 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6680 .adc_nids = alc260_adc_nids,
6681 .dig_out_nid = ALC260_DIGOUT_NID,
6682 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6683 .channel_mode = alc260_modes,
6684 .input_mux = &alc260_capture_source,
6685 .unsol_event = alc260_replacer_672v_unsol_event,
6686 .init_hook = alc260_replacer_672v_automute,
6688 #ifdef CONFIG_SND_DEBUG
6690 .mixers = { alc260_test_mixer },
6691 .init_verbs = { alc260_test_init_verbs },
6692 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6693 .dac_nids = alc260_test_dac_nids,
6694 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6695 .adc_nids = alc260_test_adc_nids,
6696 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6697 .channel_mode = alc260_modes,
6698 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6699 .input_mux = alc260_test_capture_sources,
6704 static int patch_alc260(struct hda_codec *codec)
6706 struct alc_spec *spec;
6707 int err, board_config;
6709 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6715 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6718 if (board_config < 0) {
6719 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6721 board_config = ALC260_AUTO;
6724 if (board_config == ALC260_AUTO) {
6725 /* automatic parse from the BIOS config */
6726 err = alc260_parse_auto_config(codec);
6732 "hda_codec: Cannot set up configuration "
6733 "from BIOS. Using base mode...\n");
6734 board_config = ALC260_BASIC;
6738 err = snd_hda_attach_beep_device(codec, 0x1);
6744 if (board_config != ALC260_AUTO)
6745 setup_preset(codec, &alc260_presets[board_config]);
6747 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6748 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6750 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6751 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6753 if (!spec->adc_nids && spec->input_mux) {
6754 /* check whether NID 0x04 is valid */
6755 unsigned int wcap = get_wcaps(codec, 0x04);
6756 wcap = get_wcaps_type(wcap);
6758 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6759 spec->adc_nids = alc260_adc_nids_alt;
6760 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6762 spec->adc_nids = alc260_adc_nids;
6763 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6766 set_capture_mixer(codec);
6767 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6769 spec->vmaster_nid = 0x08;
6771 codec->patch_ops = alc_patch_ops;
6772 if (board_config == ALC260_AUTO)
6773 spec->init_hook = alc260_auto_init;
6774 #ifdef CONFIG_SND_HDA_POWER_SAVE
6775 if (!spec->loopback.amplist)
6776 spec->loopback.amplist = alc260_loopbacks;
6784 * ALC882/883/885/888/889 support
6786 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6787 * configuration. Each pin widget can choose any input DACs and a mixer.
6788 * Each ADC is connected from a mixer of all inputs. This makes possible
6789 * 6-channel independent captures.
6791 * In addition, an independent DAC for the multi-playback (not used in this
6794 #define ALC882_DIGOUT_NID 0x06
6795 #define ALC882_DIGIN_NID 0x0a
6796 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
6797 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
6798 #define ALC1200_DIGOUT_NID 0x10
6801 static struct hda_channel_mode alc882_ch_modes[1] = {
6806 static hda_nid_t alc882_dac_nids[4] = {
6807 /* front, rear, clfe, rear_surr */
6808 0x02, 0x03, 0x04, 0x05
6810 #define alc883_dac_nids alc882_dac_nids
6813 #define alc882_adc_nids alc880_adc_nids
6814 #define alc882_adc_nids_alt alc880_adc_nids_alt
6815 #define alc883_adc_nids alc882_adc_nids_alt
6816 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
6817 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
6818 #define alc889_adc_nids alc880_adc_nids
6820 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6821 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6822 #define alc883_capsrc_nids alc882_capsrc_nids_alt
6823 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
6824 #define alc889_capsrc_nids alc882_capsrc_nids
6827 /* FIXME: should be a matrix-type input source selection */
6829 static struct hda_input_mux alc882_capture_source = {
6833 { "Front Mic", 0x1 },
6839 #define alc883_capture_source alc882_capture_source
6841 static struct hda_input_mux alc889_capture_source = {
6844 { "Front Mic", 0x0 },
6850 static struct hda_input_mux mb5_capture_source = {
6859 static struct hda_input_mux macmini3_capture_source = {
6867 static struct hda_input_mux alc883_3stack_6ch_intel = {
6871 { "Front Mic", 0x0 },
6877 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6885 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6895 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6903 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
6907 { "Front Mic", 0x1 },
6912 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
6920 static struct hda_input_mux alc889A_mb31_capture_source = {
6924 /* Front Mic (0x01) unused */
6926 /* Line 2 (0x03) unused */
6927 /* CD (0x04) unused? */
6934 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6941 static struct hda_verb alc882_3ST_ch2_init[] = {
6942 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6943 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6944 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6945 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6952 static struct hda_verb alc882_3ST_ch4_init[] = {
6953 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6954 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6955 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6956 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6957 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6964 static struct hda_verb alc882_3ST_ch6_init[] = {
6965 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6966 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6967 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6968 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6969 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6970 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6974 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
6975 { 2, alc882_3ST_ch2_init },
6976 { 4, alc882_3ST_ch4_init },
6977 { 6, alc882_3ST_ch6_init },
6980 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
6985 static struct hda_verb alc883_3ST_ch2_clevo_init[] = {
6986 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
6987 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6988 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6989 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6990 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6997 static struct hda_verb alc883_3ST_ch4_clevo_init[] = {
6998 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6999 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7000 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7001 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7002 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7003 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7010 static struct hda_verb alc883_3ST_ch6_clevo_init[] = {
7011 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7012 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7013 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7014 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7015 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7016 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7017 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7021 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
7022 { 2, alc883_3ST_ch2_clevo_init },
7023 { 4, alc883_3ST_ch4_clevo_init },
7024 { 6, alc883_3ST_ch6_clevo_init },
7031 static struct hda_verb alc882_sixstack_ch6_init[] = {
7032 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7033 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7034 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7035 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7042 static struct hda_verb alc882_sixstack_ch8_init[] = {
7043 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7044 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7045 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7046 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7050 static struct hda_channel_mode alc882_sixstack_modes[2] = {
7051 { 6, alc882_sixstack_ch6_init },
7052 { 8, alc882_sixstack_ch8_init },
7056 /* Macbook Air 2,1 */
7058 static struct hda_channel_mode alc885_mba21_ch_modes[1] = {
7063 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
7069 static struct hda_verb alc885_mbp_ch2_init[] = {
7070 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7071 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7072 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7079 static struct hda_verb alc885_mbp_ch4_init[] = {
7080 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7081 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7082 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7083 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7084 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7088 static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
7089 { 2, alc885_mbp_ch2_init },
7090 { 4, alc885_mbp_ch4_init },
7095 * Speakers/Woofer/HP = Front
7098 static struct hda_verb alc885_mb5_ch2_init[] = {
7099 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7100 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7106 * Speakers/HP = Front
7110 static struct hda_verb alc885_mb5_ch6_init[] = {
7111 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7112 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7113 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7117 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
7118 { 2, alc885_mb5_ch2_init },
7119 { 6, alc885_mb5_ch6_init },
7122 #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes
7127 static struct hda_verb alc883_4ST_ch2_init[] = {
7128 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7129 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7130 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7131 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7132 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7133 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7140 static struct hda_verb alc883_4ST_ch4_init[] = {
7141 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7142 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7143 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7144 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7145 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7146 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7147 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7154 static struct hda_verb alc883_4ST_ch6_init[] = {
7155 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7156 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7157 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7158 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7159 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7160 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7161 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7162 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7169 static struct hda_verb alc883_4ST_ch8_init[] = {
7170 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7171 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7172 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7173 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7174 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7175 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7176 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7177 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7178 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7182 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
7183 { 2, alc883_4ST_ch2_init },
7184 { 4, alc883_4ST_ch4_init },
7185 { 6, alc883_4ST_ch6_init },
7186 { 8, alc883_4ST_ch8_init },
7193 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7194 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7195 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7196 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7197 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7204 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7205 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7206 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7207 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7208 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7209 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7216 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7217 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7218 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7219 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7220 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7221 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7222 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7226 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7227 { 2, alc883_3ST_ch2_intel_init },
7228 { 4, alc883_3ST_ch4_intel_init },
7229 { 6, alc883_3ST_ch6_intel_init },
7235 static struct hda_verb alc889_ch2_intel_init[] = {
7236 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7237 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
7238 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
7239 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
7240 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7241 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7248 static struct hda_verb alc889_ch6_intel_init[] = {
7249 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7250 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7251 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7252 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7253 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7254 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7261 static struct hda_verb alc889_ch8_intel_init[] = {
7262 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7263 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7264 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7265 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7266 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
7267 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7268 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7272 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
7273 { 2, alc889_ch2_intel_init },
7274 { 6, alc889_ch6_intel_init },
7275 { 8, alc889_ch8_intel_init },
7281 static struct hda_verb alc883_sixstack_ch6_init[] = {
7282 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7283 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7284 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7285 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7292 static struct hda_verb alc883_sixstack_ch8_init[] = {
7293 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7294 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7295 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7296 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7300 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7301 { 6, alc883_sixstack_ch6_init },
7302 { 8, alc883_sixstack_ch8_init },
7306 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7307 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7309 static struct snd_kcontrol_new alc882_base_mixer[] = {
7310 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7311 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7312 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7313 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7314 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7315 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7316 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7317 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7318 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7319 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7320 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7321 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7322 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7323 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7324 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7325 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7326 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7327 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7328 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7329 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7330 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7334 /* Macbook Air 2,1 same control for HP and internal Speaker */
7336 static struct snd_kcontrol_new alc885_mba21_mixer[] = {
7337 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7338 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT),
7343 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
7344 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7345 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7346 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7347 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
7348 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7349 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7350 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7351 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7352 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7353 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
7354 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7358 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7359 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7360 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7361 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7362 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7363 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7364 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7365 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7366 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7367 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7368 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7369 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7370 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7371 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7372 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
7376 static struct snd_kcontrol_new alc885_macmini3_mixer[] = {
7377 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7378 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7379 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7380 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7381 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7382 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7383 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7384 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7385 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
7386 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
7387 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7391 static struct snd_kcontrol_new alc885_imac91_mixer[] = {
7392 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7393 HDA_BIND_MUTE ("Line-Out Playback Switch", 0x0c, 0x02, HDA_INPUT),
7394 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
7395 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7396 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7397 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7398 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7399 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7400 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7405 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
7406 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7407 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7408 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7409 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7410 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7411 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7412 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7413 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7414 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7418 static struct snd_kcontrol_new alc882_targa_mixer[] = {
7419 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7420 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7421 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7422 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7423 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7424 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7425 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7426 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7427 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7428 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7429 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7430 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7431 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7435 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
7436 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
7438 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
7439 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7440 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7441 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7442 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
7443 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7444 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7445 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7446 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7447 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
7448 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
7449 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7450 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7451 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7455 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
7456 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7457 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7458 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7459 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7460 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7461 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7462 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7463 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7464 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7465 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7469 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
7471 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7472 .name = "Channel Mode",
7473 .info = alc_ch_mode_info,
7474 .get = alc_ch_mode_get,
7475 .put = alc_ch_mode_put,
7480 static struct hda_verb alc882_base_init_verbs[] = {
7481 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7482 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7483 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7485 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7486 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7488 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7489 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7491 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7492 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7494 /* Front Pin: output 0 (0x0c) */
7495 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7496 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7497 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7498 /* Rear Pin: output 1 (0x0d) */
7499 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7500 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7501 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7502 /* CLFE Pin: output 2 (0x0e) */
7503 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7504 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7505 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7506 /* Side Pin: output 3 (0x0f) */
7507 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7508 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7509 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7510 /* Mic (rear) pin: input vref at 80% */
7511 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7512 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7513 /* Front Mic pin: input vref at 80% */
7514 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7515 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7516 /* Line In pin: input */
7517 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7518 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7519 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7520 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7521 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7522 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7523 /* CD pin widget for input */
7524 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7526 /* FIXME: use matrix-type input source selection */
7527 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7529 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7531 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7532 /* ADC2: mute amp left and right */
7533 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7534 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7535 /* ADC3: mute amp left and right */
7536 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7537 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7542 static struct hda_verb alc882_adc1_init_verbs[] = {
7543 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7544 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7545 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7546 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7547 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7548 /* ADC1: mute amp left and right */
7549 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7550 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7554 static struct hda_verb alc882_eapd_verbs[] = {
7555 /* change to EAPD mode */
7556 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7557 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
7561 static struct hda_verb alc889_eapd_verbs[] = {
7562 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
7563 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
7567 static struct hda_verb alc_hp15_unsol_verbs[] = {
7568 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7569 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7573 static struct hda_verb alc885_init_verbs[] = {
7574 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7575 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7576 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7578 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7579 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7581 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7582 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7584 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7585 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7587 /* Front HP Pin: output 0 (0x0c) */
7588 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7589 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7590 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7591 /* Front Pin: output 0 (0x0c) */
7592 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7593 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7594 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7595 /* Rear Pin: output 1 (0x0d) */
7596 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7597 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7598 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
7599 /* CLFE Pin: output 2 (0x0e) */
7600 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7601 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7602 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7603 /* Side Pin: output 3 (0x0f) */
7604 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7605 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7606 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7607 /* Mic (rear) pin: input vref at 80% */
7608 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7609 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7610 /* Front Mic pin: input vref at 80% */
7611 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7612 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7613 /* Line In pin: input */
7614 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7615 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7617 /* Mixer elements: 0x18, , 0x1a, 0x1b */
7619 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7621 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7623 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7624 /* ADC2: mute amp left and right */
7625 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7626 /* ADC3: mute amp left and right */
7627 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7632 static struct hda_verb alc885_init_input_verbs[] = {
7633 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7634 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7635 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7640 /* Unmute Selector 24h and set the default input to front mic */
7641 static struct hda_verb alc889_init_input_verbs[] = {
7642 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
7643 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7648 #define alc883_init_verbs alc882_base_init_verbs
7651 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
7652 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7653 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7654 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
7655 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7656 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7657 /* FIXME: this looks suspicious...
7658 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
7659 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
7664 static struct hda_verb alc882_macpro_init_verbs[] = {
7665 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7666 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7667 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7668 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7669 /* Front Pin: output 0 (0x0c) */
7670 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7671 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7672 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7673 /* Front Mic pin: input vref at 80% */
7674 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7675 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7676 /* Speaker: output */
7677 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7678 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7679 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
7680 /* Headphone output (output 0 - 0x0c) */
7681 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7682 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7683 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7685 /* FIXME: use matrix-type input source selection */
7686 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7687 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7688 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7689 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7690 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7691 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7693 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7694 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7695 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7696 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7698 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7699 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7700 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7701 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7702 /* ADC1: mute amp left and right */
7703 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7704 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7705 /* ADC2: mute amp left and right */
7706 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7707 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7708 /* ADC3: mute amp left and right */
7709 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7710 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7716 static struct hda_verb alc885_mb5_init_verbs[] = {
7718 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7719 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7720 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7721 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7723 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7724 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7725 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7726 /* Surround mixer */
7727 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7728 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7729 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7731 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7732 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7733 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7735 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7736 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7737 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7738 /* Front Pin (0x0c) */
7739 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7740 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7741 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7742 /* LFE Pin (0x0e) */
7743 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7744 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7745 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7747 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7748 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7749 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7750 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7751 /* Front Mic pin: input vref at 80% */
7752 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7753 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7755 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7756 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7758 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7759 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7760 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7761 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7766 static struct hda_verb alc885_macmini3_init_verbs[] = {
7768 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7769 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7770 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7771 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7773 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7774 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7775 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7776 /* Surround mixer */
7777 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7778 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7779 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7781 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7782 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7783 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7785 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7786 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7787 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7788 /* Front Pin (0x0c) */
7789 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7790 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7791 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7792 /* LFE Pin (0x0e) */
7793 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7794 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7795 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7797 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7798 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7799 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7800 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7802 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7803 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7805 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7806 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7807 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7808 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7813 static struct hda_verb alc885_mba21_init_verbs[] = {
7814 /*Internal and HP Speaker Mixer*/
7815 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7816 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7817 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7818 /*Internal Speaker Pin (0x0c)*/
7819 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
7820 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7821 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7822 /* HP Pin: output 0 (0x0e) */
7823 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7824 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7825 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7826 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
7827 /* Line in (is hp when jack connected)*/
7828 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
7829 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7835 /* Macbook Pro rev3 */
7836 static struct hda_verb alc885_mbp3_init_verbs[] = {
7837 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7838 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7839 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7840 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7842 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7843 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7844 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7846 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7847 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7848 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7849 /* Front Pin: output 0 (0x0c) */
7850 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7851 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7852 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7853 /* HP Pin: output 0 (0x0e) */
7854 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7855 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7856 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
7857 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7858 /* Mic (rear) pin: input vref at 80% */
7859 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7860 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7861 /* Front Mic pin: input vref at 80% */
7862 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7863 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7864 /* Line In pin: use output 1 when in LineOut mode */
7865 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7866 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7867 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7869 /* FIXME: use matrix-type input source selection */
7870 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7871 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7872 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7873 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7874 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7875 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7877 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7878 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7879 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7880 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7882 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7883 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7884 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7885 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7886 /* ADC1: mute amp left and right */
7887 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7888 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7889 /* ADC2: mute amp left and right */
7890 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7891 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7892 /* ADC3: mute amp left and right */
7893 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7894 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7900 static struct hda_verb alc885_imac91_init_verbs[] = {
7901 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
7902 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7903 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7904 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7906 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7907 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7908 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7909 /* HP Pin: output 0 (0x0c) */
7910 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7911 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7912 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7913 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7914 /* Internal Speakers: output 0 (0x0d) */
7915 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7916 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7917 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7918 /* Mic (rear) pin: input vref at 80% */
7919 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7920 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7921 /* Front Mic pin: input vref at 80% */
7922 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7923 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7924 /* Line In pin: use output 1 when in LineOut mode */
7925 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7926 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7927 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7929 /* FIXME: use matrix-type input source selection */
7930 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7931 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7932 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7933 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7934 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7935 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7937 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7938 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7939 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7940 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7942 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7943 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7944 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7945 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7946 /* ADC1: mute amp left and right */
7947 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7948 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7949 /* ADC2: mute amp left and right */
7950 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7951 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7952 /* ADC3: mute amp left and right */
7953 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7954 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7959 /* iMac 24 mixer. */
7960 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
7961 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7962 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
7966 /* iMac 24 init verbs. */
7967 static struct hda_verb alc885_imac24_init_verbs[] = {
7968 /* Internal speakers: output 0 (0x0c) */
7969 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7970 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7971 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7972 /* Internal speakers: output 0 (0x0c) */
7973 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7974 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7975 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7976 /* Headphone: output 0 (0x0c) */
7977 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7978 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7979 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7980 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7981 /* Front Mic: input vref at 80% */
7982 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7983 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7987 /* Toggle speaker-output according to the hp-jack state */
7988 static void alc885_imac24_setup(struct hda_codec *codec)
7990 struct alc_spec *spec = codec->spec;
7992 spec->autocfg.hp_pins[0] = 0x14;
7993 spec->autocfg.speaker_pins[0] = 0x18;
7994 spec->autocfg.speaker_pins[1] = 0x1a;
7997 #define alc885_mb5_setup alc885_imac24_setup
7998 #define alc885_macmini3_setup alc885_imac24_setup
8000 /* Macbook Air 2,1 */
8001 static void alc885_mba21_setup(struct hda_codec *codec)
8003 struct alc_spec *spec = codec->spec;
8005 spec->autocfg.hp_pins[0] = 0x14;
8006 spec->autocfg.speaker_pins[0] = 0x18;
8011 static void alc885_mbp3_setup(struct hda_codec *codec)
8013 struct alc_spec *spec = codec->spec;
8015 spec->autocfg.hp_pins[0] = 0x15;
8016 spec->autocfg.speaker_pins[0] = 0x14;
8019 static void alc885_imac91_setup(struct hda_codec *codec)
8021 struct alc_spec *spec = codec->spec;
8023 spec->autocfg.hp_pins[0] = 0x14;
8024 spec->autocfg.speaker_pins[0] = 0x15;
8025 spec->autocfg.speaker_pins[1] = 0x1a;
8028 static struct hda_verb alc882_targa_verbs[] = {
8029 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8030 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8032 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8033 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8035 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8036 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8037 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8039 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8043 /* toggle speaker-output according to the hp-jack state */
8044 static void alc882_targa_automute(struct hda_codec *codec)
8046 struct alc_spec *spec = codec->spec;
8047 alc_automute_amp(codec);
8048 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
8049 spec->jack_present ? 1 : 3);
8052 static void alc882_targa_setup(struct hda_codec *codec)
8054 struct alc_spec *spec = codec->spec;
8056 spec->autocfg.hp_pins[0] = 0x14;
8057 spec->autocfg.speaker_pins[0] = 0x1b;
8060 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
8062 if ((res >> 26) == ALC880_HP_EVENT)
8063 alc882_targa_automute(codec);
8066 static struct hda_verb alc882_asus_a7j_verbs[] = {
8067 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8068 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8070 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8071 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8072 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8074 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8075 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8076 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8078 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8079 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8080 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8084 static struct hda_verb alc882_asus_a7m_verbs[] = {
8085 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8086 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8088 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8089 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8090 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8092 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8093 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8094 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8096 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8097 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8098 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8102 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
8104 unsigned int gpiostate, gpiomask, gpiodir;
8106 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
8107 AC_VERB_GET_GPIO_DATA, 0);
8110 gpiostate |= (1 << pin);
8112 gpiostate &= ~(1 << pin);
8114 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
8115 AC_VERB_GET_GPIO_MASK, 0);
8116 gpiomask |= (1 << pin);
8118 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
8119 AC_VERB_GET_GPIO_DIRECTION, 0);
8120 gpiodir |= (1 << pin);
8123 snd_hda_codec_write(codec, codec->afg, 0,
8124 AC_VERB_SET_GPIO_MASK, gpiomask);
8125 snd_hda_codec_write(codec, codec->afg, 0,
8126 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
8130 snd_hda_codec_write(codec, codec->afg, 0,
8131 AC_VERB_SET_GPIO_DATA, gpiostate);
8134 /* set up GPIO at initialization */
8135 static void alc885_macpro_init_hook(struct hda_codec *codec)
8137 alc882_gpio_mute(codec, 0, 0);
8138 alc882_gpio_mute(codec, 1, 0);
8141 /* set up GPIO and update auto-muting at initialization */
8142 static void alc885_imac24_init_hook(struct hda_codec *codec)
8144 alc885_macpro_init_hook(codec);
8145 alc_automute_amp(codec);
8149 * generic initialization of ADC, input mixers and output mixers
8151 static struct hda_verb alc883_auto_init_verbs[] = {
8153 * Unmute ADC0-2 and set the default input to mic-in
8155 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8156 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8157 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8158 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8161 * Set up output mixers (0x0c - 0x0f)
8163 /* set vol=0 to output mixers */
8164 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8165 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8166 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8167 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8168 /* set up input amps for analog loopback */
8169 /* Amp Indices: DAC = 0, mixer = 1 */
8170 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8171 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8172 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8173 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8174 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8175 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8176 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8177 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8178 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8179 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8181 /* FIXME: use matrix-type input source selection */
8182 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8184 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8186 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8190 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
8191 static struct hda_verb alc889A_mb31_ch2_init[] = {
8192 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8193 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8194 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8195 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8199 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
8200 static struct hda_verb alc889A_mb31_ch4_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_OUT}, /* Line as output */
8204 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8208 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
8209 static struct hda_verb alc889A_mb31_ch5_init[] = {
8210 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
8211 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8212 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8213 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8217 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
8218 static struct hda_verb alc889A_mb31_ch6_init[] = {
8219 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
8220 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
8221 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8222 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8226 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
8227 { 2, alc889A_mb31_ch2_init },
8228 { 4, alc889A_mb31_ch4_init },
8229 { 5, alc889A_mb31_ch5_init },
8230 { 6, alc889A_mb31_ch6_init },
8233 static struct hda_verb alc883_medion_eapd_verbs[] = {
8234 /* eanable EAPD on medion laptop */
8235 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8236 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
8240 #define alc883_base_mixer alc882_base_mixer
8242 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
8243 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8244 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8245 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8246 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8247 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8248 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8249 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8250 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8251 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8252 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8253 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8254 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8255 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8259 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
8260 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8261 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8262 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8263 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8264 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8265 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8266 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8267 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8268 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8269 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8273 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
8274 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8275 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8276 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8277 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8278 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8279 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8280 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8281 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8282 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8283 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8287 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
8288 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8289 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8290 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8291 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8292 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8293 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8294 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8295 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8296 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8297 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8298 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8299 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8300 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8304 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
8305 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8306 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8307 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8308 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8309 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8310 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8311 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8312 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8313 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8314 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8315 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8316 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8317 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8318 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8319 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8320 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8321 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8322 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8323 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8327 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
8328 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8329 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8330 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8331 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8332 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8334 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8335 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8336 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8337 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8338 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8339 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8340 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8341 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8342 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8343 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8344 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8345 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8346 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8347 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8351 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
8352 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8353 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8354 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8355 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8356 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8358 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8359 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8360 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8361 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8362 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
8363 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8364 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8365 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8366 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
8367 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT),
8368 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
8369 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8370 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8371 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8375 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
8376 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8377 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8378 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8379 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8380 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8381 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8382 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8383 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8384 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8385 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8386 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8387 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8388 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8389 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8390 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8391 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8392 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8393 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8394 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8398 static struct snd_kcontrol_new alc883_targa_mixer[] = {
8399 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8400 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8401 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8402 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8403 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8404 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8405 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8406 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8407 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8408 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8409 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8410 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8411 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8412 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8413 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8414 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8415 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8419 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
8420 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8421 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8422 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8423 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8424 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8425 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8426 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8427 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8428 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8429 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8430 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8431 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8435 static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
8436 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8437 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, 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_lenovo_101e_2ch_mixer[] = {
8445 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8446 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8447 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8448 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8449 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8450 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8451 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8452 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8456 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
8457 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8458 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
8459 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8460 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8461 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8462 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8463 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8464 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8465 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8469 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
8470 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8471 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8472 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8473 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8474 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8475 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8476 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8477 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8478 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8482 static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = {
8483 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8484 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8485 HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8486 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
8487 HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT),
8488 HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT),
8492 static struct hda_verb alc883_medion_wim2160_verbs[] = {
8493 /* Unmute front mixer */
8494 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8495 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8497 /* Set speaker pin to front mixer */
8498 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8500 /* Init headphone pin */
8501 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8502 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8503 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8504 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8509 /* toggle speaker-output according to the hp-jack state */
8510 static void alc883_medion_wim2160_setup(struct hda_codec *codec)
8512 struct alc_spec *spec = codec->spec;
8514 spec->autocfg.hp_pins[0] = 0x1a;
8515 spec->autocfg.speaker_pins[0] = 0x15;
8518 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
8519 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8520 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8521 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8522 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8523 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8524 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8525 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8526 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8530 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
8531 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8532 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8533 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8534 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8535 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8536 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8537 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8538 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8539 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8543 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
8544 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8545 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8546 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8547 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
8548 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
8549 0x0d, 1, 0x0, HDA_OUTPUT),
8550 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
8551 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
8552 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
8553 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8554 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8555 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8556 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8557 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8558 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8559 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8560 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8561 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8562 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8563 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8564 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8568 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
8570 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8571 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8572 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8573 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8574 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
8576 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
8577 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
8578 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
8579 /* Output switches */
8580 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
8581 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
8582 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
8584 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
8585 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
8587 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8588 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8589 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8590 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8594 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
8595 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8596 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8597 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8598 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8599 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8600 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8604 static struct hda_bind_ctls alc883_bind_cap_vol = {
8605 .ops = &snd_hda_bind_vol,
8607 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8608 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8613 static struct hda_bind_ctls alc883_bind_cap_switch = {
8614 .ops = &snd_hda_bind_sw,
8616 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8617 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8622 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
8623 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8624 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8625 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8626 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8627 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8628 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8629 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8630 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8634 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
8635 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
8636 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
8638 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8639 /* .name = "Capture Source", */
8640 .name = "Input Source",
8642 .info = alc_mux_enum_info,
8643 .get = alc_mux_enum_get,
8644 .put = alc_mux_enum_put,
8649 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
8651 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8652 .name = "Channel Mode",
8653 .info = alc_ch_mode_info,
8654 .get = alc_ch_mode_get,
8655 .put = alc_ch_mode_put,
8660 /* toggle speaker-output according to the hp-jack state */
8661 static void alc883_mitac_setup(struct hda_codec *codec)
8663 struct alc_spec *spec = codec->spec;
8665 spec->autocfg.hp_pins[0] = 0x15;
8666 spec->autocfg.speaker_pins[0] = 0x14;
8667 spec->autocfg.speaker_pins[1] = 0x17;
8670 /* auto-toggle front mic */
8672 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8674 unsigned char bits = snd_hda_jack_detect(codec, 0x18) ? HDA_AMP_MUTE : 0;
8676 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8680 static struct hda_verb alc883_mitac_verbs[] = {
8682 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8683 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8685 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8686 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8688 /* enable unsolicited event */
8689 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8690 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8695 static struct hda_verb alc883_clevo_m540r_verbs[] = {
8697 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8698 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8700 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
8702 /* enable unsolicited event */
8704 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8705 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8711 static struct hda_verb alc883_clevo_m720_verbs[] = {
8713 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8714 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8716 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
8717 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8719 /* enable unsolicited event */
8720 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8721 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8726 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8728 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8729 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8731 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8732 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8734 /* enable unsolicited event */
8735 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8740 static struct hda_verb alc883_targa_verbs[] = {
8741 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8742 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8744 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8745 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8747 /* Connect Line-Out side jack (SPDIF) to Side */
8748 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8749 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8750 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8751 /* Connect Mic jack to CLFE */
8752 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8753 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8754 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
8755 /* Connect Line-in jack to Surround */
8756 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8757 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8758 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8759 /* Connect HP out jack to Front */
8760 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8761 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8762 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8764 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8769 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8770 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8771 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8772 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8776 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8777 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8778 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8779 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8780 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8784 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8785 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8786 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8787 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8788 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8789 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8793 static struct hda_verb alc883_haier_w66_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)},
8797 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8799 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8800 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8801 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8802 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8806 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8807 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8808 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8809 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8810 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8811 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8812 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8813 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8814 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8818 static struct hda_verb alc888_6st_dell_verbs[] = {
8819 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8823 static struct hda_verb alc883_vaiott_verbs[] = {
8825 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8826 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8828 /* enable unsolicited event */
8829 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8834 static void alc888_3st_hp_setup(struct hda_codec *codec)
8836 struct alc_spec *spec = codec->spec;
8838 spec->autocfg.hp_pins[0] = 0x1b;
8839 spec->autocfg.speaker_pins[0] = 0x14;
8840 spec->autocfg.speaker_pins[1] = 0x16;
8841 spec->autocfg.speaker_pins[2] = 0x18;
8844 static struct hda_verb alc888_3st_hp_verbs[] = {
8845 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8846 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8847 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8848 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8855 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8856 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8857 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8858 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8859 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8866 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8867 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8868 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8869 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8870 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8871 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8878 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8879 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8880 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8881 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8882 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8883 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8884 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8888 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8889 { 2, alc888_3st_hp_2ch_init },
8890 { 4, alc888_3st_hp_4ch_init },
8891 { 6, alc888_3st_hp_6ch_init },
8894 /* toggle front-jack and RCA according to the hp-jack state */
8895 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8897 unsigned int present = snd_hda_jack_detect(codec, 0x1b);
8899 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8900 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8901 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8902 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8905 /* toggle RCA according to the front-jack state */
8906 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8908 unsigned int present = snd_hda_jack_detect(codec, 0x14);
8910 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8911 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8914 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8917 if ((res >> 26) == ALC880_HP_EVENT)
8918 alc888_lenovo_ms7195_front_automute(codec);
8919 if ((res >> 26) == ALC880_FRONT_EVENT)
8920 alc888_lenovo_ms7195_rca_automute(codec);
8923 static struct hda_verb alc883_medion_md2_verbs[] = {
8924 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8925 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8927 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8929 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8933 /* toggle speaker-output according to the hp-jack state */
8934 static void alc883_medion_md2_setup(struct hda_codec *codec)
8936 struct alc_spec *spec = codec->spec;
8938 spec->autocfg.hp_pins[0] = 0x14;
8939 spec->autocfg.speaker_pins[0] = 0x15;
8942 /* toggle speaker-output according to the hp-jack state */
8943 #define alc883_targa_init_hook alc882_targa_init_hook
8944 #define alc883_targa_unsol_event alc882_targa_unsol_event
8946 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8948 unsigned int present;
8950 present = snd_hda_jack_detect(codec, 0x18);
8951 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8952 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8955 static void alc883_clevo_m720_setup(struct hda_codec *codec)
8957 struct alc_spec *spec = codec->spec;
8959 spec->autocfg.hp_pins[0] = 0x15;
8960 spec->autocfg.speaker_pins[0] = 0x14;
8963 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
8965 alc_automute_amp(codec);
8966 alc883_clevo_m720_mic_automute(codec);
8969 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8972 switch (res >> 26) {
8973 case ALC880_MIC_EVENT:
8974 alc883_clevo_m720_mic_automute(codec);
8977 alc_automute_amp_unsol_event(codec, res);
8982 /* toggle speaker-output according to the hp-jack state */
8983 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
8985 struct alc_spec *spec = codec->spec;
8987 spec->autocfg.hp_pins[0] = 0x14;
8988 spec->autocfg.speaker_pins[0] = 0x15;
8991 static void alc883_haier_w66_setup(struct hda_codec *codec)
8993 struct alc_spec *spec = codec->spec;
8995 spec->autocfg.hp_pins[0] = 0x1b;
8996 spec->autocfg.speaker_pins[0] = 0x14;
8999 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
9001 int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0;
9003 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9004 HDA_AMP_MUTE, bits);
9007 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
9009 int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0;
9011 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9012 HDA_AMP_MUTE, bits);
9013 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9014 HDA_AMP_MUTE, bits);
9017 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
9020 if ((res >> 26) == ALC880_HP_EVENT)
9021 alc883_lenovo_101e_all_automute(codec);
9022 if ((res >> 26) == ALC880_FRONT_EVENT)
9023 alc883_lenovo_101e_ispeaker_automute(codec);
9026 /* toggle speaker-output according to the hp-jack state */
9027 static void alc883_acer_aspire_setup(struct hda_codec *codec)
9029 struct alc_spec *spec = codec->spec;
9031 spec->autocfg.hp_pins[0] = 0x14;
9032 spec->autocfg.speaker_pins[0] = 0x15;
9033 spec->autocfg.speaker_pins[1] = 0x16;
9036 static struct hda_verb alc883_acer_eapd_verbs[] = {
9037 /* HP Pin: output 0 (0x0c) */
9038 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9039 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9040 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9041 /* Front Pin: output 0 (0x0c) */
9042 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9043 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9044 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9045 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
9046 /* eanable EAPD on medion laptop */
9047 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9048 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
9049 /* enable unsolicited event */
9050 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9054 static struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
9055 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9056 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
9057 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9061 static void alc888_6st_dell_setup(struct hda_codec *codec)
9063 struct alc_spec *spec = codec->spec;
9065 spec->autocfg.hp_pins[0] = 0x1b;
9066 spec->autocfg.speaker_pins[0] = 0x14;
9067 spec->autocfg.speaker_pins[1] = 0x15;
9068 spec->autocfg.speaker_pins[2] = 0x16;
9069 spec->autocfg.speaker_pins[3] = 0x17;
9072 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
9074 struct alc_spec *spec = codec->spec;
9076 spec->autocfg.hp_pins[0] = 0x1b;
9077 spec->autocfg.speaker_pins[0] = 0x14;
9078 spec->autocfg.speaker_pins[1] = 0x15;
9079 spec->autocfg.speaker_pins[2] = 0x16;
9080 spec->autocfg.speaker_pins[3] = 0x17;
9081 spec->autocfg.speaker_pins[4] = 0x1a;
9084 static void alc883_vaiott_setup(struct hda_codec *codec)
9086 struct alc_spec *spec = codec->spec;
9088 spec->autocfg.hp_pins[0] = 0x15;
9089 spec->autocfg.speaker_pins[0] = 0x14;
9090 spec->autocfg.speaker_pins[1] = 0x17;
9093 static struct hda_verb alc888_asus_m90v_verbs[] = {
9094 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9095 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9096 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9097 /* enable unsolicited event */
9098 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9099 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9103 static void alc883_mode2_setup(struct hda_codec *codec)
9105 struct alc_spec *spec = codec->spec;
9107 spec->autocfg.hp_pins[0] = 0x1b;
9108 spec->autocfg.speaker_pins[0] = 0x14;
9109 spec->autocfg.speaker_pins[1] = 0x15;
9110 spec->autocfg.speaker_pins[2] = 0x16;
9111 spec->ext_mic.pin = 0x18;
9112 spec->int_mic.pin = 0x19;
9113 spec->ext_mic.mux_idx = 0;
9114 spec->int_mic.mux_idx = 1;
9118 static struct hda_verb alc888_asus_eee1601_verbs[] = {
9119 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9120 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9121 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9122 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9123 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9124 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
9125 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
9126 /* enable unsolicited event */
9127 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9131 static void alc883_eee1601_inithook(struct hda_codec *codec)
9133 struct alc_spec *spec = codec->spec;
9135 spec->autocfg.hp_pins[0] = 0x14;
9136 spec->autocfg.speaker_pins[0] = 0x1b;
9137 alc_automute_pin(codec);
9140 static struct hda_verb alc889A_mb31_verbs[] = {
9141 /* Init rear pin (used as headphone output) */
9142 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
9143 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
9144 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9145 /* Init line pin (used as output in 4ch and 6ch mode) */
9146 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
9147 /* Init line 2 pin (used as headphone out by default) */
9148 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
9149 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
9153 /* Mute speakers according to the headphone jack state */
9154 static void alc889A_mb31_automute(struct hda_codec *codec)
9156 unsigned int present;
9158 /* Mute only in 2ch or 4ch mode */
9159 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
9161 present = snd_hda_jack_detect(codec, 0x15);
9162 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9163 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9164 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9165 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9169 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
9171 if ((res >> 26) == ALC880_HP_EVENT)
9172 alc889A_mb31_automute(codec);
9176 #ifdef CONFIG_SND_HDA_POWER_SAVE
9177 #define alc882_loopbacks alc880_loopbacks
9180 /* pcm configuration: identical with ALC880 */
9181 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
9182 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
9183 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
9184 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
9186 static hda_nid_t alc883_slave_dig_outs[] = {
9187 ALC1200_DIGOUT_NID, 0,
9190 static hda_nid_t alc1200_slave_dig_outs[] = {
9191 ALC883_DIGOUT_NID, 0,
9195 * configuration and preset
9197 static const char *alc882_models[ALC882_MODEL_LAST] = {
9198 [ALC882_3ST_DIG] = "3stack-dig",
9199 [ALC882_6ST_DIG] = "6stack-dig",
9200 [ALC882_ARIMA] = "arima",
9201 [ALC882_W2JC] = "w2jc",
9202 [ALC882_TARGA] = "targa",
9203 [ALC882_ASUS_A7J] = "asus-a7j",
9204 [ALC882_ASUS_A7M] = "asus-a7m",
9205 [ALC885_MACPRO] = "macpro",
9206 [ALC885_MB5] = "mb5",
9207 [ALC885_MACMINI3] = "macmini3",
9208 [ALC885_MBA21] = "mba21",
9209 [ALC885_MBP3] = "mbp3",
9210 [ALC885_IMAC24] = "imac24",
9211 [ALC885_IMAC91] = "imac91",
9212 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
9213 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
9214 [ALC883_3ST_6ch] = "3stack-6ch",
9215 [ALC883_6ST_DIG] = "alc883-6stack-dig",
9216 [ALC883_TARGA_DIG] = "targa-dig",
9217 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
9218 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
9219 [ALC883_ACER] = "acer",
9220 [ALC883_ACER_ASPIRE] = "acer-aspire",
9221 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
9222 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
9223 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
9224 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
9225 [ALC883_MEDION] = "medion",
9226 [ALC883_MEDION_MD2] = "medion-md2",
9227 [ALC883_MEDION_WIM2160] = "medion-wim2160",
9228 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
9229 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
9230 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
9231 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
9232 [ALC888_LENOVO_SKY] = "lenovo-sky",
9233 [ALC883_HAIER_W66] = "haier-w66",
9234 [ALC888_3ST_HP] = "3stack-hp",
9235 [ALC888_6ST_DELL] = "6stack-dell",
9236 [ALC883_MITAC] = "mitac",
9237 [ALC883_CLEVO_M540R] = "clevo-m540r",
9238 [ALC883_CLEVO_M720] = "clevo-m720",
9239 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
9240 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
9241 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
9242 [ALC889A_INTEL] = "intel-alc889a",
9243 [ALC889_INTEL] = "intel-x58",
9244 [ALC1200_ASUS_P5Q] = "asus-p5q",
9245 [ALC889A_MB31] = "mb31",
9246 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
9247 [ALC882_AUTO] = "auto",
9250 static struct snd_pci_quirk alc882_cfg_tbl[] = {
9251 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
9253 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
9254 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
9255 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
9256 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
9257 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
9258 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
9259 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
9260 ALC888_ACER_ASPIRE_4930G),
9261 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
9262 ALC888_ACER_ASPIRE_4930G),
9263 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
9264 ALC888_ACER_ASPIRE_8930G),
9265 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
9266 ALC888_ACER_ASPIRE_8930G),
9267 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
9268 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
9269 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
9270 ALC888_ACER_ASPIRE_6530G),
9271 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
9272 ALC888_ACER_ASPIRE_6530G),
9273 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
9274 ALC888_ACER_ASPIRE_7730G),
9275 /* default Acer -- disabled as it causes more problems.
9276 * model=auto should work fine now
9278 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
9280 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
9282 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
9283 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
9284 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
9285 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
9286 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
9287 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
9289 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
9290 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
9291 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
9292 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
9293 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
9294 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
9295 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
9296 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
9297 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
9298 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
9299 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
9301 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
9302 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
9303 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
9304 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
9305 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
9306 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
9307 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
9308 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
9309 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
9311 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
9312 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
9313 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
9314 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
9315 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
9316 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
9317 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
9318 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
9319 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
9320 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
9321 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
9322 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
9323 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
9324 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
9325 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
9326 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
9327 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
9328 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
9329 SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG),
9330 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
9331 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
9332 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
9333 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
9334 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
9335 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
9336 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
9337 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
9338 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
9339 SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG),
9340 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
9341 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
9343 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
9344 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
9345 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
9346 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
9347 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
9348 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
9349 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
9350 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
9351 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9352 ALC883_FUJITSU_PI2515),
9353 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9354 ALC888_FUJITSU_XA3530),
9355 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
9356 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9357 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9358 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9359 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
9360 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
9361 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
9362 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
9363 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
9365 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
9366 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
9367 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
9368 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
9369 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
9370 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
9371 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG),
9376 /* codec SSID table for Intel Mac */
9377 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
9378 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
9379 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
9380 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
9381 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
9382 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
9383 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
9384 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
9385 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
9386 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
9387 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
9388 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
9389 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
9390 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
9391 * so apparently no perfect solution yet
9393 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
9394 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
9395 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3),
9399 static struct alc_config_preset alc882_presets[] = {
9400 [ALC882_3ST_DIG] = {
9401 .mixers = { alc882_base_mixer },
9402 .init_verbs = { alc882_base_init_verbs,
9403 alc882_adc1_init_verbs },
9404 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9405 .dac_nids = alc882_dac_nids,
9406 .dig_out_nid = ALC882_DIGOUT_NID,
9407 .dig_in_nid = ALC882_DIGIN_NID,
9408 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9409 .channel_mode = alc882_ch_modes,
9411 .input_mux = &alc882_capture_source,
9413 [ALC882_6ST_DIG] = {
9414 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9415 .init_verbs = { alc882_base_init_verbs,
9416 alc882_adc1_init_verbs },
9417 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9418 .dac_nids = alc882_dac_nids,
9419 .dig_out_nid = ALC882_DIGOUT_NID,
9420 .dig_in_nid = ALC882_DIGIN_NID,
9421 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9422 .channel_mode = alc882_sixstack_modes,
9423 .input_mux = &alc882_capture_source,
9426 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9427 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9428 alc882_eapd_verbs },
9429 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9430 .dac_nids = alc882_dac_nids,
9431 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9432 .channel_mode = alc882_sixstack_modes,
9433 .input_mux = &alc882_capture_source,
9436 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
9437 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9438 alc882_eapd_verbs, alc880_gpio1_init_verbs },
9439 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9440 .dac_nids = alc882_dac_nids,
9441 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9442 .channel_mode = alc880_threestack_modes,
9444 .input_mux = &alc882_capture_source,
9445 .dig_out_nid = ALC882_DIGOUT_NID,
9448 .mixers = { alc885_mba21_mixer },
9449 .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs },
9451 .dac_nids = alc882_dac_nids,
9452 .channel_mode = alc885_mba21_ch_modes,
9453 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
9454 .input_mux = &alc882_capture_source,
9455 .unsol_event = alc_automute_amp_unsol_event,
9456 .setup = alc885_mba21_setup,
9457 .init_hook = alc_automute_amp,
9460 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
9461 .init_verbs = { alc885_mbp3_init_verbs,
9462 alc880_gpio1_init_verbs },
9464 .dac_nids = alc882_dac_nids,
9466 .channel_mode = alc885_mbp_4ch_modes,
9467 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9468 .input_mux = &alc882_capture_source,
9469 .dig_out_nid = ALC882_DIGOUT_NID,
9470 .dig_in_nid = ALC882_DIGIN_NID,
9471 .unsol_event = alc_automute_amp_unsol_event,
9472 .setup = alc885_mbp3_setup,
9473 .init_hook = alc_automute_amp,
9476 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
9477 .init_verbs = { alc885_mb5_init_verbs,
9478 alc880_gpio1_init_verbs },
9479 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9480 .dac_nids = alc882_dac_nids,
9481 .channel_mode = alc885_mb5_6ch_modes,
9482 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
9483 .input_mux = &mb5_capture_source,
9484 .dig_out_nid = ALC882_DIGOUT_NID,
9485 .dig_in_nid = ALC882_DIGIN_NID,
9486 .unsol_event = alc_automute_amp_unsol_event,
9487 .setup = alc885_mb5_setup,
9488 .init_hook = alc_automute_amp,
9490 [ALC885_MACMINI3] = {
9491 .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer },
9492 .init_verbs = { alc885_macmini3_init_verbs,
9493 alc880_gpio1_init_verbs },
9494 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9495 .dac_nids = alc882_dac_nids,
9496 .channel_mode = alc885_macmini3_6ch_modes,
9497 .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes),
9498 .input_mux = &macmini3_capture_source,
9499 .dig_out_nid = ALC882_DIGOUT_NID,
9500 .dig_in_nid = ALC882_DIGIN_NID,
9501 .unsol_event = alc_automute_amp_unsol_event,
9502 .setup = alc885_macmini3_setup,
9503 .init_hook = alc_automute_amp,
9506 .mixers = { alc882_macpro_mixer },
9507 .init_verbs = { alc882_macpro_init_verbs },
9508 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9509 .dac_nids = alc882_dac_nids,
9510 .dig_out_nid = ALC882_DIGOUT_NID,
9511 .dig_in_nid = ALC882_DIGIN_NID,
9512 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9513 .channel_mode = alc882_ch_modes,
9514 .input_mux = &alc882_capture_source,
9515 .init_hook = alc885_macpro_init_hook,
9518 .mixers = { alc885_imac24_mixer },
9519 .init_verbs = { alc885_imac24_init_verbs },
9520 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9521 .dac_nids = alc882_dac_nids,
9522 .dig_out_nid = ALC882_DIGOUT_NID,
9523 .dig_in_nid = ALC882_DIGIN_NID,
9524 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9525 .channel_mode = alc882_ch_modes,
9526 .input_mux = &alc882_capture_source,
9527 .unsol_event = alc_automute_amp_unsol_event,
9528 .setup = alc885_imac24_setup,
9529 .init_hook = alc885_imac24_init_hook,
9532 .mixers = { alc885_imac91_mixer, alc882_chmode_mixer },
9533 .init_verbs = { alc885_imac91_init_verbs,
9534 alc880_gpio1_init_verbs },
9535 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9536 .dac_nids = alc882_dac_nids,
9537 .channel_mode = alc885_mbp_4ch_modes,
9538 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9539 .input_mux = &alc882_capture_source,
9540 .dig_out_nid = ALC882_DIGOUT_NID,
9541 .dig_in_nid = ALC882_DIGIN_NID,
9542 .unsol_event = alc_automute_amp_unsol_event,
9543 .setup = alc885_imac91_setup,
9544 .init_hook = alc_automute_amp,
9547 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
9548 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9549 alc880_gpio3_init_verbs, alc882_targa_verbs},
9550 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9551 .dac_nids = alc882_dac_nids,
9552 .dig_out_nid = ALC882_DIGOUT_NID,
9553 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9554 .adc_nids = alc882_adc_nids,
9555 .capsrc_nids = alc882_capsrc_nids,
9556 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9557 .channel_mode = alc882_3ST_6ch_modes,
9559 .input_mux = &alc882_capture_source,
9560 .unsol_event = alc882_targa_unsol_event,
9561 .setup = alc882_targa_setup,
9562 .init_hook = alc882_targa_automute,
9564 [ALC882_ASUS_A7J] = {
9565 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
9566 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9567 alc882_asus_a7j_verbs},
9568 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9569 .dac_nids = alc882_dac_nids,
9570 .dig_out_nid = ALC882_DIGOUT_NID,
9571 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9572 .adc_nids = alc882_adc_nids,
9573 .capsrc_nids = alc882_capsrc_nids,
9574 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9575 .channel_mode = alc882_3ST_6ch_modes,
9577 .input_mux = &alc882_capture_source,
9579 [ALC882_ASUS_A7M] = {
9580 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
9581 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9582 alc882_eapd_verbs, alc880_gpio1_init_verbs,
9583 alc882_asus_a7m_verbs },
9584 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9585 .dac_nids = alc882_dac_nids,
9586 .dig_out_nid = ALC882_DIGOUT_NID,
9587 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9588 .channel_mode = alc880_threestack_modes,
9590 .input_mux = &alc882_capture_source,
9592 [ALC883_3ST_2ch_DIG] = {
9593 .mixers = { alc883_3ST_2ch_mixer },
9594 .init_verbs = { alc883_init_verbs },
9595 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9596 .dac_nids = alc883_dac_nids,
9597 .dig_out_nid = ALC883_DIGOUT_NID,
9598 .dig_in_nid = ALC883_DIGIN_NID,
9599 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9600 .channel_mode = alc883_3ST_2ch_modes,
9601 .input_mux = &alc883_capture_source,
9603 [ALC883_3ST_6ch_DIG] = {
9604 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9605 .init_verbs = { alc883_init_verbs },
9606 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9607 .dac_nids = alc883_dac_nids,
9608 .dig_out_nid = ALC883_DIGOUT_NID,
9609 .dig_in_nid = ALC883_DIGIN_NID,
9610 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9611 .channel_mode = alc883_3ST_6ch_modes,
9613 .input_mux = &alc883_capture_source,
9615 [ALC883_3ST_6ch] = {
9616 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9617 .init_verbs = { alc883_init_verbs },
9618 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9619 .dac_nids = alc883_dac_nids,
9620 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9621 .channel_mode = alc883_3ST_6ch_modes,
9623 .input_mux = &alc883_capture_source,
9625 [ALC883_3ST_6ch_INTEL] = {
9626 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
9627 .init_verbs = { alc883_init_verbs },
9628 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9629 .dac_nids = alc883_dac_nids,
9630 .dig_out_nid = ALC883_DIGOUT_NID,
9631 .dig_in_nid = ALC883_DIGIN_NID,
9632 .slave_dig_outs = alc883_slave_dig_outs,
9633 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
9634 .channel_mode = alc883_3ST_6ch_intel_modes,
9636 .input_mux = &alc883_3stack_6ch_intel,
9639 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9640 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
9641 alc_hp15_unsol_verbs },
9642 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9643 .dac_nids = alc883_dac_nids,
9644 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9645 .adc_nids = alc889_adc_nids,
9646 .dig_out_nid = ALC883_DIGOUT_NID,
9647 .dig_in_nid = ALC883_DIGIN_NID,
9648 .slave_dig_outs = alc883_slave_dig_outs,
9649 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9650 .channel_mode = alc889_8ch_intel_modes,
9651 .capsrc_nids = alc889_capsrc_nids,
9652 .input_mux = &alc889_capture_source,
9653 .setup = alc889_automute_setup,
9654 .init_hook = alc_automute_amp,
9655 .unsol_event = alc_automute_amp_unsol_event,
9659 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9660 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
9661 alc889_eapd_verbs, alc_hp15_unsol_verbs},
9662 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9663 .dac_nids = alc883_dac_nids,
9664 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9665 .adc_nids = alc889_adc_nids,
9666 .dig_out_nid = ALC883_DIGOUT_NID,
9667 .dig_in_nid = ALC883_DIGIN_NID,
9668 .slave_dig_outs = alc883_slave_dig_outs,
9669 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9670 .channel_mode = alc889_8ch_intel_modes,
9671 .capsrc_nids = alc889_capsrc_nids,
9672 .input_mux = &alc889_capture_source,
9673 .setup = alc889_automute_setup,
9674 .init_hook = alc889_intel_init_hook,
9675 .unsol_event = alc_automute_amp_unsol_event,
9678 [ALC883_6ST_DIG] = {
9679 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9680 .init_verbs = { alc883_init_verbs },
9681 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9682 .dac_nids = alc883_dac_nids,
9683 .dig_out_nid = ALC883_DIGOUT_NID,
9684 .dig_in_nid = ALC883_DIGIN_NID,
9685 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9686 .channel_mode = alc883_sixstack_modes,
9687 .input_mux = &alc883_capture_source,
9689 [ALC883_TARGA_DIG] = {
9690 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
9691 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9692 alc883_targa_verbs},
9693 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9694 .dac_nids = alc883_dac_nids,
9695 .dig_out_nid = ALC883_DIGOUT_NID,
9696 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9697 .channel_mode = alc883_3ST_6ch_modes,
9699 .input_mux = &alc883_capture_source,
9700 .unsol_event = alc883_targa_unsol_event,
9701 .setup = alc882_targa_setup,
9702 .init_hook = alc882_targa_automute,
9704 [ALC883_TARGA_2ch_DIG] = {
9705 .mixers = { alc883_targa_2ch_mixer},
9706 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9707 alc883_targa_verbs},
9708 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9709 .dac_nids = alc883_dac_nids,
9710 .adc_nids = alc883_adc_nids_alt,
9711 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9712 .capsrc_nids = alc883_capsrc_nids,
9713 .dig_out_nid = ALC883_DIGOUT_NID,
9714 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9715 .channel_mode = alc883_3ST_2ch_modes,
9716 .input_mux = &alc883_capture_source,
9717 .unsol_event = alc883_targa_unsol_event,
9718 .setup = alc882_targa_setup,
9719 .init_hook = alc882_targa_automute,
9721 [ALC883_TARGA_8ch_DIG] = {
9722 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
9723 alc883_chmode_mixer },
9724 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9725 alc883_targa_verbs },
9726 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9727 .dac_nids = alc883_dac_nids,
9728 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9729 .adc_nids = alc883_adc_nids_rev,
9730 .capsrc_nids = alc883_capsrc_nids_rev,
9731 .dig_out_nid = ALC883_DIGOUT_NID,
9732 .dig_in_nid = ALC883_DIGIN_NID,
9733 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
9734 .channel_mode = alc883_4ST_8ch_modes,
9736 .input_mux = &alc883_capture_source,
9737 .unsol_event = alc883_targa_unsol_event,
9738 .setup = alc882_targa_setup,
9739 .init_hook = alc882_targa_automute,
9742 .mixers = { alc883_base_mixer },
9743 /* On TravelMate laptops, GPIO 0 enables the internal speaker
9744 * and the headphone jack. Turn this on and rely on the
9745 * standard mute methods whenever the user wants to turn
9746 * these outputs off.
9748 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
9749 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9750 .dac_nids = alc883_dac_nids,
9751 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9752 .channel_mode = alc883_3ST_2ch_modes,
9753 .input_mux = &alc883_capture_source,
9755 [ALC883_ACER_ASPIRE] = {
9756 .mixers = { alc883_acer_aspire_mixer },
9757 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
9758 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9759 .dac_nids = alc883_dac_nids,
9760 .dig_out_nid = ALC883_DIGOUT_NID,
9761 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9762 .channel_mode = alc883_3ST_2ch_modes,
9763 .input_mux = &alc883_capture_source,
9764 .unsol_event = alc_automute_amp_unsol_event,
9765 .setup = alc883_acer_aspire_setup,
9766 .init_hook = alc_automute_amp,
9768 [ALC888_ACER_ASPIRE_4930G] = {
9769 .mixers = { alc888_base_mixer,
9770 alc883_chmode_mixer },
9771 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9772 alc888_acer_aspire_4930g_verbs },
9773 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9774 .dac_nids = alc883_dac_nids,
9775 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9776 .adc_nids = alc883_adc_nids_rev,
9777 .capsrc_nids = alc883_capsrc_nids_rev,
9778 .dig_out_nid = ALC883_DIGOUT_NID,
9779 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9780 .channel_mode = alc883_3ST_6ch_modes,
9782 .const_channel_count = 6,
9784 ARRAY_SIZE(alc888_2_capture_sources),
9785 .input_mux = alc888_2_capture_sources,
9786 .unsol_event = alc_automute_amp_unsol_event,
9787 .setup = alc888_acer_aspire_4930g_setup,
9788 .init_hook = alc_automute_amp,
9790 [ALC888_ACER_ASPIRE_6530G] = {
9791 .mixers = { alc888_acer_aspire_6530_mixer },
9792 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9793 alc888_acer_aspire_6530g_verbs },
9794 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9795 .dac_nids = alc883_dac_nids,
9796 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9797 .adc_nids = alc883_adc_nids_rev,
9798 .capsrc_nids = alc883_capsrc_nids_rev,
9799 .dig_out_nid = ALC883_DIGOUT_NID,
9800 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9801 .channel_mode = alc883_3ST_2ch_modes,
9803 ARRAY_SIZE(alc888_2_capture_sources),
9804 .input_mux = alc888_acer_aspire_6530_sources,
9805 .unsol_event = alc_automute_amp_unsol_event,
9806 .setup = alc888_acer_aspire_6530g_setup,
9807 .init_hook = alc_automute_amp,
9809 [ALC888_ACER_ASPIRE_8930G] = {
9810 .mixers = { alc889_acer_aspire_8930g_mixer,
9811 alc883_chmode_mixer },
9812 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9813 alc889_acer_aspire_8930g_verbs,
9815 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9816 .dac_nids = alc883_dac_nids,
9817 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9818 .adc_nids = alc889_adc_nids,
9819 .capsrc_nids = alc889_capsrc_nids,
9820 .dig_out_nid = ALC883_DIGOUT_NID,
9821 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9822 .channel_mode = alc883_3ST_6ch_modes,
9824 .const_channel_count = 6,
9826 ARRAY_SIZE(alc889_capture_sources),
9827 .input_mux = alc889_capture_sources,
9828 .unsol_event = alc_automute_amp_unsol_event,
9829 .setup = alc889_acer_aspire_8930g_setup,
9830 .init_hook = alc_automute_amp,
9831 #ifdef CONFIG_SND_HDA_POWER_SAVE
9832 .power_hook = alc_power_eapd,
9835 [ALC888_ACER_ASPIRE_7730G] = {
9836 .mixers = { alc883_3ST_6ch_mixer,
9837 alc883_chmode_mixer },
9838 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9839 alc888_acer_aspire_7730G_verbs },
9840 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9841 .dac_nids = alc883_dac_nids,
9842 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9843 .adc_nids = alc883_adc_nids_rev,
9844 .capsrc_nids = alc883_capsrc_nids_rev,
9845 .dig_out_nid = ALC883_DIGOUT_NID,
9846 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9847 .channel_mode = alc883_3ST_6ch_modes,
9849 .const_channel_count = 6,
9850 .input_mux = &alc883_capture_source,
9851 .unsol_event = alc_automute_amp_unsol_event,
9852 .setup = alc888_acer_aspire_6530g_setup,
9853 .init_hook = alc_automute_amp,
9856 .mixers = { alc883_fivestack_mixer,
9857 alc883_chmode_mixer },
9858 .init_verbs = { alc883_init_verbs,
9859 alc883_medion_eapd_verbs },
9860 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9861 .dac_nids = alc883_dac_nids,
9862 .adc_nids = alc883_adc_nids_alt,
9863 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9864 .capsrc_nids = alc883_capsrc_nids,
9865 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9866 .channel_mode = alc883_sixstack_modes,
9867 .input_mux = &alc883_capture_source,
9869 [ALC883_MEDION_MD2] = {
9870 .mixers = { alc883_medion_md2_mixer},
9871 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
9872 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9873 .dac_nids = alc883_dac_nids,
9874 .dig_out_nid = ALC883_DIGOUT_NID,
9875 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9876 .channel_mode = alc883_3ST_2ch_modes,
9877 .input_mux = &alc883_capture_source,
9878 .unsol_event = alc_automute_amp_unsol_event,
9879 .setup = alc883_medion_md2_setup,
9880 .init_hook = alc_automute_amp,
9882 [ALC883_MEDION_WIM2160] = {
9883 .mixers = { alc883_medion_wim2160_mixer },
9884 .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs },
9885 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9886 .dac_nids = alc883_dac_nids,
9887 .dig_out_nid = ALC883_DIGOUT_NID,
9888 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
9889 .adc_nids = alc883_adc_nids,
9890 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9891 .channel_mode = alc883_3ST_2ch_modes,
9892 .input_mux = &alc883_capture_source,
9893 .unsol_event = alc_automute_amp_unsol_event,
9894 .setup = alc883_medion_wim2160_setup,
9895 .init_hook = alc_automute_amp,
9897 [ALC883_LAPTOP_EAPD] = {
9898 .mixers = { alc883_base_mixer },
9899 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
9900 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9901 .dac_nids = alc883_dac_nids,
9902 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9903 .channel_mode = alc883_3ST_2ch_modes,
9904 .input_mux = &alc883_capture_source,
9906 [ALC883_CLEVO_M540R] = {
9907 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9908 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
9909 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9910 .dac_nids = alc883_dac_nids,
9911 .dig_out_nid = ALC883_DIGOUT_NID,
9912 .dig_in_nid = ALC883_DIGIN_NID,
9913 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
9914 .channel_mode = alc883_3ST_6ch_clevo_modes,
9916 .input_mux = &alc883_capture_source,
9917 /* This machine has the hardware HP auto-muting, thus
9918 * we need no software mute via unsol event
9921 [ALC883_CLEVO_M720] = {
9922 .mixers = { alc883_clevo_m720_mixer },
9923 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
9924 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9925 .dac_nids = alc883_dac_nids,
9926 .dig_out_nid = ALC883_DIGOUT_NID,
9927 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9928 .channel_mode = alc883_3ST_2ch_modes,
9929 .input_mux = &alc883_capture_source,
9930 .unsol_event = alc883_clevo_m720_unsol_event,
9931 .setup = alc883_clevo_m720_setup,
9932 .init_hook = alc883_clevo_m720_init_hook,
9934 [ALC883_LENOVO_101E_2ch] = {
9935 .mixers = { alc883_lenovo_101e_2ch_mixer},
9936 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
9937 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9938 .dac_nids = alc883_dac_nids,
9939 .adc_nids = alc883_adc_nids_alt,
9940 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9941 .capsrc_nids = alc883_capsrc_nids,
9942 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9943 .channel_mode = alc883_3ST_2ch_modes,
9944 .input_mux = &alc883_lenovo_101e_capture_source,
9945 .unsol_event = alc883_lenovo_101e_unsol_event,
9946 .init_hook = alc883_lenovo_101e_all_automute,
9948 [ALC883_LENOVO_NB0763] = {
9949 .mixers = { alc883_lenovo_nb0763_mixer },
9950 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
9951 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9952 .dac_nids = alc883_dac_nids,
9953 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9954 .channel_mode = alc883_3ST_2ch_modes,
9956 .input_mux = &alc883_lenovo_nb0763_capture_source,
9957 .unsol_event = alc_automute_amp_unsol_event,
9958 .setup = alc883_medion_md2_setup,
9959 .init_hook = alc_automute_amp,
9961 [ALC888_LENOVO_MS7195_DIG] = {
9962 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9963 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
9964 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9965 .dac_nids = alc883_dac_nids,
9966 .dig_out_nid = ALC883_DIGOUT_NID,
9967 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9968 .channel_mode = alc883_3ST_6ch_modes,
9970 .input_mux = &alc883_capture_source,
9971 .unsol_event = alc883_lenovo_ms7195_unsol_event,
9972 .init_hook = alc888_lenovo_ms7195_front_automute,
9974 [ALC883_HAIER_W66] = {
9975 .mixers = { alc883_targa_2ch_mixer},
9976 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
9977 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9978 .dac_nids = alc883_dac_nids,
9979 .dig_out_nid = ALC883_DIGOUT_NID,
9980 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9981 .channel_mode = alc883_3ST_2ch_modes,
9982 .input_mux = &alc883_capture_source,
9983 .unsol_event = alc_automute_amp_unsol_event,
9984 .setup = alc883_haier_w66_setup,
9985 .init_hook = alc_automute_amp,
9988 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9989 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
9990 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9991 .dac_nids = alc883_dac_nids,
9992 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
9993 .channel_mode = alc888_3st_hp_modes,
9995 .input_mux = &alc883_capture_source,
9996 .unsol_event = alc_automute_amp_unsol_event,
9997 .setup = alc888_3st_hp_setup,
9998 .init_hook = alc_automute_amp,
10000 [ALC888_6ST_DELL] = {
10001 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10002 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
10003 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10004 .dac_nids = alc883_dac_nids,
10005 .dig_out_nid = ALC883_DIGOUT_NID,
10006 .dig_in_nid = ALC883_DIGIN_NID,
10007 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10008 .channel_mode = alc883_sixstack_modes,
10009 .input_mux = &alc883_capture_source,
10010 .unsol_event = alc_automute_amp_unsol_event,
10011 .setup = alc888_6st_dell_setup,
10012 .init_hook = alc_automute_amp,
10015 .mixers = { alc883_mitac_mixer },
10016 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
10017 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10018 .dac_nids = alc883_dac_nids,
10019 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10020 .channel_mode = alc883_3ST_2ch_modes,
10021 .input_mux = &alc883_capture_source,
10022 .unsol_event = alc_automute_amp_unsol_event,
10023 .setup = alc883_mitac_setup,
10024 .init_hook = alc_automute_amp,
10026 [ALC883_FUJITSU_PI2515] = {
10027 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
10028 .init_verbs = { alc883_init_verbs,
10029 alc883_2ch_fujitsu_pi2515_verbs},
10030 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10031 .dac_nids = alc883_dac_nids,
10032 .dig_out_nid = ALC883_DIGOUT_NID,
10033 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10034 .channel_mode = alc883_3ST_2ch_modes,
10035 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10036 .unsol_event = alc_automute_amp_unsol_event,
10037 .setup = alc883_2ch_fujitsu_pi2515_setup,
10038 .init_hook = alc_automute_amp,
10040 [ALC888_FUJITSU_XA3530] = {
10041 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
10042 .init_verbs = { alc883_init_verbs,
10043 alc888_fujitsu_xa3530_verbs },
10044 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10045 .dac_nids = alc883_dac_nids,
10046 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10047 .adc_nids = alc883_adc_nids_rev,
10048 .capsrc_nids = alc883_capsrc_nids_rev,
10049 .dig_out_nid = ALC883_DIGOUT_NID,
10050 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
10051 .channel_mode = alc888_4ST_8ch_intel_modes,
10053 ARRAY_SIZE(alc888_2_capture_sources),
10054 .input_mux = alc888_2_capture_sources,
10055 .unsol_event = alc_automute_amp_unsol_event,
10056 .setup = alc888_fujitsu_xa3530_setup,
10057 .init_hook = alc_automute_amp,
10059 [ALC888_LENOVO_SKY] = {
10060 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
10061 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
10062 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10063 .dac_nids = alc883_dac_nids,
10064 .dig_out_nid = ALC883_DIGOUT_NID,
10065 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10066 .channel_mode = alc883_sixstack_modes,
10068 .input_mux = &alc883_lenovo_sky_capture_source,
10069 .unsol_event = alc_automute_amp_unsol_event,
10070 .setup = alc888_lenovo_sky_setup,
10071 .init_hook = alc_automute_amp,
10073 [ALC888_ASUS_M90V] = {
10074 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10075 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
10076 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10077 .dac_nids = alc883_dac_nids,
10078 .dig_out_nid = ALC883_DIGOUT_NID,
10079 .dig_in_nid = ALC883_DIGIN_NID,
10080 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10081 .channel_mode = alc883_3ST_6ch_modes,
10083 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10084 .unsol_event = alc_sku_unsol_event,
10085 .setup = alc883_mode2_setup,
10086 .init_hook = alc_inithook,
10088 [ALC888_ASUS_EEE1601] = {
10089 .mixers = { alc883_asus_eee1601_mixer },
10090 .cap_mixer = alc883_asus_eee1601_cap_mixer,
10091 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
10092 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10093 .dac_nids = alc883_dac_nids,
10094 .dig_out_nid = ALC883_DIGOUT_NID,
10095 .dig_in_nid = ALC883_DIGIN_NID,
10096 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10097 .channel_mode = alc883_3ST_2ch_modes,
10099 .input_mux = &alc883_asus_eee1601_capture_source,
10100 .unsol_event = alc_sku_unsol_event,
10101 .init_hook = alc883_eee1601_inithook,
10103 [ALC1200_ASUS_P5Q] = {
10104 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10105 .init_verbs = { alc883_init_verbs },
10106 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10107 .dac_nids = alc883_dac_nids,
10108 .dig_out_nid = ALC1200_DIGOUT_NID,
10109 .dig_in_nid = ALC883_DIGIN_NID,
10110 .slave_dig_outs = alc1200_slave_dig_outs,
10111 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10112 .channel_mode = alc883_sixstack_modes,
10113 .input_mux = &alc883_capture_source,
10116 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
10117 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
10118 alc880_gpio1_init_verbs },
10119 .adc_nids = alc883_adc_nids,
10120 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10121 .capsrc_nids = alc883_capsrc_nids,
10122 .dac_nids = alc883_dac_nids,
10123 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10124 .channel_mode = alc889A_mb31_6ch_modes,
10125 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
10126 .input_mux = &alc889A_mb31_capture_source,
10127 .dig_out_nid = ALC883_DIGOUT_NID,
10128 .unsol_event = alc889A_mb31_unsol_event,
10129 .init_hook = alc889A_mb31_automute,
10131 [ALC883_SONY_VAIO_TT] = {
10132 .mixers = { alc883_vaiott_mixer },
10133 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
10134 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10135 .dac_nids = alc883_dac_nids,
10136 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10137 .channel_mode = alc883_3ST_2ch_modes,
10138 .input_mux = &alc883_capture_source,
10139 .unsol_event = alc_automute_amp_unsol_event,
10140 .setup = alc883_vaiott_setup,
10141 .init_hook = alc_automute_amp,
10150 PINFIX_ABIT_AW9D_MAX
10153 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
10154 { 0x15, 0x01080104 }, /* side */
10155 { 0x16, 0x01011012 }, /* rear */
10156 { 0x17, 0x01016011 }, /* clfe */
10160 static const struct alc_fixup alc882_fixups[] = {
10161 [PINFIX_ABIT_AW9D_MAX] = {
10162 .pins = alc882_abit_aw9d_pinfix
10166 static struct snd_pci_quirk alc882_fixup_tbl[] = {
10167 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
10172 * BIOS auto configuration
10174 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
10175 const struct auto_pin_cfg *cfg)
10177 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
10180 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
10181 hda_nid_t nid, int pin_type,
10184 /* set as output */
10185 struct alc_spec *spec = codec->spec;
10188 alc_set_pin_output(codec, nid, pin_type);
10189 if (dac_idx >= spec->multiout.num_dacs)
10191 if (spec->multiout.dac_nids[dac_idx] == 0x25)
10194 idx = spec->multiout.dac_nids[dac_idx] - 2;
10195 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
10199 static void alc882_auto_init_multi_out(struct hda_codec *codec)
10201 struct alc_spec *spec = codec->spec;
10204 for (i = 0; i <= HDA_SIDE; i++) {
10205 hda_nid_t nid = spec->autocfg.line_out_pins[i];
10206 int pin_type = get_pin_type(spec->autocfg.line_out_type);
10208 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
10213 static void alc882_auto_init_hp_out(struct hda_codec *codec)
10215 struct alc_spec *spec = codec->spec;
10218 pin = spec->autocfg.hp_pins[0];
10219 if (pin) /* connect to front */
10221 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
10222 pin = spec->autocfg.speaker_pins[0];
10224 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
10227 static void alc882_auto_init_analog_input(struct hda_codec *codec)
10229 struct alc_spec *spec = codec->spec;
10232 for (i = 0; i < AUTO_PIN_LAST; i++) {
10233 hda_nid_t nid = spec->autocfg.input_pins[i];
10236 alc_set_input_pin(codec, nid, i);
10237 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
10238 snd_hda_codec_write(codec, nid, 0,
10239 AC_VERB_SET_AMP_GAIN_MUTE,
10244 static void alc882_auto_init_input_src(struct hda_codec *codec)
10246 struct alc_spec *spec = codec->spec;
10249 for (c = 0; c < spec->num_adc_nids; c++) {
10250 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
10251 hda_nid_t nid = spec->capsrc_nids[c];
10252 unsigned int mux_idx;
10253 const struct hda_input_mux *imux;
10254 int conns, mute, idx, item;
10256 conns = snd_hda_get_connections(codec, nid, conn_list,
10257 ARRAY_SIZE(conn_list));
10260 mux_idx = c >= spec->num_mux_defs ? 0 : c;
10261 imux = &spec->input_mux[mux_idx];
10262 if (!imux->num_items && mux_idx > 0)
10263 imux = &spec->input_mux[0];
10264 for (idx = 0; idx < conns; idx++) {
10265 /* if the current connection is the selected one,
10266 * unmute it as default - otherwise mute it
10268 mute = AMP_IN_MUTE(idx);
10269 for (item = 0; item < imux->num_items; item++) {
10270 if (imux->items[item].index == idx) {
10271 if (spec->cur_mux[c] == item)
10272 mute = AMP_IN_UNMUTE(idx);
10276 /* check if we have a selector or mixer
10277 * we could check for the widget type instead, but
10278 * just check for Amp-In presence (in case of mixer
10279 * without amp-in there is something wrong, this
10280 * function shouldn't be used or capsrc nid is wrong)
10282 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
10283 snd_hda_codec_write(codec, nid, 0,
10284 AC_VERB_SET_AMP_GAIN_MUTE,
10286 else if (mute != AMP_IN_MUTE(idx))
10287 snd_hda_codec_write(codec, nid, 0,
10288 AC_VERB_SET_CONNECT_SEL,
10294 /* add mic boosts if needed */
10295 static int alc_auto_add_mic_boost(struct hda_codec *codec)
10297 struct alc_spec *spec = codec->spec;
10301 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
10302 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
10303 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10305 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10309 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
10310 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
10311 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10313 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10320 /* almost identical with ALC880 parser... */
10321 static int alc882_parse_auto_config(struct hda_codec *codec)
10323 struct alc_spec *spec = codec->spec;
10324 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
10327 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10331 if (!spec->autocfg.line_outs)
10332 return 0; /* can't find valid BIOS pin config */
10334 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
10337 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
10340 err = alc880_auto_create_extra_out(spec,
10341 spec->autocfg.speaker_pins[0],
10345 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
10349 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
10353 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10355 /* check multiple SPDIF-out (for recent codecs) */
10356 for (i = 0; i < spec->autocfg.dig_outs; i++) {
10358 err = snd_hda_get_connections(codec,
10359 spec->autocfg.dig_out_pins[i],
10364 spec->multiout.dig_out_nid = dig_nid;
10366 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
10367 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
10369 spec->slave_dig_outs[i - 1] = dig_nid;
10372 if (spec->autocfg.dig_in_pin)
10373 spec->dig_in_nid = ALC880_DIGIN_NID;
10375 if (spec->kctls.list)
10376 add_mixer(spec, spec->kctls.list);
10378 add_verb(spec, alc883_auto_init_verbs);
10379 /* if ADC 0x07 is available, initialize it, too */
10380 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
10381 add_verb(spec, alc882_adc1_init_verbs);
10383 spec->num_mux_defs = 1;
10384 spec->input_mux = &spec->private_imux[0];
10386 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
10388 err = alc_auto_add_mic_boost(codec);
10392 return 1; /* config found */
10395 /* additional initialization for auto-configuration model */
10396 static void alc882_auto_init(struct hda_codec *codec)
10398 struct alc_spec *spec = codec->spec;
10399 alc882_auto_init_multi_out(codec);
10400 alc882_auto_init_hp_out(codec);
10401 alc882_auto_init_analog_input(codec);
10402 alc882_auto_init_input_src(codec);
10403 if (spec->unsol_event)
10404 alc_inithook(codec);
10407 static int patch_alc882(struct hda_codec *codec)
10409 struct alc_spec *spec;
10410 int err, board_config;
10412 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10416 codec->spec = spec;
10418 switch (codec->vendor_id) {
10423 /* ALC883 and variants */
10424 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10428 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
10432 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
10433 board_config = snd_hda_check_board_codec_sid_config(codec,
10434 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
10436 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
10437 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
10439 board_config = ALC882_AUTO;
10442 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups);
10444 if (board_config == ALC882_AUTO) {
10445 /* automatic parse from the BIOS config */
10446 err = alc882_parse_auto_config(codec);
10452 "hda_codec: Cannot set up configuration "
10453 "from BIOS. Using base mode...\n");
10454 board_config = ALC882_3ST_DIG;
10458 err = snd_hda_attach_beep_device(codec, 0x1);
10464 if (board_config != ALC882_AUTO)
10465 setup_preset(codec, &alc882_presets[board_config]);
10467 spec->stream_analog_playback = &alc882_pcm_analog_playback;
10468 spec->stream_analog_capture = &alc882_pcm_analog_capture;
10469 /* FIXME: setup DAC5 */
10470 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
10471 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
10473 spec->stream_digital_playback = &alc882_pcm_digital_playback;
10474 spec->stream_digital_capture = &alc882_pcm_digital_capture;
10476 if (codec->vendor_id == 0x10ec0888)
10477 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
10479 if (!spec->adc_nids && spec->input_mux) {
10481 spec->num_adc_nids = 0;
10482 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
10483 const struct hda_input_mux *imux = spec->input_mux;
10485 hda_nid_t items[16];
10486 hda_nid_t nid = alc882_adc_nids[i];
10487 unsigned int wcap = get_wcaps(codec, nid);
10489 wcap = get_wcaps_type(wcap);
10490 if (wcap != AC_WID_AUD_IN)
10492 spec->private_adc_nids[spec->num_adc_nids] = nid;
10493 err = snd_hda_get_connections(codec, nid, &cap, 1);
10496 err = snd_hda_get_connections(codec, cap, items,
10497 ARRAY_SIZE(items));
10500 for (j = 0; j < imux->num_items; j++)
10501 if (imux->items[j].index >= err)
10503 if (j < imux->num_items)
10505 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
10506 spec->num_adc_nids++;
10508 spec->adc_nids = spec->private_adc_nids;
10509 spec->capsrc_nids = spec->private_capsrc_nids;
10512 set_capture_mixer(codec);
10513 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10515 spec->vmaster_nid = 0x0c;
10517 codec->patch_ops = alc_patch_ops;
10518 if (board_config == ALC882_AUTO)
10519 spec->init_hook = alc882_auto_init;
10520 #ifdef CONFIG_SND_HDA_POWER_SAVE
10521 if (!spec->loopback.amplist)
10522 spec->loopback.amplist = alc882_loopbacks;
10533 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
10534 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
10536 #define alc262_dac_nids alc260_dac_nids
10537 #define alc262_adc_nids alc882_adc_nids
10538 #define alc262_adc_nids_alt alc882_adc_nids_alt
10539 #define alc262_capsrc_nids alc882_capsrc_nids
10540 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
10542 #define alc262_modes alc260_modes
10543 #define alc262_capture_source alc882_capture_source
10545 static hda_nid_t alc262_dmic_adc_nids[1] = {
10550 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
10552 static struct snd_kcontrol_new alc262_base_mixer[] = {
10553 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10554 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10555 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10556 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10557 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10558 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10559 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10560 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10561 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10562 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10563 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10564 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10565 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
10566 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10567 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
10568 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
10572 /* update HP, line and mono-out pins according to the master switch */
10573 static void alc262_hp_master_update(struct hda_codec *codec)
10575 struct alc_spec *spec = codec->spec;
10576 int val = spec->master_sw;
10578 /* HP & line-out */
10579 snd_hda_codec_write_cache(codec, 0x1b, 0,
10580 AC_VERB_SET_PIN_WIDGET_CONTROL,
10582 snd_hda_codec_write_cache(codec, 0x15, 0,
10583 AC_VERB_SET_PIN_WIDGET_CONTROL,
10585 /* mono (speaker) depending on the HP jack sense */
10586 val = val && !spec->jack_present;
10587 snd_hda_codec_write_cache(codec, 0x16, 0,
10588 AC_VERB_SET_PIN_WIDGET_CONTROL,
10589 val ? PIN_OUT : 0);
10592 static void alc262_hp_bpc_automute(struct hda_codec *codec)
10594 struct alc_spec *spec = codec->spec;
10596 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
10597 alc262_hp_master_update(codec);
10600 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
10602 if ((res >> 26) != ALC880_HP_EVENT)
10604 alc262_hp_bpc_automute(codec);
10607 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
10609 struct alc_spec *spec = codec->spec;
10611 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
10612 alc262_hp_master_update(codec);
10615 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
10618 if ((res >> 26) != ALC880_HP_EVENT)
10620 alc262_hp_wildwest_automute(codec);
10623 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
10625 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
10626 struct snd_ctl_elem_value *ucontrol)
10628 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10629 struct alc_spec *spec = codec->spec;
10630 int val = !!*ucontrol->value.integer.value;
10632 if (val == spec->master_sw)
10634 spec->master_sw = val;
10635 alc262_hp_master_update(codec);
10639 #define ALC262_HP_MASTER_SWITCH \
10641 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10642 .name = "Master Playback Switch", \
10643 .info = snd_ctl_boolean_mono_info, \
10644 .get = alc262_hp_master_sw_get, \
10645 .put = alc262_hp_master_sw_put, \
10648 .iface = NID_MAPPING, \
10649 .name = "Master Playback Switch", \
10650 .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \
10654 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
10655 ALC262_HP_MASTER_SWITCH,
10656 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10657 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10658 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10659 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10661 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10663 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10664 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10665 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10666 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10667 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10668 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10669 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10670 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10671 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10672 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10673 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
10674 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
10678 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
10679 ALC262_HP_MASTER_SWITCH,
10680 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10681 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10682 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10683 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10684 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10686 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10688 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
10689 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
10690 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
10691 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10692 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10693 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10694 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10698 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
10699 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10700 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10701 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
10705 /* mute/unmute internal speaker according to the hp jack and mute state */
10706 static void alc262_hp_t5735_setup(struct hda_codec *codec)
10708 struct alc_spec *spec = codec->spec;
10710 spec->autocfg.hp_pins[0] = 0x15;
10711 spec->autocfg.speaker_pins[0] = 0x14;
10714 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
10715 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10716 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10717 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10718 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10719 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10720 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10721 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10725 static struct hda_verb alc262_hp_t5735_verbs[] = {
10726 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10727 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10729 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10733 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
10734 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10735 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10736 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
10737 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
10738 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10739 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10743 static struct hda_verb alc262_hp_rp5700_verbs[] = {
10744 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10745 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10746 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10747 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10748 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10749 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10750 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10751 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10752 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10753 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10757 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
10764 /* bind hp and internal speaker mute (with plug check) as master switch */
10765 static void alc262_hippo_master_update(struct hda_codec *codec)
10767 struct alc_spec *spec = codec->spec;
10768 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10769 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10770 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10774 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
10775 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
10776 HDA_AMP_MUTE, mute);
10777 /* mute internal speaker per jack sense */
10778 if (spec->jack_present)
10779 mute = HDA_AMP_MUTE;
10781 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
10782 HDA_AMP_MUTE, mute);
10783 if (speaker_nid && speaker_nid != line_nid)
10784 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
10785 HDA_AMP_MUTE, mute);
10788 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
10790 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
10791 struct snd_ctl_elem_value *ucontrol)
10793 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10794 struct alc_spec *spec = codec->spec;
10795 int val = !!*ucontrol->value.integer.value;
10797 if (val == spec->master_sw)
10799 spec->master_sw = val;
10800 alc262_hippo_master_update(codec);
10804 #define ALC262_HIPPO_MASTER_SWITCH \
10806 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10807 .name = "Master Playback Switch", \
10808 .info = snd_ctl_boolean_mono_info, \
10809 .get = alc262_hippo_master_sw_get, \
10810 .put = alc262_hippo_master_sw_put, \
10813 .iface = NID_MAPPING, \
10814 .name = "Master Playback Switch", \
10815 .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \
10816 (SUBDEV_SPEAKER(0) << 16), \
10819 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
10820 ALC262_HIPPO_MASTER_SWITCH,
10821 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10822 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10823 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10824 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10825 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10826 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10827 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10828 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10829 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10830 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10831 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10832 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10836 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
10837 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10838 ALC262_HIPPO_MASTER_SWITCH,
10839 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10840 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10841 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10842 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10843 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10844 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10845 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10846 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10847 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10848 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10852 /* mute/unmute internal speaker according to the hp jack and mute state */
10853 static void alc262_hippo_automute(struct hda_codec *codec)
10855 struct alc_spec *spec = codec->spec;
10856 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10858 spec->jack_present = snd_hda_jack_detect(codec, hp_nid);
10859 alc262_hippo_master_update(codec);
10862 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
10864 if ((res >> 26) != ALC880_HP_EVENT)
10866 alc262_hippo_automute(codec);
10869 static void alc262_hippo_setup(struct hda_codec *codec)
10871 struct alc_spec *spec = codec->spec;
10873 spec->autocfg.hp_pins[0] = 0x15;
10874 spec->autocfg.speaker_pins[0] = 0x14;
10877 static void alc262_hippo1_setup(struct hda_codec *codec)
10879 struct alc_spec *spec = codec->spec;
10881 spec->autocfg.hp_pins[0] = 0x1b;
10882 spec->autocfg.speaker_pins[0] = 0x14;
10886 static struct snd_kcontrol_new alc262_sony_mixer[] = {
10887 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10888 ALC262_HIPPO_MASTER_SWITCH,
10889 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10890 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10891 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10892 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10896 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
10897 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10898 ALC262_HIPPO_MASTER_SWITCH,
10899 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10900 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10901 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10902 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10903 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10907 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
10908 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10909 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10910 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
10911 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
10912 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10913 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10914 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10915 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10916 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10917 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10918 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10919 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10923 static struct hda_verb alc262_tyan_verbs[] = {
10924 /* Headphone automute */
10925 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10926 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10927 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10929 /* P11 AUX_IN, white 4-pin connector */
10930 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10931 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
10932 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
10933 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
10938 /* unsolicited event for HP jack sensing */
10939 static void alc262_tyan_setup(struct hda_codec *codec)
10941 struct alc_spec *spec = codec->spec;
10943 spec->autocfg.hp_pins[0] = 0x1b;
10944 spec->autocfg.speaker_pins[0] = 0x15;
10948 #define alc262_capture_mixer alc882_capture_mixer
10949 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
10952 * generic initialization of ADC, input mixers and output mixers
10954 static struct hda_verb alc262_init_verbs[] = {
10956 * Unmute ADC0-2 and set the default input to mic-in
10958 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10959 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10960 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10961 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10962 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10963 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10965 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10967 * Note: PASD motherboards uses the Line In 2 as the input for
10968 * front panel mic (mic 2)
10970 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10971 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10972 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10973 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10974 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10975 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10978 * Set up output mixers (0x0c - 0x0e)
10980 /* set vol=0 to output mixers */
10981 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10982 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10983 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10984 /* set up input amps for analog loopback */
10985 /* Amp Indices: DAC = 0, mixer = 1 */
10986 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10987 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10988 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10989 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10990 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10991 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10993 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10994 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10995 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10996 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10997 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10998 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11000 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11001 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11002 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11003 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11004 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11006 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11007 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11009 /* FIXME: use matrix-type input source selection */
11010 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11011 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11012 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11013 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11014 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11015 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11017 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11018 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11019 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11020 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11022 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11023 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11024 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11025 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11030 static struct hda_verb alc262_eapd_verbs[] = {
11031 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11032 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11036 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
11037 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11038 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11039 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11041 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11042 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11046 static struct hda_verb alc262_sony_unsol_verbs[] = {
11047 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11048 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11049 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
11051 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11052 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11056 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
11057 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11058 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11059 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11060 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11061 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11065 static struct hda_verb alc262_toshiba_s06_verbs[] = {
11066 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11067 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11068 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11069 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11070 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
11071 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11072 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11073 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11077 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
11079 struct alc_spec *spec = codec->spec;
11081 spec->autocfg.hp_pins[0] = 0x15;
11082 spec->autocfg.speaker_pins[0] = 0x14;
11083 spec->ext_mic.pin = 0x18;
11084 spec->ext_mic.mux_idx = 0;
11085 spec->int_mic.pin = 0x12;
11086 spec->int_mic.mux_idx = 9;
11087 spec->auto_mic = 1;
11093 * 0x16 = internal speaker
11094 * 0x18 = external mic
11097 static struct snd_kcontrol_new alc262_nec_mixer[] = {
11098 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
11099 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
11101 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11102 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11103 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11105 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11106 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11110 static struct hda_verb alc262_nec_verbs[] = {
11111 /* Unmute Speaker */
11112 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11115 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11116 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11118 /* External mic to headphone */
11119 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11120 /* External mic to speaker */
11121 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11127 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
11128 * 0x1b = port replicator headphone out
11131 #define ALC_HP_EVENT 0x37
11133 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
11134 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11135 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11136 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11137 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11141 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
11142 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11143 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11147 static struct hda_verb alc262_lenovo_3000_init_verbs[] = {
11148 /* Front Mic pin: input vref at 50% */
11149 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
11150 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11154 static struct hda_input_mux alc262_fujitsu_capture_source = {
11158 { "Int Mic", 0x1 },
11163 static struct hda_input_mux alc262_HP_capture_source = {
11167 { "Front Mic", 0x1 },
11174 static struct hda_input_mux alc262_HP_D7000_capture_source = {
11178 { "Front Mic", 0x2 },
11184 /* mute/unmute internal speaker according to the hp jacks and mute state */
11185 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
11187 struct alc_spec *spec = codec->spec;
11190 if (force || !spec->sense_updated) {
11191 spec->jack_present = snd_hda_jack_detect(codec, 0x14) ||
11192 snd_hda_jack_detect(codec, 0x1b);
11193 spec->sense_updated = 1;
11195 /* unmute internal speaker only if both HPs are unplugged and
11196 * master switch is on
11198 if (spec->jack_present)
11199 mute = HDA_AMP_MUTE;
11201 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11202 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11203 HDA_AMP_MUTE, mute);
11206 /* unsolicited event for HP jack sensing */
11207 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
11210 if ((res >> 26) != ALC_HP_EVENT)
11212 alc262_fujitsu_automute(codec, 1);
11215 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
11217 alc262_fujitsu_automute(codec, 1);
11220 /* bind volumes of both NID 0x0c and 0x0d */
11221 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
11222 .ops = &snd_hda_bind_vol,
11224 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
11225 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
11230 /* mute/unmute internal speaker according to the hp jack and mute state */
11231 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
11233 struct alc_spec *spec = codec->spec;
11236 if (force || !spec->sense_updated) {
11237 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
11238 spec->sense_updated = 1;
11240 if (spec->jack_present) {
11241 /* mute internal speaker */
11242 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11243 HDA_AMP_MUTE, HDA_AMP_MUTE);
11244 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11245 HDA_AMP_MUTE, HDA_AMP_MUTE);
11247 /* unmute internal speaker if necessary */
11248 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
11249 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11250 HDA_AMP_MUTE, mute);
11251 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11252 HDA_AMP_MUTE, mute);
11256 /* unsolicited event for HP jack sensing */
11257 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
11260 if ((res >> 26) != ALC_HP_EVENT)
11262 alc262_lenovo_3000_automute(codec, 1);
11265 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
11266 int dir, int idx, long *valp)
11270 for (i = 0; i < 2; i++, valp++)
11271 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
11273 *valp ? 0 : HDA_AMP_MUTE);
11277 /* bind hp and internal speaker mute (with plug check) */
11278 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
11279 struct snd_ctl_elem_value *ucontrol)
11281 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11282 long *valp = ucontrol->value.integer.value;
11285 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
11286 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11288 alc262_fujitsu_automute(codec, 0);
11292 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
11293 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11295 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11296 .name = "Master Playback Switch",
11297 .subdevice = HDA_SUBDEV_AMP_FLAG,
11298 .info = snd_hda_mixer_amp_switch_info,
11299 .get = snd_hda_mixer_amp_switch_get,
11300 .put = alc262_fujitsu_master_sw_put,
11301 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11304 .iface = NID_MAPPING,
11305 .name = "Master Playback Switch",
11306 .private_value = 0x1b,
11308 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11309 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11310 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11311 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11312 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11313 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11314 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11315 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11319 /* bind hp and internal speaker mute (with plug check) */
11320 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
11321 struct snd_ctl_elem_value *ucontrol)
11323 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11324 long *valp = ucontrol->value.integer.value;
11327 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11329 alc262_lenovo_3000_automute(codec, 0);
11333 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
11334 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11336 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11337 .name = "Master Playback Switch",
11338 .subdevice = HDA_SUBDEV_AMP_FLAG,
11339 .info = snd_hda_mixer_amp_switch_info,
11340 .get = snd_hda_mixer_amp_switch_get,
11341 .put = alc262_lenovo_3000_master_sw_put,
11342 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
11344 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11345 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11346 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11347 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11348 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11349 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11350 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11351 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11355 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
11356 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11357 ALC262_HIPPO_MASTER_SWITCH,
11358 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11359 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11360 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11361 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11362 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11363 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11367 /* additional init verbs for Benq laptops */
11368 static struct hda_verb alc262_EAPD_verbs[] = {
11369 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11370 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
11374 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
11375 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11376 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11378 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11379 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
11383 /* Samsung Q1 Ultra Vista model setup */
11384 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
11385 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11386 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11387 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11388 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11389 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
11390 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
11394 static struct hda_verb alc262_ultra_verbs[] = {
11396 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11397 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11398 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11400 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11401 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11402 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11403 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11405 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11406 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11407 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11408 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11409 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11411 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11412 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11413 /* ADC, choose mic */
11414 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11415 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11416 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11417 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11418 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11419 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11420 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11421 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11422 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11423 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
11427 /* mute/unmute internal speaker according to the hp jack and mute state */
11428 static void alc262_ultra_automute(struct hda_codec *codec)
11430 struct alc_spec *spec = codec->spec;
11434 /* auto-mute only when HP is used as HP */
11435 if (!spec->cur_mux[0]) {
11436 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11437 if (spec->jack_present)
11438 mute = HDA_AMP_MUTE;
11440 /* mute/unmute internal speaker */
11441 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11442 HDA_AMP_MUTE, mute);
11443 /* mute/unmute HP */
11444 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11445 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
11448 /* unsolicited event for HP jack sensing */
11449 static void alc262_ultra_unsol_event(struct hda_codec *codec,
11452 if ((res >> 26) != ALC880_HP_EVENT)
11454 alc262_ultra_automute(codec);
11457 static struct hda_input_mux alc262_ultra_capture_source = {
11461 { "Headphone", 0x7 },
11465 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
11466 struct snd_ctl_elem_value *ucontrol)
11468 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11469 struct alc_spec *spec = codec->spec;
11472 ret = alc_mux_enum_put(kcontrol, ucontrol);
11475 /* reprogram the HP pin as mic or HP according to the input source */
11476 snd_hda_codec_write_cache(codec, 0x15, 0,
11477 AC_VERB_SET_PIN_WIDGET_CONTROL,
11478 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
11479 alc262_ultra_automute(codec); /* mute/unmute HP */
11483 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
11484 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
11485 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
11487 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11488 .name = "Capture Source",
11489 .info = alc_mux_enum_info,
11490 .get = alc_mux_enum_get,
11491 .put = alc262_ultra_mux_enum_put,
11494 .iface = NID_MAPPING,
11495 .name = "Capture Source",
11496 .private_value = 0x15,
11501 /* We use two mixers depending on the output pin; 0x16 is a mono output
11502 * and thus it's bound with a different mixer.
11503 * This function returns which mixer amp should be used.
11505 static int alc262_check_volbit(hda_nid_t nid)
11509 else if (nid == 0x16)
11515 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
11516 const char *pfx, int *vbits)
11521 vbit = alc262_check_volbit(nid);
11524 if (*vbits & vbit) /* a volume control for this mixer already there */
11528 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
11530 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
11531 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, val);
11534 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
11542 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
11544 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
11545 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val);
11548 /* add playback controls from the parsed DAC table */
11549 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
11550 const struct auto_pin_cfg *cfg)
11556 spec->multiout.num_dacs = 1; /* only use one dac */
11557 spec->multiout.dac_nids = spec->private_dac_nids;
11558 spec->multiout.dac_nids[0] = 2;
11560 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
11562 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11566 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx);
11569 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker");
11572 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone");
11576 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
11577 alc262_check_volbit(cfg->speaker_pins[0]) |
11578 alc262_check_volbit(cfg->hp_pins[0]);
11579 if (vbits == 1 || vbits == 2)
11580 pfx = "Master"; /* only one mixer is used */
11581 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11586 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits);
11589 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker",
11593 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone",
11600 #define alc262_auto_create_input_ctls \
11601 alc882_auto_create_input_ctls
11604 * generic initialization of ADC, input mixers and output mixers
11606 static struct hda_verb alc262_volume_init_verbs[] = {
11608 * Unmute ADC0-2 and set the default input to mic-in
11610 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11611 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11612 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11613 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11614 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11615 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11617 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11619 * Note: PASD motherboards uses the Line In 2 as the input for
11620 * front panel mic (mic 2)
11622 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11623 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11624 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11625 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11626 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11627 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11630 * Set up output mixers (0x0c - 0x0f)
11632 /* set vol=0 to output mixers */
11633 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11634 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11635 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11637 /* set up input amps for analog loopback */
11638 /* Amp Indices: DAC = 0, mixer = 1 */
11639 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11640 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11641 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11642 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11643 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11644 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11646 /* FIXME: use matrix-type input source selection */
11647 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11648 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11649 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11650 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11651 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11652 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11654 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11655 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11656 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11657 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11659 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11660 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11661 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11662 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11667 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
11669 * Unmute ADC0-2 and set the default input to mic-in
11671 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11672 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11673 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11674 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11675 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11676 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11678 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11680 * Note: PASD motherboards uses the Line In 2 as the input for
11681 * front panel mic (mic 2)
11683 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11684 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11685 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11686 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11687 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11688 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11689 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11690 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11693 * Set up output mixers (0x0c - 0x0e)
11695 /* set vol=0 to output mixers */
11696 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11697 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11698 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11700 /* set up input amps for analog loopback */
11701 /* Amp Indices: DAC = 0, mixer = 1 */
11702 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11703 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11704 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11705 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11706 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11707 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11709 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11710 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11711 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11713 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11714 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11716 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11717 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11719 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11720 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11721 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11722 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11723 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11725 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11726 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11727 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11728 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11729 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11730 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11733 /* FIXME: use matrix-type input source selection */
11734 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
11735 /* Input mixer1: only unmute Mic */
11736 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11737 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11738 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11739 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11740 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11741 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11742 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11743 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11744 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11746 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11747 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11748 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11749 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11750 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11751 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11752 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11753 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11754 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11756 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11757 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11758 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11759 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11760 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11761 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11762 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11763 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11764 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11766 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11771 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
11773 * Unmute ADC0-2 and set the default input to mic-in
11775 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11776 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11777 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11778 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11779 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11780 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11782 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11784 * Note: PASD motherboards uses the Line In 2 as the input for front
11785 * panel mic (mic 2)
11787 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11788 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11789 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11790 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11791 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11792 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11793 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11794 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11795 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11797 * Set up output mixers (0x0c - 0x0e)
11799 /* set vol=0 to output mixers */
11800 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11801 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11802 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11804 /* set up input amps for analog loopback */
11805 /* Amp Indices: DAC = 0, mixer = 1 */
11806 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11807 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11808 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11809 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11810 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11811 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11814 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
11815 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
11816 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
11817 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
11818 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11819 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
11820 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
11822 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11823 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11825 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11826 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11828 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
11829 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11830 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11831 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
11832 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11833 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11835 /* FIXME: use matrix-type input source selection */
11836 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11837 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11838 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
11839 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
11840 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
11841 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
11842 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
11843 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11844 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
11846 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11847 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11848 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11849 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11850 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11851 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11852 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11854 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11855 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11856 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11857 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11858 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11859 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11860 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11862 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11867 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
11869 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
11870 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11871 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
11873 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
11874 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11875 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11876 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11878 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
11879 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11880 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11885 #ifdef CONFIG_SND_HDA_POWER_SAVE
11886 #define alc262_loopbacks alc880_loopbacks
11889 /* pcm configuration: identical with ALC880 */
11890 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
11891 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
11892 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
11893 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
11896 * BIOS auto configuration
11898 static int alc262_parse_auto_config(struct hda_codec *codec)
11900 struct alc_spec *spec = codec->spec;
11902 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
11904 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11908 if (!spec->autocfg.line_outs) {
11909 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11910 spec->multiout.max_channels = 2;
11911 spec->no_analog = 1;
11914 return 0; /* can't find valid BIOS pin config */
11916 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
11919 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
11923 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11926 if (spec->autocfg.dig_outs) {
11927 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
11928 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11930 if (spec->autocfg.dig_in_pin)
11931 spec->dig_in_nid = ALC262_DIGIN_NID;
11933 if (spec->kctls.list)
11934 add_mixer(spec, spec->kctls.list);
11936 add_verb(spec, alc262_volume_init_verbs);
11937 spec->num_mux_defs = 1;
11938 spec->input_mux = &spec->private_imux[0];
11940 err = alc_auto_add_mic_boost(codec);
11944 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
11949 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
11950 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
11951 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
11952 #define alc262_auto_init_input_src alc882_auto_init_input_src
11955 /* init callback for auto-configuration model -- overriding the default init */
11956 static void alc262_auto_init(struct hda_codec *codec)
11958 struct alc_spec *spec = codec->spec;
11959 alc262_auto_init_multi_out(codec);
11960 alc262_auto_init_hp_out(codec);
11961 alc262_auto_init_analog_input(codec);
11962 alc262_auto_init_input_src(codec);
11963 if (spec->unsol_event)
11964 alc_inithook(codec);
11968 * configuration and preset
11970 static const char *alc262_models[ALC262_MODEL_LAST] = {
11971 [ALC262_BASIC] = "basic",
11972 [ALC262_HIPPO] = "hippo",
11973 [ALC262_HIPPO_1] = "hippo_1",
11974 [ALC262_FUJITSU] = "fujitsu",
11975 [ALC262_HP_BPC] = "hp-bpc",
11976 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
11977 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
11978 [ALC262_HP_RP5700] = "hp-rp5700",
11979 [ALC262_BENQ_ED8] = "benq",
11980 [ALC262_BENQ_T31] = "benq-t31",
11981 [ALC262_SONY_ASSAMD] = "sony-assamd",
11982 [ALC262_TOSHIBA_S06] = "toshiba-s06",
11983 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
11984 [ALC262_ULTRA] = "ultra",
11985 [ALC262_LENOVO_3000] = "lenovo-3000",
11986 [ALC262_NEC] = "nec",
11987 [ALC262_TYAN] = "tyan",
11988 [ALC262_AUTO] = "auto",
11991 static struct snd_pci_quirk alc262_cfg_tbl[] = {
11992 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
11993 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
11994 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
11996 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
11998 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
12000 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
12001 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
12002 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
12003 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
12004 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
12005 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
12006 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
12007 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
12008 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
12009 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
12010 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
12011 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
12012 ALC262_HP_TC_T5735),
12013 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
12014 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12015 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
12016 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12017 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
12018 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
12019 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
12020 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
12021 #if 0 /* disable the quirk since model=auto works better in recent versions */
12022 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
12023 ALC262_SONY_ASSAMD),
12025 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
12026 ALC262_TOSHIBA_RX1),
12027 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
12028 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
12029 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
12030 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
12031 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
12033 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
12034 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
12035 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
12036 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
12037 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
12041 static struct alc_config_preset alc262_presets[] = {
12043 .mixers = { alc262_base_mixer },
12044 .init_verbs = { alc262_init_verbs },
12045 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12046 .dac_nids = alc262_dac_nids,
12048 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12049 .channel_mode = alc262_modes,
12050 .input_mux = &alc262_capture_source,
12053 .mixers = { alc262_hippo_mixer },
12054 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
12055 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12056 .dac_nids = alc262_dac_nids,
12058 .dig_out_nid = ALC262_DIGOUT_NID,
12059 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12060 .channel_mode = alc262_modes,
12061 .input_mux = &alc262_capture_source,
12062 .unsol_event = alc262_hippo_unsol_event,
12063 .setup = alc262_hippo_setup,
12064 .init_hook = alc262_hippo_automute,
12066 [ALC262_HIPPO_1] = {
12067 .mixers = { alc262_hippo1_mixer },
12068 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
12069 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12070 .dac_nids = alc262_dac_nids,
12072 .dig_out_nid = ALC262_DIGOUT_NID,
12073 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12074 .channel_mode = alc262_modes,
12075 .input_mux = &alc262_capture_source,
12076 .unsol_event = alc262_hippo_unsol_event,
12077 .setup = alc262_hippo1_setup,
12078 .init_hook = alc262_hippo_automute,
12080 [ALC262_FUJITSU] = {
12081 .mixers = { alc262_fujitsu_mixer },
12082 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12083 alc262_fujitsu_unsol_verbs },
12084 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12085 .dac_nids = alc262_dac_nids,
12087 .dig_out_nid = ALC262_DIGOUT_NID,
12088 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12089 .channel_mode = alc262_modes,
12090 .input_mux = &alc262_fujitsu_capture_source,
12091 .unsol_event = alc262_fujitsu_unsol_event,
12092 .init_hook = alc262_fujitsu_init_hook,
12094 [ALC262_HP_BPC] = {
12095 .mixers = { alc262_HP_BPC_mixer },
12096 .init_verbs = { alc262_HP_BPC_init_verbs },
12097 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12098 .dac_nids = alc262_dac_nids,
12100 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12101 .channel_mode = alc262_modes,
12102 .input_mux = &alc262_HP_capture_source,
12103 .unsol_event = alc262_hp_bpc_unsol_event,
12104 .init_hook = alc262_hp_bpc_automute,
12106 [ALC262_HP_BPC_D7000_WF] = {
12107 .mixers = { alc262_HP_BPC_WildWest_mixer },
12108 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12109 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12110 .dac_nids = alc262_dac_nids,
12112 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12113 .channel_mode = alc262_modes,
12114 .input_mux = &alc262_HP_D7000_capture_source,
12115 .unsol_event = alc262_hp_wildwest_unsol_event,
12116 .init_hook = alc262_hp_wildwest_automute,
12118 [ALC262_HP_BPC_D7000_WL] = {
12119 .mixers = { alc262_HP_BPC_WildWest_mixer,
12120 alc262_HP_BPC_WildWest_option_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_TC_T5735] = {
12132 .mixers = { alc262_hp_t5735_mixer },
12133 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
12134 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12135 .dac_nids = alc262_dac_nids,
12137 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12138 .channel_mode = alc262_modes,
12139 .input_mux = &alc262_capture_source,
12140 .unsol_event = alc_sku_unsol_event,
12141 .setup = alc262_hp_t5735_setup,
12142 .init_hook = alc_inithook,
12144 [ALC262_HP_RP5700] = {
12145 .mixers = { alc262_hp_rp5700_mixer },
12146 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
12147 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12148 .dac_nids = alc262_dac_nids,
12149 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12150 .channel_mode = alc262_modes,
12151 .input_mux = &alc262_hp_rp5700_capture_source,
12153 [ALC262_BENQ_ED8] = {
12154 .mixers = { alc262_base_mixer },
12155 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
12156 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12157 .dac_nids = alc262_dac_nids,
12159 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12160 .channel_mode = alc262_modes,
12161 .input_mux = &alc262_capture_source,
12163 [ALC262_SONY_ASSAMD] = {
12164 .mixers = { alc262_sony_mixer },
12165 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
12166 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12167 .dac_nids = alc262_dac_nids,
12169 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12170 .channel_mode = alc262_modes,
12171 .input_mux = &alc262_capture_source,
12172 .unsol_event = alc262_hippo_unsol_event,
12173 .setup = alc262_hippo_setup,
12174 .init_hook = alc262_hippo_automute,
12176 [ALC262_BENQ_T31] = {
12177 .mixers = { alc262_benq_t31_mixer },
12178 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
12179 alc_hp15_unsol_verbs },
12180 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12181 .dac_nids = alc262_dac_nids,
12183 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12184 .channel_mode = alc262_modes,
12185 .input_mux = &alc262_capture_source,
12186 .unsol_event = alc262_hippo_unsol_event,
12187 .setup = alc262_hippo_setup,
12188 .init_hook = alc262_hippo_automute,
12191 .mixers = { alc262_ultra_mixer },
12192 .cap_mixer = alc262_ultra_capture_mixer,
12193 .init_verbs = { alc262_ultra_verbs },
12194 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12195 .dac_nids = alc262_dac_nids,
12196 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12197 .channel_mode = alc262_modes,
12198 .input_mux = &alc262_ultra_capture_source,
12199 .adc_nids = alc262_adc_nids, /* ADC0 */
12200 .capsrc_nids = alc262_capsrc_nids,
12201 .num_adc_nids = 1, /* single ADC */
12202 .unsol_event = alc262_ultra_unsol_event,
12203 .init_hook = alc262_ultra_automute,
12205 [ALC262_LENOVO_3000] = {
12206 .mixers = { alc262_lenovo_3000_mixer },
12207 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12208 alc262_lenovo_3000_unsol_verbs,
12209 alc262_lenovo_3000_init_verbs },
12210 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12211 .dac_nids = alc262_dac_nids,
12213 .dig_out_nid = ALC262_DIGOUT_NID,
12214 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12215 .channel_mode = alc262_modes,
12216 .input_mux = &alc262_fujitsu_capture_source,
12217 .unsol_event = alc262_lenovo_3000_unsol_event,
12220 .mixers = { alc262_nec_mixer },
12221 .init_verbs = { alc262_nec_verbs },
12222 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12223 .dac_nids = alc262_dac_nids,
12225 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12226 .channel_mode = alc262_modes,
12227 .input_mux = &alc262_capture_source,
12229 [ALC262_TOSHIBA_S06] = {
12230 .mixers = { alc262_toshiba_s06_mixer },
12231 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
12232 alc262_eapd_verbs },
12233 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12234 .capsrc_nids = alc262_dmic_capsrc_nids,
12235 .dac_nids = alc262_dac_nids,
12236 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
12237 .num_adc_nids = 1, /* single ADC */
12238 .dig_out_nid = ALC262_DIGOUT_NID,
12239 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12240 .channel_mode = alc262_modes,
12241 .unsol_event = alc_sku_unsol_event,
12242 .setup = alc262_toshiba_s06_setup,
12243 .init_hook = alc_inithook,
12245 [ALC262_TOSHIBA_RX1] = {
12246 .mixers = { alc262_toshiba_rx1_mixer },
12247 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
12248 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12249 .dac_nids = alc262_dac_nids,
12251 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12252 .channel_mode = alc262_modes,
12253 .input_mux = &alc262_capture_source,
12254 .unsol_event = alc262_hippo_unsol_event,
12255 .setup = alc262_hippo_setup,
12256 .init_hook = alc262_hippo_automute,
12259 .mixers = { alc262_tyan_mixer },
12260 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
12261 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12262 .dac_nids = alc262_dac_nids,
12264 .dig_out_nid = ALC262_DIGOUT_NID,
12265 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12266 .channel_mode = alc262_modes,
12267 .input_mux = &alc262_capture_source,
12268 .unsol_event = alc_automute_amp_unsol_event,
12269 .setup = alc262_tyan_setup,
12270 .init_hook = alc_automute_amp,
12274 static int patch_alc262(struct hda_codec *codec)
12276 struct alc_spec *spec;
12280 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12284 codec->spec = spec;
12286 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
12291 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12292 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
12293 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12294 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
12298 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
12300 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
12304 if (board_config < 0) {
12305 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12307 board_config = ALC262_AUTO;
12310 if (board_config == ALC262_AUTO) {
12311 /* automatic parse from the BIOS config */
12312 err = alc262_parse_auto_config(codec);
12318 "hda_codec: Cannot set up configuration "
12319 "from BIOS. Using base mode...\n");
12320 board_config = ALC262_BASIC;
12324 if (!spec->no_analog) {
12325 err = snd_hda_attach_beep_device(codec, 0x1);
12332 if (board_config != ALC262_AUTO)
12333 setup_preset(codec, &alc262_presets[board_config]);
12335 spec->stream_analog_playback = &alc262_pcm_analog_playback;
12336 spec->stream_analog_capture = &alc262_pcm_analog_capture;
12338 spec->stream_digital_playback = &alc262_pcm_digital_playback;
12339 spec->stream_digital_capture = &alc262_pcm_digital_capture;
12341 if (!spec->adc_nids && spec->input_mux) {
12343 /* check whether the digital-mic has to be supported */
12344 for (i = 0; i < spec->input_mux->num_items; i++) {
12345 if (spec->input_mux->items[i].index >= 9)
12348 if (i < spec->input_mux->num_items) {
12349 /* use only ADC0 */
12350 spec->adc_nids = alc262_dmic_adc_nids;
12351 spec->num_adc_nids = 1;
12352 spec->capsrc_nids = alc262_dmic_capsrc_nids;
12354 /* all analog inputs */
12355 /* check whether NID 0x07 is valid */
12356 unsigned int wcap = get_wcaps(codec, 0x07);
12359 wcap = get_wcaps_type(wcap);
12360 if (wcap != AC_WID_AUD_IN) {
12361 spec->adc_nids = alc262_adc_nids_alt;
12362 spec->num_adc_nids =
12363 ARRAY_SIZE(alc262_adc_nids_alt);
12364 spec->capsrc_nids = alc262_capsrc_nids_alt;
12366 spec->adc_nids = alc262_adc_nids;
12367 spec->num_adc_nids =
12368 ARRAY_SIZE(alc262_adc_nids);
12369 spec->capsrc_nids = alc262_capsrc_nids;
12373 if (!spec->cap_mixer && !spec->no_analog)
12374 set_capture_mixer(codec);
12375 if (!spec->no_analog)
12376 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12378 spec->vmaster_nid = 0x0c;
12380 codec->patch_ops = alc_patch_ops;
12381 if (board_config == ALC262_AUTO)
12382 spec->init_hook = alc262_auto_init;
12383 #ifdef CONFIG_SND_HDA_POWER_SAVE
12384 if (!spec->loopback.amplist)
12385 spec->loopback.amplist = alc262_loopbacks;
12392 * ALC268 channel source setting (2 channel)
12394 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
12395 #define alc268_modes alc260_modes
12397 static hda_nid_t alc268_dac_nids[2] = {
12402 static hda_nid_t alc268_adc_nids[2] = {
12407 static hda_nid_t alc268_adc_nids_alt[1] = {
12412 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
12414 static struct snd_kcontrol_new alc268_base_mixer[] = {
12415 /* output mixer control */
12416 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12417 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12418 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12419 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12420 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12421 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12422 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12426 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
12427 /* output mixer control */
12428 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12429 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12430 ALC262_HIPPO_MASTER_SWITCH,
12431 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12432 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12433 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12437 /* bind Beep switches of both NID 0x0f and 0x10 */
12438 static struct hda_bind_ctls alc268_bind_beep_sw = {
12439 .ops = &snd_hda_bind_sw,
12441 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
12442 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
12447 static struct snd_kcontrol_new alc268_beep_mixer[] = {
12448 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
12449 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
12453 static struct hda_verb alc268_eapd_verbs[] = {
12454 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12455 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12459 /* Toshiba specific */
12460 static struct hda_verb alc268_toshiba_verbs[] = {
12461 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12465 /* Acer specific */
12466 /* bind volumes of both NID 0x02 and 0x03 */
12467 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
12468 .ops = &snd_hda_bind_vol,
12470 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12471 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12476 /* mute/unmute internal speaker according to the hp jack and mute state */
12477 static void alc268_acer_automute(struct hda_codec *codec, int force)
12479 struct alc_spec *spec = codec->spec;
12482 if (force || !spec->sense_updated) {
12483 spec->jack_present = snd_hda_jack_detect(codec, 0x14);
12484 spec->sense_updated = 1;
12486 if (spec->jack_present)
12487 mute = HDA_AMP_MUTE; /* mute internal speaker */
12488 else /* unmute internal speaker if necessary */
12489 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
12490 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12491 HDA_AMP_MUTE, mute);
12495 /* bind hp and internal speaker mute (with plug check) */
12496 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
12497 struct snd_ctl_elem_value *ucontrol)
12499 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12500 long *valp = ucontrol->value.integer.value;
12503 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
12505 alc268_acer_automute(codec, 0);
12509 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
12510 /* output mixer control */
12511 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12513 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12514 .name = "Master Playback Switch",
12515 .subdevice = HDA_SUBDEV_AMP_FLAG,
12516 .info = snd_hda_mixer_amp_switch_info,
12517 .get = snd_hda_mixer_amp_switch_get,
12518 .put = alc268_acer_master_sw_put,
12519 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12521 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
12525 static struct snd_kcontrol_new alc268_acer_mixer[] = {
12526 /* output mixer control */
12527 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12529 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12530 .name = "Master Playback Switch",
12531 .subdevice = HDA_SUBDEV_AMP_FLAG,
12532 .info = snd_hda_mixer_amp_switch_info,
12533 .get = snd_hda_mixer_amp_switch_get,
12534 .put = alc268_acer_master_sw_put,
12535 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12537 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12538 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12539 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12543 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
12544 /* output mixer control */
12545 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12547 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12548 .name = "Master Playback Switch",
12549 .subdevice = HDA_SUBDEV_AMP_FLAG,
12550 .info = snd_hda_mixer_amp_switch_info,
12551 .get = snd_hda_mixer_amp_switch_get,
12552 .put = alc268_acer_master_sw_put,
12553 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12555 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12556 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12560 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
12561 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12562 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12563 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12564 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12565 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
12566 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
12570 static struct hda_verb alc268_acer_verbs[] = {
12571 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
12572 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12573 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12574 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12575 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12576 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12577 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12581 /* unsolicited event for HP jack sensing */
12582 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
12583 #define alc268_toshiba_setup alc262_hippo_setup
12584 #define alc268_toshiba_automute alc262_hippo_automute
12586 static void alc268_acer_unsol_event(struct hda_codec *codec,
12589 if ((res >> 26) != ALC880_HP_EVENT)
12591 alc268_acer_automute(codec, 1);
12594 static void alc268_acer_init_hook(struct hda_codec *codec)
12596 alc268_acer_automute(codec, 1);
12599 /* toggle speaker-output according to the hp-jack state */
12600 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
12602 unsigned int present;
12603 unsigned char bits;
12605 present = snd_hda_jack_detect(codec, 0x15);
12606 bits = present ? HDA_AMP_MUTE : 0;
12607 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
12608 HDA_AMP_MUTE, bits);
12609 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
12610 HDA_AMP_MUTE, bits);
12613 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
12616 switch (res >> 26) {
12617 case ALC880_HP_EVENT:
12618 alc268_aspire_one_speaker_automute(codec);
12620 case ALC880_MIC_EVENT:
12621 alc_mic_automute(codec);
12626 static void alc268_acer_lc_setup(struct hda_codec *codec)
12628 struct alc_spec *spec = codec->spec;
12629 spec->ext_mic.pin = 0x18;
12630 spec->ext_mic.mux_idx = 0;
12631 spec->int_mic.pin = 0x12;
12632 spec->int_mic.mux_idx = 6;
12633 spec->auto_mic = 1;
12636 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
12638 alc268_aspire_one_speaker_automute(codec);
12639 alc_mic_automute(codec);
12642 static struct snd_kcontrol_new alc268_dell_mixer[] = {
12643 /* output mixer control */
12644 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12645 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12646 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12647 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12648 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12649 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12653 static struct hda_verb alc268_dell_verbs[] = {
12654 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12655 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12656 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12657 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12661 /* mute/unmute internal speaker according to the hp jack and mute state */
12662 static void alc268_dell_setup(struct hda_codec *codec)
12664 struct alc_spec *spec = codec->spec;
12666 spec->autocfg.hp_pins[0] = 0x15;
12667 spec->autocfg.speaker_pins[0] = 0x14;
12668 spec->ext_mic.pin = 0x18;
12669 spec->ext_mic.mux_idx = 0;
12670 spec->int_mic.pin = 0x19;
12671 spec->int_mic.mux_idx = 1;
12672 spec->auto_mic = 1;
12675 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
12676 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12677 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12678 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12679 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12680 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12681 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
12682 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
12683 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
12687 static struct hda_verb alc267_quanta_il1_verbs[] = {
12688 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12689 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12693 static void alc267_quanta_il1_setup(struct hda_codec *codec)
12695 struct alc_spec *spec = codec->spec;
12696 spec->autocfg.hp_pins[0] = 0x15;
12697 spec->autocfg.speaker_pins[0] = 0x14;
12698 spec->ext_mic.pin = 0x18;
12699 spec->ext_mic.mux_idx = 0;
12700 spec->int_mic.pin = 0x19;
12701 spec->int_mic.mux_idx = 1;
12702 spec->auto_mic = 1;
12706 * generic initialization of ADC, input mixers and output mixers
12708 static struct hda_verb alc268_base_init_verbs[] = {
12709 /* Unmute DAC0-1 and set vol = 0 */
12710 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12711 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12714 * Set up output mixers (0x0c - 0x0e)
12716 /* set vol=0 to output mixers */
12717 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12718 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
12720 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12721 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12723 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12724 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
12725 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12726 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12727 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12728 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12729 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12730 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12732 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12733 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12734 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12735 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12736 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12738 /* set PCBEEP vol = 0, mute connections */
12739 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12740 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12741 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12743 /* Unmute Selector 23h,24h and set the default input to mic-in */
12745 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
12746 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12747 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
12748 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12754 * generic initialization of ADC, input mixers and output mixers
12756 static struct hda_verb alc268_volume_init_verbs[] = {
12757 /* set output DAC */
12758 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12759 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12761 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12762 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12763 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12764 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12765 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12767 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12768 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12769 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12771 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12772 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12774 /* set PCBEEP vol = 0, mute connections */
12775 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12776 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12777 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12782 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
12783 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12784 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12788 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
12789 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12790 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12795 static struct snd_kcontrol_new alc268_capture_mixer[] = {
12796 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12797 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12798 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
12799 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
12804 static struct hda_input_mux alc268_capture_source = {
12808 { "Front Mic", 0x1 },
12814 static struct hda_input_mux alc268_acer_capture_source = {
12818 { "Internal Mic", 0x1 },
12823 static struct hda_input_mux alc268_acer_dmic_capture_source = {
12827 { "Internal Mic", 0x6 },
12832 #ifdef CONFIG_SND_DEBUG
12833 static struct snd_kcontrol_new alc268_test_mixer[] = {
12834 /* Volume widgets */
12835 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12836 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12837 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12838 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
12839 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
12840 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
12841 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
12842 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
12843 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
12844 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
12845 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
12846 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
12847 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
12848 /* The below appears problematic on some hardwares */
12849 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
12850 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12851 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
12852 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
12853 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
12855 /* Modes for retasking pin widgets */
12856 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
12857 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
12858 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
12859 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
12861 /* Controls for GPIO pins, assuming they are configured as outputs */
12862 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
12863 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
12864 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
12865 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
12867 /* Switches to allow the digital SPDIF output pin to be enabled.
12868 * The ALC268 does not have an SPDIF input.
12870 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
12872 /* A switch allowing EAPD to be enabled. Some laptops seem to use
12873 * this output to turn on an external amplifier.
12875 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
12876 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
12882 /* create input playback/capture controls for the given pin */
12883 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12884 const char *ctlname, int idx)
12895 case 0x21: /* ALC269vb has this pin, too */
12901 if (spec->multiout.dac_nids[0] != dac &&
12902 spec->multiout.dac_nids[1] != dac) {
12903 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
12904 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
12908 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
12912 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12913 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
12915 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12916 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
12922 /* add playback controls from the parsed DAC table */
12923 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
12924 const struct auto_pin_cfg *cfg)
12929 spec->multiout.dac_nids = spec->private_dac_nids;
12931 nid = cfg->line_out_pins[0];
12934 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
12938 err = alc268_new_analog_output(spec, nid, name, 0);
12943 nid = cfg->speaker_pins[0];
12945 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
12946 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
12950 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
12954 nid = cfg->hp_pins[0];
12956 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
12961 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
12963 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
12964 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
12971 /* create playback/capture controls for input pins */
12972 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
12973 const struct auto_pin_cfg *cfg)
12975 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
12978 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
12979 hda_nid_t nid, int pin_type)
12983 alc_set_pin_output(codec, nid, pin_type);
12984 if (nid == 0x14 || nid == 0x16)
12988 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
12991 static void alc268_auto_init_multi_out(struct hda_codec *codec)
12993 struct alc_spec *spec = codec->spec;
12994 hda_nid_t nid = spec->autocfg.line_out_pins[0];
12996 int pin_type = get_pin_type(spec->autocfg.line_out_type);
12997 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
13001 static void alc268_auto_init_hp_out(struct hda_codec *codec)
13003 struct alc_spec *spec = codec->spec;
13006 pin = spec->autocfg.hp_pins[0];
13008 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
13009 pin = spec->autocfg.speaker_pins[0];
13011 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
13014 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
13016 struct alc_spec *spec = codec->spec;
13017 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
13018 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
13019 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
13020 unsigned int dac_vol1, dac_vol2;
13022 if (line_nid == 0x1d || speaker_nid == 0x1d) {
13023 snd_hda_codec_write(codec, speaker_nid, 0,
13024 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
13025 /* mute mixer inputs from 0x1d */
13026 snd_hda_codec_write(codec, 0x0f, 0,
13027 AC_VERB_SET_AMP_GAIN_MUTE,
13029 snd_hda_codec_write(codec, 0x10, 0,
13030 AC_VERB_SET_AMP_GAIN_MUTE,
13033 /* unmute mixer inputs from 0x1d */
13034 snd_hda_codec_write(codec, 0x0f, 0,
13035 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13036 snd_hda_codec_write(codec, 0x10, 0,
13037 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13040 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
13041 if (line_nid == 0x14)
13042 dac_vol2 = AMP_OUT_ZERO;
13043 else if (line_nid == 0x15)
13044 dac_vol1 = AMP_OUT_ZERO;
13045 if (hp_nid == 0x14)
13046 dac_vol2 = AMP_OUT_ZERO;
13047 else if (hp_nid == 0x15)
13048 dac_vol1 = AMP_OUT_ZERO;
13049 if (line_nid != 0x16 || hp_nid != 0x16 ||
13050 spec->autocfg.line_out_pins[1] != 0x16 ||
13051 spec->autocfg.line_out_pins[2] != 0x16)
13052 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
13054 snd_hda_codec_write(codec, 0x02, 0,
13055 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
13056 snd_hda_codec_write(codec, 0x03, 0,
13057 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
13060 /* pcm configuration: identical with ALC880 */
13061 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
13062 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
13063 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
13064 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
13067 * BIOS auto configuration
13069 static int alc268_parse_auto_config(struct hda_codec *codec)
13071 struct alc_spec *spec = codec->spec;
13073 static hda_nid_t alc268_ignore[] = { 0 };
13075 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13079 if (!spec->autocfg.line_outs) {
13080 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
13081 spec->multiout.max_channels = 2;
13082 spec->no_analog = 1;
13085 return 0; /* can't find valid BIOS pin config */
13087 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
13090 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
13094 spec->multiout.max_channels = 2;
13097 /* digital only support output */
13098 if (spec->autocfg.dig_outs) {
13099 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
13100 spec->dig_out_type = spec->autocfg.dig_out_type[0];
13102 if (spec->kctls.list)
13103 add_mixer(spec, spec->kctls.list);
13105 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
13106 add_mixer(spec, alc268_beep_mixer);
13108 add_verb(spec, alc268_volume_init_verbs);
13109 spec->num_mux_defs = 2;
13110 spec->input_mux = &spec->private_imux[0];
13112 err = alc_auto_add_mic_boost(codec);
13116 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
13121 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
13123 /* init callback for auto-configuration model -- overriding the default init */
13124 static void alc268_auto_init(struct hda_codec *codec)
13126 struct alc_spec *spec = codec->spec;
13127 alc268_auto_init_multi_out(codec);
13128 alc268_auto_init_hp_out(codec);
13129 alc268_auto_init_mono_speaker_out(codec);
13130 alc268_auto_init_analog_input(codec);
13131 if (spec->unsol_event)
13132 alc_inithook(codec);
13136 * configuration and preset
13138 static const char *alc268_models[ALC268_MODEL_LAST] = {
13139 [ALC267_QUANTA_IL1] = "quanta-il1",
13140 [ALC268_3ST] = "3stack",
13141 [ALC268_TOSHIBA] = "toshiba",
13142 [ALC268_ACER] = "acer",
13143 [ALC268_ACER_DMIC] = "acer-dmic",
13144 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
13145 [ALC268_DELL] = "dell",
13146 [ALC268_ZEPTO] = "zepto",
13147 #ifdef CONFIG_SND_DEBUG
13148 [ALC268_TEST] = "test",
13150 [ALC268_AUTO] = "auto",
13153 static struct snd_pci_quirk alc268_cfg_tbl[] = {
13154 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
13155 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
13156 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
13157 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
13158 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
13159 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
13160 ALC268_ACER_ASPIRE_ONE),
13161 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
13162 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
13163 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
13164 /* almost compatible with toshiba but with optional digital outs;
13165 * auto-probing seems working fine
13167 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
13169 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
13170 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
13171 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
13172 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
13173 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
13174 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
13178 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
13179 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
13180 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
13181 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
13182 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
13187 static struct alc_config_preset alc268_presets[] = {
13188 [ALC267_QUANTA_IL1] = {
13189 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
13190 alc268_capture_nosrc_mixer },
13191 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13192 alc267_quanta_il1_verbs },
13193 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13194 .dac_nids = alc268_dac_nids,
13195 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13196 .adc_nids = alc268_adc_nids_alt,
13198 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13199 .channel_mode = alc268_modes,
13200 .unsol_event = alc_sku_unsol_event,
13201 .setup = alc267_quanta_il1_setup,
13202 .init_hook = alc_inithook,
13205 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13206 alc268_beep_mixer },
13207 .init_verbs = { alc268_base_init_verbs },
13208 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13209 .dac_nids = alc268_dac_nids,
13210 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13211 .adc_nids = alc268_adc_nids_alt,
13212 .capsrc_nids = alc268_capsrc_nids,
13214 .dig_out_nid = ALC268_DIGOUT_NID,
13215 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13216 .channel_mode = alc268_modes,
13217 .input_mux = &alc268_capture_source,
13219 [ALC268_TOSHIBA] = {
13220 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
13221 alc268_beep_mixer },
13222 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13223 alc268_toshiba_verbs },
13224 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13225 .dac_nids = alc268_dac_nids,
13226 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13227 .adc_nids = alc268_adc_nids_alt,
13228 .capsrc_nids = alc268_capsrc_nids,
13230 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13231 .channel_mode = alc268_modes,
13232 .input_mux = &alc268_capture_source,
13233 .unsol_event = alc268_toshiba_unsol_event,
13234 .setup = alc268_toshiba_setup,
13235 .init_hook = alc268_toshiba_automute,
13238 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
13239 alc268_beep_mixer },
13240 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13241 alc268_acer_verbs },
13242 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13243 .dac_nids = alc268_dac_nids,
13244 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13245 .adc_nids = alc268_adc_nids_alt,
13246 .capsrc_nids = alc268_capsrc_nids,
13248 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13249 .channel_mode = alc268_modes,
13250 .input_mux = &alc268_acer_capture_source,
13251 .unsol_event = alc268_acer_unsol_event,
13252 .init_hook = alc268_acer_init_hook,
13254 [ALC268_ACER_DMIC] = {
13255 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
13256 alc268_beep_mixer },
13257 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13258 alc268_acer_verbs },
13259 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13260 .dac_nids = alc268_dac_nids,
13261 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13262 .adc_nids = alc268_adc_nids_alt,
13263 .capsrc_nids = alc268_capsrc_nids,
13265 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13266 .channel_mode = alc268_modes,
13267 .input_mux = &alc268_acer_dmic_capture_source,
13268 .unsol_event = alc268_acer_unsol_event,
13269 .init_hook = alc268_acer_init_hook,
13271 [ALC268_ACER_ASPIRE_ONE] = {
13272 .mixers = { alc268_acer_aspire_one_mixer,
13274 alc268_capture_nosrc_mixer },
13275 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13276 alc268_acer_aspire_one_verbs },
13277 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13278 .dac_nids = alc268_dac_nids,
13279 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13280 .adc_nids = alc268_adc_nids_alt,
13281 .capsrc_nids = alc268_capsrc_nids,
13283 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13284 .channel_mode = alc268_modes,
13285 .unsol_event = alc268_acer_lc_unsol_event,
13286 .setup = alc268_acer_lc_setup,
13287 .init_hook = alc268_acer_lc_init_hook,
13290 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
13291 alc268_capture_nosrc_mixer },
13292 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13293 alc268_dell_verbs },
13294 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13295 .dac_nids = alc268_dac_nids,
13296 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13297 .adc_nids = alc268_adc_nids_alt,
13298 .capsrc_nids = alc268_capsrc_nids,
13300 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13301 .channel_mode = alc268_modes,
13302 .unsol_event = alc_sku_unsol_event,
13303 .setup = alc268_dell_setup,
13304 .init_hook = alc_inithook,
13307 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13308 alc268_beep_mixer },
13309 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13310 alc268_toshiba_verbs },
13311 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13312 .dac_nids = alc268_dac_nids,
13313 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13314 .adc_nids = alc268_adc_nids_alt,
13315 .capsrc_nids = alc268_capsrc_nids,
13317 .dig_out_nid = ALC268_DIGOUT_NID,
13318 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13319 .channel_mode = alc268_modes,
13320 .input_mux = &alc268_capture_source,
13321 .setup = alc268_toshiba_setup,
13322 .init_hook = alc268_toshiba_automute,
13324 #ifdef CONFIG_SND_DEBUG
13326 .mixers = { alc268_test_mixer, alc268_capture_mixer },
13327 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13328 alc268_volume_init_verbs },
13329 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13330 .dac_nids = alc268_dac_nids,
13331 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13332 .adc_nids = alc268_adc_nids_alt,
13333 .capsrc_nids = alc268_capsrc_nids,
13335 .dig_out_nid = ALC268_DIGOUT_NID,
13336 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13337 .channel_mode = alc268_modes,
13338 .input_mux = &alc268_capture_source,
13343 static int patch_alc268(struct hda_codec *codec)
13345 struct alc_spec *spec;
13347 int i, has_beep, err;
13349 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13353 codec->spec = spec;
13355 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
13359 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
13360 board_config = snd_hda_check_board_codec_sid_config(codec,
13361 ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
13363 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
13364 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13366 board_config = ALC268_AUTO;
13369 if (board_config == ALC268_AUTO) {
13370 /* automatic parse from the BIOS config */
13371 err = alc268_parse_auto_config(codec);
13377 "hda_codec: Cannot set up configuration "
13378 "from BIOS. Using base mode...\n");
13379 board_config = ALC268_3ST;
13383 if (board_config != ALC268_AUTO)
13384 setup_preset(codec, &alc268_presets[board_config]);
13386 spec->stream_analog_playback = &alc268_pcm_analog_playback;
13387 spec->stream_analog_capture = &alc268_pcm_analog_capture;
13388 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
13390 spec->stream_digital_playback = &alc268_pcm_digital_playback;
13393 for (i = 0; i < spec->num_mixers; i++) {
13394 if (spec->mixers[i] == alc268_beep_mixer) {
13401 err = snd_hda_attach_beep_device(codec, 0x1);
13406 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
13407 /* override the amp caps for beep generator */
13408 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
13409 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
13410 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
13411 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
13412 (0 << AC_AMPCAP_MUTE_SHIFT));
13415 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
13416 /* check whether NID 0x07 is valid */
13417 unsigned int wcap = get_wcaps(codec, 0x07);
13420 spec->capsrc_nids = alc268_capsrc_nids;
13422 wcap = get_wcaps_type(wcap);
13423 if (spec->auto_mic ||
13424 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
13425 spec->adc_nids = alc268_adc_nids_alt;
13426 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
13427 if (spec->auto_mic)
13428 fixup_automic_adc(codec);
13429 if (spec->auto_mic || spec->input_mux->num_items == 1)
13430 add_mixer(spec, alc268_capture_nosrc_mixer);
13432 add_mixer(spec, alc268_capture_alt_mixer);
13434 spec->adc_nids = alc268_adc_nids;
13435 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
13436 add_mixer(spec, alc268_capture_mixer);
13438 /* set default input source */
13439 for (i = 0; i < spec->num_adc_nids; i++)
13440 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
13441 0, AC_VERB_SET_CONNECT_SEL,
13442 i < spec->num_mux_defs ?
13443 spec->input_mux[i].items[0].index :
13444 spec->input_mux->items[0].index);
13447 spec->vmaster_nid = 0x02;
13449 codec->patch_ops = alc_patch_ops;
13450 if (board_config == ALC268_AUTO)
13451 spec->init_hook = alc268_auto_init;
13457 * ALC269 channel source setting (2 channel)
13459 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
13461 #define alc269_dac_nids alc260_dac_nids
13463 static hda_nid_t alc269_adc_nids[1] = {
13468 static hda_nid_t alc269_capsrc_nids[1] = {
13472 static hda_nid_t alc269vb_adc_nids[1] = {
13477 static hda_nid_t alc269vb_capsrc_nids[1] = {
13481 static hda_nid_t alc269_adc_candidates[] = {
13485 #define alc269_modes alc260_modes
13486 #define alc269_capture_source alc880_lg_lw_capture_source
13488 static struct snd_kcontrol_new alc269_base_mixer[] = {
13489 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13490 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13491 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13492 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13493 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13494 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13495 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13496 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13497 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13498 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13499 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13500 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
13504 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
13505 /* output mixer control */
13506 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13508 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13509 .name = "Master Playback Switch",
13510 .subdevice = HDA_SUBDEV_AMP_FLAG,
13511 .info = snd_hda_mixer_amp_switch_info,
13512 .get = snd_hda_mixer_amp_switch_get,
13513 .put = alc268_acer_master_sw_put,
13514 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13516 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13517 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13518 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13519 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13520 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13521 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13525 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
13526 /* output mixer control */
13527 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13529 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13530 .name = "Master Playback Switch",
13531 .subdevice = HDA_SUBDEV_AMP_FLAG,
13532 .info = snd_hda_mixer_amp_switch_info,
13533 .get = snd_hda_mixer_amp_switch_get,
13534 .put = alc268_acer_master_sw_put,
13535 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13537 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13538 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13539 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13540 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13541 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13542 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13543 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
13544 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
13545 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
13549 static struct snd_kcontrol_new alc269_laptop_mixer[] = {
13550 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13551 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13552 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13553 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13557 static struct snd_kcontrol_new alc269vb_laptop_mixer[] = {
13558 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13559 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13560 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
13561 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13565 /* capture mixer elements */
13566 static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = {
13567 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13568 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13569 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13570 HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT),
13574 static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = {
13575 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13576 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13577 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13581 static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = {
13582 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13583 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13584 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13585 HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT),
13589 static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = {
13590 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13591 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13592 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13597 #define alc269_fujitsu_mixer alc269_laptop_mixer
13599 static struct hda_verb alc269_quanta_fl1_verbs[] = {
13600 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13601 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13602 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13603 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13604 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13605 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13609 static struct hda_verb alc269_lifebook_verbs[] = {
13610 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13611 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
13612 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13613 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13614 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13615 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13616 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13617 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13618 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13619 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13623 /* toggle speaker-output according to the hp-jack state */
13624 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
13626 unsigned int present;
13627 unsigned char bits;
13629 present = snd_hda_jack_detect(codec, 0x15);
13630 bits = present ? HDA_AMP_MUTE : 0;
13631 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13632 HDA_AMP_MUTE, bits);
13633 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13634 HDA_AMP_MUTE, bits);
13636 snd_hda_codec_write(codec, 0x20, 0,
13637 AC_VERB_SET_COEF_INDEX, 0x0c);
13638 snd_hda_codec_write(codec, 0x20, 0,
13639 AC_VERB_SET_PROC_COEF, 0x680);
13641 snd_hda_codec_write(codec, 0x20, 0,
13642 AC_VERB_SET_COEF_INDEX, 0x0c);
13643 snd_hda_codec_write(codec, 0x20, 0,
13644 AC_VERB_SET_PROC_COEF, 0x480);
13647 /* toggle speaker-output according to the hp-jacks state */
13648 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
13650 unsigned int present;
13651 unsigned char bits;
13653 /* Check laptop headphone socket */
13654 present = snd_hda_jack_detect(codec, 0x15);
13656 /* Check port replicator headphone socket */
13657 present |= snd_hda_jack_detect(codec, 0x1a);
13659 bits = present ? HDA_AMP_MUTE : 0;
13660 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13661 HDA_AMP_MUTE, bits);
13662 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13663 HDA_AMP_MUTE, bits);
13665 snd_hda_codec_write(codec, 0x20, 0,
13666 AC_VERB_SET_COEF_INDEX, 0x0c);
13667 snd_hda_codec_write(codec, 0x20, 0,
13668 AC_VERB_SET_PROC_COEF, 0x680);
13670 snd_hda_codec_write(codec, 0x20, 0,
13671 AC_VERB_SET_COEF_INDEX, 0x0c);
13672 snd_hda_codec_write(codec, 0x20, 0,
13673 AC_VERB_SET_PROC_COEF, 0x480);
13676 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
13678 unsigned int present_laptop;
13679 unsigned int present_dock;
13681 present_laptop = snd_hda_jack_detect(codec, 0x18);
13682 present_dock = snd_hda_jack_detect(codec, 0x1b);
13684 /* Laptop mic port overrides dock mic port, design decision */
13686 snd_hda_codec_write(codec, 0x23, 0,
13687 AC_VERB_SET_CONNECT_SEL, 0x3);
13688 if (present_laptop)
13689 snd_hda_codec_write(codec, 0x23, 0,
13690 AC_VERB_SET_CONNECT_SEL, 0x0);
13691 if (!present_dock && !present_laptop)
13692 snd_hda_codec_write(codec, 0x23, 0,
13693 AC_VERB_SET_CONNECT_SEL, 0x1);
13696 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
13699 switch (res >> 26) {
13700 case ALC880_HP_EVENT:
13701 alc269_quanta_fl1_speaker_automute(codec);
13703 case ALC880_MIC_EVENT:
13704 alc_mic_automute(codec);
13709 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
13712 if ((res >> 26) == ALC880_HP_EVENT)
13713 alc269_lifebook_speaker_automute(codec);
13714 if ((res >> 26) == ALC880_MIC_EVENT)
13715 alc269_lifebook_mic_autoswitch(codec);
13718 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
13720 struct alc_spec *spec = codec->spec;
13721 spec->autocfg.hp_pins[0] = 0x15;
13722 spec->autocfg.speaker_pins[0] = 0x14;
13723 spec->ext_mic.pin = 0x18;
13724 spec->ext_mic.mux_idx = 0;
13725 spec->int_mic.pin = 0x19;
13726 spec->int_mic.mux_idx = 1;
13727 spec->auto_mic = 1;
13730 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
13732 alc269_quanta_fl1_speaker_automute(codec);
13733 alc_mic_automute(codec);
13736 static void alc269_lifebook_init_hook(struct hda_codec *codec)
13738 alc269_lifebook_speaker_automute(codec);
13739 alc269_lifebook_mic_autoswitch(codec);
13742 static struct hda_verb alc269_laptop_dmic_init_verbs[] = {
13743 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13744 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
13745 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13746 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13747 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13748 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13749 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13753 static struct hda_verb alc269_laptop_amic_init_verbs[] = {
13754 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13755 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
13756 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13757 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
13758 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13759 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13763 static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = {
13764 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
13765 {0x22, AC_VERB_SET_CONNECT_SEL, 0x06},
13766 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13767 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13768 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13769 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13770 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13774 static struct hda_verb alc269vb_laptop_amic_init_verbs[] = {
13775 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
13776 {0x22, AC_VERB_SET_CONNECT_SEL, 0x01},
13777 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13778 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13779 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13780 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13781 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13785 /* toggle speaker-output according to the hp-jack state */
13786 static void alc269_speaker_automute(struct hda_codec *codec)
13788 struct alc_spec *spec = codec->spec;
13789 unsigned int nid = spec->autocfg.hp_pins[0];
13790 unsigned int present;
13791 unsigned char bits;
13793 present = snd_hda_jack_detect(codec, nid);
13794 bits = present ? HDA_AMP_MUTE : 0;
13795 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13796 HDA_AMP_MUTE, bits);
13797 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13798 HDA_AMP_MUTE, bits);
13801 /* unsolicited event for HP jack sensing */
13802 static void alc269_laptop_unsol_event(struct hda_codec *codec,
13805 switch (res >> 26) {
13806 case ALC880_HP_EVENT:
13807 alc269_speaker_automute(codec);
13809 case ALC880_MIC_EVENT:
13810 alc_mic_automute(codec);
13815 static void alc269_laptop_amic_setup(struct hda_codec *codec)
13817 struct alc_spec *spec = codec->spec;
13818 spec->autocfg.hp_pins[0] = 0x15;
13819 spec->autocfg.speaker_pins[0] = 0x14;
13820 spec->ext_mic.pin = 0x18;
13821 spec->ext_mic.mux_idx = 0;
13822 spec->int_mic.pin = 0x19;
13823 spec->int_mic.mux_idx = 1;
13824 spec->auto_mic = 1;
13827 static void alc269_laptop_dmic_setup(struct hda_codec *codec)
13829 struct alc_spec *spec = codec->spec;
13830 spec->autocfg.hp_pins[0] = 0x15;
13831 spec->autocfg.speaker_pins[0] = 0x14;
13832 spec->ext_mic.pin = 0x18;
13833 spec->ext_mic.mux_idx = 0;
13834 spec->int_mic.pin = 0x12;
13835 spec->int_mic.mux_idx = 5;
13836 spec->auto_mic = 1;
13839 static void alc269vb_laptop_amic_setup(struct hda_codec *codec)
13841 struct alc_spec *spec = codec->spec;
13842 spec->autocfg.hp_pins[0] = 0x21;
13843 spec->autocfg.speaker_pins[0] = 0x14;
13844 spec->ext_mic.pin = 0x18;
13845 spec->ext_mic.mux_idx = 0;
13846 spec->int_mic.pin = 0x19;
13847 spec->int_mic.mux_idx = 1;
13848 spec->auto_mic = 1;
13851 static void alc269vb_laptop_dmic_setup(struct hda_codec *codec)
13853 struct alc_spec *spec = codec->spec;
13854 spec->autocfg.hp_pins[0] = 0x21;
13855 spec->autocfg.speaker_pins[0] = 0x14;
13856 spec->ext_mic.pin = 0x18;
13857 spec->ext_mic.mux_idx = 0;
13858 spec->int_mic.pin = 0x12;
13859 spec->int_mic.mux_idx = 6;
13860 spec->auto_mic = 1;
13863 static void alc269_laptop_inithook(struct hda_codec *codec)
13865 alc269_speaker_automute(codec);
13866 alc_mic_automute(codec);
13870 * generic initialization of ADC, input mixers and output mixers
13872 static struct hda_verb alc269_init_verbs[] = {
13874 * Unmute ADC0 and set the default input to mic-in
13876 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13879 * Set up output mixers (0x02 - 0x03)
13881 /* set vol=0 to output mixers */
13882 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13883 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13885 /* set up input amps for analog loopback */
13886 /* Amp Indices: DAC = 0, mixer = 1 */
13887 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13888 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13889 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13890 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13891 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13892 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13894 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13895 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13896 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13897 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13898 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13899 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13900 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13902 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13903 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13905 /* FIXME: use Mux-type input source selection */
13906 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13907 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13908 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
13911 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13915 static struct hda_verb alc269vb_init_verbs[] = {
13917 * Unmute ADC0 and set the default input to mic-in
13919 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13922 * Set up output mixers (0x02 - 0x03)
13924 /* set vol=0 to output mixers */
13925 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13926 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13928 /* set up input amps for analog loopback */
13929 /* Amp Indices: DAC = 0, mixer = 1 */
13930 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13931 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13932 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13933 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13934 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13935 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13937 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13938 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13939 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13940 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13941 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13942 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13943 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13945 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13946 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13948 /* FIXME: use Mux-type input source selection */
13949 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13950 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13951 {0x22, AC_VERB_SET_CONNECT_SEL, 0x00},
13954 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13958 #define alc269_auto_create_multi_out_ctls \
13959 alc268_auto_create_multi_out_ctls
13960 #define alc269_auto_create_input_ctls \
13961 alc268_auto_create_input_ctls
13963 #ifdef CONFIG_SND_HDA_POWER_SAVE
13964 #define alc269_loopbacks alc880_loopbacks
13967 /* pcm configuration: identical with ALC880 */
13968 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
13969 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
13970 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
13971 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
13973 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
13977 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13978 /* NID is set in alc_build_pcms */
13980 .open = alc880_playback_pcm_open,
13981 .prepare = alc880_playback_pcm_prepare,
13982 .cleanup = alc880_playback_pcm_cleanup
13986 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
13990 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13991 /* NID is set in alc_build_pcms */
13995 * BIOS auto configuration
13997 static int alc269_parse_auto_config(struct hda_codec *codec)
13999 struct alc_spec *spec = codec->spec;
14001 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
14003 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14008 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
14011 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
14015 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14017 if (spec->autocfg.dig_outs)
14018 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
14020 if (spec->kctls.list)
14021 add_mixer(spec, spec->kctls.list);
14023 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010) {
14024 add_verb(spec, alc269vb_init_verbs);
14025 alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21);
14027 add_verb(spec, alc269_init_verbs);
14028 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
14031 spec->num_mux_defs = 1;
14032 spec->input_mux = &spec->private_imux[0];
14033 fillup_priv_adc_nids(codec, alc269_adc_candidates,
14034 sizeof(alc269_adc_candidates));
14036 /* set default input source */
14037 snd_hda_codec_write_cache(codec, spec->capsrc_nids[0],
14038 0, AC_VERB_SET_CONNECT_SEL,
14039 spec->input_mux->items[0].index);
14041 err = alc_auto_add_mic_boost(codec);
14045 if (!spec->cap_mixer && !spec->no_analog)
14046 set_capture_mixer(codec);
14051 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
14052 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
14053 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
14056 /* init callback for auto-configuration model -- overriding the default init */
14057 static void alc269_auto_init(struct hda_codec *codec)
14059 struct alc_spec *spec = codec->spec;
14060 alc269_auto_init_multi_out(codec);
14061 alc269_auto_init_hp_out(codec);
14062 alc269_auto_init_analog_input(codec);
14063 if (spec->unsol_event)
14064 alc_inithook(codec);
14068 * configuration and preset
14070 static const char *alc269_models[ALC269_MODEL_LAST] = {
14071 [ALC269_BASIC] = "basic",
14072 [ALC269_QUANTA_FL1] = "quanta",
14073 [ALC269_AMIC] = "laptop-amic",
14074 [ALC269_DMIC] = "laptop-dmic",
14075 [ALC269_FUJITSU] = "fujitsu",
14076 [ALC269_LIFEBOOK] = "lifebook",
14077 [ALC269_AUTO] = "auto",
14080 static struct snd_pci_quirk alc269_cfg_tbl[] = {
14081 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
14082 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
14084 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC),
14085 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC),
14086 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC),
14087 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC),
14088 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC),
14089 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC),
14090 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC),
14091 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC),
14092 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC),
14093 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC),
14094 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC),
14095 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC),
14096 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC),
14097 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC),
14098 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC),
14099 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC),
14100 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC),
14101 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC),
14102 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC),
14103 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC),
14104 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC),
14105 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC),
14106 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC),
14107 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC),
14108 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC),
14109 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC),
14110 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC),
14111 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC),
14112 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC),
14113 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC),
14114 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC),
14115 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC),
14116 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC),
14117 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC),
14118 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC),
14119 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC),
14120 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
14122 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
14124 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC),
14125 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC),
14126 SND_PCI_QUIRK(0x104d, 0x9071, "SONY XTB", ALC269_DMIC),
14127 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
14128 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC),
14129 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
14130 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC),
14131 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC),
14132 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC),
14133 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC),
14137 static struct alc_config_preset alc269_presets[] = {
14139 .mixers = { alc269_base_mixer },
14140 .init_verbs = { alc269_init_verbs },
14141 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14142 .dac_nids = alc269_dac_nids,
14144 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14145 .channel_mode = alc269_modes,
14146 .input_mux = &alc269_capture_source,
14148 [ALC269_QUANTA_FL1] = {
14149 .mixers = { alc269_quanta_fl1_mixer },
14150 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
14151 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14152 .dac_nids = alc269_dac_nids,
14154 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14155 .channel_mode = alc269_modes,
14156 .input_mux = &alc269_capture_source,
14157 .unsol_event = alc269_quanta_fl1_unsol_event,
14158 .setup = alc269_quanta_fl1_setup,
14159 .init_hook = alc269_quanta_fl1_init_hook,
14162 .mixers = { alc269_laptop_mixer },
14163 .cap_mixer = alc269_laptop_analog_capture_mixer,
14164 .init_verbs = { alc269_init_verbs,
14165 alc269_laptop_amic_init_verbs },
14166 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14167 .dac_nids = alc269_dac_nids,
14169 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14170 .channel_mode = alc269_modes,
14171 .unsol_event = alc269_laptop_unsol_event,
14172 .setup = alc269_laptop_amic_setup,
14173 .init_hook = alc269_laptop_inithook,
14176 .mixers = { alc269_laptop_mixer },
14177 .cap_mixer = alc269_laptop_digital_capture_mixer,
14178 .init_verbs = { alc269_init_verbs,
14179 alc269_laptop_dmic_init_verbs },
14180 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14181 .dac_nids = alc269_dac_nids,
14183 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14184 .channel_mode = alc269_modes,
14185 .unsol_event = alc269_laptop_unsol_event,
14186 .setup = alc269_laptop_dmic_setup,
14187 .init_hook = alc269_laptop_inithook,
14189 [ALC269VB_AMIC] = {
14190 .mixers = { alc269vb_laptop_mixer },
14191 .cap_mixer = alc269vb_laptop_analog_capture_mixer,
14192 .init_verbs = { alc269vb_init_verbs,
14193 alc269vb_laptop_amic_init_verbs },
14194 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14195 .dac_nids = alc269_dac_nids,
14197 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14198 .channel_mode = alc269_modes,
14199 .unsol_event = alc269_laptop_unsol_event,
14200 .setup = alc269vb_laptop_amic_setup,
14201 .init_hook = alc269_laptop_inithook,
14203 [ALC269VB_DMIC] = {
14204 .mixers = { alc269vb_laptop_mixer },
14205 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
14206 .init_verbs = { alc269vb_init_verbs,
14207 alc269vb_laptop_dmic_init_verbs },
14208 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14209 .dac_nids = alc269_dac_nids,
14211 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14212 .channel_mode = alc269_modes,
14213 .unsol_event = alc269_laptop_unsol_event,
14214 .setup = alc269vb_laptop_dmic_setup,
14215 .init_hook = alc269_laptop_inithook,
14217 [ALC269_FUJITSU] = {
14218 .mixers = { alc269_fujitsu_mixer },
14219 .cap_mixer = alc269_laptop_digital_capture_mixer,
14220 .init_verbs = { alc269_init_verbs,
14221 alc269_laptop_dmic_init_verbs },
14222 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14223 .dac_nids = alc269_dac_nids,
14225 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14226 .channel_mode = alc269_modes,
14227 .unsol_event = alc269_laptop_unsol_event,
14228 .setup = alc269_laptop_dmic_setup,
14229 .init_hook = alc269_laptop_inithook,
14231 [ALC269_LIFEBOOK] = {
14232 .mixers = { alc269_lifebook_mixer },
14233 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
14234 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14235 .dac_nids = alc269_dac_nids,
14237 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14238 .channel_mode = alc269_modes,
14239 .input_mux = &alc269_capture_source,
14240 .unsol_event = alc269_lifebook_unsol_event,
14241 .init_hook = alc269_lifebook_init_hook,
14245 static int patch_alc269(struct hda_codec *codec)
14247 struct alc_spec *spec;
14250 int is_alc269vb = 0;
14252 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14256 codec->spec = spec;
14258 alc_fix_pll_init(codec, 0x20, 0x04, 15);
14260 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){
14261 kfree(codec->chip_name);
14262 codec->chip_name = kstrdup("ALC259", GFP_KERNEL);
14263 if (!codec->chip_name) {
14270 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
14274 if (board_config < 0) {
14275 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14277 board_config = ALC269_AUTO;
14280 if (board_config == ALC269_AUTO) {
14281 /* automatic parse from the BIOS config */
14282 err = alc269_parse_auto_config(codec);
14288 "hda_codec: Cannot set up configuration "
14289 "from BIOS. Using base mode...\n");
14290 board_config = ALC269_BASIC;
14294 err = snd_hda_attach_beep_device(codec, 0x1);
14300 if (board_config != ALC269_AUTO)
14301 setup_preset(codec, &alc269_presets[board_config]);
14303 if (board_config == ALC269_QUANTA_FL1) {
14304 /* Due to a hardware problem on Lenovo Ideadpad, we need to
14305 * fix the sample rate of analog I/O to 44.1kHz
14307 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
14308 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
14310 spec->stream_analog_playback = &alc269_pcm_analog_playback;
14311 spec->stream_analog_capture = &alc269_pcm_analog_capture;
14313 spec->stream_digital_playback = &alc269_pcm_digital_playback;
14314 spec->stream_digital_capture = &alc269_pcm_digital_capture;
14316 if (!spec->adc_nids) { /* wasn't filled automatically? use default */
14317 if (!is_alc269vb) {
14318 spec->adc_nids = alc269_adc_nids;
14319 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
14320 spec->capsrc_nids = alc269_capsrc_nids;
14322 spec->adc_nids = alc269vb_adc_nids;
14323 spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids);
14324 spec->capsrc_nids = alc269vb_capsrc_nids;
14328 if (!spec->cap_mixer)
14329 set_capture_mixer(codec);
14330 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
14332 spec->vmaster_nid = 0x02;
14334 codec->patch_ops = alc_patch_ops;
14335 if (board_config == ALC269_AUTO)
14336 spec->init_hook = alc269_auto_init;
14337 #ifdef CONFIG_SND_HDA_POWER_SAVE
14338 if (!spec->loopback.amplist)
14339 spec->loopback.amplist = alc269_loopbacks;
14346 * ALC861 channel source setting (2/6 channel selection for 3-stack)
14350 * set the path ways for 2 channel output
14351 * need to set the codec line out and mic 1 pin widgets to inputs
14353 static struct hda_verb alc861_threestack_ch2_init[] = {
14354 /* set pin widget 1Ah (line in) for input */
14355 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14356 /* set pin widget 18h (mic1/2) for input, for mic also enable
14359 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14361 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
14363 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14364 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
14370 * need to set the codec line out and mic 1 pin widgets to outputs
14372 static struct hda_verb alc861_threestack_ch6_init[] = {
14373 /* set pin widget 1Ah (line in) for output (Back Surround)*/
14374 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14375 /* set pin widget 18h (mic1) for output (CLFE)*/
14376 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14378 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
14379 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
14381 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
14383 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14384 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
14389 static struct hda_channel_mode alc861_threestack_modes[2] = {
14390 { 2, alc861_threestack_ch2_init },
14391 { 6, alc861_threestack_ch6_init },
14393 /* Set mic1 as input and unmute the mixer */
14394 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
14395 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14396 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14399 /* Set mic1 as output and mute mixer */
14400 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
14401 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14402 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14406 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
14407 { 2, alc861_uniwill_m31_ch2_init },
14408 { 4, alc861_uniwill_m31_ch4_init },
14411 /* Set mic1 and line-in as input and unmute the mixer */
14412 static struct hda_verb alc861_asus_ch2_init[] = {
14413 /* set pin widget 1Ah (line in) for input */
14414 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14415 /* set pin widget 18h (mic1/2) for input, for mic also enable
14418 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14420 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
14422 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14423 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
14427 /* Set mic1 nad line-in as output and mute mixer */
14428 static struct hda_verb alc861_asus_ch6_init[] = {
14429 /* set pin widget 1Ah (line in) for output (Back Surround)*/
14430 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14431 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
14432 /* set pin widget 18h (mic1) for output (CLFE)*/
14433 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14434 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
14435 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
14436 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
14438 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
14440 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14441 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
14446 static struct hda_channel_mode alc861_asus_modes[2] = {
14447 { 2, alc861_asus_ch2_init },
14448 { 6, alc861_asus_ch6_init },
14453 static struct snd_kcontrol_new alc861_base_mixer[] = {
14454 /* output mixer control */
14455 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14456 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14457 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14458 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14459 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
14461 /*Input mixer control */
14462 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14463 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14464 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14465 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14466 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14467 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14468 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14469 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14470 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14471 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14476 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
14477 /* output mixer control */
14478 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14479 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14480 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14481 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14482 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
14484 /* Input mixer control */
14485 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14486 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14487 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14488 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14489 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14490 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14491 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14492 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14493 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14494 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14497 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14498 .name = "Channel Mode",
14499 .info = alc_ch_mode_info,
14500 .get = alc_ch_mode_get,
14501 .put = alc_ch_mode_put,
14502 .private_value = ARRAY_SIZE(alc861_threestack_modes),
14507 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
14508 /* output mixer control */
14509 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14510 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14511 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14516 static struct snd_kcontrol_new alc861_uniwill_m31_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_uniwill_m31_modes),
14547 static struct snd_kcontrol_new alc861_asus_mixer[] = {
14548 /* output mixer control */
14549 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14550 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14551 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14552 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14553 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
14555 /* Input mixer control */
14556 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14557 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14558 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14559 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14560 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14561 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14562 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14563 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14564 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14565 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
14568 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14569 .name = "Channel Mode",
14570 .info = alc_ch_mode_info,
14571 .get = alc_ch_mode_get,
14572 .put = alc_ch_mode_put,
14573 .private_value = ARRAY_SIZE(alc861_asus_modes),
14578 /* additional mixer */
14579 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
14580 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14581 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14586 * generic initialization of ADC, input mixers and output mixers
14588 static struct hda_verb alc861_base_init_verbs[] = {
14590 * Unmute ADC0 and set the default input to mic-in
14592 /* port-A for surround (rear panel) */
14593 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14594 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
14595 /* port-B for mic-in (rear panel) with vref */
14596 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14597 /* port-C for line-in (rear panel) */
14598 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14599 /* port-D for Front */
14600 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14601 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14602 /* port-E for HP out (front panel) */
14603 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14604 /* route front PCM to HP */
14605 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14606 /* port-F for mic-in (front panel) with vref */
14607 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14608 /* port-G for CLFE (rear panel) */
14609 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14610 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14611 /* port-H for side (rear panel) */
14612 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14613 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
14615 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14616 /* route front mic to ADC1*/
14617 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14618 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14620 /* Unmute DAC0~3 & spdif out*/
14621 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14622 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14623 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14624 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14625 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14627 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14628 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14629 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14630 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14631 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14633 /* Unmute Stereo Mixer 15 */
14634 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14635 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14636 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14637 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14639 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14640 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14641 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14642 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14643 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14644 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14645 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14646 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14647 /* hp used DAC 3 (Front) */
14648 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14649 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14654 static struct hda_verb alc861_threestack_init_verbs[] = {
14656 * Unmute ADC0 and set the default input to mic-in
14658 /* port-A for surround (rear panel) */
14659 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14660 /* port-B for mic-in (rear panel) with vref */
14661 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14662 /* port-C for line-in (rear panel) */
14663 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14664 /* port-D for Front */
14665 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14666 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14667 /* port-E for HP out (front panel) */
14668 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14669 /* route front PCM to HP */
14670 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14671 /* port-F for mic-in (front panel) with vref */
14672 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14673 /* port-G for CLFE (rear panel) */
14674 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14675 /* port-H for side (rear panel) */
14676 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14678 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14679 /* route front mic to ADC1*/
14680 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14681 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14682 /* Unmute DAC0~3 & spdif out*/
14683 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14684 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14685 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14686 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14687 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14689 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14690 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14691 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14692 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14693 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14695 /* Unmute Stereo Mixer 15 */
14696 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14697 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14698 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14699 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14701 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14702 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14703 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14704 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14705 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14706 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14707 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14708 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14709 /* hp used DAC 3 (Front) */
14710 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14711 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14715 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
14717 * Unmute ADC0 and set the default input to mic-in
14719 /* port-A for surround (rear panel) */
14720 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14721 /* port-B for mic-in (rear panel) with vref */
14722 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14723 /* port-C for line-in (rear panel) */
14724 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14725 /* port-D for Front */
14726 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14727 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14728 /* port-E for HP out (front panel) */
14729 /* this has to be set to VREF80 */
14730 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14731 /* route front PCM to HP */
14732 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14733 /* port-F for mic-in (front panel) with vref */
14734 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14735 /* port-G for CLFE (rear panel) */
14736 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14737 /* port-H for side (rear panel) */
14738 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14740 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14741 /* route front mic to ADC1*/
14742 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14743 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14744 /* Unmute DAC0~3 & spdif out*/
14745 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14746 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14747 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14748 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14749 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14751 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14752 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14753 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14754 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14755 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14757 /* Unmute Stereo Mixer 15 */
14758 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14759 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14760 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14761 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14763 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14764 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14765 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14766 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14767 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14768 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14769 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14770 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14771 /* hp used DAC 3 (Front) */
14772 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14773 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14777 static struct hda_verb alc861_asus_init_verbs[] = {
14779 * Unmute ADC0 and set the default input to mic-in
14781 /* port-A for surround (rear panel)
14782 * according to codec#0 this is the HP jack
14784 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
14785 /* route front PCM to HP */
14786 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
14787 /* port-B for mic-in (rear panel) with vref */
14788 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14789 /* port-C for line-in (rear panel) */
14790 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14791 /* port-D for Front */
14792 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14793 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14794 /* port-E for HP out (front panel) */
14795 /* this has to be set to VREF80 */
14796 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14797 /* route front PCM to HP */
14798 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14799 /* port-F for mic-in (front panel) with vref */
14800 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14801 /* port-G for CLFE (rear panel) */
14802 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14803 /* port-H for side (rear panel) */
14804 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14806 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14807 /* route front mic to ADC1*/
14808 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14809 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14810 /* Unmute DAC0~3 & spdif out*/
14811 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14812 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14813 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14814 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14815 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14816 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14817 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14818 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14819 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14820 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14822 /* Unmute Stereo Mixer 15 */
14823 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14824 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14825 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14826 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14828 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14829 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14830 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14831 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14832 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14833 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14834 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14835 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14836 /* hp used DAC 3 (Front) */
14837 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14838 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14842 /* additional init verbs for ASUS laptops */
14843 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
14844 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
14845 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
14850 * generic initialization of ADC, input mixers and output mixers
14852 static struct hda_verb alc861_auto_init_verbs[] = {
14854 * Unmute ADC0 and set the default input to mic-in
14856 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
14857 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14859 /* Unmute DAC0~3 & spdif out*/
14860 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14861 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14862 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14863 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14864 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14866 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14867 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14868 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14869 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14870 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14872 /* Unmute Stereo Mixer 15 */
14873 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14874 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14875 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14876 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
14878 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14879 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14880 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14881 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14882 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14883 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14884 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14885 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14887 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14888 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14889 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14890 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14891 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14892 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14893 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14894 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14896 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
14901 static struct hda_verb alc861_toshiba_init_verbs[] = {
14902 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14907 /* toggle speaker-output according to the hp-jack state */
14908 static void alc861_toshiba_automute(struct hda_codec *codec)
14910 unsigned int present = snd_hda_jack_detect(codec, 0x0f);
14912 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
14913 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14914 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
14915 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
14918 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
14921 if ((res >> 26) == ALC880_HP_EVENT)
14922 alc861_toshiba_automute(codec);
14925 /* pcm configuration: identical with ALC880 */
14926 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
14927 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
14928 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
14929 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
14932 #define ALC861_DIGOUT_NID 0x07
14934 static struct hda_channel_mode alc861_8ch_modes[1] = {
14938 static hda_nid_t alc861_dac_nids[4] = {
14939 /* front, surround, clfe, side */
14940 0x03, 0x06, 0x05, 0x04
14943 static hda_nid_t alc660_dac_nids[3] = {
14944 /* front, clfe, surround */
14948 static hda_nid_t alc861_adc_nids[1] = {
14953 static struct hda_input_mux alc861_capture_source = {
14957 { "Front Mic", 0x3 },
14964 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
14966 struct alc_spec *spec = codec->spec;
14967 hda_nid_t mix, srcs[5];
14970 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
14972 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14975 for (i = 0; i < num; i++) {
14977 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
14978 if (type != AC_WID_AUD_OUT)
14980 for (j = 0; j < spec->multiout.num_dacs; j++)
14981 if (spec->multiout.dac_nids[j] == srcs[i])
14983 if (j >= spec->multiout.num_dacs)
14989 /* fill in the dac_nids table from the parsed pin configuration */
14990 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
14991 const struct auto_pin_cfg *cfg)
14993 struct alc_spec *spec = codec->spec;
14995 hda_nid_t nid, dac;
14997 spec->multiout.dac_nids = spec->private_dac_nids;
14998 for (i = 0; i < cfg->line_outs; i++) {
14999 nid = cfg->line_out_pins[i];
15000 dac = alc861_look_for_dac(codec, nid);
15003 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
15008 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
15009 hda_nid_t nid, unsigned int chs)
15011 return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx,
15012 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
15015 /* add playback controls from the parsed DAC table */
15016 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
15017 const struct auto_pin_cfg *cfg)
15019 struct alc_spec *spec = codec->spec;
15020 static const char *chname[4] = {
15021 "Front", "Surround", NULL /*CLFE*/, "Side"
15026 if (cfg->line_outs == 1) {
15027 const char *pfx = NULL;
15030 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
15033 nid = spec->multiout.dac_nids[0];
15034 return alc861_create_out_sw(codec, pfx, nid, 3);
15038 for (i = 0; i < cfg->line_outs; i++) {
15039 nid = spec->multiout.dac_nids[i];
15044 err = alc861_create_out_sw(codec, "Center", nid, 1);
15047 err = alc861_create_out_sw(codec, "LFE", nid, 2);
15051 err = alc861_create_out_sw(codec, chname[i], nid, 3);
15059 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
15061 struct alc_spec *spec = codec->spec;
15068 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
15069 nid = alc861_look_for_dac(codec, pin);
15071 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
15074 spec->multiout.hp_nid = nid;
15080 /* create playback/capture controls for input pins */
15081 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
15082 const struct auto_pin_cfg *cfg)
15084 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
15087 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
15089 int pin_type, hda_nid_t dac)
15091 hda_nid_t mix, srcs[5];
15094 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
15096 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15098 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
15100 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
15103 for (i = 0; i < num; i++) {
15105 if (srcs[i] == dac || srcs[i] == 0x15)
15106 mute = AMP_IN_UNMUTE(i);
15108 mute = AMP_IN_MUTE(i);
15109 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15114 static void alc861_auto_init_multi_out(struct hda_codec *codec)
15116 struct alc_spec *spec = codec->spec;
15119 for (i = 0; i < spec->autocfg.line_outs; i++) {
15120 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15121 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15123 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
15124 spec->multiout.dac_nids[i]);
15128 static void alc861_auto_init_hp_out(struct hda_codec *codec)
15130 struct alc_spec *spec = codec->spec;
15132 if (spec->autocfg.hp_outs)
15133 alc861_auto_set_output_and_unmute(codec,
15134 spec->autocfg.hp_pins[0],
15136 spec->multiout.hp_nid);
15137 if (spec->autocfg.speaker_outs)
15138 alc861_auto_set_output_and_unmute(codec,
15139 spec->autocfg.speaker_pins[0],
15141 spec->multiout.dac_nids[0]);
15144 static void alc861_auto_init_analog_input(struct hda_codec *codec)
15146 struct alc_spec *spec = codec->spec;
15149 for (i = 0; i < AUTO_PIN_LAST; i++) {
15150 hda_nid_t nid = spec->autocfg.input_pins[i];
15151 if (nid >= 0x0c && nid <= 0x11)
15152 alc_set_input_pin(codec, nid, i);
15156 /* parse the BIOS configuration and set up the alc_spec */
15157 /* return 1 if successful, 0 if the proper config is not found,
15158 * or a negative error code
15160 static int alc861_parse_auto_config(struct hda_codec *codec)
15162 struct alc_spec *spec = codec->spec;
15164 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
15166 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15170 if (!spec->autocfg.line_outs)
15171 return 0; /* can't find valid BIOS pin config */
15173 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
15176 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
15179 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
15182 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
15186 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15188 if (spec->autocfg.dig_outs)
15189 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
15191 if (spec->kctls.list)
15192 add_mixer(spec, spec->kctls.list);
15194 add_verb(spec, alc861_auto_init_verbs);
15196 spec->num_mux_defs = 1;
15197 spec->input_mux = &spec->private_imux[0];
15199 spec->adc_nids = alc861_adc_nids;
15200 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
15201 set_capture_mixer(codec);
15203 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0);
15208 /* additional initialization for auto-configuration model */
15209 static void alc861_auto_init(struct hda_codec *codec)
15211 struct alc_spec *spec = codec->spec;
15212 alc861_auto_init_multi_out(codec);
15213 alc861_auto_init_hp_out(codec);
15214 alc861_auto_init_analog_input(codec);
15215 if (spec->unsol_event)
15216 alc_inithook(codec);
15219 #ifdef CONFIG_SND_HDA_POWER_SAVE
15220 static struct hda_amp_list alc861_loopbacks[] = {
15221 { 0x15, HDA_INPUT, 0 },
15222 { 0x15, HDA_INPUT, 1 },
15223 { 0x15, HDA_INPUT, 2 },
15224 { 0x15, HDA_INPUT, 3 },
15231 * configuration and preset
15233 static const char *alc861_models[ALC861_MODEL_LAST] = {
15234 [ALC861_3ST] = "3stack",
15235 [ALC660_3ST] = "3stack-660",
15236 [ALC861_3ST_DIG] = "3stack-dig",
15237 [ALC861_6ST_DIG] = "6stack-dig",
15238 [ALC861_UNIWILL_M31] = "uniwill-m31",
15239 [ALC861_TOSHIBA] = "toshiba",
15240 [ALC861_ASUS] = "asus",
15241 [ALC861_ASUS_LAPTOP] = "asus-laptop",
15242 [ALC861_AUTO] = "auto",
15245 static struct snd_pci_quirk alc861_cfg_tbl[] = {
15246 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
15247 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
15248 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
15249 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
15250 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
15251 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
15252 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
15253 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
15254 * Any other models that need this preset?
15256 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
15257 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
15258 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
15259 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
15260 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
15261 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
15262 /* FIXME: the below seems conflict */
15263 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
15264 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
15265 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
15269 static struct alc_config_preset alc861_presets[] = {
15271 .mixers = { alc861_3ST_mixer },
15272 .init_verbs = { alc861_threestack_init_verbs },
15273 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15274 .dac_nids = alc861_dac_nids,
15275 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15276 .channel_mode = alc861_threestack_modes,
15278 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15279 .adc_nids = alc861_adc_nids,
15280 .input_mux = &alc861_capture_source,
15282 [ALC861_3ST_DIG] = {
15283 .mixers = { alc861_base_mixer },
15284 .init_verbs = { alc861_threestack_init_verbs },
15285 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15286 .dac_nids = alc861_dac_nids,
15287 .dig_out_nid = ALC861_DIGOUT_NID,
15288 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15289 .channel_mode = alc861_threestack_modes,
15291 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15292 .adc_nids = alc861_adc_nids,
15293 .input_mux = &alc861_capture_source,
15295 [ALC861_6ST_DIG] = {
15296 .mixers = { alc861_base_mixer },
15297 .init_verbs = { alc861_base_init_verbs },
15298 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15299 .dac_nids = alc861_dac_nids,
15300 .dig_out_nid = ALC861_DIGOUT_NID,
15301 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
15302 .channel_mode = alc861_8ch_modes,
15303 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15304 .adc_nids = alc861_adc_nids,
15305 .input_mux = &alc861_capture_source,
15308 .mixers = { alc861_3ST_mixer },
15309 .init_verbs = { alc861_threestack_init_verbs },
15310 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
15311 .dac_nids = alc660_dac_nids,
15312 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15313 .channel_mode = alc861_threestack_modes,
15315 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15316 .adc_nids = alc861_adc_nids,
15317 .input_mux = &alc861_capture_source,
15319 [ALC861_UNIWILL_M31] = {
15320 .mixers = { alc861_uniwill_m31_mixer },
15321 .init_verbs = { alc861_uniwill_m31_init_verbs },
15322 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15323 .dac_nids = alc861_dac_nids,
15324 .dig_out_nid = ALC861_DIGOUT_NID,
15325 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
15326 .channel_mode = alc861_uniwill_m31_modes,
15328 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15329 .adc_nids = alc861_adc_nids,
15330 .input_mux = &alc861_capture_source,
15332 [ALC861_TOSHIBA] = {
15333 .mixers = { alc861_toshiba_mixer },
15334 .init_verbs = { alc861_base_init_verbs,
15335 alc861_toshiba_init_verbs },
15336 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15337 .dac_nids = alc861_dac_nids,
15338 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
15339 .channel_mode = alc883_3ST_2ch_modes,
15340 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15341 .adc_nids = alc861_adc_nids,
15342 .input_mux = &alc861_capture_source,
15343 .unsol_event = alc861_toshiba_unsol_event,
15344 .init_hook = alc861_toshiba_automute,
15347 .mixers = { alc861_asus_mixer },
15348 .init_verbs = { alc861_asus_init_verbs },
15349 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15350 .dac_nids = alc861_dac_nids,
15351 .dig_out_nid = ALC861_DIGOUT_NID,
15352 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
15353 .channel_mode = alc861_asus_modes,
15356 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15357 .adc_nids = alc861_adc_nids,
15358 .input_mux = &alc861_capture_source,
15360 [ALC861_ASUS_LAPTOP] = {
15361 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
15362 .init_verbs = { alc861_asus_init_verbs,
15363 alc861_asus_laptop_init_verbs },
15364 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15365 .dac_nids = alc861_dac_nids,
15366 .dig_out_nid = ALC861_DIGOUT_NID,
15367 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
15368 .channel_mode = alc883_3ST_2ch_modes,
15370 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15371 .adc_nids = alc861_adc_nids,
15372 .input_mux = &alc861_capture_source,
15376 /* Pin config fixes */
15378 PINFIX_FSC_AMILO_PI1505,
15381 static struct alc_pincfg alc861_fsc_amilo_pi1505_pinfix[] = {
15382 { 0x0b, 0x0221101f }, /* HP */
15383 { 0x0f, 0x90170310 }, /* speaker */
15387 static const struct alc_fixup alc861_fixups[] = {
15388 [PINFIX_FSC_AMILO_PI1505] = {
15389 .pins = alc861_fsc_amilo_pi1505_pinfix
15393 static struct snd_pci_quirk alc861_fixup_tbl[] = {
15394 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
15398 static int patch_alc861(struct hda_codec *codec)
15400 struct alc_spec *spec;
15404 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15408 codec->spec = spec;
15410 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
15414 if (board_config < 0) {
15415 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15417 board_config = ALC861_AUTO;
15420 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups);
15422 if (board_config == ALC861_AUTO) {
15423 /* automatic parse from the BIOS config */
15424 err = alc861_parse_auto_config(codec);
15430 "hda_codec: Cannot set up configuration "
15431 "from BIOS. Using base mode...\n");
15432 board_config = ALC861_3ST_DIG;
15436 err = snd_hda_attach_beep_device(codec, 0x23);
15442 if (board_config != ALC861_AUTO)
15443 setup_preset(codec, &alc861_presets[board_config]);
15445 spec->stream_analog_playback = &alc861_pcm_analog_playback;
15446 spec->stream_analog_capture = &alc861_pcm_analog_capture;
15448 spec->stream_digital_playback = &alc861_pcm_digital_playback;
15449 spec->stream_digital_capture = &alc861_pcm_digital_capture;
15451 if (!spec->cap_mixer)
15452 set_capture_mixer(codec);
15453 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
15455 spec->vmaster_nid = 0x03;
15457 codec->patch_ops = alc_patch_ops;
15458 if (board_config == ALC861_AUTO) {
15459 spec->init_hook = alc861_auto_init;
15460 #ifdef CONFIG_SND_HDA_POWER_SAVE
15461 spec->power_hook = alc_power_eapd;
15464 #ifdef CONFIG_SND_HDA_POWER_SAVE
15465 if (!spec->loopback.amplist)
15466 spec->loopback.amplist = alc861_loopbacks;
15473 * ALC861-VD support
15477 * In addition, an independent DAC
15479 #define ALC861VD_DIGOUT_NID 0x06
15481 static hda_nid_t alc861vd_dac_nids[4] = {
15482 /* front, surr, clfe, side surr */
15483 0x02, 0x03, 0x04, 0x05
15486 /* dac_nids for ALC660vd are in a different order - according to
15487 * Realtek's driver.
15488 * This should probably result in a different mixer for 6stack models
15489 * of ALC660vd codecs, but for now there is only 3stack mixer
15490 * - and it is the same as in 861vd.
15491 * adc_nids in ALC660vd are (is) the same as in 861vd
15493 static hda_nid_t alc660vd_dac_nids[3] = {
15494 /* front, rear, clfe, rear_surr */
15498 static hda_nid_t alc861vd_adc_nids[1] = {
15503 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
15506 /* FIXME: should be a matrix-type input source selection */
15507 static struct hda_input_mux alc861vd_capture_source = {
15511 { "Front Mic", 0x1 },
15517 static struct hda_input_mux alc861vd_dallas_capture_source = {
15520 { "Ext Mic", 0x0 },
15521 { "Int Mic", 0x1 },
15525 static struct hda_input_mux alc861vd_hp_capture_source = {
15528 { "Front Mic", 0x0 },
15529 { "ATAPI Mic", 0x1 },
15536 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
15543 static struct hda_verb alc861vd_6stack_ch6_init[] = {
15544 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15545 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15546 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15547 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15554 static struct hda_verb alc861vd_6stack_ch8_init[] = {
15555 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15556 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15557 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15558 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15562 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
15563 { 6, alc861vd_6stack_ch6_init },
15564 { 8, alc861vd_6stack_ch8_init },
15567 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
15569 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15570 .name = "Channel Mode",
15571 .info = alc_ch_mode_info,
15572 .get = alc_ch_mode_get,
15573 .put = alc_ch_mode_put,
15578 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15579 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15581 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
15582 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15583 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15585 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15586 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
15588 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
15590 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
15592 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
15593 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
15595 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
15596 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
15598 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15600 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15601 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15602 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15604 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15605 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15606 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15608 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15609 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15611 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15612 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15617 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
15618 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15619 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15621 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15623 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15624 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15625 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15627 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15628 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15629 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15631 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15632 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15634 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15635 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15640 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
15641 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15642 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
15643 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15645 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15647 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15648 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15649 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15651 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15652 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15653 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, 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 /* Pin assignment: Speaker=0x14, HP = 0x15,
15662 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
15664 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
15665 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15666 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
15667 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15668 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15669 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
15670 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15671 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15672 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
15673 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15674 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15678 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
15679 * Front Mic=0x18, ATAPI Mic = 0x19,
15681 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
15682 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15683 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15684 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15685 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15686 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15687 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15688 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15689 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15695 * generic initialization of ADC, input mixers and output mixers
15697 static struct hda_verb alc861vd_volume_init_verbs[] = {
15699 * Unmute ADC0 and set the default input to mic-in
15701 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15702 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15704 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
15705 * the analog-loopback mixer widget
15707 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15708 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15709 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15710 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15711 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15712 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15714 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
15715 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15716 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15717 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15718 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15721 * Set up output mixers (0x02 - 0x05)
15723 /* set vol=0 to output mixers */
15724 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15725 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15726 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15727 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15729 /* set up input amps for analog loopback */
15730 /* Amp Indices: DAC = 0, mixer = 1 */
15731 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15732 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15733 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15734 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15735 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15736 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15737 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15738 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15744 * 3-stack pin configuration:
15745 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
15747 static struct hda_verb alc861vd_3stack_init_verbs[] = {
15749 * Set pin mode and muting
15751 /* set front pin widgets 0x14 for output */
15752 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15753 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15754 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15756 /* Mic (rear) pin: input vref at 80% */
15757 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15758 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15759 /* Front Mic pin: input vref at 80% */
15760 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15761 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15762 /* Line In pin: input */
15763 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15764 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15765 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15766 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15767 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15768 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15769 /* CD pin widget for input */
15770 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15776 * 6-stack pin configuration:
15778 static struct hda_verb alc861vd_6stack_init_verbs[] = {
15780 * Set pin mode and muting
15782 /* set front pin widgets 0x14 for output */
15783 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15784 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15785 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15787 /* Rear Pin: output 1 (0x0d) */
15788 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15789 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15790 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
15791 /* CLFE Pin: output 2 (0x0e) */
15792 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15793 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15794 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
15795 /* Side Pin: output 3 (0x0f) */
15796 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15797 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15798 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
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},
15819 static struct hda_verb alc861vd_eapd_verbs[] = {
15820 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15824 static struct hda_verb alc660vd_eapd_verbs[] = {
15825 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15826 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15830 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
15831 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15832 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15833 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
15834 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15835 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15839 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
15841 unsigned int present;
15842 unsigned char bits;
15844 present = snd_hda_jack_detect(codec, 0x18);
15845 bits = present ? HDA_AMP_MUTE : 0;
15847 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
15848 HDA_AMP_MUTE, bits);
15851 static void alc861vd_lenovo_setup(struct hda_codec *codec)
15853 struct alc_spec *spec = codec->spec;
15854 spec->autocfg.hp_pins[0] = 0x1b;
15855 spec->autocfg.speaker_pins[0] = 0x14;
15858 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
15860 alc_automute_amp(codec);
15861 alc861vd_lenovo_mic_automute(codec);
15864 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
15867 switch (res >> 26) {
15868 case ALC880_MIC_EVENT:
15869 alc861vd_lenovo_mic_automute(codec);
15872 alc_automute_amp_unsol_event(codec, res);
15877 static struct hda_verb alc861vd_dallas_verbs[] = {
15878 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15879 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15880 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15881 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15883 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15884 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15885 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15886 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15887 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15888 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15889 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15890 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15892 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15893 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15894 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15895 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15896 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15897 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15898 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15899 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15901 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15902 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15903 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15904 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15905 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15906 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15907 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15908 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15910 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15911 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15912 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15913 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15915 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15916 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15917 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15922 /* toggle speaker-output according to the hp-jack state */
15923 static void alc861vd_dallas_setup(struct hda_codec *codec)
15925 struct alc_spec *spec = codec->spec;
15927 spec->autocfg.hp_pins[0] = 0x15;
15928 spec->autocfg.speaker_pins[0] = 0x14;
15931 #ifdef CONFIG_SND_HDA_POWER_SAVE
15932 #define alc861vd_loopbacks alc880_loopbacks
15935 /* pcm configuration: identical with ALC880 */
15936 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
15937 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
15938 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
15939 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
15942 * configuration and preset
15944 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
15945 [ALC660VD_3ST] = "3stack-660",
15946 [ALC660VD_3ST_DIG] = "3stack-660-digout",
15947 [ALC660VD_ASUS_V1S] = "asus-v1s",
15948 [ALC861VD_3ST] = "3stack",
15949 [ALC861VD_3ST_DIG] = "3stack-digout",
15950 [ALC861VD_6ST_DIG] = "6stack-digout",
15951 [ALC861VD_LENOVO] = "lenovo",
15952 [ALC861VD_DALLAS] = "dallas",
15953 [ALC861VD_HP] = "hp",
15954 [ALC861VD_AUTO] = "auto",
15957 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
15958 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
15959 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
15960 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
15961 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
15962 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
15963 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
15964 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
15965 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
15966 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
15967 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
15968 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
15969 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
15970 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
15971 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
15972 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
15976 static struct alc_config_preset alc861vd_presets[] = {
15978 .mixers = { alc861vd_3st_mixer },
15979 .init_verbs = { alc861vd_volume_init_verbs,
15980 alc861vd_3stack_init_verbs },
15981 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15982 .dac_nids = alc660vd_dac_nids,
15983 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15984 .channel_mode = alc861vd_3stack_2ch_modes,
15985 .input_mux = &alc861vd_capture_source,
15987 [ALC660VD_3ST_DIG] = {
15988 .mixers = { alc861vd_3st_mixer },
15989 .init_verbs = { alc861vd_volume_init_verbs,
15990 alc861vd_3stack_init_verbs },
15991 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15992 .dac_nids = alc660vd_dac_nids,
15993 .dig_out_nid = ALC861VD_DIGOUT_NID,
15994 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15995 .channel_mode = alc861vd_3stack_2ch_modes,
15996 .input_mux = &alc861vd_capture_source,
15999 .mixers = { alc861vd_3st_mixer },
16000 .init_verbs = { alc861vd_volume_init_verbs,
16001 alc861vd_3stack_init_verbs },
16002 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16003 .dac_nids = alc861vd_dac_nids,
16004 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16005 .channel_mode = alc861vd_3stack_2ch_modes,
16006 .input_mux = &alc861vd_capture_source,
16008 [ALC861VD_3ST_DIG] = {
16009 .mixers = { alc861vd_3st_mixer },
16010 .init_verbs = { alc861vd_volume_init_verbs,
16011 alc861vd_3stack_init_verbs },
16012 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16013 .dac_nids = alc861vd_dac_nids,
16014 .dig_out_nid = ALC861VD_DIGOUT_NID,
16015 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16016 .channel_mode = alc861vd_3stack_2ch_modes,
16017 .input_mux = &alc861vd_capture_source,
16019 [ALC861VD_6ST_DIG] = {
16020 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
16021 .init_verbs = { alc861vd_volume_init_verbs,
16022 alc861vd_6stack_init_verbs },
16023 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16024 .dac_nids = alc861vd_dac_nids,
16025 .dig_out_nid = ALC861VD_DIGOUT_NID,
16026 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
16027 .channel_mode = alc861vd_6stack_modes,
16028 .input_mux = &alc861vd_capture_source,
16030 [ALC861VD_LENOVO] = {
16031 .mixers = { alc861vd_lenovo_mixer },
16032 .init_verbs = { alc861vd_volume_init_verbs,
16033 alc861vd_3stack_init_verbs,
16034 alc861vd_eapd_verbs,
16035 alc861vd_lenovo_unsol_verbs },
16036 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16037 .dac_nids = alc660vd_dac_nids,
16038 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16039 .channel_mode = alc861vd_3stack_2ch_modes,
16040 .input_mux = &alc861vd_capture_source,
16041 .unsol_event = alc861vd_lenovo_unsol_event,
16042 .setup = alc861vd_lenovo_setup,
16043 .init_hook = alc861vd_lenovo_init_hook,
16045 [ALC861VD_DALLAS] = {
16046 .mixers = { alc861vd_dallas_mixer },
16047 .init_verbs = { alc861vd_dallas_verbs },
16048 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16049 .dac_nids = alc861vd_dac_nids,
16050 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16051 .channel_mode = alc861vd_3stack_2ch_modes,
16052 .input_mux = &alc861vd_dallas_capture_source,
16053 .unsol_event = alc_automute_amp_unsol_event,
16054 .setup = alc861vd_dallas_setup,
16055 .init_hook = alc_automute_amp,
16058 .mixers = { alc861vd_hp_mixer },
16059 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
16060 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16061 .dac_nids = alc861vd_dac_nids,
16062 .dig_out_nid = ALC861VD_DIGOUT_NID,
16063 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16064 .channel_mode = alc861vd_3stack_2ch_modes,
16065 .input_mux = &alc861vd_hp_capture_source,
16066 .unsol_event = alc_automute_amp_unsol_event,
16067 .setup = alc861vd_dallas_setup,
16068 .init_hook = alc_automute_amp,
16070 [ALC660VD_ASUS_V1S] = {
16071 .mixers = { alc861vd_lenovo_mixer },
16072 .init_verbs = { alc861vd_volume_init_verbs,
16073 alc861vd_3stack_init_verbs,
16074 alc861vd_eapd_verbs,
16075 alc861vd_lenovo_unsol_verbs },
16076 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16077 .dac_nids = alc660vd_dac_nids,
16078 .dig_out_nid = ALC861VD_DIGOUT_NID,
16079 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16080 .channel_mode = alc861vd_3stack_2ch_modes,
16081 .input_mux = &alc861vd_capture_source,
16082 .unsol_event = alc861vd_lenovo_unsol_event,
16083 .setup = alc861vd_lenovo_setup,
16084 .init_hook = alc861vd_lenovo_init_hook,
16089 * BIOS auto configuration
16091 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
16092 const struct auto_pin_cfg *cfg)
16094 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0);
16098 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
16099 hda_nid_t nid, int pin_type, int dac_idx)
16101 alc_set_pin_output(codec, nid, pin_type);
16104 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
16106 struct alc_spec *spec = codec->spec;
16109 for (i = 0; i <= HDA_SIDE; i++) {
16110 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16111 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16113 alc861vd_auto_set_output_and_unmute(codec, nid,
16119 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
16121 struct alc_spec *spec = codec->spec;
16124 pin = spec->autocfg.hp_pins[0];
16125 if (pin) /* connect to front and use dac 0 */
16126 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
16127 pin = spec->autocfg.speaker_pins[0];
16129 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
16132 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
16134 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
16136 struct alc_spec *spec = codec->spec;
16139 for (i = 0; i < AUTO_PIN_LAST; i++) {
16140 hda_nid_t nid = spec->autocfg.input_pins[i];
16141 if (alc_is_input_pin(codec, nid)) {
16142 alc_set_input_pin(codec, nid, i);
16143 if (nid != ALC861VD_PIN_CD_NID &&
16144 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
16145 snd_hda_codec_write(codec, nid, 0,
16146 AC_VERB_SET_AMP_GAIN_MUTE,
16152 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
16154 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
16155 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
16157 /* add playback controls from the parsed DAC table */
16158 /* Based on ALC880 version. But ALC861VD has separate,
16159 * different NIDs for mute/unmute switch and volume control */
16160 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
16161 const struct auto_pin_cfg *cfg)
16163 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
16164 hda_nid_t nid_v, nid_s;
16167 for (i = 0; i < cfg->line_outs; i++) {
16168 if (!spec->multiout.dac_nids[i])
16170 nid_v = alc861vd_idx_to_mixer_vol(
16172 spec->multiout.dac_nids[i]));
16173 nid_s = alc861vd_idx_to_mixer_switch(
16175 spec->multiout.dac_nids[i]));
16179 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
16181 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
16185 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
16187 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
16191 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
16193 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
16197 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
16199 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
16205 if (cfg->line_outs == 1 &&
16206 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
16213 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
16214 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
16218 if (cfg->line_outs == 1 &&
16219 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
16221 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
16222 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
16231 /* add playback controls for speaker and HP outputs */
16232 /* Based on ALC880 version. But ALC861VD has separate,
16233 * different NIDs for mute/unmute switch and volume control */
16234 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
16235 hda_nid_t pin, const char *pfx)
16237 hda_nid_t nid_v, nid_s;
16243 if (alc880_is_fixed_pin(pin)) {
16244 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16245 /* specify the DAC as the extra output */
16246 if (!spec->multiout.hp_nid)
16247 spec->multiout.hp_nid = nid_v;
16249 spec->multiout.extra_out_nid[0] = nid_v;
16250 /* control HP volume/switch on the output mixer amp */
16251 nid_v = alc861vd_idx_to_mixer_vol(
16252 alc880_fixed_pin_idx(pin));
16253 nid_s = alc861vd_idx_to_mixer_switch(
16254 alc880_fixed_pin_idx(pin));
16256 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
16257 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
16260 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
16261 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
16264 } else if (alc880_is_multi_pin(pin)) {
16265 /* set manual connection */
16266 /* we have only a switch on HP-out PIN */
16267 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
16268 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
16275 /* parse the BIOS configuration and set up the alc_spec
16276 * return 1 if successful, 0 if the proper config is not found,
16277 * or a negative error code
16278 * Based on ALC880 version - had to change it to override
16279 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
16280 static int alc861vd_parse_auto_config(struct hda_codec *codec)
16282 struct alc_spec *spec = codec->spec;
16284 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
16286 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16290 if (!spec->autocfg.line_outs)
16291 return 0; /* can't find valid BIOS pin config */
16293 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
16296 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
16299 err = alc861vd_auto_create_extra_out(spec,
16300 spec->autocfg.speaker_pins[0],
16304 err = alc861vd_auto_create_extra_out(spec,
16305 spec->autocfg.hp_pins[0],
16309 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
16313 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16315 if (spec->autocfg.dig_outs)
16316 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
16318 if (spec->kctls.list)
16319 add_mixer(spec, spec->kctls.list);
16321 add_verb(spec, alc861vd_volume_init_verbs);
16323 spec->num_mux_defs = 1;
16324 spec->input_mux = &spec->private_imux[0];
16326 err = alc_auto_add_mic_boost(codec);
16330 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
16335 /* additional initialization for auto-configuration model */
16336 static void alc861vd_auto_init(struct hda_codec *codec)
16338 struct alc_spec *spec = codec->spec;
16339 alc861vd_auto_init_multi_out(codec);
16340 alc861vd_auto_init_hp_out(codec);
16341 alc861vd_auto_init_analog_input(codec);
16342 alc861vd_auto_init_input_src(codec);
16343 if (spec->unsol_event)
16344 alc_inithook(codec);
16348 ALC660VD_FIX_ASUS_GPIO1
16352 static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = {
16353 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
16354 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
16355 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
16359 static const struct alc_fixup alc861vd_fixups[] = {
16360 [ALC660VD_FIX_ASUS_GPIO1] = {
16361 .verbs = alc660vd_fix_asus_gpio1_verbs,
16365 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
16366 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
16370 static int patch_alc861vd(struct hda_codec *codec)
16372 struct alc_spec *spec;
16373 int err, board_config;
16375 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16379 codec->spec = spec;
16381 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
16385 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
16386 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
16388 board_config = ALC861VD_AUTO;
16391 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups);
16393 if (board_config == ALC861VD_AUTO) {
16394 /* automatic parse from the BIOS config */
16395 err = alc861vd_parse_auto_config(codec);
16401 "hda_codec: Cannot set up configuration "
16402 "from BIOS. Using base mode...\n");
16403 board_config = ALC861VD_3ST;
16407 err = snd_hda_attach_beep_device(codec, 0x23);
16413 if (board_config != ALC861VD_AUTO)
16414 setup_preset(codec, &alc861vd_presets[board_config]);
16416 if (codec->vendor_id == 0x10ec0660) {
16417 /* always turn on EAPD */
16418 add_verb(spec, alc660vd_eapd_verbs);
16421 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
16422 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
16424 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
16425 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
16427 if (!spec->adc_nids) {
16428 spec->adc_nids = alc861vd_adc_nids;
16429 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
16431 if (!spec->capsrc_nids)
16432 spec->capsrc_nids = alc861vd_capsrc_nids;
16434 set_capture_mixer(codec);
16435 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
16437 spec->vmaster_nid = 0x02;
16439 codec->patch_ops = alc_patch_ops;
16441 if (board_config == ALC861VD_AUTO)
16442 spec->init_hook = alc861vd_auto_init;
16443 #ifdef CONFIG_SND_HDA_POWER_SAVE
16444 if (!spec->loopback.amplist)
16445 spec->loopback.amplist = alc861vd_loopbacks;
16454 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
16455 * configuration. Each pin widget can choose any input DACs and a mixer.
16456 * Each ADC is connected from a mixer of all inputs. This makes possible
16457 * 6-channel independent captures.
16459 * In addition, an independent DAC for the multi-playback (not used in this
16462 #define ALC662_DIGOUT_NID 0x06
16463 #define ALC662_DIGIN_NID 0x0a
16465 static hda_nid_t alc662_dac_nids[4] = {
16466 /* front, rear, clfe, rear_surr */
16470 static hda_nid_t alc272_dac_nids[2] = {
16474 static hda_nid_t alc662_adc_nids[2] = {
16479 static hda_nid_t alc272_adc_nids[1] = {
16484 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
16485 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
16489 /* FIXME: should be a matrix-type input source selection */
16490 static struct hda_input_mux alc662_capture_source = {
16494 { "Front Mic", 0x1 },
16500 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
16508 static struct hda_input_mux alc663_capture_source = {
16512 { "Front Mic", 0x1 },
16517 #if 0 /* set to 1 for testing other input sources below */
16518 static struct hda_input_mux alc272_nc10_capture_source = {
16521 { "Autoselect Mic", 0x0 },
16522 { "Internal Mic", 0x1 },
16523 { "In-0x02", 0x2 },
16524 { "In-0x03", 0x3 },
16525 { "In-0x04", 0x4 },
16526 { "In-0x05", 0x5 },
16527 { "In-0x06", 0x6 },
16528 { "In-0x07", 0x7 },
16529 { "In-0x08", 0x8 },
16530 { "In-0x09", 0x9 },
16531 { "In-0x0a", 0x0a },
16532 { "In-0x0b", 0x0b },
16533 { "In-0x0c", 0x0c },
16534 { "In-0x0d", 0x0d },
16535 { "In-0x0e", 0x0e },
16536 { "In-0x0f", 0x0f },
16544 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
16551 static struct hda_verb alc662_3ST_ch2_init[] = {
16552 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
16553 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
16554 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
16555 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
16562 static struct hda_verb alc662_3ST_ch6_init[] = {
16563 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16564 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
16565 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
16566 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16567 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
16568 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
16572 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
16573 { 2, alc662_3ST_ch2_init },
16574 { 6, alc662_3ST_ch6_init },
16580 static struct hda_verb alc662_sixstack_ch6_init[] = {
16581 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16582 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16583 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16590 static struct hda_verb alc662_sixstack_ch8_init[] = {
16591 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16592 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16593 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16597 static struct hda_channel_mode alc662_5stack_modes[2] = {
16598 { 2, alc662_sixstack_ch6_init },
16599 { 6, alc662_sixstack_ch8_init },
16602 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16603 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16606 static struct snd_kcontrol_new alc662_base_mixer[] = {
16607 /* output mixer control */
16608 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
16609 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16610 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
16611 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16612 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16613 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16614 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16615 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16616 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16618 /*Input mixer control */
16619 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
16620 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
16621 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
16622 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
16623 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
16624 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
16625 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
16626 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
16630 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
16631 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16632 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16633 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16634 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16635 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16636 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16637 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16638 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16639 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16640 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16641 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16645 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
16646 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16647 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16648 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16649 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16650 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16651 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16652 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16653 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16654 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16655 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16656 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16657 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16658 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16659 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16660 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16661 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16662 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16666 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
16667 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16668 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
16669 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16670 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
16671 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16672 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16673 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16674 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16675 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16679 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
16680 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16681 ALC262_HIPPO_MASTER_SWITCH,
16683 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
16684 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16685 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16687 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16688 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16689 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16693 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
16694 ALC262_HIPPO_MASTER_SWITCH,
16695 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16696 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16697 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16698 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16699 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
16700 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16701 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16702 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16703 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16707 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
16708 .ops = &snd_hda_bind_vol,
16710 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16711 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
16716 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
16717 .ops = &snd_hda_bind_sw,
16719 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16720 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16725 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
16726 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16727 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
16728 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16729 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16733 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
16734 .ops = &snd_hda_bind_sw,
16736 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16737 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16738 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16743 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
16744 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16745 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
16746 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16747 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16748 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16749 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16754 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
16755 .ops = &snd_hda_bind_sw,
16757 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16758 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16759 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16764 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
16765 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16766 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
16767 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16768 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16769 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16770 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16774 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
16775 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16776 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16777 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16778 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16779 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16780 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16781 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16785 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
16786 .ops = &snd_hda_bind_vol,
16788 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16789 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
16794 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
16795 .ops = &snd_hda_bind_sw,
16797 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16798 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
16803 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
16804 HDA_BIND_VOL("Master Playback Volume",
16805 &alc663_asus_two_bind_master_vol),
16806 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16807 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16808 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16809 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16810 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16814 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
16815 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16816 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16817 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16818 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16819 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16820 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16824 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
16825 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16826 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16827 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16828 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16829 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16831 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16832 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16833 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16834 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16838 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
16839 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16840 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16841 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16843 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16844 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16845 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16846 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16847 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16848 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16852 static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
16853 .ops = &snd_hda_bind_sw,
16855 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16856 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16857 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16858 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16859 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16864 static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
16865 .ops = &snd_hda_bind_sw,
16867 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16868 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16873 static struct snd_kcontrol_new alc663_mode7_mixer[] = {
16874 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16875 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16876 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16877 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16878 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16879 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16880 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16881 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16882 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16886 static struct snd_kcontrol_new alc663_mode8_mixer[] = {
16887 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16888 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16889 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16890 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16891 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16892 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16893 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16898 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
16900 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16901 .name = "Channel Mode",
16902 .info = alc_ch_mode_info,
16903 .get = alc_ch_mode_get,
16904 .put = alc_ch_mode_put,
16909 static struct hda_verb alc662_init_verbs[] = {
16910 /* ADC: mute amp left and right */
16911 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16912 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16914 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16915 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16916 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16917 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16918 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16919 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16921 /* Front Pin: output 0 (0x0c) */
16922 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16923 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16925 /* Rear Pin: output 1 (0x0d) */
16926 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16927 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16929 /* CLFE Pin: output 2 (0x0e) */
16930 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16931 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16933 /* Mic (rear) pin: input vref at 80% */
16934 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16935 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16936 /* Front Mic pin: input vref at 80% */
16937 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16938 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16939 /* Line In pin: input */
16940 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16941 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16942 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16943 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16944 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16945 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16946 /* CD pin widget for input */
16947 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16949 /* FIXME: use matrix-type input source selection */
16950 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16952 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16953 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16955 /* always trun on EAPD */
16956 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16957 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16962 static struct hda_verb alc663_init_verbs[] = {
16963 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16964 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16965 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16966 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16967 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16968 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16972 static struct hda_verb alc272_init_verbs[] = {
16973 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16974 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16975 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16976 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16977 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16978 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16979 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16980 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16984 static struct hda_verb alc662_sue_init_verbs[] = {
16985 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16986 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16990 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
16991 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16992 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16996 /* Set Unsolicited Event*/
16997 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
16998 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16999 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17003 static struct hda_verb alc663_m51va_init_verbs[] = {
17004 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17005 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17006 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17007 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17008 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17009 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17010 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17011 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17012 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17016 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
17017 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17018 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17019 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17020 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17021 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17022 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17023 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17027 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
17028 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17029 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17030 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17031 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17032 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17033 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17034 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17035 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17039 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
17040 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17041 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17042 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17043 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17044 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17045 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17046 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17050 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
17051 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17052 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17053 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17054 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
17055 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17056 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17057 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
17058 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17059 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17060 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17061 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17062 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17066 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
17067 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17068 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17069 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17070 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17071 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17072 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17073 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17074 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17075 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17076 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17077 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17078 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17082 static struct hda_verb alc663_g71v_init_verbs[] = {
17083 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17084 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
17085 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
17087 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17088 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17089 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17091 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
17092 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
17093 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
17097 static struct hda_verb alc663_g50v_init_verbs[] = {
17098 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17099 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17100 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17102 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17103 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17107 static struct hda_verb alc662_ecs_init_verbs[] = {
17108 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
17109 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17110 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17111 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17115 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
17116 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17117 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17118 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17119 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17120 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17121 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17122 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17123 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17124 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17125 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17126 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17130 static struct hda_verb alc272_dell_init_verbs[] = {
17131 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17132 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17133 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17134 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
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, 0x01}, /* Headphone */
17138 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17139 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
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_mode7_init_verbs[] = {
17146 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17147 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17148 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17149 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17150 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17151 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17152 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
17153 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17154 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17155 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17156 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17157 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17158 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17159 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17160 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17164 static struct hda_verb alc663_mode8_init_verbs[] = {
17165 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17166 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17167 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17168 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
17169 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17170 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17171 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17172 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17173 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17174 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17175 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17176 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17177 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17178 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17179 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17180 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17184 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
17185 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
17186 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
17190 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
17191 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
17192 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
17196 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
17198 unsigned int present;
17199 unsigned char bits;
17201 present = snd_hda_jack_detect(codec, 0x14);
17202 bits = present ? HDA_AMP_MUTE : 0;
17204 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17205 HDA_AMP_MUTE, bits);
17208 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
17210 unsigned int present;
17211 unsigned char bits;
17213 present = snd_hda_jack_detect(codec, 0x1b);
17214 bits = present ? HDA_AMP_MUTE : 0;
17216 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17217 HDA_AMP_MUTE, bits);
17218 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17219 HDA_AMP_MUTE, bits);
17222 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
17225 if ((res >> 26) == ALC880_HP_EVENT)
17226 alc662_lenovo_101e_all_automute(codec);
17227 if ((res >> 26) == ALC880_FRONT_EVENT)
17228 alc662_lenovo_101e_ispeaker_automute(codec);
17231 /* unsolicited event for HP jack sensing */
17232 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
17235 if ((res >> 26) == ALC880_MIC_EVENT)
17236 alc_mic_automute(codec);
17238 alc262_hippo_unsol_event(codec, res);
17241 static void alc662_eeepc_setup(struct hda_codec *codec)
17243 struct alc_spec *spec = codec->spec;
17245 alc262_hippo1_setup(codec);
17246 spec->ext_mic.pin = 0x18;
17247 spec->ext_mic.mux_idx = 0;
17248 spec->int_mic.pin = 0x19;
17249 spec->int_mic.mux_idx = 1;
17250 spec->auto_mic = 1;
17253 static void alc662_eeepc_inithook(struct hda_codec *codec)
17255 alc262_hippo_automute(codec);
17256 alc_mic_automute(codec);
17259 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
17261 struct alc_spec *spec = codec->spec;
17263 spec->autocfg.hp_pins[0] = 0x14;
17264 spec->autocfg.speaker_pins[0] = 0x1b;
17267 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
17269 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
17271 unsigned int present;
17272 unsigned char bits;
17274 present = snd_hda_jack_detect(codec, 0x21);
17275 bits = present ? HDA_AMP_MUTE : 0;
17276 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17277 HDA_AMP_MUTE, bits);
17278 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17279 HDA_AMP_MUTE, bits);
17282 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
17284 unsigned int present;
17285 unsigned char bits;
17287 present = snd_hda_jack_detect(codec, 0x21);
17288 bits = present ? HDA_AMP_MUTE : 0;
17289 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17290 HDA_AMP_MUTE, bits);
17291 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17292 HDA_AMP_MUTE, bits);
17293 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
17294 HDA_AMP_MUTE, bits);
17295 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
17296 HDA_AMP_MUTE, bits);
17299 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
17301 unsigned int present;
17302 unsigned char bits;
17304 present = snd_hda_jack_detect(codec, 0x15);
17305 bits = present ? HDA_AMP_MUTE : 0;
17306 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17307 HDA_AMP_MUTE, bits);
17308 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17309 HDA_AMP_MUTE, bits);
17310 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
17311 HDA_AMP_MUTE, bits);
17312 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
17313 HDA_AMP_MUTE, bits);
17316 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
17318 unsigned int present;
17319 unsigned char bits;
17321 present = snd_hda_jack_detect(codec, 0x1b);
17322 bits = present ? 0 : PIN_OUT;
17323 snd_hda_codec_write(codec, 0x14, 0,
17324 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
17327 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
17329 unsigned int present1, present2;
17331 present1 = snd_hda_jack_detect(codec, 0x21);
17332 present2 = snd_hda_jack_detect(codec, 0x15);
17334 if (present1 || present2) {
17335 snd_hda_codec_write_cache(codec, 0x14, 0,
17336 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17338 snd_hda_codec_write_cache(codec, 0x14, 0,
17339 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17343 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
17345 unsigned int present1, present2;
17347 present1 = snd_hda_jack_detect(codec, 0x1b);
17348 present2 = snd_hda_jack_detect(codec, 0x15);
17350 if (present1 || present2) {
17351 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17352 HDA_AMP_MUTE, HDA_AMP_MUTE);
17353 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17354 HDA_AMP_MUTE, HDA_AMP_MUTE);
17356 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17358 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17363 static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
17365 unsigned int present1, present2;
17367 present1 = snd_hda_codec_read(codec, 0x1b, 0,
17368 AC_VERB_GET_PIN_SENSE, 0)
17369 & AC_PINSENSE_PRESENCE;
17370 present2 = snd_hda_codec_read(codec, 0x21, 0,
17371 AC_VERB_GET_PIN_SENSE, 0)
17372 & AC_PINSENSE_PRESENCE;
17374 if (present1 || present2) {
17375 snd_hda_codec_write_cache(codec, 0x14, 0,
17376 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17377 snd_hda_codec_write_cache(codec, 0x17, 0,
17378 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17380 snd_hda_codec_write_cache(codec, 0x14, 0,
17381 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17382 snd_hda_codec_write_cache(codec, 0x17, 0,
17383 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17387 static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
17389 unsigned int present1, present2;
17391 present1 = snd_hda_codec_read(codec, 0x21, 0,
17392 AC_VERB_GET_PIN_SENSE, 0)
17393 & AC_PINSENSE_PRESENCE;
17394 present2 = snd_hda_codec_read(codec, 0x15, 0,
17395 AC_VERB_GET_PIN_SENSE, 0)
17396 & AC_PINSENSE_PRESENCE;
17398 if (present1 || present2) {
17399 snd_hda_codec_write_cache(codec, 0x14, 0,
17400 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17401 snd_hda_codec_write_cache(codec, 0x17, 0,
17402 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17404 snd_hda_codec_write_cache(codec, 0x14, 0,
17405 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17406 snd_hda_codec_write_cache(codec, 0x17, 0,
17407 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17411 static void alc663_m51va_unsol_event(struct hda_codec *codec,
17414 switch (res >> 26) {
17415 case ALC880_HP_EVENT:
17416 alc663_m51va_speaker_automute(codec);
17418 case ALC880_MIC_EVENT:
17419 alc_mic_automute(codec);
17424 static void alc663_m51va_setup(struct hda_codec *codec)
17426 struct alc_spec *spec = codec->spec;
17427 spec->ext_mic.pin = 0x18;
17428 spec->ext_mic.mux_idx = 0;
17429 spec->int_mic.pin = 0x12;
17430 spec->int_mic.mux_idx = 9;
17431 spec->auto_mic = 1;
17434 static void alc663_m51va_inithook(struct hda_codec *codec)
17436 alc663_m51va_speaker_automute(codec);
17437 alc_mic_automute(codec);
17440 /* ***************** Mode1 ******************************/
17441 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
17443 static void alc663_mode1_setup(struct hda_codec *codec)
17445 struct alc_spec *spec = codec->spec;
17446 spec->ext_mic.pin = 0x18;
17447 spec->ext_mic.mux_idx = 0;
17448 spec->int_mic.pin = 0x19;
17449 spec->int_mic.mux_idx = 1;
17450 spec->auto_mic = 1;
17453 #define alc663_mode1_inithook alc663_m51va_inithook
17455 /* ***************** Mode2 ******************************/
17456 static void alc662_mode2_unsol_event(struct hda_codec *codec,
17459 switch (res >> 26) {
17460 case ALC880_HP_EVENT:
17461 alc662_f5z_speaker_automute(codec);
17463 case ALC880_MIC_EVENT:
17464 alc_mic_automute(codec);
17469 #define alc662_mode2_setup alc663_mode1_setup
17471 static void alc662_mode2_inithook(struct hda_codec *codec)
17473 alc662_f5z_speaker_automute(codec);
17474 alc_mic_automute(codec);
17476 /* ***************** Mode3 ******************************/
17477 static void alc663_mode3_unsol_event(struct hda_codec *codec,
17480 switch (res >> 26) {
17481 case ALC880_HP_EVENT:
17482 alc663_two_hp_m1_speaker_automute(codec);
17484 case ALC880_MIC_EVENT:
17485 alc_mic_automute(codec);
17490 #define alc663_mode3_setup alc663_mode1_setup
17492 static void alc663_mode3_inithook(struct hda_codec *codec)
17494 alc663_two_hp_m1_speaker_automute(codec);
17495 alc_mic_automute(codec);
17497 /* ***************** Mode4 ******************************/
17498 static void alc663_mode4_unsol_event(struct hda_codec *codec,
17501 switch (res >> 26) {
17502 case ALC880_HP_EVENT:
17503 alc663_21jd_two_speaker_automute(codec);
17505 case ALC880_MIC_EVENT:
17506 alc_mic_automute(codec);
17511 #define alc663_mode4_setup alc663_mode1_setup
17513 static void alc663_mode4_inithook(struct hda_codec *codec)
17515 alc663_21jd_two_speaker_automute(codec);
17516 alc_mic_automute(codec);
17518 /* ***************** Mode5 ******************************/
17519 static void alc663_mode5_unsol_event(struct hda_codec *codec,
17522 switch (res >> 26) {
17523 case ALC880_HP_EVENT:
17524 alc663_15jd_two_speaker_automute(codec);
17526 case ALC880_MIC_EVENT:
17527 alc_mic_automute(codec);
17532 #define alc663_mode5_setup alc663_mode1_setup
17534 static void alc663_mode5_inithook(struct hda_codec *codec)
17536 alc663_15jd_two_speaker_automute(codec);
17537 alc_mic_automute(codec);
17539 /* ***************** Mode6 ******************************/
17540 static void alc663_mode6_unsol_event(struct hda_codec *codec,
17543 switch (res >> 26) {
17544 case ALC880_HP_EVENT:
17545 alc663_two_hp_m2_speaker_automute(codec);
17547 case ALC880_MIC_EVENT:
17548 alc_mic_automute(codec);
17553 #define alc663_mode6_setup alc663_mode1_setup
17555 static void alc663_mode6_inithook(struct hda_codec *codec)
17557 alc663_two_hp_m2_speaker_automute(codec);
17558 alc_mic_automute(codec);
17561 /* ***************** Mode7 ******************************/
17562 static void alc663_mode7_unsol_event(struct hda_codec *codec,
17565 switch (res >> 26) {
17566 case ALC880_HP_EVENT:
17567 alc663_two_hp_m7_speaker_automute(codec);
17569 case ALC880_MIC_EVENT:
17570 alc_mic_automute(codec);
17575 #define alc663_mode7_setup alc663_mode1_setup
17577 static void alc663_mode7_inithook(struct hda_codec *codec)
17579 alc663_two_hp_m7_speaker_automute(codec);
17580 alc_mic_automute(codec);
17583 /* ***************** Mode8 ******************************/
17584 static void alc663_mode8_unsol_event(struct hda_codec *codec,
17587 switch (res >> 26) {
17588 case ALC880_HP_EVENT:
17589 alc663_two_hp_m8_speaker_automute(codec);
17591 case ALC880_MIC_EVENT:
17592 alc_mic_automute(codec);
17597 #define alc663_mode8_setup alc663_m51va_setup
17599 static void alc663_mode8_inithook(struct hda_codec *codec)
17601 alc663_two_hp_m8_speaker_automute(codec);
17602 alc_mic_automute(codec);
17605 static void alc663_g71v_hp_automute(struct hda_codec *codec)
17607 unsigned int present;
17608 unsigned char bits;
17610 present = snd_hda_jack_detect(codec, 0x21);
17611 bits = present ? HDA_AMP_MUTE : 0;
17612 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17613 HDA_AMP_MUTE, bits);
17614 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17615 HDA_AMP_MUTE, bits);
17618 static void alc663_g71v_front_automute(struct hda_codec *codec)
17620 unsigned int present;
17621 unsigned char bits;
17623 present = snd_hda_jack_detect(codec, 0x15);
17624 bits = present ? HDA_AMP_MUTE : 0;
17625 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17626 HDA_AMP_MUTE, bits);
17629 static void alc663_g71v_unsol_event(struct hda_codec *codec,
17632 switch (res >> 26) {
17633 case ALC880_HP_EVENT:
17634 alc663_g71v_hp_automute(codec);
17636 case ALC880_FRONT_EVENT:
17637 alc663_g71v_front_automute(codec);
17639 case ALC880_MIC_EVENT:
17640 alc_mic_automute(codec);
17645 #define alc663_g71v_setup alc663_m51va_setup
17647 static void alc663_g71v_inithook(struct hda_codec *codec)
17649 alc663_g71v_front_automute(codec);
17650 alc663_g71v_hp_automute(codec);
17651 alc_mic_automute(codec);
17654 static void alc663_g50v_unsol_event(struct hda_codec *codec,
17657 switch (res >> 26) {
17658 case ALC880_HP_EVENT:
17659 alc663_m51va_speaker_automute(codec);
17661 case ALC880_MIC_EVENT:
17662 alc_mic_automute(codec);
17667 #define alc663_g50v_setup alc663_m51va_setup
17669 static void alc663_g50v_inithook(struct hda_codec *codec)
17671 alc663_m51va_speaker_automute(codec);
17672 alc_mic_automute(codec);
17675 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
17676 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17677 ALC262_HIPPO_MASTER_SWITCH,
17679 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
17680 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
17681 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
17683 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
17684 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17685 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17689 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
17690 /* Master Playback automatically created from Speaker and Headphone */
17691 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17692 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17693 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17694 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17696 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17697 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17698 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
17700 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17701 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17702 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
17706 #ifdef CONFIG_SND_HDA_POWER_SAVE
17707 #define alc662_loopbacks alc880_loopbacks
17711 /* pcm configuration: identical with ALC880 */
17712 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
17713 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
17714 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
17715 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
17718 * configuration and preset
17720 static const char *alc662_models[ALC662_MODEL_LAST] = {
17721 [ALC662_3ST_2ch_DIG] = "3stack-dig",
17722 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
17723 [ALC662_3ST_6ch] = "3stack-6ch",
17724 [ALC662_5ST_DIG] = "6stack-dig",
17725 [ALC662_LENOVO_101E] = "lenovo-101e",
17726 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
17727 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
17728 [ALC662_ECS] = "ecs",
17729 [ALC663_ASUS_M51VA] = "m51va",
17730 [ALC663_ASUS_G71V] = "g71v",
17731 [ALC663_ASUS_H13] = "h13",
17732 [ALC663_ASUS_G50V] = "g50v",
17733 [ALC663_ASUS_MODE1] = "asus-mode1",
17734 [ALC662_ASUS_MODE2] = "asus-mode2",
17735 [ALC663_ASUS_MODE3] = "asus-mode3",
17736 [ALC663_ASUS_MODE4] = "asus-mode4",
17737 [ALC663_ASUS_MODE5] = "asus-mode5",
17738 [ALC663_ASUS_MODE6] = "asus-mode6",
17739 [ALC663_ASUS_MODE7] = "asus-mode7",
17740 [ALC663_ASUS_MODE8] = "asus-mode8",
17741 [ALC272_DELL] = "dell",
17742 [ALC272_DELL_ZM1] = "dell-zm1",
17743 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
17744 [ALC662_AUTO] = "auto",
17747 static struct snd_pci_quirk alc662_cfg_tbl[] = {
17748 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
17749 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
17750 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
17751 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
17752 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
17753 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1),
17754 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
17755 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
17756 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
17757 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
17758 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
17759 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
17760 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
17761 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
17762 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
17763 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
17764 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
17765 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
17766 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
17767 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
17768 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
17769 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
17770 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
17771 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
17772 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
17773 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
17774 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
17775 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
17776 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
17777 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
17778 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
17779 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
17780 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
17781 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
17782 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
17783 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
17784 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
17785 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
17786 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
17787 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
17788 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
17789 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1),
17790 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
17791 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
17792 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
17793 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
17794 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
17795 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
17796 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
17797 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
17798 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
17799 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
17800 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
17801 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
17802 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
17803 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
17804 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
17805 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
17806 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
17807 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
17808 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
17809 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
17810 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
17811 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
17812 ALC662_3ST_6ch_DIG),
17813 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO),
17814 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
17815 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
17816 ALC662_3ST_6ch_DIG),
17817 SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13),
17818 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
17819 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
17820 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
17821 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
17822 ALC662_3ST_6ch_DIG),
17823 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
17825 SND_PCI_QUIRK(0x8086, 0xd604, "Intel mobo", ALC662_3ST_2ch_DIG),
17829 static struct alc_config_preset alc662_presets[] = {
17830 [ALC662_3ST_2ch_DIG] = {
17831 .mixers = { alc662_3ST_2ch_mixer },
17832 .init_verbs = { alc662_init_verbs },
17833 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17834 .dac_nids = alc662_dac_nids,
17835 .dig_out_nid = ALC662_DIGOUT_NID,
17836 .dig_in_nid = ALC662_DIGIN_NID,
17837 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17838 .channel_mode = alc662_3ST_2ch_modes,
17839 .input_mux = &alc662_capture_source,
17841 [ALC662_3ST_6ch_DIG] = {
17842 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17843 .init_verbs = { alc662_init_verbs },
17844 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17845 .dac_nids = alc662_dac_nids,
17846 .dig_out_nid = ALC662_DIGOUT_NID,
17847 .dig_in_nid = ALC662_DIGIN_NID,
17848 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17849 .channel_mode = alc662_3ST_6ch_modes,
17851 .input_mux = &alc662_capture_source,
17853 [ALC662_3ST_6ch] = {
17854 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17855 .init_verbs = { alc662_init_verbs },
17856 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17857 .dac_nids = alc662_dac_nids,
17858 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17859 .channel_mode = alc662_3ST_6ch_modes,
17861 .input_mux = &alc662_capture_source,
17863 [ALC662_5ST_DIG] = {
17864 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
17865 .init_verbs = { alc662_init_verbs },
17866 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17867 .dac_nids = alc662_dac_nids,
17868 .dig_out_nid = ALC662_DIGOUT_NID,
17869 .dig_in_nid = ALC662_DIGIN_NID,
17870 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
17871 .channel_mode = alc662_5stack_modes,
17872 .input_mux = &alc662_capture_source,
17874 [ALC662_LENOVO_101E] = {
17875 .mixers = { alc662_lenovo_101e_mixer },
17876 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
17877 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17878 .dac_nids = alc662_dac_nids,
17879 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17880 .channel_mode = alc662_3ST_2ch_modes,
17881 .input_mux = &alc662_lenovo_101e_capture_source,
17882 .unsol_event = alc662_lenovo_101e_unsol_event,
17883 .init_hook = alc662_lenovo_101e_all_automute,
17885 [ALC662_ASUS_EEEPC_P701] = {
17886 .mixers = { alc662_eeepc_p701_mixer },
17887 .init_verbs = { alc662_init_verbs,
17888 alc662_eeepc_sue_init_verbs },
17889 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17890 .dac_nids = alc662_dac_nids,
17891 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17892 .channel_mode = alc662_3ST_2ch_modes,
17893 .unsol_event = alc662_eeepc_unsol_event,
17894 .setup = alc662_eeepc_setup,
17895 .init_hook = alc662_eeepc_inithook,
17897 [ALC662_ASUS_EEEPC_EP20] = {
17898 .mixers = { alc662_eeepc_ep20_mixer,
17899 alc662_chmode_mixer },
17900 .init_verbs = { alc662_init_verbs,
17901 alc662_eeepc_ep20_sue_init_verbs },
17902 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17903 .dac_nids = alc662_dac_nids,
17904 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17905 .channel_mode = alc662_3ST_6ch_modes,
17906 .input_mux = &alc662_lenovo_101e_capture_source,
17907 .unsol_event = alc662_eeepc_unsol_event,
17908 .setup = alc662_eeepc_ep20_setup,
17909 .init_hook = alc662_eeepc_ep20_inithook,
17912 .mixers = { alc662_ecs_mixer },
17913 .init_verbs = { alc662_init_verbs,
17914 alc662_ecs_init_verbs },
17915 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17916 .dac_nids = alc662_dac_nids,
17917 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17918 .channel_mode = alc662_3ST_2ch_modes,
17919 .unsol_event = alc662_eeepc_unsol_event,
17920 .setup = alc662_eeepc_setup,
17921 .init_hook = alc662_eeepc_inithook,
17923 [ALC663_ASUS_M51VA] = {
17924 .mixers = { alc663_m51va_mixer },
17925 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17926 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17927 .dac_nids = alc662_dac_nids,
17928 .dig_out_nid = ALC662_DIGOUT_NID,
17929 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17930 .channel_mode = alc662_3ST_2ch_modes,
17931 .unsol_event = alc663_m51va_unsol_event,
17932 .setup = alc663_m51va_setup,
17933 .init_hook = alc663_m51va_inithook,
17935 [ALC663_ASUS_G71V] = {
17936 .mixers = { alc663_g71v_mixer },
17937 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
17938 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17939 .dac_nids = alc662_dac_nids,
17940 .dig_out_nid = ALC662_DIGOUT_NID,
17941 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17942 .channel_mode = alc662_3ST_2ch_modes,
17943 .unsol_event = alc663_g71v_unsol_event,
17944 .setup = alc663_g71v_setup,
17945 .init_hook = alc663_g71v_inithook,
17947 [ALC663_ASUS_H13] = {
17948 .mixers = { alc663_m51va_mixer },
17949 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17950 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17951 .dac_nids = alc662_dac_nids,
17952 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17953 .channel_mode = alc662_3ST_2ch_modes,
17954 .unsol_event = alc663_m51va_unsol_event,
17955 .init_hook = alc663_m51va_inithook,
17957 [ALC663_ASUS_G50V] = {
17958 .mixers = { alc663_g50v_mixer },
17959 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
17960 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17961 .dac_nids = alc662_dac_nids,
17962 .dig_out_nid = ALC662_DIGOUT_NID,
17963 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17964 .channel_mode = alc662_3ST_6ch_modes,
17965 .input_mux = &alc663_capture_source,
17966 .unsol_event = alc663_g50v_unsol_event,
17967 .setup = alc663_g50v_setup,
17968 .init_hook = alc663_g50v_inithook,
17970 [ALC663_ASUS_MODE1] = {
17971 .mixers = { alc663_m51va_mixer },
17972 .cap_mixer = alc662_auto_capture_mixer,
17973 .init_verbs = { alc662_init_verbs,
17974 alc663_21jd_amic_init_verbs },
17975 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17977 .dac_nids = alc662_dac_nids,
17978 .dig_out_nid = ALC662_DIGOUT_NID,
17979 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17980 .channel_mode = alc662_3ST_2ch_modes,
17981 .unsol_event = alc663_mode1_unsol_event,
17982 .setup = alc663_mode1_setup,
17983 .init_hook = alc663_mode1_inithook,
17985 [ALC662_ASUS_MODE2] = {
17986 .mixers = { alc662_1bjd_mixer },
17987 .cap_mixer = alc662_auto_capture_mixer,
17988 .init_verbs = { alc662_init_verbs,
17989 alc662_1bjd_amic_init_verbs },
17990 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17991 .dac_nids = alc662_dac_nids,
17992 .dig_out_nid = ALC662_DIGOUT_NID,
17993 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17994 .channel_mode = alc662_3ST_2ch_modes,
17995 .unsol_event = alc662_mode2_unsol_event,
17996 .setup = alc662_mode2_setup,
17997 .init_hook = alc662_mode2_inithook,
17999 [ALC663_ASUS_MODE3] = {
18000 .mixers = { alc663_two_hp_m1_mixer },
18001 .cap_mixer = alc662_auto_capture_mixer,
18002 .init_verbs = { alc662_init_verbs,
18003 alc663_two_hp_amic_m1_init_verbs },
18004 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18006 .dac_nids = alc662_dac_nids,
18007 .dig_out_nid = ALC662_DIGOUT_NID,
18008 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18009 .channel_mode = alc662_3ST_2ch_modes,
18010 .unsol_event = alc663_mode3_unsol_event,
18011 .setup = alc663_mode3_setup,
18012 .init_hook = alc663_mode3_inithook,
18014 [ALC663_ASUS_MODE4] = {
18015 .mixers = { alc663_asus_21jd_clfe_mixer },
18016 .cap_mixer = alc662_auto_capture_mixer,
18017 .init_verbs = { alc662_init_verbs,
18018 alc663_21jd_amic_init_verbs},
18019 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18021 .dac_nids = alc662_dac_nids,
18022 .dig_out_nid = ALC662_DIGOUT_NID,
18023 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18024 .channel_mode = alc662_3ST_2ch_modes,
18025 .unsol_event = alc663_mode4_unsol_event,
18026 .setup = alc663_mode4_setup,
18027 .init_hook = alc663_mode4_inithook,
18029 [ALC663_ASUS_MODE5] = {
18030 .mixers = { alc663_asus_15jd_clfe_mixer },
18031 .cap_mixer = alc662_auto_capture_mixer,
18032 .init_verbs = { alc662_init_verbs,
18033 alc663_15jd_amic_init_verbs },
18034 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18036 .dac_nids = alc662_dac_nids,
18037 .dig_out_nid = ALC662_DIGOUT_NID,
18038 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18039 .channel_mode = alc662_3ST_2ch_modes,
18040 .unsol_event = alc663_mode5_unsol_event,
18041 .setup = alc663_mode5_setup,
18042 .init_hook = alc663_mode5_inithook,
18044 [ALC663_ASUS_MODE6] = {
18045 .mixers = { alc663_two_hp_m2_mixer },
18046 .cap_mixer = alc662_auto_capture_mixer,
18047 .init_verbs = { alc662_init_verbs,
18048 alc663_two_hp_amic_m2_init_verbs },
18049 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18051 .dac_nids = alc662_dac_nids,
18052 .dig_out_nid = ALC662_DIGOUT_NID,
18053 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18054 .channel_mode = alc662_3ST_2ch_modes,
18055 .unsol_event = alc663_mode6_unsol_event,
18056 .setup = alc663_mode6_setup,
18057 .init_hook = alc663_mode6_inithook,
18059 [ALC663_ASUS_MODE7] = {
18060 .mixers = { alc663_mode7_mixer },
18061 .cap_mixer = alc662_auto_capture_mixer,
18062 .init_verbs = { alc662_init_verbs,
18063 alc663_mode7_init_verbs },
18064 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18066 .dac_nids = alc662_dac_nids,
18067 .dig_out_nid = ALC662_DIGOUT_NID,
18068 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18069 .channel_mode = alc662_3ST_2ch_modes,
18070 .unsol_event = alc663_mode7_unsol_event,
18071 .setup = alc663_mode7_setup,
18072 .init_hook = alc663_mode7_inithook,
18074 [ALC663_ASUS_MODE8] = {
18075 .mixers = { alc663_mode8_mixer },
18076 .cap_mixer = alc662_auto_capture_mixer,
18077 .init_verbs = { alc662_init_verbs,
18078 alc663_mode8_init_verbs },
18079 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18081 .dac_nids = alc662_dac_nids,
18082 .dig_out_nid = ALC662_DIGOUT_NID,
18083 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18084 .channel_mode = alc662_3ST_2ch_modes,
18085 .unsol_event = alc663_mode8_unsol_event,
18086 .setup = alc663_mode8_setup,
18087 .init_hook = alc663_mode8_inithook,
18090 .mixers = { alc663_m51va_mixer },
18091 .cap_mixer = alc272_auto_capture_mixer,
18092 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
18093 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18094 .dac_nids = alc662_dac_nids,
18095 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18096 .adc_nids = alc272_adc_nids,
18097 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
18098 .capsrc_nids = alc272_capsrc_nids,
18099 .channel_mode = alc662_3ST_2ch_modes,
18100 .unsol_event = alc663_m51va_unsol_event,
18101 .setup = alc663_m51va_setup,
18102 .init_hook = alc663_m51va_inithook,
18104 [ALC272_DELL_ZM1] = {
18105 .mixers = { alc663_m51va_mixer },
18106 .cap_mixer = alc662_auto_capture_mixer,
18107 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
18108 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18109 .dac_nids = alc662_dac_nids,
18110 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18111 .adc_nids = alc662_adc_nids,
18113 .capsrc_nids = alc662_capsrc_nids,
18114 .channel_mode = alc662_3ST_2ch_modes,
18115 .unsol_event = alc663_m51va_unsol_event,
18116 .setup = alc663_m51va_setup,
18117 .init_hook = alc663_m51va_inithook,
18119 [ALC272_SAMSUNG_NC10] = {
18120 .mixers = { alc272_nc10_mixer },
18121 .init_verbs = { alc662_init_verbs,
18122 alc663_21jd_amic_init_verbs },
18123 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18124 .dac_nids = alc272_dac_nids,
18125 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18126 .channel_mode = alc662_3ST_2ch_modes,
18127 /*.input_mux = &alc272_nc10_capture_source,*/
18128 .unsol_event = alc663_mode4_unsol_event,
18129 .setup = alc663_mode4_setup,
18130 .init_hook = alc663_mode4_inithook,
18136 * BIOS auto configuration
18139 /* convert from MIX nid to DAC */
18140 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
18144 else if (nid >= 0x0c && nid <= 0x0e)
18145 return nid - 0x0c + 0x02;
18150 /* get MIX nid connected to the given pin targeted to DAC */
18151 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
18157 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
18158 for (i = 0; i < num; i++) {
18159 if (alc662_mix_to_dac(mix[i]) == dac)
18165 /* look for an empty DAC slot */
18166 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
18168 struct alc_spec *spec = codec->spec;
18172 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
18175 for (i = 0; i < num; i++) {
18176 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
18179 for (j = 0; j < spec->multiout.num_dacs; j++)
18180 if (spec->multiout.dac_nids[j] == nid)
18182 if (j >= spec->multiout.num_dacs)
18188 /* fill in the dac_nids table from the parsed pin configuration */
18189 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
18190 const struct auto_pin_cfg *cfg)
18192 struct alc_spec *spec = codec->spec;
18196 spec->multiout.dac_nids = spec->private_dac_nids;
18197 for (i = 0; i < cfg->line_outs; i++) {
18198 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
18201 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
18206 static inline int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
18207 hda_nid_t nid, unsigned int chs)
18209 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
18210 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
18213 static inline int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
18214 hda_nid_t nid, unsigned int chs)
18216 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
18217 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
18220 #define alc662_add_stereo_vol(spec, pfx, nid) \
18221 alc662_add_vol_ctl(spec, pfx, nid, 3)
18222 #define alc662_add_stereo_sw(spec, pfx, nid) \
18223 alc662_add_sw_ctl(spec, pfx, nid, 3)
18225 /* add playback controls from the parsed DAC table */
18226 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
18227 const struct auto_pin_cfg *cfg)
18229 struct alc_spec *spec = codec->spec;
18230 static const char *chname[4] = {
18231 "Front", "Surround", NULL /*CLFE*/, "Side"
18233 hda_nid_t nid, mix;
18236 for (i = 0; i < cfg->line_outs; i++) {
18237 nid = spec->multiout.dac_nids[i];
18240 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
18245 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
18248 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
18251 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
18254 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
18259 if (cfg->line_outs == 1 &&
18260 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
18267 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
18270 if (cfg->line_outs == 1 &&
18271 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
18273 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
18281 /* add playback controls for speaker and HP outputs */
18282 /* return DAC nid if any new DAC is assigned */
18283 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
18286 struct alc_spec *spec = codec->spec;
18287 hda_nid_t nid, mix;
18292 nid = alc662_look_for_dac(codec, pin);
18294 /* the corresponding DAC is already occupied */
18295 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
18296 return 0; /* no way */
18297 /* create a switch only */
18298 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
18299 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
18302 mix = alc662_dac_to_mix(codec, pin, nid);
18305 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
18308 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
18314 /* create playback/capture controls for input pins */
18315 #define alc662_auto_create_input_ctls \
18316 alc882_auto_create_input_ctls
18318 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
18319 hda_nid_t nid, int pin_type,
18325 alc_set_pin_output(codec, nid, pin_type);
18326 /* need the manual connection? */
18327 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
18330 for (i = 0; i < num; i++) {
18331 if (alc662_mix_to_dac(srcs[i]) != dac)
18333 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
18338 static void alc662_auto_init_multi_out(struct hda_codec *codec)
18340 struct alc_spec *spec = codec->spec;
18341 int pin_type = get_pin_type(spec->autocfg.line_out_type);
18344 for (i = 0; i <= HDA_SIDE; i++) {
18345 hda_nid_t nid = spec->autocfg.line_out_pins[i];
18347 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
18348 spec->multiout.dac_nids[i]);
18352 static void alc662_auto_init_hp_out(struct hda_codec *codec)
18354 struct alc_spec *spec = codec->spec;
18357 pin = spec->autocfg.hp_pins[0];
18359 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
18360 spec->multiout.hp_nid);
18361 pin = spec->autocfg.speaker_pins[0];
18363 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
18364 spec->multiout.extra_out_nid[0]);
18367 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
18369 static void alc662_auto_init_analog_input(struct hda_codec *codec)
18371 struct alc_spec *spec = codec->spec;
18374 for (i = 0; i < AUTO_PIN_LAST; i++) {
18375 hda_nid_t nid = spec->autocfg.input_pins[i];
18376 if (alc_is_input_pin(codec, nid)) {
18377 alc_set_input_pin(codec, nid, i);
18378 if (nid != ALC662_PIN_CD_NID &&
18379 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
18380 snd_hda_codec_write(codec, nid, 0,
18381 AC_VERB_SET_AMP_GAIN_MUTE,
18387 #define alc662_auto_init_input_src alc882_auto_init_input_src
18389 static int alc662_parse_auto_config(struct hda_codec *codec)
18391 struct alc_spec *spec = codec->spec;
18393 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
18395 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
18399 if (!spec->autocfg.line_outs)
18400 return 0; /* can't find valid BIOS pin config */
18402 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
18405 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
18408 err = alc662_auto_create_extra_out(codec,
18409 spec->autocfg.speaker_pins[0],
18414 spec->multiout.extra_out_nid[0] = err;
18415 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
18420 spec->multiout.hp_nid = err;
18421 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
18425 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
18427 if (spec->autocfg.dig_outs)
18428 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
18430 if (spec->kctls.list)
18431 add_mixer(spec, spec->kctls.list);
18433 spec->num_mux_defs = 1;
18434 spec->input_mux = &spec->private_imux[0];
18436 add_verb(spec, alc662_init_verbs);
18437 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
18438 codec->vendor_id == 0x10ec0665)
18439 add_verb(spec, alc663_init_verbs);
18441 if (codec->vendor_id == 0x10ec0272)
18442 add_verb(spec, alc272_init_verbs);
18444 err = alc_auto_add_mic_boost(codec);
18448 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
18449 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
18450 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21);
18452 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
18457 /* additional initialization for auto-configuration model */
18458 static void alc662_auto_init(struct hda_codec *codec)
18460 struct alc_spec *spec = codec->spec;
18461 alc662_auto_init_multi_out(codec);
18462 alc662_auto_init_hp_out(codec);
18463 alc662_auto_init_analog_input(codec);
18464 alc662_auto_init_input_src(codec);
18465 if (spec->unsol_event)
18466 alc_inithook(codec);
18469 static int patch_alc662(struct hda_codec *codec)
18471 struct alc_spec *spec;
18472 int err, board_config;
18474 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
18478 codec->spec = spec;
18480 alc_fix_pll_init(codec, 0x20, 0x04, 15);
18482 if (alc_read_coef_idx(codec, 0)==0x8020){
18483 kfree(codec->chip_name);
18484 codec->chip_name = kstrdup("ALC661", GFP_KERNEL);
18485 if (!codec->chip_name) {
18491 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
18494 if (board_config < 0) {
18495 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
18497 board_config = ALC662_AUTO;
18500 if (board_config == ALC662_AUTO) {
18501 /* automatic parse from the BIOS config */
18502 err = alc662_parse_auto_config(codec);
18508 "hda_codec: Cannot set up configuration "
18509 "from BIOS. Using base mode...\n");
18510 board_config = ALC662_3ST_2ch_DIG;
18514 err = snd_hda_attach_beep_device(codec, 0x1);
18520 if (board_config != ALC662_AUTO)
18521 setup_preset(codec, &alc662_presets[board_config]);
18523 spec->stream_analog_playback = &alc662_pcm_analog_playback;
18524 spec->stream_analog_capture = &alc662_pcm_analog_capture;
18526 spec->stream_digital_playback = &alc662_pcm_digital_playback;
18527 spec->stream_digital_capture = &alc662_pcm_digital_capture;
18529 if (!spec->adc_nids) {
18530 spec->adc_nids = alc662_adc_nids;
18531 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
18533 if (!spec->capsrc_nids)
18534 spec->capsrc_nids = alc662_capsrc_nids;
18536 if (!spec->cap_mixer)
18537 set_capture_mixer(codec);
18539 switch (codec->vendor_id) {
18541 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
18546 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
18549 set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
18552 spec->vmaster_nid = 0x02;
18554 codec->patch_ops = alc_patch_ops;
18555 if (board_config == ALC662_AUTO)
18556 spec->init_hook = alc662_auto_init;
18557 #ifdef CONFIG_SND_HDA_POWER_SAVE
18558 if (!spec->loopback.amplist)
18559 spec->loopback.amplist = alc662_loopbacks;
18565 static int patch_alc888(struct hda_codec *codec)
18567 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
18568 kfree(codec->chip_name);
18569 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
18570 if (!codec->chip_name) {
18574 return patch_alc662(codec);
18576 return patch_alc882(codec);
18582 static struct hda_codec_preset snd_hda_preset_realtek[] = {
18583 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
18584 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
18585 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
18586 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
18587 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
18588 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
18589 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
18590 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
18591 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
18592 .patch = patch_alc861 },
18593 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
18594 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
18595 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
18596 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
18597 .patch = patch_alc882 },
18598 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
18599 .patch = patch_alc662 },
18600 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
18601 { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
18602 { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
18603 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
18604 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
18605 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
18606 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
18607 .patch = patch_alc882 },
18608 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
18609 .patch = patch_alc882 },
18610 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
18611 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
18612 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
18613 .patch = patch_alc882 },
18614 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
18615 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
18616 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
18617 {} /* terminator */
18620 MODULE_ALIAS("snd-hda-codec-id:10ec*");
18622 MODULE_LICENSE("GPL");
18623 MODULE_DESCRIPTION("Realtek HD-audio codec");
18625 static struct hda_codec_preset_list realtek_list = {
18626 .preset = snd_hda_preset_realtek,
18627 .owner = THIS_MODULE,
18630 static int __init patch_realtek_init(void)
18632 return snd_hda_add_codec_preset(&realtek_list);
18635 static void __exit patch_realtek_exit(void)
18637 snd_hda_delete_codec_preset(&realtek_list);
18640 module_init(patch_realtek_init)
18641 module_exit(patch_realtek_exit)