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 */
134 ALC269_ASUS_EEEPC_P703,
135 ALC269_ASUS_EEEPC_P901,
139 ALC269_MODEL_LAST /* last tag */
156 /* ALC861-VD models */
178 ALC662_ASUS_EEEPC_P701,
179 ALC662_ASUS_EEEPC_EP20,
217 ALC883_TARGA_2ch_DIG,
218 ALC883_TARGA_8ch_DIG,
221 ALC888_ACER_ASPIRE_4930G,
222 ALC888_ACER_ASPIRE_6530G,
223 ALC888_ACER_ASPIRE_8930G,
224 ALC888_ACER_ASPIRE_7730G,
228 ALC883_LENOVO_101E_2ch,
229 ALC883_LENOVO_NB0763,
230 ALC888_LENOVO_MS7195_DIG,
238 ALC883_FUJITSU_PI2515,
239 ALC888_FUJITSU_XA3530,
240 ALC883_3ST_6ch_INTEL,
253 #define GPIO_MASK 0x03
255 /* extra amp-initialization sequence types */
264 struct alc_mic_route {
266 unsigned char mux_idx;
267 unsigned char amix_idx;
270 #define MUX_IDX_UNDEF ((unsigned char)-1)
273 /* codec parameterization */
274 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
275 unsigned int num_mixers;
276 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
277 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
279 const struct hda_verb *init_verbs[10]; /* initialization verbs
283 unsigned int num_init_verbs;
285 char stream_name_analog[32]; /* analog PCM stream */
286 struct hda_pcm_stream *stream_analog_playback;
287 struct hda_pcm_stream *stream_analog_capture;
288 struct hda_pcm_stream *stream_analog_alt_playback;
289 struct hda_pcm_stream *stream_analog_alt_capture;
291 char stream_name_digital[32]; /* digital PCM stream */
292 struct hda_pcm_stream *stream_digital_playback;
293 struct hda_pcm_stream *stream_digital_capture;
296 struct hda_multi_out multiout; /* playback set-up
297 * max_channels, dacs must be set
298 * dig_out_nid and hp_nid are optional
300 hda_nid_t alt_dac_nid;
301 hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */
305 unsigned int num_adc_nids;
307 hda_nid_t *capsrc_nids;
308 hda_nid_t dig_in_nid; /* digital-in NID; optional */
311 unsigned int num_mux_defs;
312 const struct hda_input_mux *input_mux;
313 unsigned int cur_mux[3];
314 struct alc_mic_route ext_mic;
315 struct alc_mic_route int_mic;
318 const struct hda_channel_mode *channel_mode;
319 int num_channel_mode;
321 int const_channel_count;
322 int ext_channel_count;
324 /* PCM information */
325 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
327 /* dynamic controls, init_verbs and input_mux */
328 struct auto_pin_cfg autocfg;
329 struct snd_array kctls;
330 struct hda_input_mux private_imux[3];
331 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
332 hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS];
333 hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS];
336 void (*init_hook)(struct hda_codec *codec);
337 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
339 /* for pin sensing */
340 unsigned int sense_updated: 1;
341 unsigned int jack_present: 1;
342 unsigned int master_sw: 1;
343 unsigned int auto_mic:1;
346 unsigned int no_analog :1; /* digital I/O only */
349 /* for virtual master */
350 hda_nid_t vmaster_nid;
351 #ifdef CONFIG_SND_HDA_POWER_SAVE
352 struct hda_loopback_check loopback;
357 unsigned int pll_coef_idx, pll_coef_bit;
361 * configuration template - to be copied to the spec instance
363 struct alc_config_preset {
364 struct snd_kcontrol_new *mixers[5]; /* should be identical size
367 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
368 const struct hda_verb *init_verbs[5];
369 unsigned int num_dacs;
371 hda_nid_t dig_out_nid; /* optional */
372 hda_nid_t hp_nid; /* optional */
373 hda_nid_t *slave_dig_outs;
374 unsigned int num_adc_nids;
376 hda_nid_t *capsrc_nids;
377 hda_nid_t dig_in_nid;
378 unsigned int num_channel_mode;
379 const struct hda_channel_mode *channel_mode;
381 int const_channel_count;
382 unsigned int num_mux_defs;
383 const struct hda_input_mux *input_mux;
384 void (*unsol_event)(struct hda_codec *, unsigned int);
385 void (*setup)(struct hda_codec *);
386 void (*init_hook)(struct hda_codec *);
387 #ifdef CONFIG_SND_HDA_POWER_SAVE
388 struct hda_amp_list *loopbacks;
396 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
397 struct snd_ctl_elem_info *uinfo)
399 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
400 struct alc_spec *spec = codec->spec;
401 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
402 if (mux_idx >= spec->num_mux_defs)
404 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
407 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
408 struct snd_ctl_elem_value *ucontrol)
410 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
411 struct alc_spec *spec = codec->spec;
412 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
414 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
418 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
419 struct snd_ctl_elem_value *ucontrol)
421 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
422 struct alc_spec *spec = codec->spec;
423 const struct hda_input_mux *imux;
424 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
425 unsigned int mux_idx;
426 hda_nid_t nid = spec->capsrc_nids ?
427 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
430 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
431 imux = &spec->input_mux[mux_idx];
433 type = get_wcaps_type(get_wcaps(codec, nid));
434 if (type == AC_WID_AUD_MIX) {
435 /* Matrix-mixer style (e.g. ALC882) */
436 unsigned int *cur_val = &spec->cur_mux[adc_idx];
439 idx = ucontrol->value.enumerated.item[0];
440 if (idx >= imux->num_items)
441 idx = imux->num_items - 1;
444 for (i = 0; i < imux->num_items; i++) {
445 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
446 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
447 imux->items[i].index,
453 /* MUX style (e.g. ALC880) */
454 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
455 &spec->cur_mux[adc_idx]);
460 * channel mode setting
462 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
463 struct snd_ctl_elem_info *uinfo)
465 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
466 struct alc_spec *spec = codec->spec;
467 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
468 spec->num_channel_mode);
471 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
472 struct snd_ctl_elem_value *ucontrol)
474 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
475 struct alc_spec *spec = codec->spec;
476 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
477 spec->num_channel_mode,
478 spec->ext_channel_count);
481 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
482 struct snd_ctl_elem_value *ucontrol)
484 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
485 struct alc_spec *spec = codec->spec;
486 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
487 spec->num_channel_mode,
488 &spec->ext_channel_count);
489 if (err >= 0 && !spec->const_channel_count) {
490 spec->multiout.max_channels = spec->ext_channel_count;
491 if (spec->need_dac_fix)
492 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
498 * Control the mode of pin widget settings via the mixer. "pc" is used
499 * instead of "%" to avoid consequences of accidently treating the % as
500 * being part of a format specifier. Maximum allowed length of a value is
501 * 63 characters plus NULL terminator.
503 * Note: some retasking pin complexes seem to ignore requests for input
504 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
505 * are requested. Therefore order this list so that this behaviour will not
506 * cause problems when mixer clients move through the enum sequentially.
507 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
510 static char *alc_pin_mode_names[] = {
511 "Mic 50pc bias", "Mic 80pc bias",
512 "Line in", "Line out", "Headphone out",
514 static unsigned char alc_pin_mode_values[] = {
515 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
517 /* The control can present all 5 options, or it can limit the options based
518 * in the pin being assumed to be exclusively an input or an output pin. In
519 * addition, "input" pins may or may not process the mic bias option
520 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
521 * accept requests for bias as of chip versions up to March 2006) and/or
522 * wiring in the computer.
524 #define ALC_PIN_DIR_IN 0x00
525 #define ALC_PIN_DIR_OUT 0x01
526 #define ALC_PIN_DIR_INOUT 0x02
527 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
528 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
530 /* Info about the pin modes supported by the different pin direction modes.
531 * For each direction the minimum and maximum values are given.
533 static signed char alc_pin_mode_dir_info[5][2] = {
534 { 0, 2 }, /* ALC_PIN_DIR_IN */
535 { 3, 4 }, /* ALC_PIN_DIR_OUT */
536 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
537 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
538 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
540 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
541 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
542 #define alc_pin_mode_n_items(_dir) \
543 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
545 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
546 struct snd_ctl_elem_info *uinfo)
548 unsigned int item_num = uinfo->value.enumerated.item;
549 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
551 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
553 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
555 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
556 item_num = alc_pin_mode_min(dir);
557 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
561 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
562 struct snd_ctl_elem_value *ucontrol)
565 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
566 hda_nid_t nid = kcontrol->private_value & 0xffff;
567 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
568 long *valp = ucontrol->value.integer.value;
569 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
570 AC_VERB_GET_PIN_WIDGET_CONTROL,
573 /* Find enumerated value for current pinctl setting */
574 i = alc_pin_mode_min(dir);
575 while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl)
577 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
581 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
582 struct snd_ctl_elem_value *ucontrol)
585 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
586 hda_nid_t nid = kcontrol->private_value & 0xffff;
587 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
588 long val = *ucontrol->value.integer.value;
589 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
590 AC_VERB_GET_PIN_WIDGET_CONTROL,
593 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
594 val = alc_pin_mode_min(dir);
596 change = pinctl != alc_pin_mode_values[val];
598 /* Set pin mode to that requested */
599 snd_hda_codec_write_cache(codec, nid, 0,
600 AC_VERB_SET_PIN_WIDGET_CONTROL,
601 alc_pin_mode_values[val]);
603 /* Also enable the retasking pin's input/output as required
604 * for the requested pin mode. Enum values of 2 or less are
607 * Dynamically switching the input/output buffers probably
608 * reduces noise slightly (particularly on input) so we'll
609 * do it. However, having both input and output buffers
610 * enabled simultaneously doesn't seem to be problematic if
611 * this turns out to be necessary in the future.
614 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
615 HDA_AMP_MUTE, HDA_AMP_MUTE);
616 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
619 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
620 HDA_AMP_MUTE, HDA_AMP_MUTE);
621 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
628 #define ALC_PIN_MODE(xname, nid, dir) \
629 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
630 .info = alc_pin_mode_info, \
631 .get = alc_pin_mode_get, \
632 .put = alc_pin_mode_put, \
633 .private_value = nid | (dir<<16) }
635 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
636 * together using a mask with more than one bit set. This control is
637 * currently used only by the ALC260 test model. At this stage they are not
638 * needed for any "production" models.
640 #ifdef CONFIG_SND_DEBUG
641 #define alc_gpio_data_info snd_ctl_boolean_mono_info
643 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
644 struct snd_ctl_elem_value *ucontrol)
646 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
647 hda_nid_t nid = kcontrol->private_value & 0xffff;
648 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
649 long *valp = ucontrol->value.integer.value;
650 unsigned int val = snd_hda_codec_read(codec, nid, 0,
651 AC_VERB_GET_GPIO_DATA, 0x00);
653 *valp = (val & mask) != 0;
656 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
657 struct snd_ctl_elem_value *ucontrol)
660 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
661 hda_nid_t nid = kcontrol->private_value & 0xffff;
662 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
663 long val = *ucontrol->value.integer.value;
664 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
665 AC_VERB_GET_GPIO_DATA,
668 /* Set/unset the masked GPIO bit(s) as needed */
669 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
674 snd_hda_codec_write_cache(codec, nid, 0,
675 AC_VERB_SET_GPIO_DATA, gpio_data);
679 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
680 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
681 .info = alc_gpio_data_info, \
682 .get = alc_gpio_data_get, \
683 .put = alc_gpio_data_put, \
684 .private_value = nid | (mask<<16) }
685 #endif /* CONFIG_SND_DEBUG */
687 /* A switch control to allow the enabling of the digital IO pins on the
688 * ALC260. This is incredibly simplistic; the intention of this control is
689 * to provide something in the test model allowing digital outputs to be
690 * identified if present. If models are found which can utilise these
691 * outputs a more complete mixer control can be devised for those models if
694 #ifdef CONFIG_SND_DEBUG
695 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
697 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
698 struct snd_ctl_elem_value *ucontrol)
700 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
701 hda_nid_t nid = kcontrol->private_value & 0xffff;
702 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
703 long *valp = ucontrol->value.integer.value;
704 unsigned int val = snd_hda_codec_read(codec, nid, 0,
705 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
707 *valp = (val & mask) != 0;
710 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
711 struct snd_ctl_elem_value *ucontrol)
714 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
715 hda_nid_t nid = kcontrol->private_value & 0xffff;
716 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
717 long val = *ucontrol->value.integer.value;
718 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
719 AC_VERB_GET_DIGI_CONVERT_1,
722 /* Set/unset the masked control bit(s) as needed */
723 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
728 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
733 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
734 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
735 .info = alc_spdif_ctrl_info, \
736 .get = alc_spdif_ctrl_get, \
737 .put = alc_spdif_ctrl_put, \
738 .private_value = nid | (mask<<16) }
739 #endif /* CONFIG_SND_DEBUG */
741 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
742 * Again, this is only used in the ALC26x test models to help identify when
743 * the EAPD line must be asserted for features to work.
745 #ifdef CONFIG_SND_DEBUG
746 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
748 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
749 struct snd_ctl_elem_value *ucontrol)
751 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
752 hda_nid_t nid = kcontrol->private_value & 0xffff;
753 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
754 long *valp = ucontrol->value.integer.value;
755 unsigned int val = snd_hda_codec_read(codec, nid, 0,
756 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
758 *valp = (val & mask) != 0;
762 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
763 struct snd_ctl_elem_value *ucontrol)
766 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
767 hda_nid_t nid = kcontrol->private_value & 0xffff;
768 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
769 long val = *ucontrol->value.integer.value;
770 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
771 AC_VERB_GET_EAPD_BTLENABLE,
774 /* Set/unset the masked control bit(s) as needed */
775 change = (!val ? 0 : mask) != (ctrl_data & mask);
780 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
786 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
787 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
788 .info = alc_eapd_ctrl_info, \
789 .get = alc_eapd_ctrl_get, \
790 .put = alc_eapd_ctrl_put, \
791 .private_value = nid | (mask<<16) }
792 #endif /* CONFIG_SND_DEBUG */
795 * set up the input pin config (depending on the given auto-pin type)
797 static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
800 unsigned int val = PIN_IN;
802 if (auto_pin_type <= AUTO_PIN_FRONT_MIC) {
804 pincap = snd_hda_query_pin_caps(codec, nid);
805 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
806 if (pincap & AC_PINCAP_VREF_80)
808 else if (pincap & AC_PINCAP_VREF_50)
810 else if (pincap & AC_PINCAP_VREF_100)
812 else if (pincap & AC_PINCAP_VREF_GRD)
815 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val);
820 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
822 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
824 spec->mixers[spec->num_mixers++] = mix;
827 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
829 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
831 spec->init_verbs[spec->num_init_verbs++] = verb;
834 #ifdef CONFIG_PROC_FS
838 static void print_realtek_coef(struct snd_info_buffer *buffer,
839 struct hda_codec *codec, hda_nid_t nid)
845 coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
846 snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff);
847 coeff = snd_hda_codec_read(codec, nid, 0,
848 AC_VERB_GET_COEF_INDEX, 0);
849 snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff);
852 #define print_realtek_coef NULL
856 * set up from the preset table
858 static void setup_preset(struct hda_codec *codec,
859 const struct alc_config_preset *preset)
861 struct alc_spec *spec = codec->spec;
864 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
865 add_mixer(spec, preset->mixers[i]);
866 spec->cap_mixer = preset->cap_mixer;
867 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
869 add_verb(spec, preset->init_verbs[i]);
871 spec->channel_mode = preset->channel_mode;
872 spec->num_channel_mode = preset->num_channel_mode;
873 spec->need_dac_fix = preset->need_dac_fix;
874 spec->const_channel_count = preset->const_channel_count;
876 if (preset->const_channel_count)
877 spec->multiout.max_channels = preset->const_channel_count;
879 spec->multiout.max_channels = spec->channel_mode[0].channels;
880 spec->ext_channel_count = spec->channel_mode[0].channels;
882 spec->multiout.num_dacs = preset->num_dacs;
883 spec->multiout.dac_nids = preset->dac_nids;
884 spec->multiout.dig_out_nid = preset->dig_out_nid;
885 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
886 spec->multiout.hp_nid = preset->hp_nid;
888 spec->num_mux_defs = preset->num_mux_defs;
889 if (!spec->num_mux_defs)
890 spec->num_mux_defs = 1;
891 spec->input_mux = preset->input_mux;
893 spec->num_adc_nids = preset->num_adc_nids;
894 spec->adc_nids = preset->adc_nids;
895 spec->capsrc_nids = preset->capsrc_nids;
896 spec->dig_in_nid = preset->dig_in_nid;
898 spec->unsol_event = preset->unsol_event;
899 spec->init_hook = preset->init_hook;
900 #ifdef CONFIG_SND_HDA_POWER_SAVE
901 spec->loopback.amplist = preset->loopbacks;
905 preset->setup(codec);
908 /* Enable GPIO mask and set output */
909 static struct hda_verb alc_gpio1_init_verbs[] = {
910 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
911 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
912 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
916 static struct hda_verb alc_gpio2_init_verbs[] = {
917 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
918 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
919 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
923 static struct hda_verb alc_gpio3_init_verbs[] = {
924 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
925 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
926 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
931 * Fix hardware PLL issue
932 * On some codecs, the analog PLL gating control must be off while
933 * the default value is 1.
935 static void alc_fix_pll(struct hda_codec *codec)
937 struct alc_spec *spec = codec->spec;
942 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
944 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
945 AC_VERB_GET_PROC_COEF, 0);
946 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
948 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
949 val & ~(1 << spec->pll_coef_bit));
952 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
953 unsigned int coef_idx, unsigned int coef_bit)
955 struct alc_spec *spec = codec->spec;
957 spec->pll_coef_idx = coef_idx;
958 spec->pll_coef_bit = coef_bit;
962 static void alc_automute_pin(struct hda_codec *codec)
964 struct alc_spec *spec = codec->spec;
965 unsigned int nid = spec->autocfg.hp_pins[0];
970 spec->jack_present = snd_hda_jack_detect(codec, nid);
971 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
972 nid = spec->autocfg.speaker_pins[i];
975 snd_hda_codec_write(codec, nid, 0,
976 AC_VERB_SET_PIN_WIDGET_CONTROL,
977 spec->jack_present ? 0 : PIN_OUT);
981 static int get_connection_index(struct hda_codec *codec, hda_nid_t mux,
984 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
987 nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn));
988 for (i = 0; i < nums; i++)
994 static void alc_mic_automute(struct hda_codec *codec)
996 struct alc_spec *spec = codec->spec;
997 struct alc_mic_route *dead, *alive;
998 unsigned int present, type;
1001 if (!spec->auto_mic)
1003 if (!spec->int_mic.pin || !spec->ext_mic.pin)
1005 if (snd_BUG_ON(!spec->adc_nids))
1008 cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0];
1010 present = snd_hda_jack_detect(codec, spec->ext_mic.pin);
1012 alive = &spec->ext_mic;
1013 dead = &spec->int_mic;
1015 alive = &spec->int_mic;
1016 dead = &spec->ext_mic;
1019 type = get_wcaps_type(get_wcaps(codec, cap_nid));
1020 if (type == AC_WID_AUD_MIX) {
1021 /* Matrix-mixer style (e.g. ALC882) */
1022 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1025 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1027 HDA_AMP_MUTE, HDA_AMP_MUTE);
1029 /* MUX style (e.g. ALC880) */
1030 snd_hda_codec_write_cache(codec, cap_nid, 0,
1031 AC_VERB_SET_CONNECT_SEL,
1035 /* FIXME: analog mixer */
1038 /* unsolicited event for HP jack sensing */
1039 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
1041 if (codec->vendor_id == 0x10ec0880)
1046 case ALC880_HP_EVENT:
1047 alc_automute_pin(codec);
1049 case ALC880_MIC_EVENT:
1050 alc_mic_automute(codec);
1055 static void alc_inithook(struct hda_codec *codec)
1057 alc_automute_pin(codec);
1058 alc_mic_automute(codec);
1061 /* additional initialization for ALC888 variants */
1062 static void alc888_coef_init(struct hda_codec *codec)
1066 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
1067 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1068 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1069 if ((tmp & 0xf0) == 0x20)
1071 snd_hda_codec_read(codec, 0x20, 0,
1072 AC_VERB_SET_PROC_COEF, 0x830);
1075 snd_hda_codec_read(codec, 0x20, 0,
1076 AC_VERB_SET_PROC_COEF, 0x3030);
1079 static void alc889_coef_init(struct hda_codec *codec)
1083 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1084 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1085 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1086 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010);
1089 static void alc_auto_init_amp(struct hda_codec *codec, int type)
1094 case ALC_INIT_GPIO1:
1095 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1097 case ALC_INIT_GPIO2:
1098 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1100 case ALC_INIT_GPIO3:
1101 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1103 case ALC_INIT_DEFAULT:
1104 switch (codec->vendor_id) {
1106 snd_hda_codec_write(codec, 0x0f, 0,
1107 AC_VERB_SET_EAPD_BTLENABLE, 2);
1108 snd_hda_codec_write(codec, 0x10, 0,
1109 AC_VERB_SET_EAPD_BTLENABLE, 2);
1121 snd_hda_codec_write(codec, 0x14, 0,
1122 AC_VERB_SET_EAPD_BTLENABLE, 2);
1123 snd_hda_codec_write(codec, 0x15, 0,
1124 AC_VERB_SET_EAPD_BTLENABLE, 2);
1127 switch (codec->vendor_id) {
1129 snd_hda_codec_write(codec, 0x1a, 0,
1130 AC_VERB_SET_COEF_INDEX, 7);
1131 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1132 AC_VERB_GET_PROC_COEF, 0);
1133 snd_hda_codec_write(codec, 0x1a, 0,
1134 AC_VERB_SET_COEF_INDEX, 7);
1135 snd_hda_codec_write(codec, 0x1a, 0,
1136 AC_VERB_SET_PROC_COEF,
1146 alc889_coef_init(codec);
1149 alc888_coef_init(codec);
1153 snd_hda_codec_write(codec, 0x20, 0,
1154 AC_VERB_SET_COEF_INDEX, 7);
1155 tmp = snd_hda_codec_read(codec, 0x20, 0,
1156 AC_VERB_GET_PROC_COEF, 0);
1157 snd_hda_codec_write(codec, 0x20, 0,
1158 AC_VERB_SET_COEF_INDEX, 7);
1159 snd_hda_codec_write(codec, 0x20, 0,
1160 AC_VERB_SET_PROC_COEF,
1168 static void alc_init_auto_hp(struct hda_codec *codec)
1170 struct alc_spec *spec = codec->spec;
1172 if (!spec->autocfg.hp_pins[0])
1175 if (!spec->autocfg.speaker_pins[0]) {
1176 if (spec->autocfg.line_out_pins[0] &&
1177 spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT)
1178 spec->autocfg.speaker_pins[0] =
1179 spec->autocfg.line_out_pins[0];
1184 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1185 spec->autocfg.hp_pins[0]);
1186 snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0,
1187 AC_VERB_SET_UNSOLICITED_ENABLE,
1188 AC_USRSP_EN | ALC880_HP_EVENT);
1189 spec->unsol_event = alc_sku_unsol_event;
1192 static void alc_init_auto_mic(struct hda_codec *codec)
1194 struct alc_spec *spec = codec->spec;
1195 struct auto_pin_cfg *cfg = &spec->autocfg;
1196 hda_nid_t fixed, ext;
1199 /* there must be only two mic inputs exclusively */
1200 for (i = AUTO_PIN_LINE; i < AUTO_PIN_LAST; i++)
1201 if (cfg->input_pins[i])
1205 for (i = AUTO_PIN_MIC; i <= AUTO_PIN_FRONT_MIC; i++) {
1206 hda_nid_t nid = cfg->input_pins[i];
1207 unsigned int defcfg;
1210 defcfg = snd_hda_codec_get_pincfg(codec, nid);
1211 switch (get_defcfg_connect(defcfg)) {
1212 case AC_JACK_PORT_FIXED:
1214 return; /* already occupied */
1217 case AC_JACK_PORT_COMPLEX:
1219 return; /* already occupied */
1223 return; /* invalid entry */
1226 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP))
1227 return; /* no unsol support */
1228 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n",
1230 spec->ext_mic.pin = ext;
1231 spec->int_mic.pin = fixed;
1232 spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1233 spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1235 snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0,
1236 AC_VERB_SET_UNSOLICITED_ENABLE,
1237 AC_USRSP_EN | ALC880_MIC_EVENT);
1238 spec->unsol_event = alc_sku_unsol_event;
1241 /* check subsystem ID and set up device-specific initialization;
1242 * return 1 if initialized, 0 if invalid SSID
1244 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1245 * 31 ~ 16 : Manufacture ID
1247 * 7 ~ 0 : Assembly ID
1248 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1250 static int alc_subsystem_id(struct hda_codec *codec,
1251 hda_nid_t porta, hda_nid_t porte,
1254 unsigned int ass, tmp, i;
1256 struct alc_spec *spec = codec->spec;
1258 ass = codec->subsystem_id & 0xffff;
1259 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1262 /* invalid SSID, check the special NID pin defcfg instead */
1264 * 31~30 : port connectivity
1267 * 19~16 : Check sum (15:1)
1272 if (codec->vendor_id == 0x10ec0260)
1274 ass = snd_hda_codec_get_pincfg(codec, nid);
1275 snd_printd("realtek: No valid SSID, "
1276 "checking pincfg 0x%08x for NID 0x%x\n",
1278 if (!(ass & 1) && !(ass & 0x100000))
1280 if ((ass >> 30) != 1) /* no physical connection */
1285 for (i = 1; i < 16; i++) {
1289 if (((ass >> 16) & 0xf) != tmp)
1292 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1293 ass & 0xffff, codec->vendor_id);
1297 * 2 : 0 --> Desktop, 1 --> Laptop
1298 * 3~5 : External Amplifier control
1301 tmp = (ass & 0x38) >> 3; /* external Amp control */
1304 spec->init_amp = ALC_INIT_GPIO1;
1307 spec->init_amp = ALC_INIT_GPIO2;
1310 spec->init_amp = ALC_INIT_GPIO3;
1313 spec->init_amp = ALC_INIT_DEFAULT;
1317 /* is laptop or Desktop and enable the function "Mute internal speaker
1318 * when the external headphone out jack is plugged"
1320 if (!(ass & 0x8000))
1323 * 10~8 : Jack location
1324 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1326 * 15 : 1 --> enable the function "Mute internal speaker
1327 * when the external headphone out jack is plugged"
1329 if (!spec->autocfg.hp_pins[0]) {
1331 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1340 for (i = 0; i < spec->autocfg.line_outs; i++)
1341 if (spec->autocfg.line_out_pins[i] == nid)
1343 spec->autocfg.hp_pins[0] = nid;
1346 alc_init_auto_hp(codec);
1347 alc_init_auto_mic(codec);
1351 static void alc_ssid_check(struct hda_codec *codec,
1352 hda_nid_t porta, hda_nid_t porte, hda_nid_t portd)
1354 if (!alc_subsystem_id(codec, porta, porte, portd)) {
1355 struct alc_spec *spec = codec->spec;
1356 snd_printd("realtek: "
1357 "Enable default setup for auto mode as fallback\n");
1358 spec->init_amp = ALC_INIT_DEFAULT;
1359 alc_init_auto_hp(codec);
1360 alc_init_auto_mic(codec);
1365 * Fix-up pin default configurations and add default verbs
1374 const struct alc_pincfg *pins;
1375 const struct hda_verb *verbs;
1378 static void alc_pick_fixup(struct hda_codec *codec,
1379 const struct snd_pci_quirk *quirk,
1380 const struct alc_fixup *fix)
1382 const struct alc_pincfg *cfg;
1384 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1388 fix += quirk->value;
1391 for (; cfg->nid; cfg++)
1392 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1395 add_verb(codec->spec, fix->verbs);
1398 static int alc_read_coef_idx(struct hda_codec *codec,
1399 unsigned int coef_idx)
1402 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX,
1404 val = snd_hda_codec_read(codec, 0x20, 0,
1405 AC_VERB_GET_PROC_COEF, 0);
1416 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1417 /* Mic-in jack as mic in */
1418 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1419 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1420 /* Line-in jack as Line in */
1421 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1422 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1423 /* Line-Out as Front */
1424 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1431 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1432 /* Mic-in jack as mic in */
1433 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1434 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1435 /* Line-in jack as Surround */
1436 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1437 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1438 /* Line-Out as Front */
1439 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1446 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1447 /* Mic-in jack as CLFE */
1448 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1449 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1450 /* Line-in jack as Surround */
1451 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1452 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1453 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1454 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1461 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1462 /* Mic-in jack as CLFE */
1463 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1464 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1465 /* Line-in jack as Surround */
1466 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1467 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1468 /* Line-Out as Side */
1469 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1473 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1474 { 2, alc888_4ST_ch2_intel_init },
1475 { 4, alc888_4ST_ch4_intel_init },
1476 { 6, alc888_4ST_ch6_intel_init },
1477 { 8, alc888_4ST_ch8_intel_init },
1481 * ALC888 Fujitsu Siemens Amillo xa3530
1484 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1485 /* Front Mic: set to PIN_IN (empty by default) */
1486 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1487 /* Connect Internal HP to Front */
1488 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1489 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1490 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1491 /* Connect Bass HP to Front */
1492 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1493 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1494 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1495 /* Connect Line-Out side jack (SPDIF) to Side */
1496 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1497 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1498 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1499 /* Connect Mic jack to CLFE */
1500 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1501 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1502 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1503 /* Connect Line-in jack to Surround */
1504 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1505 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1506 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1507 /* Connect HP out jack to Front */
1508 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1509 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1510 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1511 /* Enable unsolicited event for HP jack and Line-out jack */
1512 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1513 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1517 static void alc_automute_amp(struct hda_codec *codec)
1519 struct alc_spec *spec = codec->spec;
1524 spec->jack_present = 0;
1525 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
1526 nid = spec->autocfg.hp_pins[i];
1529 if (snd_hda_jack_detect(codec, nid)) {
1530 spec->jack_present = 1;
1535 mute = spec->jack_present ? HDA_AMP_MUTE : 0;
1536 /* Toggle internal speakers muting */
1537 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1538 nid = spec->autocfg.speaker_pins[i];
1541 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1542 HDA_AMP_MUTE, mute);
1546 static void alc_automute_amp_unsol_event(struct hda_codec *codec,
1549 if (codec->vendor_id == 0x10ec0880)
1553 if (res == ALC880_HP_EVENT)
1554 alc_automute_amp(codec);
1557 static void alc889_automute_setup(struct hda_codec *codec)
1559 struct alc_spec *spec = codec->spec;
1561 spec->autocfg.hp_pins[0] = 0x15;
1562 spec->autocfg.speaker_pins[0] = 0x14;
1563 spec->autocfg.speaker_pins[1] = 0x16;
1564 spec->autocfg.speaker_pins[2] = 0x17;
1565 spec->autocfg.speaker_pins[3] = 0x19;
1566 spec->autocfg.speaker_pins[4] = 0x1a;
1569 static void alc889_intel_init_hook(struct hda_codec *codec)
1571 alc889_coef_init(codec);
1572 alc_automute_amp(codec);
1575 static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec)
1577 struct alc_spec *spec = codec->spec;
1579 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
1580 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
1581 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
1582 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
1586 * ALC888 Acer Aspire 4930G model
1589 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1590 /* Front Mic: set to PIN_IN (empty by default) */
1591 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1592 /* Unselect Front Mic by default in input mixer 3 */
1593 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1594 /* Enable unsolicited event for HP jack */
1595 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1596 /* Connect Internal HP to front */
1597 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1598 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1599 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1600 /* Connect HP out to front */
1601 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1602 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1603 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1608 * ALC888 Acer Aspire 6530G model
1611 static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
1612 /* Bias voltage on for external mic port */
1613 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
1614 /* Front Mic: set to PIN_IN (empty by default) */
1615 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1616 /* Unselect Front Mic by default in input mixer 3 */
1617 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1618 /* Enable unsolicited event for HP jack */
1619 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1620 /* Enable speaker output */
1621 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1622 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1623 /* Enable headphone output */
1624 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1625 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1626 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1631 * ALC889 Acer Aspire 8930G model
1634 static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
1635 /* Front Mic: set to PIN_IN (empty by default) */
1636 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1637 /* Unselect Front Mic by default in input mixer 3 */
1638 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1639 /* Enable unsolicited event for HP jack */
1640 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1641 /* Connect Internal Front to Front */
1642 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1643 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1644 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1645 /* Connect Internal Rear to Rear */
1646 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1647 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1648 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
1649 /* Connect Internal CLFE to CLFE */
1650 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1651 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1652 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
1653 /* Connect HP out to Front */
1654 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1655 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1656 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1657 /* Enable all DACs */
1658 /* DAC DISABLE/MUTE 1? */
1659 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
1660 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
1661 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1662 /* DAC DISABLE/MUTE 2? */
1663 /* some bit here disables the other DACs. Init=0x4900 */
1664 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
1665 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1666 /* Enable amplifiers */
1667 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1668 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1670 * This laptop has a stereo digital microphone. The mics are only 1cm apart
1671 * which makes the stereo useless. However, either the mic or the ALC889
1672 * makes the signal become a difference/sum signal instead of standard
1673 * stereo, which is annoying. So instead we flip this bit which makes the
1674 * codec replicate the sum signal to both channels, turning it into a
1677 /* DMIC_CONTROL? Init value = 0x0001 */
1678 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
1679 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
1683 static struct hda_input_mux alc888_2_capture_sources[2] = {
1684 /* Front mic only available on one ADC */
1691 { "Front Mic", 0xb },
1704 static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
1705 /* Interal mic only available on one ADC */
1712 { "Input Mix", 0xa },
1722 { "Input Mix", 0xa },
1727 static struct hda_input_mux alc889_capture_sources[3] = {
1728 /* Digital mic only available on first "ADC" */
1735 { "Front Mic", 0xb },
1736 { "Input Mix", 0xa },
1745 { "Input Mix", 0xa },
1754 { "Input Mix", 0xa },
1759 static struct snd_kcontrol_new alc888_base_mixer[] = {
1760 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1761 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1762 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1763 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1764 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1766 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1767 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1768 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1769 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1770 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1771 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1772 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1773 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1774 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1775 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1776 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1777 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1781 static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
1783 struct alc_spec *spec = codec->spec;
1785 spec->autocfg.hp_pins[0] = 0x15;
1786 spec->autocfg.speaker_pins[0] = 0x14;
1787 spec->autocfg.speaker_pins[1] = 0x16;
1788 spec->autocfg.speaker_pins[2] = 0x17;
1791 static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
1793 struct alc_spec *spec = codec->spec;
1795 spec->autocfg.hp_pins[0] = 0x15;
1796 spec->autocfg.speaker_pins[0] = 0x14;
1797 spec->autocfg.speaker_pins[1] = 0x16;
1798 spec->autocfg.speaker_pins[2] = 0x17;
1801 static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
1803 struct alc_spec *spec = codec->spec;
1805 spec->autocfg.hp_pins[0] = 0x15;
1806 spec->autocfg.speaker_pins[0] = 0x14;
1807 spec->autocfg.speaker_pins[1] = 0x16;
1808 spec->autocfg.speaker_pins[2] = 0x1b;
1812 * ALC880 3-stack model
1814 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1815 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1816 * F-Mic = 0x1b, HP = 0x19
1819 static hda_nid_t alc880_dac_nids[4] = {
1820 /* front, rear, clfe, rear_surr */
1821 0x02, 0x05, 0x04, 0x03
1824 static hda_nid_t alc880_adc_nids[3] = {
1829 /* The datasheet says the node 0x07 is connected from inputs,
1830 * but it shows zero connection in the real implementation on some devices.
1831 * Note: this is a 915GAV bug, fixed on 915GLV
1833 static hda_nid_t alc880_adc_nids_alt[2] = {
1838 #define ALC880_DIGOUT_NID 0x06
1839 #define ALC880_DIGIN_NID 0x0a
1841 static struct hda_input_mux alc880_capture_source = {
1845 { "Front Mic", 0x3 },
1851 /* channel source setting (2/6 channel selection for 3-stack) */
1853 static struct hda_verb alc880_threestack_ch2_init[] = {
1854 /* set line-in to input, mute it */
1855 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1856 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1857 /* set mic-in to input vref 80%, mute it */
1858 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1859 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1864 static struct hda_verb alc880_threestack_ch6_init[] = {
1865 /* set line-in to output, unmute it */
1866 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1867 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1868 /* set mic-in to output, unmute it */
1869 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1870 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1874 static struct hda_channel_mode alc880_threestack_modes[2] = {
1875 { 2, alc880_threestack_ch2_init },
1876 { 6, alc880_threestack_ch6_init },
1879 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1880 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1881 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1882 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1883 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1884 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1885 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1886 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1887 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1888 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1889 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1890 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1891 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1892 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1893 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1894 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1895 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1896 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1898 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1899 .name = "Channel Mode",
1900 .info = alc_ch_mode_info,
1901 .get = alc_ch_mode_get,
1902 .put = alc_ch_mode_put,
1907 /* capture mixer elements */
1908 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1909 struct snd_ctl_elem_info *uinfo)
1911 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1912 struct alc_spec *spec = codec->spec;
1915 mutex_lock(&codec->control_mutex);
1916 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1918 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
1919 mutex_unlock(&codec->control_mutex);
1923 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1924 unsigned int size, unsigned int __user *tlv)
1926 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1927 struct alc_spec *spec = codec->spec;
1930 mutex_lock(&codec->control_mutex);
1931 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1933 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1934 mutex_unlock(&codec->control_mutex);
1938 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
1939 struct snd_ctl_elem_value *ucontrol);
1941 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1942 struct snd_ctl_elem_value *ucontrol,
1945 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1946 struct alc_spec *spec = codec->spec;
1947 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1950 mutex_lock(&codec->control_mutex);
1951 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1953 err = func(kcontrol, ucontrol);
1954 mutex_unlock(&codec->control_mutex);
1958 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
1959 struct snd_ctl_elem_value *ucontrol)
1961 return alc_cap_getput_caller(kcontrol, ucontrol,
1962 snd_hda_mixer_amp_volume_get);
1965 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
1966 struct snd_ctl_elem_value *ucontrol)
1968 return alc_cap_getput_caller(kcontrol, ucontrol,
1969 snd_hda_mixer_amp_volume_put);
1972 /* capture mixer elements */
1973 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
1975 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
1976 struct snd_ctl_elem_value *ucontrol)
1978 return alc_cap_getput_caller(kcontrol, ucontrol,
1979 snd_hda_mixer_amp_switch_get);
1982 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
1983 struct snd_ctl_elem_value *ucontrol)
1985 return alc_cap_getput_caller(kcontrol, ucontrol,
1986 snd_hda_mixer_amp_switch_put);
1989 #define _DEFINE_CAPMIX(num) \
1991 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1992 .name = "Capture Switch", \
1993 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
1995 .info = alc_cap_sw_info, \
1996 .get = alc_cap_sw_get, \
1997 .put = alc_cap_sw_put, \
2000 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2001 .name = "Capture Volume", \
2002 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
2003 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
2004 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
2006 .info = alc_cap_vol_info, \
2007 .get = alc_cap_vol_get, \
2008 .put = alc_cap_vol_put, \
2009 .tlv = { .c = alc_cap_vol_tlv }, \
2012 #define _DEFINE_CAPSRC(num) \
2014 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2015 /* .name = "Capture Source", */ \
2016 .name = "Input Source", \
2018 .info = alc_mux_enum_info, \
2019 .get = alc_mux_enum_get, \
2020 .put = alc_mux_enum_put, \
2023 #define DEFINE_CAPMIX(num) \
2024 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2025 _DEFINE_CAPMIX(num), \
2026 _DEFINE_CAPSRC(num), \
2030 #define DEFINE_CAPMIX_NOSRC(num) \
2031 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2032 _DEFINE_CAPMIX(num), \
2036 /* up to three ADCs */
2040 DEFINE_CAPMIX_NOSRC(1);
2041 DEFINE_CAPMIX_NOSRC(2);
2042 DEFINE_CAPMIX_NOSRC(3);
2045 * ALC880 5-stack model
2047 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2049 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2050 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2053 /* additional mixers to alc880_three_stack_mixer */
2054 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2055 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2056 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2060 /* channel source setting (6/8 channel selection for 5-stack) */
2062 static struct hda_verb alc880_fivestack_ch6_init[] = {
2063 /* set line-in to input, mute it */
2064 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2065 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2070 static struct hda_verb alc880_fivestack_ch8_init[] = {
2071 /* set line-in to output, unmute it */
2072 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2073 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2077 static struct hda_channel_mode alc880_fivestack_modes[2] = {
2078 { 6, alc880_fivestack_ch6_init },
2079 { 8, alc880_fivestack_ch8_init },
2084 * ALC880 6-stack model
2086 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2087 * Side = 0x05 (0x0f)
2088 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2089 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2092 static hda_nid_t alc880_6st_dac_nids[4] = {
2093 /* front, rear, clfe, rear_surr */
2094 0x02, 0x03, 0x04, 0x05
2097 static struct hda_input_mux alc880_6stack_capture_source = {
2101 { "Front Mic", 0x1 },
2107 /* fixed 8-channels */
2108 static struct hda_channel_mode alc880_sixstack_modes[1] = {
2112 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2113 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2114 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2115 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2116 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2117 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2118 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2119 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2120 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2121 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2122 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2123 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2124 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2125 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2126 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2127 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2128 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2129 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2130 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2132 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2133 .name = "Channel Mode",
2134 .info = alc_ch_mode_info,
2135 .get = alc_ch_mode_get,
2136 .put = alc_ch_mode_put,
2145 * W810 has rear IO for:
2148 * Center/LFE (DAC 04)
2151 * The system also has a pair of internal speakers, and a headphone jack.
2152 * These are both connected to Line2 on the codec, hence to DAC 02.
2154 * There is a variable resistor to control the speaker or headphone
2155 * volume. This is a hardware-only device without a software API.
2157 * Plugging headphones in will disable the internal speakers. This is
2158 * implemented in hardware, not via the driver using jack sense. In
2159 * a similar fashion, plugging into the rear socket marked "front" will
2160 * disable both the speakers and headphones.
2162 * For input, there's a microphone jack, and an "audio in" jack.
2163 * These may not do anything useful with this driver yet, because I
2164 * haven't setup any initialization verbs for these yet...
2167 static hda_nid_t alc880_w810_dac_nids[3] = {
2168 /* front, rear/surround, clfe */
2172 /* fixed 6 channels */
2173 static struct hda_channel_mode alc880_w810_modes[1] = {
2177 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2178 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2179 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2180 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2181 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2182 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2183 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2184 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2185 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2186 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2187 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2195 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2196 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2200 static hda_nid_t alc880_z71v_dac_nids[1] = {
2203 #define ALC880_Z71V_HP_DAC 0x03
2205 /* fixed 2 channels */
2206 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2210 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2211 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2212 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2213 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2214 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2215 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2216 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2217 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2218 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2224 * ALC880 F1734 model
2226 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2227 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2230 static hda_nid_t alc880_f1734_dac_nids[1] = {
2233 #define ALC880_F1734_HP_DAC 0x02
2235 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2236 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2237 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2238 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2239 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2240 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2241 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2242 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2243 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2247 static struct hda_input_mux alc880_f1734_capture_source = {
2259 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2260 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2261 * Mic = 0x18, Line = 0x1a
2264 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2265 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2267 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2268 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2269 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2270 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2271 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2272 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2273 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2274 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2275 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 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("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2279 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2280 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2281 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2283 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2284 .name = "Channel Mode",
2285 .info = alc_ch_mode_info,
2286 .get = alc_ch_mode_get,
2287 .put = alc_ch_mode_put,
2293 * ALC880 ASUS W1V model
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, Line2 = 0x1b
2300 /* additional mixers to alc880_asus_mixer */
2301 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2302 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2303 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2308 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2309 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2310 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2311 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
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("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2315 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2316 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2317 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2322 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2323 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2324 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2325 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2326 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2327 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2328 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2329 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2330 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2331 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2332 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2333 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2334 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2335 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2336 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2337 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2338 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2340 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2341 .name = "Channel Mode",
2342 .info = alc_ch_mode_info,
2343 .get = alc_ch_mode_get,
2344 .put = alc_ch_mode_put,
2349 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2350 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2351 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2352 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2353 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2354 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2355 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2356 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2357 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2358 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2359 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2363 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2364 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2365 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2366 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2367 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2368 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2369 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2374 * virtual master controls
2378 * slave controls for virtual master
2380 static const char *alc_slave_vols[] = {
2381 "Front Playback Volume",
2382 "Surround Playback Volume",
2383 "Center Playback Volume",
2384 "LFE Playback Volume",
2385 "Side Playback Volume",
2386 "Headphone Playback Volume",
2387 "Speaker Playback Volume",
2388 "Mono Playback Volume",
2389 "Line-Out Playback Volume",
2390 "PCM Playback Volume",
2394 static const char *alc_slave_sws[] = {
2395 "Front Playback Switch",
2396 "Surround Playback Switch",
2397 "Center Playback Switch",
2398 "LFE Playback Switch",
2399 "Side Playback Switch",
2400 "Headphone Playback Switch",
2401 "Speaker Playback Switch",
2402 "Mono Playback Switch",
2403 "IEC958 Playback Switch",
2408 * build control elements
2411 static void alc_free_kctls(struct hda_codec *codec);
2413 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2414 /* additional beep mixers; the actual parameters are overwritten at build */
2415 static struct snd_kcontrol_new alc_beep_mixer[] = {
2416 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2417 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
2422 static int alc_build_controls(struct hda_codec *codec)
2424 struct alc_spec *spec = codec->spec;
2428 for (i = 0; i < spec->num_mixers; i++) {
2429 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2433 if (spec->cap_mixer) {
2434 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2438 if (spec->multiout.dig_out_nid) {
2439 err = snd_hda_create_spdif_out_ctls(codec,
2440 spec->multiout.dig_out_nid);
2443 if (!spec->no_analog) {
2444 err = snd_hda_create_spdif_share_sw(codec,
2448 spec->multiout.share_spdif = 1;
2451 if (spec->dig_in_nid) {
2452 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2457 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2458 /* create beep controls if needed */
2459 if (spec->beep_amp) {
2460 struct snd_kcontrol_new *knew;
2461 for (knew = alc_beep_mixer; knew->name; knew++) {
2462 struct snd_kcontrol *kctl;
2463 kctl = snd_ctl_new1(knew, codec);
2466 kctl->private_value = spec->beep_amp;
2467 err = snd_hda_ctl_add(codec,
2468 get_amp_nid_(spec->beep_amp), kctl);
2475 /* if we have no master control, let's create it */
2476 if (!spec->no_analog &&
2477 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2478 unsigned int vmaster_tlv[4];
2479 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2480 HDA_OUTPUT, vmaster_tlv);
2481 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2482 vmaster_tlv, alc_slave_vols);
2486 if (!spec->no_analog &&
2487 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2488 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2489 NULL, alc_slave_sws);
2494 alc_free_kctls(codec); /* no longer needed */
2500 * initialize the codec volumes, etc
2504 * generic initialization of ADC, input mixers and output mixers
2506 static struct hda_verb alc880_volume_init_verbs[] = {
2508 * Unmute ADC0-2 and set the default input to mic-in
2510 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2511 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2512 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2513 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2514 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2515 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2517 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2519 * Note: PASD motherboards uses the Line In 2 as the input for front
2522 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2523 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2524 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2525 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2526 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2527 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2528 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2529 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2532 * Set up output mixers (0x0c - 0x0f)
2534 /* set vol=0 to output mixers */
2535 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2536 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2537 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2538 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2539 /* set up input amps for analog loopback */
2540 /* Amp Indices: DAC = 0, mixer = 1 */
2541 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2542 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2543 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2544 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2545 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2546 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2547 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2548 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2554 * 3-stack pin configuration:
2555 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2557 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2559 * preset connection lists of input pins
2560 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2562 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2563 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2564 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2567 * Set pin mode and muting
2569 /* set front pin widgets 0x14 for output */
2570 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2571 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2572 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2573 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2574 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2575 /* Mic2 (as headphone out) for HP output */
2576 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2577 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2578 /* Line In pin widget for input */
2579 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2580 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2581 /* Line2 (as front mic) pin widget for input and vref at 80% */
2582 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2583 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2584 /* CD pin widget for input */
2585 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2591 * 5-stack pin configuration:
2592 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2593 * line-in/side = 0x1a, f-mic = 0x1b
2595 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2597 * preset connection lists of input pins
2598 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2600 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2601 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2604 * Set pin mode and muting
2606 /* set pin widgets 0x14-0x17 for output */
2607 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2608 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2609 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2610 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2611 /* unmute pins for output (no gain on this amp) */
2612 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2613 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2614 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2615 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2617 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2618 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2619 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2620 /* Mic2 (as headphone out) for HP output */
2621 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2622 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2623 /* Line In pin widget for input */
2624 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2625 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2626 /* Line2 (as front mic) pin widget for input and vref at 80% */
2627 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2628 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2629 /* CD pin widget for input */
2630 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2636 * W810 pin configuration:
2637 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2639 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2640 /* hphone/speaker input selector: front DAC */
2641 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2643 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2644 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2645 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2646 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2647 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2648 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2650 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2651 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2657 * Z71V pin configuration:
2658 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2660 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2661 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2662 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2663 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2664 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2666 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2667 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2668 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2669 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2675 * 6-stack pin configuration:
2676 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2677 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2679 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2680 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2682 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2683 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2684 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2685 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2686 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2687 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2688 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2689 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2691 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2692 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2693 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2694 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2695 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2696 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2697 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2698 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2699 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2705 * Uniwill pin configuration:
2706 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2709 static struct hda_verb alc880_uniwill_init_verbs[] = {
2710 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2712 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2713 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2714 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2715 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2716 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2717 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2718 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2719 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2720 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2721 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2722 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2723 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2724 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2725 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2727 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2728 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2729 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2730 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2731 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2732 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2733 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2734 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2735 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2737 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2738 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2745 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2747 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2748 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2750 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2751 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2752 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2753 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2754 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2755 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2756 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2757 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2758 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2759 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2760 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2761 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2763 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2764 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2765 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2766 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2767 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2768 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2770 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2771 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2776 static struct hda_verb alc880_beep_init_verbs[] = {
2777 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2781 /* auto-toggle front mic */
2782 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2784 unsigned int present;
2787 present = snd_hda_jack_detect(codec, 0x18);
2788 bits = present ? HDA_AMP_MUTE : 0;
2789 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2792 static void alc880_uniwill_setup(struct hda_codec *codec)
2794 struct alc_spec *spec = codec->spec;
2796 spec->autocfg.hp_pins[0] = 0x14;
2797 spec->autocfg.speaker_pins[0] = 0x15;
2798 spec->autocfg.speaker_pins[0] = 0x16;
2801 static void alc880_uniwill_init_hook(struct hda_codec *codec)
2803 alc_automute_amp(codec);
2804 alc880_uniwill_mic_automute(codec);
2807 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2810 /* Looks like the unsol event is incompatible with the standard
2811 * definition. 4bit tag is placed at 28 bit!
2813 switch (res >> 28) {
2814 case ALC880_MIC_EVENT:
2815 alc880_uniwill_mic_automute(codec);
2818 alc_automute_amp_unsol_event(codec, res);
2823 static void alc880_uniwill_p53_setup(struct hda_codec *codec)
2825 struct alc_spec *spec = codec->spec;
2827 spec->autocfg.hp_pins[0] = 0x14;
2828 spec->autocfg.speaker_pins[0] = 0x15;
2831 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2833 unsigned int present;
2835 present = snd_hda_codec_read(codec, 0x21, 0,
2836 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2837 present &= HDA_AMP_VOLMASK;
2838 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2839 HDA_AMP_VOLMASK, present);
2840 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2841 HDA_AMP_VOLMASK, present);
2844 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2847 /* Looks like the unsol event is incompatible with the standard
2848 * definition. 4bit tag is placed at 28 bit!
2850 if ((res >> 28) == ALC880_DCVOL_EVENT)
2851 alc880_uniwill_p53_dcvol_automute(codec);
2853 alc_automute_amp_unsol_event(codec, res);
2857 * F1734 pin configuration:
2858 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2860 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2861 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2862 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2863 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2864 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2865 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2867 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2868 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2869 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2870 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2872 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2873 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2874 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2875 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2876 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2877 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2878 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2879 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2880 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2882 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2883 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2889 * ASUS pin configuration:
2890 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2892 static struct hda_verb alc880_pin_asus_init_verbs[] = {
2893 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2894 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2895 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2896 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2898 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2899 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2900 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2901 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2902 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2903 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2904 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2905 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2907 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2908 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2909 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2910 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2911 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2912 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2913 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2914 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2915 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2920 /* Enable GPIO mask and set output */
2921 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2922 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2923 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
2925 /* Clevo m520g init */
2926 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
2927 /* headphone output */
2928 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2930 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2931 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2933 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2934 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2936 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2937 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2938 /* Mic1 (rear panel) */
2939 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2940 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2941 /* Mic2 (front panel) */
2942 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2943 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2945 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2946 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2947 /* change to EAPD mode */
2948 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2949 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2954 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2955 /* change to EAPD mode */
2956 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2957 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2959 /* Headphone output */
2960 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2962 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2963 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2965 /* Line In pin widget for input */
2966 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2967 /* CD pin widget for input */
2968 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2969 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2970 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2972 /* change to EAPD mode */
2973 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2974 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
2980 * LG m1 express dual
2983 * Rear Line-In/Out (blue): 0x14
2984 * Build-in Mic-In: 0x15
2986 * HP-Out (green): 0x1b
2987 * Mic-In/Out (red): 0x19
2991 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2992 static hda_nid_t alc880_lg_dac_nids[3] = {
2996 /* seems analog CD is not working */
2997 static struct hda_input_mux alc880_lg_capture_source = {
3002 { "Internal Mic", 0x6 },
3006 /* 2,4,6 channel modes */
3007 static struct hda_verb alc880_lg_ch2_init[] = {
3008 /* set line-in and mic-in to input */
3009 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
3010 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3014 static struct hda_verb alc880_lg_ch4_init[] = {
3015 /* set line-in to out and mic-in to input */
3016 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3017 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3021 static struct hda_verb alc880_lg_ch6_init[] = {
3022 /* set line-in and mic-in to output */
3023 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3024 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3028 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
3029 { 2, alc880_lg_ch2_init },
3030 { 4, alc880_lg_ch4_init },
3031 { 6, alc880_lg_ch6_init },
3034 static struct snd_kcontrol_new alc880_lg_mixer[] = {
3035 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3036 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3037 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3038 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3039 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3040 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3041 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3042 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3043 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3044 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3045 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3046 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3047 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3048 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3050 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3051 .name = "Channel Mode",
3052 .info = alc_ch_mode_info,
3053 .get = alc_ch_mode_get,
3054 .put = alc_ch_mode_put,
3059 static struct hda_verb alc880_lg_init_verbs[] = {
3060 /* set capture source to mic-in */
3061 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3062 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3063 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3064 /* mute all amp mixer inputs */
3065 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3066 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3067 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3068 /* line-in to input */
3069 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3070 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3072 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3073 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3075 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3076 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3077 /* mic-in to input */
3078 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3079 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3080 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3082 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3083 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3084 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3086 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3090 /* toggle speaker-output according to the hp-jack state */
3091 static void alc880_lg_setup(struct hda_codec *codec)
3093 struct alc_spec *spec = codec->spec;
3095 spec->autocfg.hp_pins[0] = 0x1b;
3096 spec->autocfg.speaker_pins[0] = 0x17;
3105 * Built-in Mic-In: 0x19
3111 static struct hda_input_mux alc880_lg_lw_capture_source = {
3115 { "Internal Mic", 0x1 },
3120 #define alc880_lg_lw_modes alc880_threestack_modes
3122 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3123 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3124 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3125 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3126 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3127 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3128 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3129 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3130 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3131 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3132 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3133 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3134 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3135 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
3136 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
3138 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3139 .name = "Channel Mode",
3140 .info = alc_ch_mode_info,
3141 .get = alc_ch_mode_get,
3142 .put = alc_ch_mode_put,
3147 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3148 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3149 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3150 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3152 /* set capture source to mic-in */
3153 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3154 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3155 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3156 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3158 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3159 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3161 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3162 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3163 /* mic-in to input */
3164 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3165 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3167 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3168 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3170 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3174 /* toggle speaker-output according to the hp-jack state */
3175 static void alc880_lg_lw_setup(struct hda_codec *codec)
3177 struct alc_spec *spec = codec->spec;
3179 spec->autocfg.hp_pins[0] = 0x1b;
3180 spec->autocfg.speaker_pins[0] = 0x14;
3183 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3184 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3185 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3186 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3187 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3188 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3189 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3193 static struct hda_input_mux alc880_medion_rim_capture_source = {
3197 { "Internal Mic", 0x1 },
3201 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3202 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3204 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3205 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3207 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3208 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3209 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3210 /* Mic2 (as headphone out) for HP output */
3211 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3212 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3213 /* Internal Speaker */
3214 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3215 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3217 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3218 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3220 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3224 /* toggle speaker-output according to the hp-jack state */
3225 static void alc880_medion_rim_automute(struct hda_codec *codec)
3227 struct alc_spec *spec = codec->spec;
3228 alc_automute_amp(codec);
3230 if (spec->jack_present)
3231 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3233 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3236 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3239 /* Looks like the unsol event is incompatible with the standard
3240 * definition. 4bit tag is placed at 28 bit!
3242 if ((res >> 28) == ALC880_HP_EVENT)
3243 alc880_medion_rim_automute(codec);
3246 static void alc880_medion_rim_setup(struct hda_codec *codec)
3248 struct alc_spec *spec = codec->spec;
3250 spec->autocfg.hp_pins[0] = 0x14;
3251 spec->autocfg.speaker_pins[0] = 0x1b;
3254 #ifdef CONFIG_SND_HDA_POWER_SAVE
3255 static struct hda_amp_list alc880_loopbacks[] = {
3256 { 0x0b, HDA_INPUT, 0 },
3257 { 0x0b, HDA_INPUT, 1 },
3258 { 0x0b, HDA_INPUT, 2 },
3259 { 0x0b, HDA_INPUT, 3 },
3260 { 0x0b, HDA_INPUT, 4 },
3264 static struct hda_amp_list alc880_lg_loopbacks[] = {
3265 { 0x0b, HDA_INPUT, 1 },
3266 { 0x0b, HDA_INPUT, 6 },
3267 { 0x0b, HDA_INPUT, 7 },
3276 static int alc_init(struct hda_codec *codec)
3278 struct alc_spec *spec = codec->spec;
3282 alc_auto_init_amp(codec, spec->init_amp);
3284 for (i = 0; i < spec->num_init_verbs; i++)
3285 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3287 if (spec->init_hook)
3288 spec->init_hook(codec);
3293 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3295 struct alc_spec *spec = codec->spec;
3297 if (spec->unsol_event)
3298 spec->unsol_event(codec, res);
3301 #ifdef CONFIG_SND_HDA_POWER_SAVE
3302 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3304 struct alc_spec *spec = codec->spec;
3305 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3310 * Analog playback callbacks
3312 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3313 struct hda_codec *codec,
3314 struct snd_pcm_substream *substream)
3316 struct alc_spec *spec = codec->spec;
3317 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3321 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3322 struct hda_codec *codec,
3323 unsigned int stream_tag,
3324 unsigned int format,
3325 struct snd_pcm_substream *substream)
3327 struct alc_spec *spec = codec->spec;
3328 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3329 stream_tag, format, substream);
3332 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3333 struct hda_codec *codec,
3334 struct snd_pcm_substream *substream)
3336 struct alc_spec *spec = codec->spec;
3337 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3343 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3344 struct hda_codec *codec,
3345 struct snd_pcm_substream *substream)
3347 struct alc_spec *spec = codec->spec;
3348 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3351 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3352 struct hda_codec *codec,
3353 unsigned int stream_tag,
3354 unsigned int format,
3355 struct snd_pcm_substream *substream)
3357 struct alc_spec *spec = codec->spec;
3358 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3359 stream_tag, format, substream);
3362 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3363 struct hda_codec *codec,
3364 struct snd_pcm_substream *substream)
3366 struct alc_spec *spec = codec->spec;
3367 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3370 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3371 struct hda_codec *codec,
3372 struct snd_pcm_substream *substream)
3374 struct alc_spec *spec = codec->spec;
3375 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3381 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3382 struct hda_codec *codec,
3383 unsigned int stream_tag,
3384 unsigned int format,
3385 struct snd_pcm_substream *substream)
3387 struct alc_spec *spec = codec->spec;
3389 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3390 stream_tag, 0, format);
3394 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3395 struct hda_codec *codec,
3396 struct snd_pcm_substream *substream)
3398 struct alc_spec *spec = codec->spec;
3400 snd_hda_codec_cleanup_stream(codec,
3401 spec->adc_nids[substream->number + 1]);
3408 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3412 /* NID is set in alc_build_pcms */
3414 .open = alc880_playback_pcm_open,
3415 .prepare = alc880_playback_pcm_prepare,
3416 .cleanup = alc880_playback_pcm_cleanup
3420 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3424 /* NID is set in alc_build_pcms */
3427 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3431 /* NID is set in alc_build_pcms */
3434 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3435 .substreams = 2, /* can be overridden */
3438 /* NID is set in alc_build_pcms */
3440 .prepare = alc880_alt_capture_pcm_prepare,
3441 .cleanup = alc880_alt_capture_pcm_cleanup
3445 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3449 /* NID is set in alc_build_pcms */
3451 .open = alc880_dig_playback_pcm_open,
3452 .close = alc880_dig_playback_pcm_close,
3453 .prepare = alc880_dig_playback_pcm_prepare,
3454 .cleanup = alc880_dig_playback_pcm_cleanup
3458 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3462 /* NID is set in alc_build_pcms */
3465 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3466 static struct hda_pcm_stream alc_pcm_null_stream = {
3472 static int alc_build_pcms(struct hda_codec *codec)
3474 struct alc_spec *spec = codec->spec;
3475 struct hda_pcm *info = spec->pcm_rec;
3478 codec->num_pcms = 1;
3479 codec->pcm_info = info;
3481 if (spec->no_analog)
3484 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
3485 "%s Analog", codec->chip_name);
3486 info->name = spec->stream_name_analog;
3488 if (spec->stream_analog_playback) {
3489 if (snd_BUG_ON(!spec->multiout.dac_nids))
3491 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3492 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3494 if (spec->stream_analog_capture) {
3495 if (snd_BUG_ON(!spec->adc_nids))
3497 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3498 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3501 if (spec->channel_mode) {
3502 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3503 for (i = 0; i < spec->num_channel_mode; i++) {
3504 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3505 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3511 /* SPDIF for stream index #1 */
3512 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3513 snprintf(spec->stream_name_digital,
3514 sizeof(spec->stream_name_digital),
3515 "%s Digital", codec->chip_name);
3516 codec->num_pcms = 2;
3517 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3518 info = spec->pcm_rec + 1;
3519 info->name = spec->stream_name_digital;
3520 if (spec->dig_out_type)
3521 info->pcm_type = spec->dig_out_type;
3523 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3524 if (spec->multiout.dig_out_nid &&
3525 spec->stream_digital_playback) {
3526 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3527 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3529 if (spec->dig_in_nid &&
3530 spec->stream_digital_capture) {
3531 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3532 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3534 /* FIXME: do we need this for all Realtek codec models? */
3535 codec->spdif_status_reset = 1;
3538 if (spec->no_analog)
3541 /* If the use of more than one ADC is requested for the current
3542 * model, configure a second analog capture-only PCM.
3544 /* Additional Analaog capture for index #2 */
3545 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3546 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3547 codec->num_pcms = 3;
3548 info = spec->pcm_rec + 2;
3549 info->name = spec->stream_name_analog;
3550 if (spec->alt_dac_nid) {
3551 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3552 *spec->stream_analog_alt_playback;
3553 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3556 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3557 alc_pcm_null_stream;
3558 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3560 if (spec->num_adc_nids > 1) {
3561 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3562 *spec->stream_analog_alt_capture;
3563 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3565 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3566 spec->num_adc_nids - 1;
3568 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3569 alc_pcm_null_stream;
3570 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3577 static void alc_free_kctls(struct hda_codec *codec)
3579 struct alc_spec *spec = codec->spec;
3581 if (spec->kctls.list) {
3582 struct snd_kcontrol_new *kctl = spec->kctls.list;
3584 for (i = 0; i < spec->kctls.used; i++)
3585 kfree(kctl[i].name);
3587 snd_array_free(&spec->kctls);
3590 static void alc_free(struct hda_codec *codec)
3592 struct alc_spec *spec = codec->spec;
3597 alc_free_kctls(codec);
3599 snd_hda_detach_beep_device(codec);
3602 #ifdef SND_HDA_NEEDS_RESUME
3603 static int alc_resume(struct hda_codec *codec)
3605 codec->patch_ops.init(codec);
3606 snd_hda_codec_resume_amp(codec);
3607 snd_hda_codec_resume_cache(codec);
3614 static struct hda_codec_ops alc_patch_ops = {
3615 .build_controls = alc_build_controls,
3616 .build_pcms = alc_build_pcms,
3619 .unsol_event = alc_unsol_event,
3620 #ifdef SND_HDA_NEEDS_RESUME
3621 .resume = alc_resume,
3623 #ifdef CONFIG_SND_HDA_POWER_SAVE
3624 .check_power_status = alc_check_power_status,
3630 * Test configuration for debugging
3632 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3635 #ifdef CONFIG_SND_DEBUG
3636 static hda_nid_t alc880_test_dac_nids[4] = {
3637 0x02, 0x03, 0x04, 0x05
3640 static struct hda_input_mux alc880_test_capture_source = {
3649 { "Surround", 0x6 },
3653 static struct hda_channel_mode alc880_test_modes[4] = {
3660 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3661 struct snd_ctl_elem_info *uinfo)
3663 static char *texts[] = {
3664 "N/A", "Line Out", "HP Out",
3665 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3667 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3669 uinfo->value.enumerated.items = 8;
3670 if (uinfo->value.enumerated.item >= 8)
3671 uinfo->value.enumerated.item = 7;
3672 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3676 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3677 struct snd_ctl_elem_value *ucontrol)
3679 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3680 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3681 unsigned int pin_ctl, item = 0;
3683 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3684 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3685 if (pin_ctl & AC_PINCTL_OUT_EN) {
3686 if (pin_ctl & AC_PINCTL_HP_EN)
3690 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3691 switch (pin_ctl & AC_PINCTL_VREFEN) {
3692 case AC_PINCTL_VREF_HIZ: item = 3; break;
3693 case AC_PINCTL_VREF_50: item = 4; break;
3694 case AC_PINCTL_VREF_GRD: item = 5; break;
3695 case AC_PINCTL_VREF_80: item = 6; break;
3696 case AC_PINCTL_VREF_100: item = 7; break;
3699 ucontrol->value.enumerated.item[0] = item;
3703 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3704 struct snd_ctl_elem_value *ucontrol)
3706 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3707 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3708 static unsigned int ctls[] = {
3709 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3710 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3711 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3712 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3713 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3714 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3716 unsigned int old_ctl, new_ctl;
3718 old_ctl = snd_hda_codec_read(codec, nid, 0,
3719 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3720 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3721 if (old_ctl != new_ctl) {
3723 snd_hda_codec_write_cache(codec, nid, 0,
3724 AC_VERB_SET_PIN_WIDGET_CONTROL,
3726 val = ucontrol->value.enumerated.item[0] >= 3 ?
3728 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3735 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3736 struct snd_ctl_elem_info *uinfo)
3738 static char *texts[] = {
3739 "Front", "Surround", "CLFE", "Side"
3741 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3743 uinfo->value.enumerated.items = 4;
3744 if (uinfo->value.enumerated.item >= 4)
3745 uinfo->value.enumerated.item = 3;
3746 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3750 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3751 struct snd_ctl_elem_value *ucontrol)
3753 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3754 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3757 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3758 ucontrol->value.enumerated.item[0] = sel & 3;
3762 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3763 struct snd_ctl_elem_value *ucontrol)
3765 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3766 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3769 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3770 if (ucontrol->value.enumerated.item[0] != sel) {
3771 sel = ucontrol->value.enumerated.item[0] & 3;
3772 snd_hda_codec_write_cache(codec, nid, 0,
3773 AC_VERB_SET_CONNECT_SEL, sel);
3779 #define PIN_CTL_TEST(xname,nid) { \
3780 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3782 .info = alc_test_pin_ctl_info, \
3783 .get = alc_test_pin_ctl_get, \
3784 .put = alc_test_pin_ctl_put, \
3785 .private_value = nid \
3788 #define PIN_SRC_TEST(xname,nid) { \
3789 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3791 .info = alc_test_pin_src_info, \
3792 .get = alc_test_pin_src_get, \
3793 .put = alc_test_pin_src_put, \
3794 .private_value = nid \
3797 static struct snd_kcontrol_new alc880_test_mixer[] = {
3798 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3799 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3800 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3801 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3802 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3803 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3804 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3805 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3806 PIN_CTL_TEST("Front Pin Mode", 0x14),
3807 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3808 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3809 PIN_CTL_TEST("Side Pin Mode", 0x17),
3810 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3811 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3812 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3813 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3814 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3815 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3816 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3817 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3818 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3819 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3820 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3821 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3822 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3823 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3824 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3825 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3826 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3827 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3829 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3830 .name = "Channel Mode",
3831 .info = alc_ch_mode_info,
3832 .get = alc_ch_mode_get,
3833 .put = alc_ch_mode_put,
3838 static struct hda_verb alc880_test_init_verbs[] = {
3839 /* Unmute inputs of 0x0c - 0x0f */
3840 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3841 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3842 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3843 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3844 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3845 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3846 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3847 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3848 /* Vol output for 0x0c-0x0f */
3849 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3850 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3851 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3852 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3853 /* Set output pins 0x14-0x17 */
3854 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3855 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3856 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3857 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3858 /* Unmute output pins 0x14-0x17 */
3859 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3860 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3861 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3862 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3863 /* Set input pins 0x18-0x1c */
3864 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3865 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3866 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3867 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3868 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3869 /* Mute input pins 0x18-0x1b */
3870 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3871 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3872 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3873 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3875 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3876 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3877 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3878 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3879 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3880 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3881 /* Analog input/passthru */
3882 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3883 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3884 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3885 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3886 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3894 static const char *alc880_models[ALC880_MODEL_LAST] = {
3895 [ALC880_3ST] = "3stack",
3896 [ALC880_TCL_S700] = "tcl",
3897 [ALC880_3ST_DIG] = "3stack-digout",
3898 [ALC880_CLEVO] = "clevo",
3899 [ALC880_5ST] = "5stack",
3900 [ALC880_5ST_DIG] = "5stack-digout",
3901 [ALC880_W810] = "w810",
3902 [ALC880_Z71V] = "z71v",
3903 [ALC880_6ST] = "6stack",
3904 [ALC880_6ST_DIG] = "6stack-digout",
3905 [ALC880_ASUS] = "asus",
3906 [ALC880_ASUS_W1V] = "asus-w1v",
3907 [ALC880_ASUS_DIG] = "asus-dig",
3908 [ALC880_ASUS_DIG2] = "asus-dig2",
3909 [ALC880_UNIWILL_DIG] = "uniwill",
3910 [ALC880_UNIWILL_P53] = "uniwill-p53",
3911 [ALC880_FUJITSU] = "fujitsu",
3912 [ALC880_F1734] = "F1734",
3914 [ALC880_LG_LW] = "lg-lw",
3915 [ALC880_MEDION_RIM] = "medion",
3916 #ifdef CONFIG_SND_DEBUG
3917 [ALC880_TEST] = "test",
3919 [ALC880_AUTO] = "auto",
3922 static struct snd_pci_quirk alc880_cfg_tbl[] = {
3923 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
3924 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
3925 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
3926 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
3927 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
3928 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
3929 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
3930 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
3931 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
3932 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
3933 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
3934 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
3935 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
3936 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
3937 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
3938 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
3939 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
3940 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
3941 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3942 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
3943 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
3944 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
3945 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
3946 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
3947 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
3948 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
3949 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
3950 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
3951 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
3952 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
3953 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
3954 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
3955 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
3956 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
3957 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
3958 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
3959 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
3960 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
3961 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
3962 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
3963 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
3964 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
3965 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
3966 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
3967 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
3968 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
3969 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
3970 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
3971 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
3972 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
3973 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
3974 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
3975 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
3976 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
3977 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
3978 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
3979 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
3980 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
3981 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
3982 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
3983 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
3984 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
3985 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
3986 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
3987 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
3988 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
3989 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
3990 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
3992 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
3993 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
3994 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
3999 * ALC880 codec presets
4001 static struct alc_config_preset alc880_presets[] = {
4003 .mixers = { alc880_three_stack_mixer },
4004 .init_verbs = { alc880_volume_init_verbs,
4005 alc880_pin_3stack_init_verbs },
4006 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4007 .dac_nids = alc880_dac_nids,
4008 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4009 .channel_mode = alc880_threestack_modes,
4011 .input_mux = &alc880_capture_source,
4013 [ALC880_3ST_DIG] = {
4014 .mixers = { alc880_three_stack_mixer },
4015 .init_verbs = { alc880_volume_init_verbs,
4016 alc880_pin_3stack_init_verbs },
4017 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4018 .dac_nids = alc880_dac_nids,
4019 .dig_out_nid = ALC880_DIGOUT_NID,
4020 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4021 .channel_mode = alc880_threestack_modes,
4023 .input_mux = &alc880_capture_source,
4025 [ALC880_TCL_S700] = {
4026 .mixers = { alc880_tcl_s700_mixer },
4027 .init_verbs = { alc880_volume_init_verbs,
4028 alc880_pin_tcl_S700_init_verbs,
4029 alc880_gpio2_init_verbs },
4030 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4031 .dac_nids = alc880_dac_nids,
4032 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4033 .num_adc_nids = 1, /* single ADC */
4035 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4036 .channel_mode = alc880_2_jack_modes,
4037 .input_mux = &alc880_capture_source,
4040 .mixers = { alc880_three_stack_mixer,
4041 alc880_five_stack_mixer},
4042 .init_verbs = { alc880_volume_init_verbs,
4043 alc880_pin_5stack_init_verbs },
4044 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4045 .dac_nids = alc880_dac_nids,
4046 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4047 .channel_mode = alc880_fivestack_modes,
4048 .input_mux = &alc880_capture_source,
4050 [ALC880_5ST_DIG] = {
4051 .mixers = { alc880_three_stack_mixer,
4052 alc880_five_stack_mixer },
4053 .init_verbs = { alc880_volume_init_verbs,
4054 alc880_pin_5stack_init_verbs },
4055 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4056 .dac_nids = alc880_dac_nids,
4057 .dig_out_nid = ALC880_DIGOUT_NID,
4058 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4059 .channel_mode = alc880_fivestack_modes,
4060 .input_mux = &alc880_capture_source,
4063 .mixers = { alc880_six_stack_mixer },
4064 .init_verbs = { alc880_volume_init_verbs,
4065 alc880_pin_6stack_init_verbs },
4066 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4067 .dac_nids = alc880_6st_dac_nids,
4068 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4069 .channel_mode = alc880_sixstack_modes,
4070 .input_mux = &alc880_6stack_capture_source,
4072 [ALC880_6ST_DIG] = {
4073 .mixers = { alc880_six_stack_mixer },
4074 .init_verbs = { alc880_volume_init_verbs,
4075 alc880_pin_6stack_init_verbs },
4076 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4077 .dac_nids = alc880_6st_dac_nids,
4078 .dig_out_nid = ALC880_DIGOUT_NID,
4079 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4080 .channel_mode = alc880_sixstack_modes,
4081 .input_mux = &alc880_6stack_capture_source,
4084 .mixers = { alc880_w810_base_mixer },
4085 .init_verbs = { alc880_volume_init_verbs,
4086 alc880_pin_w810_init_verbs,
4087 alc880_gpio2_init_verbs },
4088 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
4089 .dac_nids = alc880_w810_dac_nids,
4090 .dig_out_nid = ALC880_DIGOUT_NID,
4091 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4092 .channel_mode = alc880_w810_modes,
4093 .input_mux = &alc880_capture_source,
4096 .mixers = { alc880_z71v_mixer },
4097 .init_verbs = { alc880_volume_init_verbs,
4098 alc880_pin_z71v_init_verbs },
4099 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
4100 .dac_nids = alc880_z71v_dac_nids,
4101 .dig_out_nid = ALC880_DIGOUT_NID,
4103 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4104 .channel_mode = alc880_2_jack_modes,
4105 .input_mux = &alc880_capture_source,
4108 .mixers = { alc880_f1734_mixer },
4109 .init_verbs = { alc880_volume_init_verbs,
4110 alc880_pin_f1734_init_verbs },
4111 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
4112 .dac_nids = alc880_f1734_dac_nids,
4114 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4115 .channel_mode = alc880_2_jack_modes,
4116 .input_mux = &alc880_f1734_capture_source,
4117 .unsol_event = alc880_uniwill_p53_unsol_event,
4118 .setup = alc880_uniwill_p53_setup,
4119 .init_hook = alc_automute_amp,
4122 .mixers = { alc880_asus_mixer },
4123 .init_verbs = { alc880_volume_init_verbs,
4124 alc880_pin_asus_init_verbs,
4125 alc880_gpio1_init_verbs },
4126 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4127 .dac_nids = alc880_asus_dac_nids,
4128 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4129 .channel_mode = alc880_asus_modes,
4131 .input_mux = &alc880_capture_source,
4133 [ALC880_ASUS_DIG] = {
4134 .mixers = { alc880_asus_mixer },
4135 .init_verbs = { alc880_volume_init_verbs,
4136 alc880_pin_asus_init_verbs,
4137 alc880_gpio1_init_verbs },
4138 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4139 .dac_nids = alc880_asus_dac_nids,
4140 .dig_out_nid = ALC880_DIGOUT_NID,
4141 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4142 .channel_mode = alc880_asus_modes,
4144 .input_mux = &alc880_capture_source,
4146 [ALC880_ASUS_DIG2] = {
4147 .mixers = { alc880_asus_mixer },
4148 .init_verbs = { alc880_volume_init_verbs,
4149 alc880_pin_asus_init_verbs,
4150 alc880_gpio2_init_verbs }, /* use GPIO2 */
4151 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4152 .dac_nids = alc880_asus_dac_nids,
4153 .dig_out_nid = ALC880_DIGOUT_NID,
4154 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4155 .channel_mode = alc880_asus_modes,
4157 .input_mux = &alc880_capture_source,
4159 [ALC880_ASUS_W1V] = {
4160 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4161 .init_verbs = { alc880_volume_init_verbs,
4162 alc880_pin_asus_init_verbs,
4163 alc880_gpio1_init_verbs },
4164 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4165 .dac_nids = alc880_asus_dac_nids,
4166 .dig_out_nid = ALC880_DIGOUT_NID,
4167 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4168 .channel_mode = alc880_asus_modes,
4170 .input_mux = &alc880_capture_source,
4172 [ALC880_UNIWILL_DIG] = {
4173 .mixers = { alc880_asus_mixer },
4174 .init_verbs = { alc880_volume_init_verbs,
4175 alc880_pin_asus_init_verbs },
4176 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4177 .dac_nids = alc880_asus_dac_nids,
4178 .dig_out_nid = ALC880_DIGOUT_NID,
4179 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4180 .channel_mode = alc880_asus_modes,
4182 .input_mux = &alc880_capture_source,
4184 [ALC880_UNIWILL] = {
4185 .mixers = { alc880_uniwill_mixer },
4186 .init_verbs = { alc880_volume_init_verbs,
4187 alc880_uniwill_init_verbs },
4188 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4189 .dac_nids = alc880_asus_dac_nids,
4190 .dig_out_nid = ALC880_DIGOUT_NID,
4191 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4192 .channel_mode = alc880_threestack_modes,
4194 .input_mux = &alc880_capture_source,
4195 .unsol_event = alc880_uniwill_unsol_event,
4196 .setup = alc880_uniwill_setup,
4197 .init_hook = alc880_uniwill_init_hook,
4199 [ALC880_UNIWILL_P53] = {
4200 .mixers = { alc880_uniwill_p53_mixer },
4201 .init_verbs = { alc880_volume_init_verbs,
4202 alc880_uniwill_p53_init_verbs },
4203 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4204 .dac_nids = alc880_asus_dac_nids,
4205 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4206 .channel_mode = alc880_threestack_modes,
4207 .input_mux = &alc880_capture_source,
4208 .unsol_event = alc880_uniwill_p53_unsol_event,
4209 .setup = alc880_uniwill_p53_setup,
4210 .init_hook = alc_automute_amp,
4212 [ALC880_FUJITSU] = {
4213 .mixers = { alc880_fujitsu_mixer },
4214 .init_verbs = { alc880_volume_init_verbs,
4215 alc880_uniwill_p53_init_verbs,
4216 alc880_beep_init_verbs },
4217 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4218 .dac_nids = alc880_dac_nids,
4219 .dig_out_nid = ALC880_DIGOUT_NID,
4220 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4221 .channel_mode = alc880_2_jack_modes,
4222 .input_mux = &alc880_capture_source,
4223 .unsol_event = alc880_uniwill_p53_unsol_event,
4224 .setup = alc880_uniwill_p53_setup,
4225 .init_hook = alc_automute_amp,
4228 .mixers = { alc880_three_stack_mixer },
4229 .init_verbs = { alc880_volume_init_verbs,
4230 alc880_pin_clevo_init_verbs },
4231 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4232 .dac_nids = alc880_dac_nids,
4234 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4235 .channel_mode = alc880_threestack_modes,
4237 .input_mux = &alc880_capture_source,
4240 .mixers = { alc880_lg_mixer },
4241 .init_verbs = { alc880_volume_init_verbs,
4242 alc880_lg_init_verbs },
4243 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4244 .dac_nids = alc880_lg_dac_nids,
4245 .dig_out_nid = ALC880_DIGOUT_NID,
4246 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4247 .channel_mode = alc880_lg_ch_modes,
4249 .input_mux = &alc880_lg_capture_source,
4250 .unsol_event = alc_automute_amp_unsol_event,
4251 .setup = alc880_lg_setup,
4252 .init_hook = alc_automute_amp,
4253 #ifdef CONFIG_SND_HDA_POWER_SAVE
4254 .loopbacks = alc880_lg_loopbacks,
4258 .mixers = { alc880_lg_lw_mixer },
4259 .init_verbs = { alc880_volume_init_verbs,
4260 alc880_lg_lw_init_verbs },
4261 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4262 .dac_nids = alc880_dac_nids,
4263 .dig_out_nid = ALC880_DIGOUT_NID,
4264 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4265 .channel_mode = alc880_lg_lw_modes,
4266 .input_mux = &alc880_lg_lw_capture_source,
4267 .unsol_event = alc_automute_amp_unsol_event,
4268 .setup = alc880_lg_lw_setup,
4269 .init_hook = alc_automute_amp,
4271 [ALC880_MEDION_RIM] = {
4272 .mixers = { alc880_medion_rim_mixer },
4273 .init_verbs = { alc880_volume_init_verbs,
4274 alc880_medion_rim_init_verbs,
4275 alc_gpio2_init_verbs },
4276 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4277 .dac_nids = alc880_dac_nids,
4278 .dig_out_nid = ALC880_DIGOUT_NID,
4279 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4280 .channel_mode = alc880_2_jack_modes,
4281 .input_mux = &alc880_medion_rim_capture_source,
4282 .unsol_event = alc880_medion_rim_unsol_event,
4283 .setup = alc880_medion_rim_setup,
4284 .init_hook = alc880_medion_rim_automute,
4286 #ifdef CONFIG_SND_DEBUG
4288 .mixers = { alc880_test_mixer },
4289 .init_verbs = { alc880_test_init_verbs },
4290 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4291 .dac_nids = alc880_test_dac_nids,
4292 .dig_out_nid = ALC880_DIGOUT_NID,
4293 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4294 .channel_mode = alc880_test_modes,
4295 .input_mux = &alc880_test_capture_source,
4301 * Automatic parse of I/O pins from the BIOS configuration
4306 ALC_CTL_WIDGET_MUTE,
4309 static struct snd_kcontrol_new alc880_control_templates[] = {
4310 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4311 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4312 HDA_BIND_MUTE(NULL, 0, 0, 0),
4315 /* add dynamic controls */
4316 static int add_control(struct alc_spec *spec, int type, const char *name,
4319 struct snd_kcontrol_new *knew;
4321 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4322 knew = snd_array_new(&spec->kctls);
4325 *knew = alc880_control_templates[type];
4326 knew->name = kstrdup(name, GFP_KERNEL);
4329 if (get_amp_nid_(val))
4330 knew->subdevice = HDA_SUBDEV_NID_FLAG | get_amp_nid_(val);
4331 knew->private_value = val;
4335 static int add_control_with_pfx(struct alc_spec *spec, int type,
4336 const char *pfx, const char *dir,
4337 const char *sfx, unsigned long val)
4340 snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx);
4341 return add_control(spec, type, name, val);
4344 #define add_pb_vol_ctrl(spec, type, pfx, val) \
4345 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", val)
4346 #define add_pb_sw_ctrl(spec, type, pfx, val) \
4347 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", val)
4349 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4350 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4351 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4352 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4353 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4354 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4355 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4356 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4357 #define ALC880_PIN_CD_NID 0x1c
4359 /* fill in the dac_nids table from the parsed pin configuration */
4360 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4361 const struct auto_pin_cfg *cfg)
4367 memset(assigned, 0, sizeof(assigned));
4368 spec->multiout.dac_nids = spec->private_dac_nids;
4370 /* check the pins hardwired to audio widget */
4371 for (i = 0; i < cfg->line_outs; i++) {
4372 nid = cfg->line_out_pins[i];
4373 if (alc880_is_fixed_pin(nid)) {
4374 int idx = alc880_fixed_pin_idx(nid);
4375 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4379 /* left pins can be connect to any audio widget */
4380 for (i = 0; i < cfg->line_outs; i++) {
4381 nid = cfg->line_out_pins[i];
4382 if (alc880_is_fixed_pin(nid))
4384 /* search for an empty channel */
4385 for (j = 0; j < cfg->line_outs; j++) {
4387 spec->multiout.dac_nids[i] =
4388 alc880_idx_to_dac(j);
4394 spec->multiout.num_dacs = cfg->line_outs;
4398 /* add playback controls from the parsed DAC table */
4399 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4400 const struct auto_pin_cfg *cfg)
4402 static const char *chname[4] = {
4403 "Front", "Surround", NULL /*CLFE*/, "Side"
4408 for (i = 0; i < cfg->line_outs; i++) {
4409 if (!spec->multiout.dac_nids[i])
4411 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4414 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4416 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4420 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4422 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4426 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4428 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4432 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4434 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4440 if (cfg->line_outs == 1 &&
4441 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
4445 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4446 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4450 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4451 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4460 /* add playback controls for speaker and HP outputs */
4461 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4470 if (alc880_is_fixed_pin(pin)) {
4471 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4472 /* specify the DAC as the extra output */
4473 if (!spec->multiout.hp_nid)
4474 spec->multiout.hp_nid = nid;
4476 spec->multiout.extra_out_nid[0] = nid;
4477 /* control HP volume/switch on the output mixer amp */
4478 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4479 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4480 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4483 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4484 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4487 } else if (alc880_is_multi_pin(pin)) {
4488 /* set manual connection */
4489 /* we have only a switch on HP-out PIN */
4490 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
4491 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4498 /* create input playback/capture controls for the given pin */
4499 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4500 const char *ctlname,
4501 int idx, hda_nid_t mix_nid)
4505 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
4506 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4509 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
4510 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4516 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
4518 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
4519 return (pincap & AC_PINCAP_IN) != 0;
4522 /* create playback/capture controls for input pins */
4523 static int alc_auto_create_input_ctls(struct hda_codec *codec,
4524 const struct auto_pin_cfg *cfg,
4526 hda_nid_t cap1, hda_nid_t cap2)
4528 struct alc_spec *spec = codec->spec;
4529 struct hda_input_mux *imux = &spec->private_imux[0];
4532 for (i = 0; i < AUTO_PIN_LAST; i++) {
4535 pin = cfg->input_pins[i];
4536 if (!alc_is_input_pin(codec, pin))
4540 idx = get_connection_index(codec, mixer, pin);
4542 err = new_analog_input(spec, pin,
4543 auto_pin_cfg_labels[i],
4552 idx = get_connection_index(codec, cap1, pin);
4553 if (idx < 0 && cap2)
4554 idx = get_connection_index(codec, cap2, pin);
4556 imux->items[imux->num_items].label =
4557 auto_pin_cfg_labels[i];
4558 imux->items[imux->num_items].index = idx;
4565 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
4566 const struct auto_pin_cfg *cfg)
4568 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
4571 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4572 unsigned int pin_type)
4574 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4577 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4581 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4582 hda_nid_t nid, int pin_type,
4585 alc_set_pin_output(codec, nid, pin_type);
4586 /* need the manual connection? */
4587 if (alc880_is_multi_pin(nid)) {
4588 struct alc_spec *spec = codec->spec;
4589 int idx = alc880_multi_pin_idx(nid);
4590 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4591 AC_VERB_SET_CONNECT_SEL,
4592 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4596 static int get_pin_type(int line_out_type)
4598 if (line_out_type == AUTO_PIN_HP_OUT)
4604 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4606 struct alc_spec *spec = codec->spec;
4609 for (i = 0; i < spec->autocfg.line_outs; i++) {
4610 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4611 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4612 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4616 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4618 struct alc_spec *spec = codec->spec;
4621 pin = spec->autocfg.speaker_pins[0];
4622 if (pin) /* connect to front */
4623 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4624 pin = spec->autocfg.hp_pins[0];
4625 if (pin) /* connect to front */
4626 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4629 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4631 struct alc_spec *spec = codec->spec;
4634 for (i = 0; i < AUTO_PIN_LAST; i++) {
4635 hda_nid_t nid = spec->autocfg.input_pins[i];
4636 if (alc_is_input_pin(codec, nid)) {
4637 alc_set_input_pin(codec, nid, i);
4638 if (nid != ALC880_PIN_CD_NID &&
4639 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
4640 snd_hda_codec_write(codec, nid, 0,
4641 AC_VERB_SET_AMP_GAIN_MUTE,
4647 /* parse the BIOS configuration and set up the alc_spec */
4648 /* return 1 if successful, 0 if the proper config is not found,
4649 * or a negative error code
4651 static int alc880_parse_auto_config(struct hda_codec *codec)
4653 struct alc_spec *spec = codec->spec;
4655 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4657 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4661 if (!spec->autocfg.line_outs)
4662 return 0; /* can't find valid BIOS pin config */
4664 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4667 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4670 err = alc880_auto_create_extra_out(spec,
4671 spec->autocfg.speaker_pins[0],
4675 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4679 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
4683 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4685 /* check multiple SPDIF-out (for recent codecs) */
4686 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4688 err = snd_hda_get_connections(codec,
4689 spec->autocfg.dig_out_pins[i],
4694 spec->multiout.dig_out_nid = dig_nid;
4696 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4697 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
4699 spec->slave_dig_outs[i - 1] = dig_nid;
4702 if (spec->autocfg.dig_in_pin)
4703 spec->dig_in_nid = ALC880_DIGIN_NID;
4705 if (spec->kctls.list)
4706 add_mixer(spec, spec->kctls.list);
4708 add_verb(spec, alc880_volume_init_verbs);
4710 spec->num_mux_defs = 1;
4711 spec->input_mux = &spec->private_imux[0];
4713 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
4718 /* additional initialization for auto-configuration model */
4719 static void alc880_auto_init(struct hda_codec *codec)
4721 struct alc_spec *spec = codec->spec;
4722 alc880_auto_init_multi_out(codec);
4723 alc880_auto_init_extra_out(codec);
4724 alc880_auto_init_analog_input(codec);
4725 if (spec->unsol_event)
4726 alc_inithook(codec);
4729 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
4730 * one of two digital mic pins, e.g. on ALC272
4732 static void fixup_automic_adc(struct hda_codec *codec)
4734 struct alc_spec *spec = codec->spec;
4737 for (i = 0; i < spec->num_adc_nids; i++) {
4738 hda_nid_t cap = spec->capsrc_nids ?
4739 spec->capsrc_nids[i] : spec->adc_nids[i];
4742 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
4745 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
4748 spec->int_mic.mux_idx = iidx;
4749 spec->ext_mic.mux_idx = eidx;
4750 if (spec->capsrc_nids)
4751 spec->capsrc_nids += i;
4752 spec->adc_nids += i;
4753 spec->num_adc_nids = 1;
4756 snd_printd(KERN_INFO "hda_codec: %s: "
4757 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
4758 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
4759 spec->auto_mic = 0; /* disable auto-mic to be sure */
4762 static void set_capture_mixer(struct hda_codec *codec)
4764 struct alc_spec *spec = codec->spec;
4765 static struct snd_kcontrol_new *caps[2][3] = {
4766 { alc_capture_mixer_nosrc1,
4767 alc_capture_mixer_nosrc2,
4768 alc_capture_mixer_nosrc3 },
4769 { alc_capture_mixer1,
4771 alc_capture_mixer3 },
4773 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
4775 if (spec->auto_mic) {
4777 fixup_automic_adc(codec);
4778 } else if (spec->input_mux && spec->input_mux->num_items > 1)
4782 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
4786 #ifdef CONFIG_SND_HDA_INPUT_BEEP
4787 #define set_beep_amp(spec, nid, idx, dir) \
4788 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
4790 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
4794 * OK, here we have finally the patch for ALC880
4797 static int patch_alc880(struct hda_codec *codec)
4799 struct alc_spec *spec;
4803 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4809 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
4812 if (board_config < 0) {
4813 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
4815 board_config = ALC880_AUTO;
4818 if (board_config == ALC880_AUTO) {
4819 /* automatic parse from the BIOS config */
4820 err = alc880_parse_auto_config(codec);
4826 "hda_codec: Cannot set up configuration "
4827 "from BIOS. Using 3-stack mode...\n");
4828 board_config = ALC880_3ST;
4832 err = snd_hda_attach_beep_device(codec, 0x1);
4838 if (board_config != ALC880_AUTO)
4839 setup_preset(codec, &alc880_presets[board_config]);
4841 spec->stream_analog_playback = &alc880_pcm_analog_playback;
4842 spec->stream_analog_capture = &alc880_pcm_analog_capture;
4843 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
4845 spec->stream_digital_playback = &alc880_pcm_digital_playback;
4846 spec->stream_digital_capture = &alc880_pcm_digital_capture;
4848 if (!spec->adc_nids && spec->input_mux) {
4849 /* check whether NID 0x07 is valid */
4850 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
4852 wcap = get_wcaps_type(wcap);
4853 if (wcap != AC_WID_AUD_IN) {
4854 spec->adc_nids = alc880_adc_nids_alt;
4855 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
4857 spec->adc_nids = alc880_adc_nids;
4858 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
4861 set_capture_mixer(codec);
4862 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
4864 spec->vmaster_nid = 0x0c;
4866 codec->patch_ops = alc_patch_ops;
4867 if (board_config == ALC880_AUTO)
4868 spec->init_hook = alc880_auto_init;
4869 #ifdef CONFIG_SND_HDA_POWER_SAVE
4870 if (!spec->loopback.amplist)
4871 spec->loopback.amplist = alc880_loopbacks;
4873 codec->proc_widget_hook = print_realtek_coef;
4883 static hda_nid_t alc260_dac_nids[1] = {
4888 static hda_nid_t alc260_adc_nids[1] = {
4893 static hda_nid_t alc260_adc_nids_alt[1] = {
4898 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
4899 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
4901 static hda_nid_t alc260_dual_adc_nids[2] = {
4906 #define ALC260_DIGOUT_NID 0x03
4907 #define ALC260_DIGIN_NID 0x06
4909 static struct hda_input_mux alc260_capture_source = {
4913 { "Front Mic", 0x1 },
4919 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
4920 * headphone jack and the internal CD lines since these are the only pins at
4921 * which audio can appear. For flexibility, also allow the option of
4922 * recording the mixer output on the second ADC (ADC0 doesn't have a
4923 * connection to the mixer output).
4925 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
4929 { "Mic/Line", 0x0 },
4931 { "Headphone", 0x2 },
4937 { "Mic/Line", 0x0 },
4939 { "Headphone", 0x2 },
4946 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
4947 * the Fujitsu S702x, but jacks are marked differently.
4949 static struct hda_input_mux alc260_acer_capture_sources[2] = {
4956 { "Headphone", 0x5 },
4965 { "Headphone", 0x6 },
4971 /* Maxdata Favorit 100XS */
4972 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
4976 { "Line/Mic", 0x0 },
4983 { "Line/Mic", 0x0 },
4991 * This is just place-holder, so there's something for alc_build_pcms to look
4992 * at when it calculates the maximum number of channels. ALC260 has no mixer
4993 * element which allows changing the channel mode, so the verb list is
4996 static struct hda_channel_mode alc260_modes[1] = {
5001 /* Mixer combinations
5003 * basic: base_output + input + pc_beep + capture
5004 * HP: base_output + input + capture_alt
5005 * HP_3013: hp_3013 + input + capture
5006 * fujitsu: fujitsu + capture
5007 * acer: acer + capture
5010 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
5011 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5012 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5013 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5014 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5015 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5016 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5020 static struct snd_kcontrol_new alc260_input_mixer[] = {
5021 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5022 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5023 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5024 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5025 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5026 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5027 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
5028 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
5032 /* update HP, line and mono out pins according to the master switch */
5033 static void alc260_hp_master_update(struct hda_codec *codec,
5034 hda_nid_t hp, hda_nid_t line,
5037 struct alc_spec *spec = codec->spec;
5038 unsigned int val = spec->master_sw ? PIN_HP : 0;
5039 /* change HP and line-out pins */
5040 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5042 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5044 /* mono (speaker) depending on the HP jack sense */
5045 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5046 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5050 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5051 struct snd_ctl_elem_value *ucontrol)
5053 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5054 struct alc_spec *spec = codec->spec;
5055 *ucontrol->value.integer.value = spec->master_sw;
5059 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
5060 struct snd_ctl_elem_value *ucontrol)
5062 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5063 struct alc_spec *spec = codec->spec;
5064 int val = !!*ucontrol->value.integer.value;
5065 hda_nid_t hp, line, mono;
5067 if (val == spec->master_sw)
5069 spec->master_sw = val;
5070 hp = (kcontrol->private_value >> 16) & 0xff;
5071 line = (kcontrol->private_value >> 8) & 0xff;
5072 mono = kcontrol->private_value & 0xff;
5073 alc260_hp_master_update(codec, hp, line, mono);
5077 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5079 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5080 .name = "Master Playback Switch",
5081 .info = snd_ctl_boolean_mono_info,
5082 .get = alc260_hp_master_sw_get,
5083 .put = alc260_hp_master_sw_put,
5084 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5086 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5087 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5088 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5089 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5090 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5092 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5096 static struct hda_verb alc260_hp_unsol_verbs[] = {
5097 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5101 static void alc260_hp_automute(struct hda_codec *codec)
5103 struct alc_spec *spec = codec->spec;
5105 spec->jack_present = snd_hda_jack_detect(codec, 0x10);
5106 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5109 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5111 if ((res >> 26) == ALC880_HP_EVENT)
5112 alc260_hp_automute(codec);
5115 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5117 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5118 .name = "Master Playback Switch",
5119 .info = snd_ctl_boolean_mono_info,
5120 .get = alc260_hp_master_sw_get,
5121 .put = alc260_hp_master_sw_put,
5122 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5124 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5125 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5126 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
5127 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
5128 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5129 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5130 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5131 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
5135 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
5136 .ops = &snd_hda_bind_vol,
5138 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
5139 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
5140 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
5145 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
5146 .ops = &snd_hda_bind_sw,
5148 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
5149 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
5154 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
5155 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
5156 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
5157 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
5158 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5162 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
5163 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5167 static void alc260_hp_3013_automute(struct hda_codec *codec)
5169 struct alc_spec *spec = codec->spec;
5171 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
5172 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
5175 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
5178 if ((res >> 26) == ALC880_HP_EVENT)
5179 alc260_hp_3013_automute(codec);
5182 static void alc260_hp_3012_automute(struct hda_codec *codec)
5184 unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT;
5186 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5188 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5190 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5194 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
5197 if ((res >> 26) == ALC880_HP_EVENT)
5198 alc260_hp_3012_automute(codec);
5201 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
5202 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
5204 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
5205 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5206 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
5207 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5208 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5209 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5210 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
5211 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
5212 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
5213 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5214 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
5218 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
5219 * versions of the ALC260 don't act on requests to enable mic bias from NID
5220 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5221 * datasheet doesn't mention this restriction. At this stage it's not clear
5222 * whether this behaviour is intentional or is a hardware bug in chip
5223 * revisions available in early 2006. Therefore for now allow the
5224 * "Headphone Jack Mode" control to span all choices, but if it turns out
5225 * that the lack of mic bias for this NID is intentional we could change the
5226 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5228 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5229 * don't appear to make the mic bias available from the "line" jack, even
5230 * though the NID used for this jack (0x14) can supply it. The theory is
5231 * that perhaps Acer have included blocking capacitors between the ALC260
5232 * and the output jack. If this turns out to be the case for all such
5233 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5234 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5236 * The C20x Tablet series have a mono internal speaker which is controlled
5237 * via the chip's Mono sum widget and pin complex, so include the necessary
5238 * controls for such models. On models without a "mono speaker" the control
5239 * won't do anything.
5241 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5242 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5243 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5244 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5245 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5247 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5249 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5250 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5251 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5252 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5253 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5254 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5255 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5256 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5260 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5262 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
5263 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5264 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5265 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5266 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5267 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5268 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5272 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5273 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5275 static struct snd_kcontrol_new alc260_will_mixer[] = {
5276 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5277 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5278 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5279 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5280 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5281 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5282 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5283 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5284 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5285 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5289 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5290 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5292 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5293 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5294 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5295 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5296 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5297 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5298 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
5299 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
5300 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5301 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5302 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5307 * initialization verbs
5309 static struct hda_verb alc260_init_verbs[] = {
5310 /* Line In pin widget for input */
5311 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5312 /* CD pin widget for input */
5313 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5314 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5315 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5316 /* Mic2 (front panel) pin widget for input and vref at 80% */
5317 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5318 /* LINE-2 is used for line-out in rear */
5319 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5320 /* select line-out */
5321 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
5323 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5325 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5327 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5328 /* mute capture amp left and right */
5329 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5330 /* set connection select to line in (default select for this ADC) */
5331 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5332 /* mute capture amp left and right */
5333 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5334 /* set connection select to line in (default select for this ADC) */
5335 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
5336 /* set vol=0 Line-Out mixer amp left and right */
5337 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5338 /* unmute pin widget amp left and right (no gain on this amp) */
5339 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5340 /* set vol=0 HP mixer amp left and right */
5341 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5342 /* unmute pin widget amp left and right (no gain on this amp) */
5343 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5344 /* set vol=0 Mono mixer amp left and right */
5345 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5346 /* unmute pin widget amp left and right (no gain on this amp) */
5347 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5348 /* unmute LINE-2 out pin */
5349 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5350 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5353 /* mute analog inputs */
5354 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5355 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5356 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5357 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5358 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5359 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5360 /* mute Front out path */
5361 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5362 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5363 /* mute Headphone out path */
5364 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5365 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5366 /* mute Mono out path */
5367 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5368 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5372 #if 0 /* should be identical with alc260_init_verbs? */
5373 static struct hda_verb alc260_hp_init_verbs[] = {
5374 /* Headphone and output */
5375 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5377 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5378 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5379 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5380 /* Mic2 (front panel) pin widget for input and vref at 80% */
5381 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5382 /* Line In pin widget for input */
5383 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5384 /* Line-2 pin widget for output */
5385 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5386 /* CD pin widget for input */
5387 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5388 /* unmute amp left and right */
5389 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5390 /* set connection select to line in (default select for this ADC) */
5391 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5392 /* unmute Line-Out mixer amp left and right (volume = 0) */
5393 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5394 /* mute pin widget amp left and right (no gain on this amp) */
5395 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5396 /* unmute HP mixer amp left and right (volume = 0) */
5397 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5398 /* mute pin widget amp left and right (no gain on this amp) */
5399 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5400 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5403 /* mute analog inputs */
5404 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5405 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5406 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5407 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5408 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5409 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5410 /* Unmute Front out path */
5411 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5412 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5413 /* Unmute Headphone out path */
5414 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5415 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5416 /* Unmute Mono out path */
5417 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5418 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5423 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5424 /* Line out and output */
5425 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5427 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5428 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5429 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5430 /* Mic2 (front panel) pin widget for input and vref at 80% */
5431 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5432 /* Line In pin widget for input */
5433 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5434 /* Headphone pin widget for output */
5435 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5436 /* CD pin widget for input */
5437 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5438 /* unmute amp left and right */
5439 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5440 /* set connection select to line in (default select for this ADC) */
5441 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5442 /* unmute Line-Out mixer amp left and right (volume = 0) */
5443 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5444 /* mute pin widget amp left and right (no gain on this amp) */
5445 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5446 /* unmute HP mixer amp left and right (volume = 0) */
5447 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5448 /* mute pin widget amp left and right (no gain on this amp) */
5449 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5450 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5453 /* mute analog inputs */
5454 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5455 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5456 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5457 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5458 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5459 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5460 /* Unmute Front out path */
5461 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5462 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5463 /* Unmute Headphone out path */
5464 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5465 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5466 /* Unmute Mono out path */
5467 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5468 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5472 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5473 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5474 * audio = 0x16, internal speaker = 0x10.
5476 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5477 /* Disable all GPIOs */
5478 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5479 /* Internal speaker is connected to headphone pin */
5480 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5481 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5482 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5483 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5484 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5485 /* Ensure all other unused pins are disabled and muted. */
5486 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5487 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5488 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5489 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5490 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5491 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5492 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5493 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5495 /* Disable digital (SPDIF) pins */
5496 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5497 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5499 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5500 * when acting as an output.
5502 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5504 /* Start with output sum widgets muted and their output gains at min */
5505 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5506 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5507 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5508 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5509 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5510 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5511 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5512 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5513 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5515 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5516 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5517 /* Unmute Line1 pin widget output buffer since it starts as an output.
5518 * If the pin mode is changed by the user the pin mode control will
5519 * take care of enabling the pin's input/output buffers as needed.
5520 * Therefore there's no need to enable the input buffer at this
5523 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5524 /* Unmute input buffer of pin widget used for Line-in (no equiv
5527 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5529 /* Mute capture amp left and right */
5530 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5531 /* Set ADC connection select to match default mixer setting - line
5534 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5536 /* Do the same for the second ADC: mute capture input amp and
5537 * set ADC connection to line in (on mic1 pin)
5539 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5540 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5542 /* Mute all inputs to mixer widget (even unconnected ones) */
5543 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5544 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5545 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5546 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5547 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5548 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5549 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5550 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5555 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5556 * similar laptops (adapted from Fujitsu init verbs).
5558 static struct hda_verb alc260_acer_init_verbs[] = {
5559 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5560 * the headphone jack. Turn this on and rely on the standard mute
5561 * methods whenever the user wants to turn these outputs off.
5563 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5564 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5565 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5566 /* Internal speaker/Headphone jack is connected to Line-out pin */
5567 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5568 /* Internal microphone/Mic jack is connected to Mic1 pin */
5569 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5570 /* Line In jack is connected to Line1 pin */
5571 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5572 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5573 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5574 /* Ensure all other unused pins are disabled and muted. */
5575 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5576 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5577 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5578 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5579 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5580 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5581 /* Disable digital (SPDIF) pins */
5582 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5583 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5585 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5586 * bus when acting as outputs.
5588 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5589 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5591 /* Start with output sum widgets muted and their output gains at min */
5592 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5593 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5594 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5595 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5596 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5597 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5598 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5599 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5600 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5602 /* Unmute Line-out pin widget amp left and right
5603 * (no equiv mixer ctrl)
5605 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5606 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5607 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5608 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5609 * inputs. If the pin mode is changed by the user the pin mode control
5610 * will take care of enabling the pin's input/output buffers as needed.
5611 * Therefore there's no need to enable the input buffer at this
5614 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5615 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5617 /* Mute capture amp left and right */
5618 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5619 /* Set ADC connection select to match default mixer setting - mic
5622 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5624 /* Do similar with the second ADC: mute capture input amp and
5625 * set ADC connection to mic to match ALSA's default state.
5627 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5628 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5630 /* Mute all inputs to mixer widget (even unconnected ones) */
5631 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5632 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5633 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5634 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5635 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5636 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5637 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5638 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5643 /* Initialisation sequence for Maxdata Favorit 100XS
5644 * (adapted from Acer init verbs).
5646 static struct hda_verb alc260_favorit100_init_verbs[] = {
5647 /* GPIO 0 enables the output jack.
5648 * Turn this on and rely on the standard mute
5649 * methods whenever the user wants to turn these outputs off.
5651 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5652 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5653 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5654 /* Line/Mic input jack is connected to Mic1 pin */
5655 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5656 /* Ensure all other unused pins are disabled and muted. */
5657 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5658 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5659 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5660 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5661 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5662 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5663 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5664 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5665 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5666 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5667 /* Disable digital (SPDIF) pins */
5668 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5669 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5671 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5672 * bus when acting as outputs.
5674 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5675 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5677 /* Start with output sum widgets muted and their output gains at min */
5678 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5679 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5680 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5681 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5682 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5683 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5684 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5685 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5686 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5688 /* Unmute Line-out pin widget amp left and right
5689 * (no equiv mixer ctrl)
5691 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5692 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5693 * inputs. If the pin mode is changed by the user the pin mode control
5694 * will take care of enabling the pin's input/output buffers as needed.
5695 * Therefore there's no need to enable the input buffer at this
5698 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5700 /* Mute capture amp left and right */
5701 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5702 /* Set ADC connection select to match default mixer setting - mic
5705 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5707 /* Do similar with the second ADC: mute capture input amp and
5708 * set ADC connection to mic to match ALSA's default state.
5710 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5711 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5713 /* Mute all inputs to mixer widget (even unconnected ones) */
5714 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5715 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5716 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5717 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5718 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5719 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5720 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5721 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5726 static struct hda_verb alc260_will_verbs[] = {
5727 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5728 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5729 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5730 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5731 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5732 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5736 static struct hda_verb alc260_replacer_672v_verbs[] = {
5737 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5738 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5739 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5741 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5742 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5743 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5745 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5749 /* toggle speaker-output according to the hp-jack state */
5750 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5752 unsigned int present;
5754 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5755 present = snd_hda_jack_detect(codec, 0x0f);
5757 snd_hda_codec_write_cache(codec, 0x01, 0,
5758 AC_VERB_SET_GPIO_DATA, 1);
5759 snd_hda_codec_write_cache(codec, 0x0f, 0,
5760 AC_VERB_SET_PIN_WIDGET_CONTROL,
5763 snd_hda_codec_write_cache(codec, 0x01, 0,
5764 AC_VERB_SET_GPIO_DATA, 0);
5765 snd_hda_codec_write_cache(codec, 0x0f, 0,
5766 AC_VERB_SET_PIN_WIDGET_CONTROL,
5771 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5774 if ((res >> 26) == ALC880_HP_EVENT)
5775 alc260_replacer_672v_automute(codec);
5778 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5779 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5780 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5781 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5782 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5783 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5784 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5785 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5786 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5787 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5788 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5792 /* Test configuration for debugging, modelled after the ALC880 test
5795 #ifdef CONFIG_SND_DEBUG
5796 static hda_nid_t alc260_test_dac_nids[1] = {
5799 static hda_nid_t alc260_test_adc_nids[2] = {
5802 /* For testing the ALC260, each input MUX needs its own definition since
5803 * the signal assignments are different. This assumes that the first ADC
5806 static struct hda_input_mux alc260_test_capture_sources[2] = {
5810 { "MIC1 pin", 0x0 },
5811 { "MIC2 pin", 0x1 },
5812 { "LINE1 pin", 0x2 },
5813 { "LINE2 pin", 0x3 },
5815 { "LINE-OUT pin", 0x5 },
5816 { "HP-OUT pin", 0x6 },
5822 { "MIC1 pin", 0x0 },
5823 { "MIC2 pin", 0x1 },
5824 { "LINE1 pin", 0x2 },
5825 { "LINE2 pin", 0x3 },
5828 { "LINE-OUT pin", 0x6 },
5829 { "HP-OUT pin", 0x7 },
5833 static struct snd_kcontrol_new alc260_test_mixer[] = {
5834 /* Output driver widgets */
5835 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5836 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5837 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5838 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
5839 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5840 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
5842 /* Modes for retasking pin widgets
5843 * Note: the ALC260 doesn't seem to act on requests to enable mic
5844 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
5845 * mention this restriction. At this stage it's not clear whether
5846 * this behaviour is intentional or is a hardware bug in chip
5847 * revisions available at least up until early 2006. Therefore for
5848 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
5849 * choices, but if it turns out that the lack of mic bias for these
5850 * NIDs is intentional we could change their modes from
5851 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5853 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
5854 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
5855 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
5856 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
5857 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
5858 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
5860 /* Loopback mixer controls */
5861 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
5862 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
5863 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
5864 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
5865 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
5866 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
5867 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
5868 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
5869 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5870 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5871 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
5872 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
5873 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
5874 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
5876 /* Controls for GPIO pins, assuming they are configured as outputs */
5877 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
5878 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
5879 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
5880 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
5882 /* Switches to allow the digital IO pins to be enabled. The datasheet
5883 * is ambigious as to which NID is which; testing on laptops which
5884 * make this output available should provide clarification.
5886 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
5887 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
5889 /* A switch allowing EAPD to be enabled. Some laptops seem to use
5890 * this output to turn on an external amplifier.
5892 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
5893 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
5897 static struct hda_verb alc260_test_init_verbs[] = {
5898 /* Enable all GPIOs as outputs with an initial value of 0 */
5899 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
5900 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5901 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
5903 /* Enable retasking pins as output, initially without power amp */
5904 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5905 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5906 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5907 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5908 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5909 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5911 /* Disable digital (SPDIF) pins initially, but users can enable
5912 * them via a mixer switch. In the case of SPDIF-out, this initverb
5913 * payload also sets the generation to 0, output to be in "consumer"
5914 * PCM format, copyright asserted, no pre-emphasis and no validity
5917 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5918 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5920 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
5921 * OUT1 sum bus when acting as an output.
5923 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5924 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
5925 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5926 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
5928 /* Start with output sum widgets muted and their output gains at min */
5929 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5930 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5931 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5932 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5933 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5934 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5935 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5936 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5937 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5939 /* Unmute retasking pin widget output buffers since the default
5940 * state appears to be output. As the pin mode is changed by the
5941 * user the pin mode control will take care of enabling the pin's
5942 * input/output buffers as needed.
5944 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5945 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5946 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5947 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5948 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5949 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5950 /* Also unmute the mono-out pin widget */
5951 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5953 /* Mute capture amp left and right */
5954 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5955 /* Set ADC connection select to match default mixer setting (mic1
5958 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5960 /* Do the same for the second ADC: mute capture input amp and
5961 * set ADC connection to mic1 pin
5963 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5964 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5966 /* Mute all inputs to mixer widget (even unconnected ones) */
5967 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5968 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5969 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5970 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5971 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5972 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5973 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5974 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5980 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
5981 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
5983 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
5984 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
5987 * for BIOS auto-configuration
5990 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
5991 const char *pfx, int *vol_bits)
5994 unsigned long vol_val, sw_val;
5997 if (nid >= 0x0f && nid < 0x11) {
5998 nid_vol = nid - 0x7;
5999 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6000 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6001 } else if (nid == 0x11) {
6002 nid_vol = nid - 0x7;
6003 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
6004 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
6005 } else if (nid >= 0x12 && nid <= 0x15) {
6007 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6008 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6012 if (!(*vol_bits & (1 << nid_vol))) {
6013 /* first control for the volume widget */
6014 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val);
6017 *vol_bits |= (1 << nid_vol);
6019 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val);
6025 /* add playback controls from the parsed DAC table */
6026 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6027 const struct auto_pin_cfg *cfg)
6033 spec->multiout.num_dacs = 1;
6034 spec->multiout.dac_nids = spec->private_dac_nids;
6035 spec->multiout.dac_nids[0] = 0x02;
6037 nid = cfg->line_out_pins[0];
6040 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6042 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6046 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6051 nid = cfg->speaker_pins[0];
6053 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6058 nid = cfg->hp_pins[0];
6060 err = alc260_add_playback_controls(spec, nid, "Headphone",
6068 /* create playback/capture controls for input pins */
6069 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6070 const struct auto_pin_cfg *cfg)
6072 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
6075 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6076 hda_nid_t nid, int pin_type,
6079 alc_set_pin_output(codec, nid, pin_type);
6080 /* need the manual connection? */
6082 int idx = nid - 0x12;
6083 snd_hda_codec_write(codec, idx + 0x0b, 0,
6084 AC_VERB_SET_CONNECT_SEL, sel_idx);
6088 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6090 struct alc_spec *spec = codec->spec;
6093 nid = spec->autocfg.line_out_pins[0];
6095 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6096 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6099 nid = spec->autocfg.speaker_pins[0];
6101 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6103 nid = spec->autocfg.hp_pins[0];
6105 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6108 #define ALC260_PIN_CD_NID 0x16
6109 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6111 struct alc_spec *spec = codec->spec;
6114 for (i = 0; i < AUTO_PIN_LAST; i++) {
6115 hda_nid_t nid = spec->autocfg.input_pins[i];
6117 alc_set_input_pin(codec, nid, i);
6118 if (nid != ALC260_PIN_CD_NID &&
6119 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6120 snd_hda_codec_write(codec, nid, 0,
6121 AC_VERB_SET_AMP_GAIN_MUTE,
6128 * generic initialization of ADC, input mixers and output mixers
6130 static struct hda_verb alc260_volume_init_verbs[] = {
6132 * Unmute ADC0-1 and set the default input to mic-in
6134 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6135 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6136 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6137 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6139 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6141 * Note: PASD motherboards uses the Line In 2 as the input for
6142 * front panel mic (mic 2)
6144 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6145 /* mute analog inputs */
6146 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6147 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6148 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6149 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6150 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6153 * Set up output mixers (0x08 - 0x0a)
6155 /* set vol=0 to output mixers */
6156 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6157 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6158 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6159 /* set up input amps for analog loopback */
6160 /* Amp Indices: DAC = 0, mixer = 1 */
6161 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6162 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6163 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6164 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6165 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6166 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6171 static int alc260_parse_auto_config(struct hda_codec *codec)
6173 struct alc_spec *spec = codec->spec;
6175 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
6177 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
6181 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
6184 if (!spec->kctls.list)
6185 return 0; /* can't find valid BIOS pin config */
6186 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
6190 spec->multiout.max_channels = 2;
6192 if (spec->autocfg.dig_outs)
6193 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6194 if (spec->kctls.list)
6195 add_mixer(spec, spec->kctls.list);
6197 add_verb(spec, alc260_volume_init_verbs);
6199 spec->num_mux_defs = 1;
6200 spec->input_mux = &spec->private_imux[0];
6202 alc_ssid_check(codec, 0x10, 0x15, 0x0f);
6207 /* additional initialization for auto-configuration model */
6208 static void alc260_auto_init(struct hda_codec *codec)
6210 struct alc_spec *spec = codec->spec;
6211 alc260_auto_init_multi_out(codec);
6212 alc260_auto_init_analog_input(codec);
6213 if (spec->unsol_event)
6214 alc_inithook(codec);
6217 #ifdef CONFIG_SND_HDA_POWER_SAVE
6218 static struct hda_amp_list alc260_loopbacks[] = {
6219 { 0x07, HDA_INPUT, 0 },
6220 { 0x07, HDA_INPUT, 1 },
6221 { 0x07, HDA_INPUT, 2 },
6222 { 0x07, HDA_INPUT, 3 },
6223 { 0x07, HDA_INPUT, 4 },
6229 * ALC260 configurations
6231 static const char *alc260_models[ALC260_MODEL_LAST] = {
6232 [ALC260_BASIC] = "basic",
6234 [ALC260_HP_3013] = "hp-3013",
6235 [ALC260_HP_DC7600] = "hp-dc7600",
6236 [ALC260_FUJITSU_S702X] = "fujitsu",
6237 [ALC260_ACER] = "acer",
6238 [ALC260_WILL] = "will",
6239 [ALC260_REPLACER_672V] = "replacer",
6240 [ALC260_FAVORIT100] = "favorit100",
6241 #ifdef CONFIG_SND_DEBUG
6242 [ALC260_TEST] = "test",
6244 [ALC260_AUTO] = "auto",
6247 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6248 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6249 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6250 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6251 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6252 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */
6253 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6254 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6255 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6256 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6257 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6258 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6259 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6260 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6261 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6262 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6263 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6264 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6265 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6266 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6270 static struct alc_config_preset alc260_presets[] = {
6272 .mixers = { alc260_base_output_mixer,
6273 alc260_input_mixer },
6274 .init_verbs = { alc260_init_verbs },
6275 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6276 .dac_nids = alc260_dac_nids,
6277 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6278 .adc_nids = alc260_adc_nids,
6279 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6280 .channel_mode = alc260_modes,
6281 .input_mux = &alc260_capture_source,
6284 .mixers = { alc260_hp_output_mixer,
6285 alc260_input_mixer },
6286 .init_verbs = { alc260_init_verbs,
6287 alc260_hp_unsol_verbs },
6288 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6289 .dac_nids = alc260_dac_nids,
6290 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6291 .adc_nids = alc260_adc_nids_alt,
6292 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6293 .channel_mode = alc260_modes,
6294 .input_mux = &alc260_capture_source,
6295 .unsol_event = alc260_hp_unsol_event,
6296 .init_hook = alc260_hp_automute,
6298 [ALC260_HP_DC7600] = {
6299 .mixers = { alc260_hp_dc7600_mixer,
6300 alc260_input_mixer },
6301 .init_verbs = { alc260_init_verbs,
6302 alc260_hp_dc7600_verbs },
6303 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6304 .dac_nids = alc260_dac_nids,
6305 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6306 .adc_nids = alc260_adc_nids_alt,
6307 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6308 .channel_mode = alc260_modes,
6309 .input_mux = &alc260_capture_source,
6310 .unsol_event = alc260_hp_3012_unsol_event,
6311 .init_hook = alc260_hp_3012_automute,
6313 [ALC260_HP_3013] = {
6314 .mixers = { alc260_hp_3013_mixer,
6315 alc260_input_mixer },
6316 .init_verbs = { alc260_hp_3013_init_verbs,
6317 alc260_hp_3013_unsol_verbs },
6318 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6319 .dac_nids = alc260_dac_nids,
6320 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6321 .adc_nids = alc260_adc_nids_alt,
6322 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6323 .channel_mode = alc260_modes,
6324 .input_mux = &alc260_capture_source,
6325 .unsol_event = alc260_hp_3013_unsol_event,
6326 .init_hook = alc260_hp_3013_automute,
6328 [ALC260_FUJITSU_S702X] = {
6329 .mixers = { alc260_fujitsu_mixer },
6330 .init_verbs = { alc260_fujitsu_init_verbs },
6331 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6332 .dac_nids = alc260_dac_nids,
6333 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6334 .adc_nids = alc260_dual_adc_nids,
6335 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6336 .channel_mode = alc260_modes,
6337 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
6338 .input_mux = alc260_fujitsu_capture_sources,
6341 .mixers = { alc260_acer_mixer },
6342 .init_verbs = { alc260_acer_init_verbs },
6343 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6344 .dac_nids = alc260_dac_nids,
6345 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6346 .adc_nids = alc260_dual_adc_nids,
6347 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6348 .channel_mode = alc260_modes,
6349 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
6350 .input_mux = alc260_acer_capture_sources,
6352 [ALC260_FAVORIT100] = {
6353 .mixers = { alc260_favorit100_mixer },
6354 .init_verbs = { alc260_favorit100_init_verbs },
6355 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6356 .dac_nids = alc260_dac_nids,
6357 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6358 .adc_nids = alc260_dual_adc_nids,
6359 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6360 .channel_mode = alc260_modes,
6361 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
6362 .input_mux = alc260_favorit100_capture_sources,
6365 .mixers = { alc260_will_mixer },
6366 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6367 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6368 .dac_nids = alc260_dac_nids,
6369 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6370 .adc_nids = alc260_adc_nids,
6371 .dig_out_nid = ALC260_DIGOUT_NID,
6372 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6373 .channel_mode = alc260_modes,
6374 .input_mux = &alc260_capture_source,
6376 [ALC260_REPLACER_672V] = {
6377 .mixers = { alc260_replacer_672v_mixer },
6378 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6379 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6380 .dac_nids = alc260_dac_nids,
6381 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6382 .adc_nids = alc260_adc_nids,
6383 .dig_out_nid = ALC260_DIGOUT_NID,
6384 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6385 .channel_mode = alc260_modes,
6386 .input_mux = &alc260_capture_source,
6387 .unsol_event = alc260_replacer_672v_unsol_event,
6388 .init_hook = alc260_replacer_672v_automute,
6390 #ifdef CONFIG_SND_DEBUG
6392 .mixers = { alc260_test_mixer },
6393 .init_verbs = { alc260_test_init_verbs },
6394 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6395 .dac_nids = alc260_test_dac_nids,
6396 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6397 .adc_nids = alc260_test_adc_nids,
6398 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6399 .channel_mode = alc260_modes,
6400 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6401 .input_mux = alc260_test_capture_sources,
6406 static int patch_alc260(struct hda_codec *codec)
6408 struct alc_spec *spec;
6409 int err, board_config;
6411 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6417 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6420 if (board_config < 0) {
6421 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6423 board_config = ALC260_AUTO;
6426 if (board_config == ALC260_AUTO) {
6427 /* automatic parse from the BIOS config */
6428 err = alc260_parse_auto_config(codec);
6434 "hda_codec: Cannot set up configuration "
6435 "from BIOS. Using base mode...\n");
6436 board_config = ALC260_BASIC;
6440 err = snd_hda_attach_beep_device(codec, 0x1);
6446 if (board_config != ALC260_AUTO)
6447 setup_preset(codec, &alc260_presets[board_config]);
6449 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6450 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6452 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6453 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6455 if (!spec->adc_nids && spec->input_mux) {
6456 /* check whether NID 0x04 is valid */
6457 unsigned int wcap = get_wcaps(codec, 0x04);
6458 wcap = get_wcaps_type(wcap);
6460 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6461 spec->adc_nids = alc260_adc_nids_alt;
6462 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6464 spec->adc_nids = alc260_adc_nids;
6465 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6468 set_capture_mixer(codec);
6469 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6471 spec->vmaster_nid = 0x08;
6473 codec->patch_ops = alc_patch_ops;
6474 if (board_config == ALC260_AUTO)
6475 spec->init_hook = alc260_auto_init;
6476 #ifdef CONFIG_SND_HDA_POWER_SAVE
6477 if (!spec->loopback.amplist)
6478 spec->loopback.amplist = alc260_loopbacks;
6480 codec->proc_widget_hook = print_realtek_coef;
6487 * ALC882/883/885/888/889 support
6489 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6490 * configuration. Each pin widget can choose any input DACs and a mixer.
6491 * Each ADC is connected from a mixer of all inputs. This makes possible
6492 * 6-channel independent captures.
6494 * In addition, an independent DAC for the multi-playback (not used in this
6497 #define ALC882_DIGOUT_NID 0x06
6498 #define ALC882_DIGIN_NID 0x0a
6499 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
6500 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
6501 #define ALC1200_DIGOUT_NID 0x10
6504 static struct hda_channel_mode alc882_ch_modes[1] = {
6509 static hda_nid_t alc882_dac_nids[4] = {
6510 /* front, rear, clfe, rear_surr */
6511 0x02, 0x03, 0x04, 0x05
6513 #define alc883_dac_nids alc882_dac_nids
6516 #define alc882_adc_nids alc880_adc_nids
6517 #define alc882_adc_nids_alt alc880_adc_nids_alt
6518 #define alc883_adc_nids alc882_adc_nids_alt
6519 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
6520 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
6521 #define alc889_adc_nids alc880_adc_nids
6523 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6524 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6525 #define alc883_capsrc_nids alc882_capsrc_nids_alt
6526 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
6527 #define alc889_capsrc_nids alc882_capsrc_nids
6530 /* FIXME: should be a matrix-type input source selection */
6532 static struct hda_input_mux alc882_capture_source = {
6536 { "Front Mic", 0x1 },
6542 #define alc883_capture_source alc882_capture_source
6544 static struct hda_input_mux alc889_capture_source = {
6547 { "Front Mic", 0x0 },
6553 static struct hda_input_mux mb5_capture_source = {
6562 static struct hda_input_mux alc883_3stack_6ch_intel = {
6566 { "Front Mic", 0x0 },
6572 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6580 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6590 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6598 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
6602 { "Front Mic", 0x1 },
6607 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
6615 static struct hda_input_mux alc889A_mb31_capture_source = {
6619 /* Front Mic (0x01) unused */
6621 /* Line 2 (0x03) unused */
6622 /* CD (0x04) unsused? */
6629 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6636 static struct hda_verb alc882_3ST_ch2_init[] = {
6637 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6638 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6639 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6640 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6647 static struct hda_verb alc882_3ST_ch4_init[] = {
6648 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6649 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6650 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6651 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6652 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6659 static struct hda_verb alc882_3ST_ch6_init[] = {
6660 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6661 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6662 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6663 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6664 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6665 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6669 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
6670 { 2, alc882_3ST_ch2_init },
6671 { 4, alc882_3ST_ch4_init },
6672 { 6, alc882_3ST_ch6_init },
6675 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
6680 static struct hda_verb alc883_3ST_ch2_clevo_init[] = {
6681 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
6682 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6683 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6684 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6685 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6692 static struct hda_verb alc883_3ST_ch4_clevo_init[] = {
6693 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6694 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6695 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6696 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6697 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6698 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6705 static struct hda_verb alc883_3ST_ch6_clevo_init[] = {
6706 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6707 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6708 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6709 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6710 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6711 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6712 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6716 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
6717 { 2, alc883_3ST_ch2_clevo_init },
6718 { 4, alc883_3ST_ch4_clevo_init },
6719 { 6, alc883_3ST_ch6_clevo_init },
6726 static struct hda_verb alc882_sixstack_ch6_init[] = {
6727 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6728 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6729 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6730 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6737 static struct hda_verb alc882_sixstack_ch8_init[] = {
6738 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6739 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6740 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6741 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6745 static struct hda_channel_mode alc882_sixstack_modes[2] = {
6746 { 6, alc882_sixstack_ch6_init },
6747 { 8, alc882_sixstack_ch8_init },
6751 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
6757 static struct hda_verb alc885_mbp_ch2_init[] = {
6758 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6759 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6760 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6767 static struct hda_verb alc885_mbp_ch4_init[] = {
6768 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6769 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6770 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6771 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6772 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6776 static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
6777 { 2, alc885_mbp_ch2_init },
6778 { 4, alc885_mbp_ch4_init },
6783 * Speakers/Woofer/HP = Front
6786 static struct hda_verb alc885_mb5_ch2_init[] = {
6787 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6788 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6794 * Speakers/HP = Front
6798 static struct hda_verb alc885_mb5_ch6_init[] = {
6799 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6800 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6801 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6805 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
6806 { 2, alc885_mb5_ch2_init },
6807 { 6, alc885_mb5_ch6_init },
6814 static struct hda_verb alc883_4ST_ch2_init[] = {
6815 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6816 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6817 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6818 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6819 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6820 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6827 static struct hda_verb alc883_4ST_ch4_init[] = {
6828 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6829 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6830 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6831 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6832 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6833 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6834 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6841 static struct hda_verb alc883_4ST_ch6_init[] = {
6842 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6843 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6844 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6845 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6846 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6847 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6848 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6849 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6856 static struct hda_verb alc883_4ST_ch8_init[] = {
6857 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6858 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6859 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6860 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6861 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6862 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6863 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6864 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6865 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6869 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
6870 { 2, alc883_4ST_ch2_init },
6871 { 4, alc883_4ST_ch4_init },
6872 { 6, alc883_4ST_ch6_init },
6873 { 8, alc883_4ST_ch8_init },
6880 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
6881 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6882 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6883 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6884 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6891 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
6892 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6893 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6894 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6895 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6896 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6903 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
6904 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6905 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6906 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
6907 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6908 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6909 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6913 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
6914 { 2, alc883_3ST_ch2_intel_init },
6915 { 4, alc883_3ST_ch4_intel_init },
6916 { 6, alc883_3ST_ch6_intel_init },
6922 static struct hda_verb alc889_ch2_intel_init[] = {
6923 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6924 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
6925 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
6926 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
6927 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6928 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6935 static struct hda_verb alc889_ch6_intel_init[] = {
6936 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6937 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
6938 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
6939 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6940 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6941 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6948 static struct hda_verb alc889_ch8_intel_init[] = {
6949 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6950 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
6951 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
6952 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6953 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
6954 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6955 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6959 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
6960 { 2, alc889_ch2_intel_init },
6961 { 6, alc889_ch6_intel_init },
6962 { 8, alc889_ch8_intel_init },
6968 static struct hda_verb alc883_sixstack_ch6_init[] = {
6969 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6970 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6971 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6972 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6979 static struct hda_verb alc883_sixstack_ch8_init[] = {
6980 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6981 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6982 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6983 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6987 static struct hda_channel_mode alc883_sixstack_modes[2] = {
6988 { 6, alc883_sixstack_ch6_init },
6989 { 8, alc883_sixstack_ch8_init },
6993 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6994 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6996 static struct snd_kcontrol_new alc882_base_mixer[] = {
6997 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6998 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6999 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7000 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7001 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7002 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7003 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7004 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7005 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7006 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7007 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7008 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7009 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7010 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7011 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7012 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7013 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7014 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7015 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7016 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7017 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7021 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
7022 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7023 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7024 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7025 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
7026 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7027 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7028 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7029 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7030 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7031 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
7032 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7036 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7037 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7038 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7039 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7040 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7041 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7042 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7043 HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7044 HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT),
7045 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7046 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7047 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7048 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7049 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7050 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
7054 static struct snd_kcontrol_new alc885_imac91_mixer[] = {
7055 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7056 HDA_BIND_MUTE ("Line-Out Playback Switch", 0x0c, 0x02, HDA_INPUT),
7057 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
7058 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7059 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7060 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7061 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7062 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7063 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7068 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
7069 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7070 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7071 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7072 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7073 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7074 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7075 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7076 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7077 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7081 static struct snd_kcontrol_new alc882_targa_mixer[] = {
7082 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7083 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7084 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7085 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7086 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7087 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7088 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7089 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7090 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7091 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7092 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7093 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7094 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7098 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
7099 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
7101 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
7102 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7103 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7104 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7105 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
7106 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7107 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7108 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7109 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7110 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
7111 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
7112 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7113 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7114 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7118 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
7119 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7120 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7121 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7122 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7123 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7124 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7125 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7126 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7127 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7128 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7132 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
7134 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7135 .name = "Channel Mode",
7136 .info = alc_ch_mode_info,
7137 .get = alc_ch_mode_get,
7138 .put = alc_ch_mode_put,
7143 static struct hda_verb alc882_base_init_verbs[] = {
7144 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7145 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7146 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7147 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7149 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7150 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7151 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7153 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7154 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7155 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7157 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7158 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7159 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7161 /* mute analog input loopbacks */
7162 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7163 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7164 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7165 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7166 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7168 /* Front Pin: output 0 (0x0c) */
7169 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7170 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7171 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7172 /* Rear Pin: output 1 (0x0d) */
7173 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7174 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7175 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7176 /* CLFE Pin: output 2 (0x0e) */
7177 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7178 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7179 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7180 /* Side Pin: output 3 (0x0f) */
7181 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7182 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7183 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7184 /* Mic (rear) pin: input vref at 80% */
7185 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7186 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7187 /* Front Mic pin: input vref at 80% */
7188 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7189 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7190 /* Line In pin: input */
7191 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7192 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7193 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7194 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7195 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7196 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7197 /* CD pin widget for input */
7198 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7200 /* FIXME: use matrix-type input source selection */
7201 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7203 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7204 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7205 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7206 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7208 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7209 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7210 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7211 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7212 /* ADC2: mute amp left and right */
7213 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7214 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7215 /* ADC3: mute amp left and right */
7216 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7217 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7222 static struct hda_verb alc882_adc1_init_verbs[] = {
7223 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7224 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7225 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7226 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7227 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7228 /* ADC1: mute amp left and right */
7229 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7230 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7234 static struct hda_verb alc882_eapd_verbs[] = {
7235 /* change to EAPD mode */
7236 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7237 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
7241 static struct hda_verb alc889_eapd_verbs[] = {
7242 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
7243 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
7247 static struct hda_verb alc_hp15_unsol_verbs[] = {
7248 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7249 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7253 static struct hda_verb alc885_init_verbs[] = {
7254 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7255 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7256 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7257 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7259 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7260 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7261 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7263 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7264 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7265 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7267 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7268 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7269 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7271 /* mute analog input loopbacks */
7272 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7273 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7274 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7276 /* Front HP Pin: output 0 (0x0c) */
7277 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7278 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7279 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7280 /* Front Pin: output 0 (0x0c) */
7281 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7282 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7283 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7284 /* Rear Pin: output 1 (0x0d) */
7285 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7286 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7287 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
7288 /* CLFE Pin: output 2 (0x0e) */
7289 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7290 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7291 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7292 /* Side Pin: output 3 (0x0f) */
7293 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7294 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7295 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7296 /* Mic (rear) pin: input vref at 80% */
7297 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7298 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7299 /* Front Mic pin: input vref at 80% */
7300 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7301 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7302 /* Line In pin: input */
7303 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7304 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7306 /* Mixer elements: 0x18, , 0x1a, 0x1b */
7308 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7309 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7310 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7312 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7313 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7314 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7316 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7317 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7318 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7319 /* ADC2: mute amp left and right */
7320 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7321 /* ADC3: mute amp left and right */
7322 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7327 static struct hda_verb alc885_init_input_verbs[] = {
7328 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7329 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7330 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7335 /* Unmute Selector 24h and set the default input to front mic */
7336 static struct hda_verb alc889_init_input_verbs[] = {
7337 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
7338 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7343 #define alc883_init_verbs alc882_base_init_verbs
7346 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
7347 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7348 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7349 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
7350 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7351 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7352 /* FIXME: this looks suspicious...
7353 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
7354 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
7359 static struct hda_verb alc882_macpro_init_verbs[] = {
7360 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7361 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7362 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7363 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7364 /* Front Pin: output 0 (0x0c) */
7365 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7366 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7367 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7368 /* Front Mic pin: input vref at 80% */
7369 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7370 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7371 /* Speaker: output */
7372 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7373 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7374 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
7375 /* Headphone output (output 0 - 0x0c) */
7376 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7377 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7378 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7380 /* FIXME: use matrix-type input source selection */
7381 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7382 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7383 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7384 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7385 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7386 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7388 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7389 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7390 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7391 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7393 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7394 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7395 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7396 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7397 /* ADC1: mute amp left and right */
7398 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7399 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7400 /* ADC2: mute amp left and right */
7401 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7402 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7403 /* ADC3: mute amp left and right */
7404 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7405 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7411 static struct hda_verb alc885_mb5_init_verbs[] = {
7413 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7414 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7415 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7416 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7418 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7419 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7420 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7421 /* Surround mixer */
7422 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7423 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7424 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7426 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7427 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7428 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7430 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7431 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7432 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7433 /* Front Pin (0x0c) */
7434 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7435 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7436 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7437 /* LFE Pin (0x0e) */
7438 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7439 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7440 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7442 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7443 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7444 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7445 /* Front Mic pin: input vref at 80% */
7446 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7447 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7449 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7450 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7452 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7453 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7454 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7455 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7459 /* Macbook Pro rev3 */
7460 static struct hda_verb alc885_mbp3_init_verbs[] = {
7461 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7462 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7463 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7464 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7466 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7467 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7468 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7470 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7471 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7472 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7473 /* Front Pin: output 0 (0x0c) */
7474 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7475 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7476 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7477 /* HP Pin: output 0 (0x0e) */
7478 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7479 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7480 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
7481 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7482 /* Mic (rear) pin: input vref at 80% */
7483 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7484 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7485 /* Front Mic pin: input vref at 80% */
7486 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7487 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7488 /* Line In pin: use output 1 when in LineOut mode */
7489 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7490 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7491 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7493 /* FIXME: use matrix-type input source selection */
7494 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7495 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7496 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7497 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7498 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7499 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7501 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7502 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7503 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7504 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7506 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7507 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7508 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7509 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7510 /* ADC1: mute amp left and right */
7511 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7512 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7513 /* ADC2: mute amp left and right */
7514 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7515 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7516 /* ADC3: mute amp left and right */
7517 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7518 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7524 static struct hda_verb alc885_imac91_init_verbs[] = {
7525 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
7526 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7527 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7528 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7530 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7531 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7532 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7533 /* HP Pin: output 0 (0x0c) */
7534 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7535 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7536 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7537 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7538 /* Internal Speakers: output 0 (0x0d) */
7539 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7540 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7541 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7542 /* Mic (rear) pin: input vref at 80% */
7543 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7544 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7545 /* Front Mic pin: input vref at 80% */
7546 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7547 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7548 /* Line In pin: use output 1 when in LineOut mode */
7549 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7550 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7551 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7553 /* FIXME: use matrix-type input source selection */
7554 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7555 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7556 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7557 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7558 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7559 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7561 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7562 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7563 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7564 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7566 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7567 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7568 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7569 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7570 /* ADC1: mute amp left and right */
7571 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7572 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7573 /* ADC2: mute amp left and right */
7574 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7575 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7576 /* ADC3: mute amp left and right */
7577 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7578 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7583 /* iMac 24 mixer. */
7584 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
7585 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7586 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
7590 /* iMac 24 init verbs. */
7591 static struct hda_verb alc885_imac24_init_verbs[] = {
7592 /* Internal speakers: output 0 (0x0c) */
7593 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7594 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7595 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7596 /* Internal speakers: output 0 (0x0c) */
7597 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7598 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7599 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7600 /* Headphone: output 0 (0x0c) */
7601 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7602 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7603 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7604 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7605 /* Front Mic: input vref at 80% */
7606 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7607 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7611 /* Toggle speaker-output according to the hp-jack state */
7612 static void alc885_imac24_setup(struct hda_codec *codec)
7614 struct alc_spec *spec = codec->spec;
7616 spec->autocfg.hp_pins[0] = 0x14;
7617 spec->autocfg.speaker_pins[0] = 0x18;
7618 spec->autocfg.speaker_pins[1] = 0x1a;
7621 static void alc885_mbp3_setup(struct hda_codec *codec)
7623 struct alc_spec *spec = codec->spec;
7625 spec->autocfg.hp_pins[0] = 0x15;
7626 spec->autocfg.speaker_pins[0] = 0x14;
7629 static void alc885_imac91_automute(struct hda_codec *codec)
7631 unsigned int present;
7633 present = snd_hda_codec_read(codec, 0x14, 0,
7634 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7635 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7636 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7637 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
7638 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7642 static void alc885_imac91_unsol_event(struct hda_codec *codec,
7645 /* Headphone insertion or removal. */
7646 if ((res >> 26) == ALC880_HP_EVENT)
7647 alc885_imac91_automute(codec);
7650 static struct hda_verb alc882_targa_verbs[] = {
7651 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7652 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7654 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7655 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7657 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7658 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7659 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7661 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7665 /* toggle speaker-output according to the hp-jack state */
7666 static void alc882_targa_automute(struct hda_codec *codec)
7668 struct alc_spec *spec = codec->spec;
7669 alc_automute_amp(codec);
7670 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7671 spec->jack_present ? 1 : 3);
7674 static void alc882_targa_setup(struct hda_codec *codec)
7676 struct alc_spec *spec = codec->spec;
7678 spec->autocfg.hp_pins[0] = 0x14;
7679 spec->autocfg.speaker_pins[0] = 0x1b;
7682 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
7684 if ((res >> 26) == ALC880_HP_EVENT)
7685 alc882_targa_automute(codec);
7688 static struct hda_verb alc882_asus_a7j_verbs[] = {
7689 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7690 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7692 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7693 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7694 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7696 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7697 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7698 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7700 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7701 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7702 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7706 static struct hda_verb alc882_asus_a7m_verbs[] = {
7707 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7708 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7710 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7711 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7712 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7714 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7715 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7716 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7718 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7719 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7720 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7724 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
7726 unsigned int gpiostate, gpiomask, gpiodir;
7728 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
7729 AC_VERB_GET_GPIO_DATA, 0);
7732 gpiostate |= (1 << pin);
7734 gpiostate &= ~(1 << pin);
7736 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
7737 AC_VERB_GET_GPIO_MASK, 0);
7738 gpiomask |= (1 << pin);
7740 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
7741 AC_VERB_GET_GPIO_DIRECTION, 0);
7742 gpiodir |= (1 << pin);
7745 snd_hda_codec_write(codec, codec->afg, 0,
7746 AC_VERB_SET_GPIO_MASK, gpiomask);
7747 snd_hda_codec_write(codec, codec->afg, 0,
7748 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
7752 snd_hda_codec_write(codec, codec->afg, 0,
7753 AC_VERB_SET_GPIO_DATA, gpiostate);
7756 /* set up GPIO at initialization */
7757 static void alc885_macpro_init_hook(struct hda_codec *codec)
7759 alc882_gpio_mute(codec, 0, 0);
7760 alc882_gpio_mute(codec, 1, 0);
7763 /* set up GPIO and update auto-muting at initialization */
7764 static void alc885_imac24_init_hook(struct hda_codec *codec)
7766 alc885_macpro_init_hook(codec);
7767 alc_automute_amp(codec);
7771 * generic initialization of ADC, input mixers and output mixers
7773 static struct hda_verb alc883_auto_init_verbs[] = {
7775 * Unmute ADC0-2 and set the default input to mic-in
7777 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7778 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7779 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7780 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7782 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7784 * Note: PASD motherboards uses the Line In 2 as the input for
7785 * front panel mic (mic 2)
7787 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7788 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7789 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7790 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7791 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7792 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7795 * Set up output mixers (0x0c - 0x0f)
7797 /* set vol=0 to output mixers */
7798 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7799 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7800 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7801 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7802 /* set up input amps for analog loopback */
7803 /* Amp Indices: DAC = 0, mixer = 1 */
7804 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7805 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7806 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7807 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7808 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7809 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7810 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7811 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7812 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7813 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7815 /* FIXME: use matrix-type input source selection */
7816 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7818 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7819 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7820 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7821 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7823 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7824 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7825 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7826 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7831 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
7832 static struct hda_verb alc889A_mb31_ch2_init[] = {
7833 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7834 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7835 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7836 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7840 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
7841 static struct hda_verb alc889A_mb31_ch4_init[] = {
7842 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7843 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7844 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7845 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7849 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
7850 static struct hda_verb alc889A_mb31_ch5_init[] = {
7851 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
7852 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7853 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7854 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7858 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
7859 static struct hda_verb alc889A_mb31_ch6_init[] = {
7860 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
7861 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
7862 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7863 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7867 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
7868 { 2, alc889A_mb31_ch2_init },
7869 { 4, alc889A_mb31_ch4_init },
7870 { 5, alc889A_mb31_ch5_init },
7871 { 6, alc889A_mb31_ch6_init },
7874 static struct hda_verb alc883_medion_eapd_verbs[] = {
7875 /* eanable EAPD on medion laptop */
7876 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7877 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7881 #define alc883_base_mixer alc882_base_mixer
7883 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7884 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7885 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7886 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7887 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7888 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7889 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7890 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7891 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7892 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7893 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7894 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7895 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7896 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7900 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7901 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7902 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7903 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7904 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7905 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7906 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7907 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7908 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7909 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7910 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7914 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
7915 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7916 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7917 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7918 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7919 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7920 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7921 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7922 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7923 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7924 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7928 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
7929 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7930 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7931 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7932 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7933 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7934 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7935 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7936 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7937 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7938 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7939 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7940 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7941 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7945 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
7946 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7947 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7948 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7949 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7950 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7951 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7952 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7953 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7954 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7955 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7956 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7957 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7958 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7959 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7960 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7961 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7962 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7963 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7964 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7968 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
7969 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7970 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7971 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7972 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7973 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7975 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7976 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7977 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7978 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7979 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7980 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7981 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7982 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7983 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7984 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7985 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7986 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7987 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7988 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7992 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
7993 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7994 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7995 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7996 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7997 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7999 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8000 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8001 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8002 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8003 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
8004 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8005 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8006 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8007 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
8008 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT),
8009 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
8010 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8011 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8012 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8016 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
8017 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8018 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8019 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8020 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8021 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8022 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8023 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8024 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8025 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8026 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8027 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8028 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8029 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8030 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8031 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8032 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8033 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8034 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8035 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8039 static struct snd_kcontrol_new alc883_targa_mixer[] = {
8040 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8041 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8042 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8043 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8044 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8045 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8046 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8047 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8048 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8049 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8050 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8051 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8052 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8053 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8054 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8055 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8056 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8060 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
8061 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8062 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8063 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8064 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8065 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8066 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8067 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8068 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8069 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8070 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8071 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8072 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8076 static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
8077 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8078 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8079 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8080 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8081 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8085 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
8086 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8087 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8088 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8089 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8090 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8091 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8092 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8093 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8097 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
8098 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8099 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
8100 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8101 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8102 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8103 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8104 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8105 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8106 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8110 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
8111 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8112 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8113 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8114 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8115 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8116 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8117 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8118 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8119 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8123 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
8124 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8125 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8126 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8127 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8128 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8129 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8130 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8131 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8135 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
8136 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8137 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8138 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8139 HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT),
8140 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8141 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8142 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8143 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8144 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8145 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8146 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8150 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
8151 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8152 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8153 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8154 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
8155 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
8156 0x0d, 1, 0x0, HDA_OUTPUT),
8157 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
8158 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
8159 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
8160 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8161 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8162 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8163 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8164 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8165 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8166 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8167 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8168 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8169 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8170 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8171 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8175 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
8177 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8178 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8179 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8180 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8181 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
8183 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
8184 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
8185 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
8186 /* Output switches */
8187 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
8188 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
8189 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
8191 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
8192 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
8194 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8195 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8196 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8197 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8201 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
8202 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8203 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8204 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8205 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8206 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8207 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8211 static struct hda_bind_ctls alc883_bind_cap_vol = {
8212 .ops = &snd_hda_bind_vol,
8214 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8215 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8220 static struct hda_bind_ctls alc883_bind_cap_switch = {
8221 .ops = &snd_hda_bind_sw,
8223 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8224 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8229 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
8230 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8231 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8232 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8233 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8234 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8235 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8236 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8237 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8241 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
8242 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
8243 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
8245 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8246 /* .name = "Capture Source", */
8247 .name = "Input Source",
8249 .info = alc_mux_enum_info,
8250 .get = alc_mux_enum_get,
8251 .put = alc_mux_enum_put,
8256 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
8258 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8259 .name = "Channel Mode",
8260 .info = alc_ch_mode_info,
8261 .get = alc_ch_mode_get,
8262 .put = alc_ch_mode_put,
8267 /* toggle speaker-output according to the hp-jack state */
8268 static void alc883_mitac_setup(struct hda_codec *codec)
8270 struct alc_spec *spec = codec->spec;
8272 spec->autocfg.hp_pins[0] = 0x15;
8273 spec->autocfg.speaker_pins[0] = 0x14;
8274 spec->autocfg.speaker_pins[1] = 0x17;
8277 /* auto-toggle front mic */
8279 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8281 unsigned char bits = snd_hda_jack_detect(codec, 0x18) ? HDA_AMP_MUTE : 0;
8283 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8287 static struct hda_verb alc883_mitac_verbs[] = {
8289 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8290 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8292 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8293 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8295 /* enable unsolicited event */
8296 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8297 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8302 static struct hda_verb alc883_clevo_m540r_verbs[] = {
8304 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8305 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8307 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
8309 /* enable unsolicited event */
8311 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8312 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8318 static struct hda_verb alc883_clevo_m720_verbs[] = {
8320 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8321 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8323 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
8324 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8326 /* enable unsolicited event */
8327 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8328 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8333 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8335 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8336 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8338 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8339 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8341 /* enable unsolicited event */
8342 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8347 static struct hda_verb alc883_targa_verbs[] = {
8348 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8349 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8351 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8352 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8354 /* Connect Line-Out side jack (SPDIF) to Side */
8355 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8356 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8357 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8358 /* Connect Mic jack to CLFE */
8359 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8360 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8361 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
8362 /* Connect Line-in jack to Surround */
8363 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8364 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8365 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8366 /* Connect HP out jack to Front */
8367 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8368 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8369 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8371 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8376 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8377 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8378 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8379 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8383 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8384 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8385 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8386 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8387 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8391 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8392 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8393 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8394 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8395 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8396 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8400 static struct hda_verb alc883_haier_w66_verbs[] = {
8401 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8402 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8404 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8406 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8407 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8408 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8409 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8413 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8414 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8415 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8416 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8417 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8418 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8419 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8420 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8421 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8425 static struct hda_verb alc888_6st_dell_verbs[] = {
8426 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8430 static struct hda_verb alc883_vaiott_verbs[] = {
8432 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8433 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8435 /* enable unsolicited event */
8436 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8441 static void alc888_3st_hp_setup(struct hda_codec *codec)
8443 struct alc_spec *spec = codec->spec;
8445 spec->autocfg.hp_pins[0] = 0x1b;
8446 spec->autocfg.speaker_pins[0] = 0x14;
8447 spec->autocfg.speaker_pins[1] = 0x16;
8448 spec->autocfg.speaker_pins[2] = 0x18;
8451 static struct hda_verb alc888_3st_hp_verbs[] = {
8452 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8453 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8454 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8455 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8462 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8463 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8464 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8465 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8466 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8473 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8474 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8475 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8476 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8477 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8478 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8485 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8486 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8487 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8488 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8489 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8490 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8491 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8495 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8496 { 2, alc888_3st_hp_2ch_init },
8497 { 4, alc888_3st_hp_4ch_init },
8498 { 6, alc888_3st_hp_6ch_init },
8501 /* toggle front-jack and RCA according to the hp-jack state */
8502 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8504 unsigned int present = snd_hda_jack_detect(codec, 0x1b);
8506 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8507 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8508 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8509 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8512 /* toggle RCA according to the front-jack state */
8513 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8515 unsigned int present = snd_hda_jack_detect(codec, 0x14);
8517 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8518 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8521 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8524 if ((res >> 26) == ALC880_HP_EVENT)
8525 alc888_lenovo_ms7195_front_automute(codec);
8526 if ((res >> 26) == ALC880_FRONT_EVENT)
8527 alc888_lenovo_ms7195_rca_automute(codec);
8530 static struct hda_verb alc883_medion_md2_verbs[] = {
8531 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8532 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8534 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8536 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8540 /* toggle speaker-output according to the hp-jack state */
8541 static void alc883_medion_md2_setup(struct hda_codec *codec)
8543 struct alc_spec *spec = codec->spec;
8545 spec->autocfg.hp_pins[0] = 0x14;
8546 spec->autocfg.speaker_pins[0] = 0x15;
8549 /* toggle speaker-output according to the hp-jack state */
8550 #define alc883_targa_init_hook alc882_targa_init_hook
8551 #define alc883_targa_unsol_event alc882_targa_unsol_event
8553 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8555 unsigned int present;
8557 present = snd_hda_jack_detect(codec, 0x18);
8558 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8559 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8562 static void alc883_clevo_m720_setup(struct hda_codec *codec)
8564 struct alc_spec *spec = codec->spec;
8566 spec->autocfg.hp_pins[0] = 0x15;
8567 spec->autocfg.speaker_pins[0] = 0x14;
8570 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
8572 alc_automute_amp(codec);
8573 alc883_clevo_m720_mic_automute(codec);
8576 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8579 switch (res >> 26) {
8580 case ALC880_MIC_EVENT:
8581 alc883_clevo_m720_mic_automute(codec);
8584 alc_automute_amp_unsol_event(codec, res);
8589 /* toggle speaker-output according to the hp-jack state */
8590 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
8592 struct alc_spec *spec = codec->spec;
8594 spec->autocfg.hp_pins[0] = 0x14;
8595 spec->autocfg.speaker_pins[0] = 0x15;
8598 static void alc883_haier_w66_setup(struct hda_codec *codec)
8600 struct alc_spec *spec = codec->spec;
8602 spec->autocfg.hp_pins[0] = 0x1b;
8603 spec->autocfg.speaker_pins[0] = 0x14;
8606 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8608 int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0;
8610 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8611 HDA_AMP_MUTE, bits);
8614 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8616 int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0;
8618 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8619 HDA_AMP_MUTE, bits);
8620 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8621 HDA_AMP_MUTE, bits);
8624 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8627 if ((res >> 26) == ALC880_HP_EVENT)
8628 alc883_lenovo_101e_all_automute(codec);
8629 if ((res >> 26) == ALC880_FRONT_EVENT)
8630 alc883_lenovo_101e_ispeaker_automute(codec);
8633 /* toggle speaker-output according to the hp-jack state */
8634 static void alc883_acer_aspire_setup(struct hda_codec *codec)
8636 struct alc_spec *spec = codec->spec;
8638 spec->autocfg.hp_pins[0] = 0x14;
8639 spec->autocfg.speaker_pins[0] = 0x15;
8640 spec->autocfg.speaker_pins[1] = 0x16;
8643 static struct hda_verb alc883_acer_eapd_verbs[] = {
8644 /* HP Pin: output 0 (0x0c) */
8645 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8646 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8647 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8648 /* Front Pin: output 0 (0x0c) */
8649 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8650 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8651 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8652 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8653 /* eanable EAPD on medion laptop */
8654 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8655 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8656 /* enable unsolicited event */
8657 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8661 static struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
8662 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8663 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8664 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8668 static void alc888_6st_dell_setup(struct hda_codec *codec)
8670 struct alc_spec *spec = codec->spec;
8672 spec->autocfg.hp_pins[0] = 0x1b;
8673 spec->autocfg.speaker_pins[0] = 0x14;
8674 spec->autocfg.speaker_pins[1] = 0x15;
8675 spec->autocfg.speaker_pins[2] = 0x16;
8676 spec->autocfg.speaker_pins[3] = 0x17;
8679 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
8681 struct alc_spec *spec = codec->spec;
8683 spec->autocfg.hp_pins[0] = 0x1b;
8684 spec->autocfg.speaker_pins[0] = 0x14;
8685 spec->autocfg.speaker_pins[1] = 0x15;
8686 spec->autocfg.speaker_pins[2] = 0x16;
8687 spec->autocfg.speaker_pins[3] = 0x17;
8688 spec->autocfg.speaker_pins[4] = 0x1a;
8691 static void alc883_vaiott_setup(struct hda_codec *codec)
8693 struct alc_spec *spec = codec->spec;
8695 spec->autocfg.hp_pins[0] = 0x15;
8696 spec->autocfg.speaker_pins[0] = 0x14;
8697 spec->autocfg.speaker_pins[1] = 0x17;
8700 static struct hda_verb alc888_asus_m90v_verbs[] = {
8701 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8702 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8703 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8704 /* enable unsolicited event */
8705 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8706 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8710 static void alc883_mode2_setup(struct hda_codec *codec)
8712 struct alc_spec *spec = codec->spec;
8714 spec->autocfg.hp_pins[0] = 0x1b;
8715 spec->autocfg.speaker_pins[0] = 0x14;
8716 spec->autocfg.speaker_pins[1] = 0x15;
8717 spec->autocfg.speaker_pins[2] = 0x16;
8718 spec->ext_mic.pin = 0x18;
8719 spec->int_mic.pin = 0x19;
8720 spec->ext_mic.mux_idx = 0;
8721 spec->int_mic.mux_idx = 1;
8725 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8726 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8727 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8728 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8729 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8730 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8731 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8732 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8733 /* enable unsolicited event */
8734 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8738 static void alc883_eee1601_inithook(struct hda_codec *codec)
8740 struct alc_spec *spec = codec->spec;
8742 spec->autocfg.hp_pins[0] = 0x14;
8743 spec->autocfg.speaker_pins[0] = 0x1b;
8744 alc_automute_pin(codec);
8747 static struct hda_verb alc889A_mb31_verbs[] = {
8748 /* Init rear pin (used as headphone output) */
8749 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
8750 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
8751 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8752 /* Init line pin (used as output in 4ch and 6ch mode) */
8753 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
8754 /* Init line 2 pin (used as headphone out by default) */
8755 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
8756 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
8760 /* Mute speakers according to the headphone jack state */
8761 static void alc889A_mb31_automute(struct hda_codec *codec)
8763 unsigned int present;
8765 /* Mute only in 2ch or 4ch mode */
8766 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
8768 present = snd_hda_jack_detect(codec, 0x15);
8769 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8770 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8771 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8772 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8776 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
8778 if ((res >> 26) == ALC880_HP_EVENT)
8779 alc889A_mb31_automute(codec);
8783 #ifdef CONFIG_SND_HDA_POWER_SAVE
8784 #define alc882_loopbacks alc880_loopbacks
8787 /* pcm configuration: identical with ALC880 */
8788 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
8789 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
8790 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
8791 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
8793 static hda_nid_t alc883_slave_dig_outs[] = {
8794 ALC1200_DIGOUT_NID, 0,
8797 static hda_nid_t alc1200_slave_dig_outs[] = {
8798 ALC883_DIGOUT_NID, 0,
8802 * configuration and preset
8804 static const char *alc882_models[ALC882_MODEL_LAST] = {
8805 [ALC882_3ST_DIG] = "3stack-dig",
8806 [ALC882_6ST_DIG] = "6stack-dig",
8807 [ALC882_ARIMA] = "arima",
8808 [ALC882_W2JC] = "w2jc",
8809 [ALC882_TARGA] = "targa",
8810 [ALC882_ASUS_A7J] = "asus-a7j",
8811 [ALC882_ASUS_A7M] = "asus-a7m",
8812 [ALC885_MACPRO] = "macpro",
8813 [ALC885_MB5] = "mb5",
8814 [ALC885_MBP3] = "mbp3",
8815 [ALC885_IMAC24] = "imac24",
8816 [ALC885_IMAC91] = "imac91",
8817 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
8818 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8819 [ALC883_3ST_6ch] = "3stack-6ch",
8820 [ALC883_6ST_DIG] = "alc883-6stack-dig",
8821 [ALC883_TARGA_DIG] = "targa-dig",
8822 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8823 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
8824 [ALC883_ACER] = "acer",
8825 [ALC883_ACER_ASPIRE] = "acer-aspire",
8826 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
8827 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
8828 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
8829 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
8830 [ALC883_MEDION] = "medion",
8831 [ALC883_MEDION_MD2] = "medion-md2",
8832 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8833 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8834 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8835 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8836 [ALC888_LENOVO_SKY] = "lenovo-sky",
8837 [ALC883_HAIER_W66] = "haier-w66",
8838 [ALC888_3ST_HP] = "3stack-hp",
8839 [ALC888_6ST_DELL] = "6stack-dell",
8840 [ALC883_MITAC] = "mitac",
8841 [ALC883_CLEVO_M540R] = "clevo-m540r",
8842 [ALC883_CLEVO_M720] = "clevo-m720",
8843 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8844 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
8845 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8846 [ALC889A_INTEL] = "intel-alc889a",
8847 [ALC889_INTEL] = "intel-x58",
8848 [ALC1200_ASUS_P5Q] = "asus-p5q",
8849 [ALC889A_MB31] = "mb31",
8850 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
8851 [ALC882_AUTO] = "auto",
8854 static struct snd_pci_quirk alc882_cfg_tbl[] = {
8855 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
8857 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8858 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
8859 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
8860 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
8861 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
8862 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
8863 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
8864 ALC888_ACER_ASPIRE_4930G),
8865 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
8866 ALC888_ACER_ASPIRE_4930G),
8867 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
8868 ALC888_ACER_ASPIRE_8930G),
8869 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
8870 ALC888_ACER_ASPIRE_8930G),
8871 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
8872 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
8873 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
8874 ALC888_ACER_ASPIRE_6530G),
8875 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
8876 ALC888_ACER_ASPIRE_6530G),
8877 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
8878 ALC888_ACER_ASPIRE_7730G),
8879 /* default Acer -- disabled as it causes more problems.
8880 * model=auto should work fine now
8882 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
8884 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8886 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
8887 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
8888 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
8889 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8890 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
8891 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
8893 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
8894 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
8895 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
8896 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
8897 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
8898 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
8899 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
8900 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8901 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
8902 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
8903 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
8905 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
8906 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
8907 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
8908 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
8909 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
8910 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
8911 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
8912 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
8913 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
8915 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
8916 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
8917 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
8918 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
8919 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
8920 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
8921 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
8922 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
8923 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
8924 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
8925 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
8926 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
8927 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
8928 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
8929 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
8930 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
8931 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
8932 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
8933 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
8934 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
8935 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
8936 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
8937 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
8938 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
8939 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
8940 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
8941 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
8942 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
8943 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
8945 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
8946 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
8947 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
8948 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
8949 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
8950 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
8951 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
8952 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
8953 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
8954 ALC883_FUJITSU_PI2515),
8955 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
8956 ALC888_FUJITSU_XA3530),
8957 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
8958 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8959 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8960 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8961 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
8962 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
8963 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
8964 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
8965 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
8967 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
8968 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
8969 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
8970 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
8971 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
8972 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
8973 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
8978 /* codec SSID table for Intel Mac */
8979 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
8980 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
8981 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
8982 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
8983 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
8984 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
8985 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
8986 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
8987 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
8988 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
8989 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
8990 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
8991 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
8992 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
8993 * so apparently no perfect solution yet
8995 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
8996 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
9000 static struct alc_config_preset alc882_presets[] = {
9001 [ALC882_3ST_DIG] = {
9002 .mixers = { alc882_base_mixer },
9003 .init_verbs = { alc882_base_init_verbs,
9004 alc882_adc1_init_verbs },
9005 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9006 .dac_nids = alc882_dac_nids,
9007 .dig_out_nid = ALC882_DIGOUT_NID,
9008 .dig_in_nid = ALC882_DIGIN_NID,
9009 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9010 .channel_mode = alc882_ch_modes,
9012 .input_mux = &alc882_capture_source,
9014 [ALC882_6ST_DIG] = {
9015 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9016 .init_verbs = { alc882_base_init_verbs,
9017 alc882_adc1_init_verbs },
9018 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9019 .dac_nids = alc882_dac_nids,
9020 .dig_out_nid = ALC882_DIGOUT_NID,
9021 .dig_in_nid = ALC882_DIGIN_NID,
9022 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9023 .channel_mode = alc882_sixstack_modes,
9024 .input_mux = &alc882_capture_source,
9027 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9028 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9029 alc882_eapd_verbs },
9030 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9031 .dac_nids = alc882_dac_nids,
9032 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9033 .channel_mode = alc882_sixstack_modes,
9034 .input_mux = &alc882_capture_source,
9037 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
9038 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9039 alc882_eapd_verbs, alc880_gpio1_init_verbs },
9040 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9041 .dac_nids = alc882_dac_nids,
9042 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9043 .channel_mode = alc880_threestack_modes,
9045 .input_mux = &alc882_capture_source,
9046 .dig_out_nid = ALC882_DIGOUT_NID,
9049 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
9050 .init_verbs = { alc885_mbp3_init_verbs,
9051 alc880_gpio1_init_verbs },
9053 .dac_nids = alc882_dac_nids,
9055 .channel_mode = alc885_mbp_4ch_modes,
9056 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9057 .input_mux = &alc882_capture_source,
9058 .dig_out_nid = ALC882_DIGOUT_NID,
9059 .dig_in_nid = ALC882_DIGIN_NID,
9060 .unsol_event = alc_automute_amp_unsol_event,
9061 .setup = alc885_mbp3_setup,
9062 .init_hook = alc_automute_amp,
9065 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
9066 .init_verbs = { alc885_mb5_init_verbs,
9067 alc880_gpio1_init_verbs },
9068 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9069 .dac_nids = alc882_dac_nids,
9070 .channel_mode = alc885_mb5_6ch_modes,
9071 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
9072 .input_mux = &mb5_capture_source,
9073 .dig_out_nid = ALC882_DIGOUT_NID,
9074 .dig_in_nid = ALC882_DIGIN_NID,
9077 .mixers = { alc882_macpro_mixer },
9078 .init_verbs = { alc882_macpro_init_verbs },
9079 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9080 .dac_nids = alc882_dac_nids,
9081 .dig_out_nid = ALC882_DIGOUT_NID,
9082 .dig_in_nid = ALC882_DIGIN_NID,
9083 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9084 .channel_mode = alc882_ch_modes,
9085 .input_mux = &alc882_capture_source,
9086 .init_hook = alc885_macpro_init_hook,
9089 .mixers = { alc885_imac24_mixer },
9090 .init_verbs = { alc885_imac24_init_verbs },
9091 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9092 .dac_nids = alc882_dac_nids,
9093 .dig_out_nid = ALC882_DIGOUT_NID,
9094 .dig_in_nid = ALC882_DIGIN_NID,
9095 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9096 .channel_mode = alc882_ch_modes,
9097 .input_mux = &alc882_capture_source,
9098 .unsol_event = alc_automute_amp_unsol_event,
9099 .setup = alc885_imac24_setup,
9100 .init_hook = alc885_imac24_init_hook,
9103 .mixers = { alc885_imac91_mixer, alc882_chmode_mixer },
9104 .init_verbs = { alc885_imac91_init_verbs,
9105 alc880_gpio1_init_verbs },
9106 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9107 .dac_nids = alc882_dac_nids,
9108 .channel_mode = alc885_mbp_4ch_modes,
9109 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9110 .input_mux = &alc882_capture_source,
9111 .dig_out_nid = ALC882_DIGOUT_NID,
9112 .dig_in_nid = ALC882_DIGIN_NID,
9113 .unsol_event = alc885_imac91_unsol_event,
9114 .init_hook = alc885_imac91_automute,
9117 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
9118 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9119 alc880_gpio3_init_verbs, alc882_targa_verbs},
9120 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9121 .dac_nids = alc882_dac_nids,
9122 .dig_out_nid = ALC882_DIGOUT_NID,
9123 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9124 .adc_nids = alc882_adc_nids,
9125 .capsrc_nids = alc882_capsrc_nids,
9126 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9127 .channel_mode = alc882_3ST_6ch_modes,
9129 .input_mux = &alc882_capture_source,
9130 .unsol_event = alc882_targa_unsol_event,
9131 .setup = alc882_targa_setup,
9132 .init_hook = alc882_targa_automute,
9134 [ALC882_ASUS_A7J] = {
9135 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
9136 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9137 alc882_asus_a7j_verbs},
9138 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9139 .dac_nids = alc882_dac_nids,
9140 .dig_out_nid = ALC882_DIGOUT_NID,
9141 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9142 .adc_nids = alc882_adc_nids,
9143 .capsrc_nids = alc882_capsrc_nids,
9144 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9145 .channel_mode = alc882_3ST_6ch_modes,
9147 .input_mux = &alc882_capture_source,
9149 [ALC882_ASUS_A7M] = {
9150 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
9151 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9152 alc882_eapd_verbs, alc880_gpio1_init_verbs,
9153 alc882_asus_a7m_verbs },
9154 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9155 .dac_nids = alc882_dac_nids,
9156 .dig_out_nid = ALC882_DIGOUT_NID,
9157 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9158 .channel_mode = alc880_threestack_modes,
9160 .input_mux = &alc882_capture_source,
9162 [ALC883_3ST_2ch_DIG] = {
9163 .mixers = { alc883_3ST_2ch_mixer },
9164 .init_verbs = { alc883_init_verbs },
9165 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9166 .dac_nids = alc883_dac_nids,
9167 .dig_out_nid = ALC883_DIGOUT_NID,
9168 .dig_in_nid = ALC883_DIGIN_NID,
9169 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9170 .channel_mode = alc883_3ST_2ch_modes,
9171 .input_mux = &alc883_capture_source,
9173 [ALC883_3ST_6ch_DIG] = {
9174 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9175 .init_verbs = { alc883_init_verbs },
9176 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9177 .dac_nids = alc883_dac_nids,
9178 .dig_out_nid = ALC883_DIGOUT_NID,
9179 .dig_in_nid = ALC883_DIGIN_NID,
9180 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9181 .channel_mode = alc883_3ST_6ch_modes,
9183 .input_mux = &alc883_capture_source,
9185 [ALC883_3ST_6ch] = {
9186 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9187 .init_verbs = { alc883_init_verbs },
9188 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9189 .dac_nids = alc883_dac_nids,
9190 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9191 .channel_mode = alc883_3ST_6ch_modes,
9193 .input_mux = &alc883_capture_source,
9195 [ALC883_3ST_6ch_INTEL] = {
9196 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
9197 .init_verbs = { alc883_init_verbs },
9198 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9199 .dac_nids = alc883_dac_nids,
9200 .dig_out_nid = ALC883_DIGOUT_NID,
9201 .dig_in_nid = ALC883_DIGIN_NID,
9202 .slave_dig_outs = alc883_slave_dig_outs,
9203 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
9204 .channel_mode = alc883_3ST_6ch_intel_modes,
9206 .input_mux = &alc883_3stack_6ch_intel,
9209 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9210 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
9211 alc_hp15_unsol_verbs },
9212 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9213 .dac_nids = alc883_dac_nids,
9214 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9215 .adc_nids = alc889_adc_nids,
9216 .dig_out_nid = ALC883_DIGOUT_NID,
9217 .dig_in_nid = ALC883_DIGIN_NID,
9218 .slave_dig_outs = alc883_slave_dig_outs,
9219 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9220 .channel_mode = alc889_8ch_intel_modes,
9221 .capsrc_nids = alc889_capsrc_nids,
9222 .input_mux = &alc889_capture_source,
9223 .setup = alc889_automute_setup,
9224 .init_hook = alc_automute_amp,
9225 .unsol_event = alc_automute_amp_unsol_event,
9229 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9230 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
9231 alc889_eapd_verbs, alc_hp15_unsol_verbs},
9232 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9233 .dac_nids = alc883_dac_nids,
9234 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9235 .adc_nids = alc889_adc_nids,
9236 .dig_out_nid = ALC883_DIGOUT_NID,
9237 .dig_in_nid = ALC883_DIGIN_NID,
9238 .slave_dig_outs = alc883_slave_dig_outs,
9239 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9240 .channel_mode = alc889_8ch_intel_modes,
9241 .capsrc_nids = alc889_capsrc_nids,
9242 .input_mux = &alc889_capture_source,
9243 .setup = alc889_automute_setup,
9244 .init_hook = alc889_intel_init_hook,
9245 .unsol_event = alc_automute_amp_unsol_event,
9248 [ALC883_6ST_DIG] = {
9249 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9250 .init_verbs = { alc883_init_verbs },
9251 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9252 .dac_nids = alc883_dac_nids,
9253 .dig_out_nid = ALC883_DIGOUT_NID,
9254 .dig_in_nid = ALC883_DIGIN_NID,
9255 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9256 .channel_mode = alc883_sixstack_modes,
9257 .input_mux = &alc883_capture_source,
9259 [ALC883_TARGA_DIG] = {
9260 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
9261 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9262 alc883_targa_verbs},
9263 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9264 .dac_nids = alc883_dac_nids,
9265 .dig_out_nid = ALC883_DIGOUT_NID,
9266 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9267 .channel_mode = alc883_3ST_6ch_modes,
9269 .input_mux = &alc883_capture_source,
9270 .unsol_event = alc883_targa_unsol_event,
9271 .setup = alc882_targa_setup,
9272 .init_hook = alc882_targa_automute,
9274 [ALC883_TARGA_2ch_DIG] = {
9275 .mixers = { alc883_targa_2ch_mixer},
9276 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9277 alc883_targa_verbs},
9278 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9279 .dac_nids = alc883_dac_nids,
9280 .adc_nids = alc883_adc_nids_alt,
9281 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9282 .dig_out_nid = ALC883_DIGOUT_NID,
9283 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9284 .channel_mode = alc883_3ST_2ch_modes,
9285 .input_mux = &alc883_capture_source,
9286 .unsol_event = alc883_targa_unsol_event,
9287 .setup = alc882_targa_setup,
9288 .init_hook = alc882_targa_automute,
9290 [ALC883_TARGA_8ch_DIG] = {
9291 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
9292 alc883_chmode_mixer },
9293 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9294 alc883_targa_verbs },
9295 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9296 .dac_nids = alc883_dac_nids,
9297 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9298 .adc_nids = alc883_adc_nids_rev,
9299 .capsrc_nids = alc883_capsrc_nids_rev,
9300 .dig_out_nid = ALC883_DIGOUT_NID,
9301 .dig_in_nid = ALC883_DIGIN_NID,
9302 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
9303 .channel_mode = alc883_4ST_8ch_modes,
9305 .input_mux = &alc883_capture_source,
9306 .unsol_event = alc883_targa_unsol_event,
9307 .setup = alc882_targa_setup,
9308 .init_hook = alc882_targa_automute,
9311 .mixers = { alc883_base_mixer },
9312 /* On TravelMate laptops, GPIO 0 enables the internal speaker
9313 * and the headphone jack. Turn this on and rely on the
9314 * standard mute methods whenever the user wants to turn
9315 * these outputs off.
9317 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
9318 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9319 .dac_nids = alc883_dac_nids,
9320 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9321 .channel_mode = alc883_3ST_2ch_modes,
9322 .input_mux = &alc883_capture_source,
9324 [ALC883_ACER_ASPIRE] = {
9325 .mixers = { alc883_acer_aspire_mixer },
9326 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
9327 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9328 .dac_nids = alc883_dac_nids,
9329 .dig_out_nid = ALC883_DIGOUT_NID,
9330 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9331 .channel_mode = alc883_3ST_2ch_modes,
9332 .input_mux = &alc883_capture_source,
9333 .unsol_event = alc_automute_amp_unsol_event,
9334 .setup = alc883_acer_aspire_setup,
9335 .init_hook = alc_automute_amp,
9337 [ALC888_ACER_ASPIRE_4930G] = {
9338 .mixers = { alc888_base_mixer,
9339 alc883_chmode_mixer },
9340 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9341 alc888_acer_aspire_4930g_verbs },
9342 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9343 .dac_nids = alc883_dac_nids,
9344 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9345 .adc_nids = alc883_adc_nids_rev,
9346 .capsrc_nids = alc883_capsrc_nids_rev,
9347 .dig_out_nid = ALC883_DIGOUT_NID,
9348 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9349 .channel_mode = alc883_3ST_6ch_modes,
9352 ARRAY_SIZE(alc888_2_capture_sources),
9353 .input_mux = alc888_2_capture_sources,
9354 .unsol_event = alc_automute_amp_unsol_event,
9355 .setup = alc888_acer_aspire_4930g_setup,
9356 .init_hook = alc_automute_amp,
9358 [ALC888_ACER_ASPIRE_6530G] = {
9359 .mixers = { alc888_acer_aspire_6530_mixer },
9360 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9361 alc888_acer_aspire_6530g_verbs },
9362 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9363 .dac_nids = alc883_dac_nids,
9364 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9365 .adc_nids = alc883_adc_nids_rev,
9366 .capsrc_nids = alc883_capsrc_nids_rev,
9367 .dig_out_nid = ALC883_DIGOUT_NID,
9368 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9369 .channel_mode = alc883_3ST_2ch_modes,
9371 ARRAY_SIZE(alc888_2_capture_sources),
9372 .input_mux = alc888_acer_aspire_6530_sources,
9373 .unsol_event = alc_automute_amp_unsol_event,
9374 .setup = alc888_acer_aspire_6530g_setup,
9375 .init_hook = alc_automute_amp,
9377 [ALC888_ACER_ASPIRE_8930G] = {
9378 .mixers = { alc888_base_mixer,
9379 alc883_chmode_mixer },
9380 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9381 alc889_acer_aspire_8930g_verbs },
9382 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9383 .dac_nids = alc883_dac_nids,
9384 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9385 .adc_nids = alc889_adc_nids,
9386 .capsrc_nids = alc889_capsrc_nids,
9387 .dig_out_nid = ALC883_DIGOUT_NID,
9388 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9389 .channel_mode = alc883_3ST_6ch_modes,
9391 .const_channel_count = 6,
9393 ARRAY_SIZE(alc889_capture_sources),
9394 .input_mux = alc889_capture_sources,
9395 .unsol_event = alc_automute_amp_unsol_event,
9396 .setup = alc889_acer_aspire_8930g_setup,
9397 .init_hook = alc_automute_amp,
9399 [ALC888_ACER_ASPIRE_7730G] = {
9400 .mixers = { alc883_3ST_6ch_mixer,
9401 alc883_chmode_mixer },
9402 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9403 alc888_acer_aspire_7730G_verbs },
9404 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9405 .dac_nids = alc883_dac_nids,
9406 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9407 .adc_nids = alc883_adc_nids_rev,
9408 .capsrc_nids = alc883_capsrc_nids_rev,
9409 .dig_out_nid = ALC883_DIGOUT_NID,
9410 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9411 .channel_mode = alc883_3ST_6ch_modes,
9413 .const_channel_count = 6,
9414 .input_mux = &alc883_capture_source,
9415 .unsol_event = alc_automute_amp_unsol_event,
9416 .setup = alc888_acer_aspire_6530g_setup,
9417 .init_hook = alc_automute_amp,
9420 .mixers = { alc883_fivestack_mixer,
9421 alc883_chmode_mixer },
9422 .init_verbs = { alc883_init_verbs,
9423 alc883_medion_eapd_verbs },
9424 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9425 .dac_nids = alc883_dac_nids,
9426 .adc_nids = alc883_adc_nids_alt,
9427 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9428 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9429 .channel_mode = alc883_sixstack_modes,
9430 .input_mux = &alc883_capture_source,
9432 [ALC883_MEDION_MD2] = {
9433 .mixers = { alc883_medion_md2_mixer},
9434 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
9435 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9436 .dac_nids = alc883_dac_nids,
9437 .dig_out_nid = ALC883_DIGOUT_NID,
9438 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9439 .channel_mode = alc883_3ST_2ch_modes,
9440 .input_mux = &alc883_capture_source,
9441 .unsol_event = alc_automute_amp_unsol_event,
9442 .setup = alc883_medion_md2_setup,
9443 .init_hook = alc_automute_amp,
9445 [ALC883_LAPTOP_EAPD] = {
9446 .mixers = { alc883_base_mixer },
9447 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
9448 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9449 .dac_nids = alc883_dac_nids,
9450 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9451 .channel_mode = alc883_3ST_2ch_modes,
9452 .input_mux = &alc883_capture_source,
9454 [ALC883_CLEVO_M540R] = {
9455 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9456 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
9457 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9458 .dac_nids = alc883_dac_nids,
9459 .dig_out_nid = ALC883_DIGOUT_NID,
9460 .dig_in_nid = ALC883_DIGIN_NID,
9461 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
9462 .channel_mode = alc883_3ST_6ch_clevo_modes,
9464 .input_mux = &alc883_capture_source,
9465 /* This machine has the hardware HP auto-muting, thus
9466 * we need no software mute via unsol event
9469 [ALC883_CLEVO_M720] = {
9470 .mixers = { alc883_clevo_m720_mixer },
9471 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
9472 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9473 .dac_nids = alc883_dac_nids,
9474 .dig_out_nid = ALC883_DIGOUT_NID,
9475 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9476 .channel_mode = alc883_3ST_2ch_modes,
9477 .input_mux = &alc883_capture_source,
9478 .unsol_event = alc883_clevo_m720_unsol_event,
9479 .setup = alc883_clevo_m720_setup,
9480 .init_hook = alc883_clevo_m720_init_hook,
9482 [ALC883_LENOVO_101E_2ch] = {
9483 .mixers = { alc883_lenovo_101e_2ch_mixer},
9484 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
9485 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9486 .dac_nids = alc883_dac_nids,
9487 .adc_nids = alc883_adc_nids_alt,
9488 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9489 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9490 .channel_mode = alc883_3ST_2ch_modes,
9491 .input_mux = &alc883_lenovo_101e_capture_source,
9492 .unsol_event = alc883_lenovo_101e_unsol_event,
9493 .init_hook = alc883_lenovo_101e_all_automute,
9495 [ALC883_LENOVO_NB0763] = {
9496 .mixers = { alc883_lenovo_nb0763_mixer },
9497 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
9498 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9499 .dac_nids = alc883_dac_nids,
9500 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9501 .channel_mode = alc883_3ST_2ch_modes,
9503 .input_mux = &alc883_lenovo_nb0763_capture_source,
9504 .unsol_event = alc_automute_amp_unsol_event,
9505 .setup = alc883_medion_md2_setup,
9506 .init_hook = alc_automute_amp,
9508 [ALC888_LENOVO_MS7195_DIG] = {
9509 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9510 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
9511 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9512 .dac_nids = alc883_dac_nids,
9513 .dig_out_nid = ALC883_DIGOUT_NID,
9514 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9515 .channel_mode = alc883_3ST_6ch_modes,
9517 .input_mux = &alc883_capture_source,
9518 .unsol_event = alc883_lenovo_ms7195_unsol_event,
9519 .init_hook = alc888_lenovo_ms7195_front_automute,
9521 [ALC883_HAIER_W66] = {
9522 .mixers = { alc883_targa_2ch_mixer},
9523 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
9524 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9525 .dac_nids = alc883_dac_nids,
9526 .dig_out_nid = ALC883_DIGOUT_NID,
9527 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9528 .channel_mode = alc883_3ST_2ch_modes,
9529 .input_mux = &alc883_capture_source,
9530 .unsol_event = alc_automute_amp_unsol_event,
9531 .setup = alc883_haier_w66_setup,
9532 .init_hook = alc_automute_amp,
9535 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9536 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
9537 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9538 .dac_nids = alc883_dac_nids,
9539 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
9540 .channel_mode = alc888_3st_hp_modes,
9542 .input_mux = &alc883_capture_source,
9543 .unsol_event = alc_automute_amp_unsol_event,
9544 .setup = alc888_3st_hp_setup,
9545 .init_hook = alc_automute_amp,
9547 [ALC888_6ST_DELL] = {
9548 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9549 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
9550 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9551 .dac_nids = alc883_dac_nids,
9552 .dig_out_nid = ALC883_DIGOUT_NID,
9553 .dig_in_nid = ALC883_DIGIN_NID,
9554 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9555 .channel_mode = alc883_sixstack_modes,
9556 .input_mux = &alc883_capture_source,
9557 .unsol_event = alc_automute_amp_unsol_event,
9558 .setup = alc888_6st_dell_setup,
9559 .init_hook = alc_automute_amp,
9562 .mixers = { alc883_mitac_mixer },
9563 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
9564 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9565 .dac_nids = alc883_dac_nids,
9566 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9567 .channel_mode = alc883_3ST_2ch_modes,
9568 .input_mux = &alc883_capture_source,
9569 .unsol_event = alc_automute_amp_unsol_event,
9570 .setup = alc883_mitac_setup,
9571 .init_hook = alc_automute_amp,
9573 [ALC883_FUJITSU_PI2515] = {
9574 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
9575 .init_verbs = { alc883_init_verbs,
9576 alc883_2ch_fujitsu_pi2515_verbs},
9577 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9578 .dac_nids = alc883_dac_nids,
9579 .dig_out_nid = ALC883_DIGOUT_NID,
9580 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9581 .channel_mode = alc883_3ST_2ch_modes,
9582 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9583 .unsol_event = alc_automute_amp_unsol_event,
9584 .setup = alc883_2ch_fujitsu_pi2515_setup,
9585 .init_hook = alc_automute_amp,
9587 [ALC888_FUJITSU_XA3530] = {
9588 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
9589 .init_verbs = { alc883_init_verbs,
9590 alc888_fujitsu_xa3530_verbs },
9591 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9592 .dac_nids = alc883_dac_nids,
9593 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9594 .adc_nids = alc883_adc_nids_rev,
9595 .capsrc_nids = alc883_capsrc_nids_rev,
9596 .dig_out_nid = ALC883_DIGOUT_NID,
9597 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
9598 .channel_mode = alc888_4ST_8ch_intel_modes,
9600 ARRAY_SIZE(alc888_2_capture_sources),
9601 .input_mux = alc888_2_capture_sources,
9602 .unsol_event = alc_automute_amp_unsol_event,
9603 .setup = alc888_fujitsu_xa3530_setup,
9604 .init_hook = alc_automute_amp,
9606 [ALC888_LENOVO_SKY] = {
9607 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
9608 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
9609 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9610 .dac_nids = alc883_dac_nids,
9611 .dig_out_nid = ALC883_DIGOUT_NID,
9612 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9613 .channel_mode = alc883_sixstack_modes,
9615 .input_mux = &alc883_lenovo_sky_capture_source,
9616 .unsol_event = alc_automute_amp_unsol_event,
9617 .setup = alc888_lenovo_sky_setup,
9618 .init_hook = alc_automute_amp,
9620 [ALC888_ASUS_M90V] = {
9621 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9622 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
9623 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9624 .dac_nids = alc883_dac_nids,
9625 .dig_out_nid = ALC883_DIGOUT_NID,
9626 .dig_in_nid = ALC883_DIGIN_NID,
9627 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9628 .channel_mode = alc883_3ST_6ch_modes,
9630 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9631 .unsol_event = alc_sku_unsol_event,
9632 .setup = alc883_mode2_setup,
9633 .init_hook = alc_inithook,
9635 [ALC888_ASUS_EEE1601] = {
9636 .mixers = { alc883_asus_eee1601_mixer },
9637 .cap_mixer = alc883_asus_eee1601_cap_mixer,
9638 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
9639 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9640 .dac_nids = alc883_dac_nids,
9641 .dig_out_nid = ALC883_DIGOUT_NID,
9642 .dig_in_nid = ALC883_DIGIN_NID,
9643 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9644 .channel_mode = alc883_3ST_2ch_modes,
9646 .input_mux = &alc883_asus_eee1601_capture_source,
9647 .unsol_event = alc_sku_unsol_event,
9648 .init_hook = alc883_eee1601_inithook,
9650 [ALC1200_ASUS_P5Q] = {
9651 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9652 .init_verbs = { alc883_init_verbs },
9653 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9654 .dac_nids = alc883_dac_nids,
9655 .dig_out_nid = ALC1200_DIGOUT_NID,
9656 .dig_in_nid = ALC883_DIGIN_NID,
9657 .slave_dig_outs = alc1200_slave_dig_outs,
9658 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9659 .channel_mode = alc883_sixstack_modes,
9660 .input_mux = &alc883_capture_source,
9663 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
9664 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
9665 alc880_gpio1_init_verbs },
9666 .adc_nids = alc883_adc_nids,
9667 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
9668 .dac_nids = alc883_dac_nids,
9669 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9670 .channel_mode = alc889A_mb31_6ch_modes,
9671 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
9672 .input_mux = &alc889A_mb31_capture_source,
9673 .dig_out_nid = ALC883_DIGOUT_NID,
9674 .unsol_event = alc889A_mb31_unsol_event,
9675 .init_hook = alc889A_mb31_automute,
9677 [ALC883_SONY_VAIO_TT] = {
9678 .mixers = { alc883_vaiott_mixer },
9679 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
9680 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9681 .dac_nids = alc883_dac_nids,
9682 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9683 .channel_mode = alc883_3ST_2ch_modes,
9684 .input_mux = &alc883_capture_source,
9685 .unsol_event = alc_automute_amp_unsol_event,
9686 .setup = alc883_vaiott_setup,
9687 .init_hook = alc_automute_amp,
9696 PINFIX_ABIT_AW9D_MAX
9699 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
9700 { 0x15, 0x01080104 }, /* side */
9701 { 0x16, 0x01011012 }, /* rear */
9702 { 0x17, 0x01016011 }, /* clfe */
9706 static const struct alc_fixup alc882_fixups[] = {
9707 [PINFIX_ABIT_AW9D_MAX] = {
9708 .pins = alc882_abit_aw9d_pinfix
9712 static struct snd_pci_quirk alc882_fixup_tbl[] = {
9713 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
9718 * BIOS auto configuration
9720 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
9721 const struct auto_pin_cfg *cfg)
9723 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
9726 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
9727 hda_nid_t nid, int pin_type,
9731 struct alc_spec *spec = codec->spec;
9734 alc_set_pin_output(codec, nid, pin_type);
9735 if (spec->multiout.dac_nids[dac_idx] == 0x25)
9738 idx = spec->multiout.dac_nids[dac_idx] - 2;
9739 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
9743 static void alc882_auto_init_multi_out(struct hda_codec *codec)
9745 struct alc_spec *spec = codec->spec;
9748 for (i = 0; i <= HDA_SIDE; i++) {
9749 hda_nid_t nid = spec->autocfg.line_out_pins[i];
9750 int pin_type = get_pin_type(spec->autocfg.line_out_type);
9752 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
9757 static void alc882_auto_init_hp_out(struct hda_codec *codec)
9759 struct alc_spec *spec = codec->spec;
9762 pin = spec->autocfg.hp_pins[0];
9763 if (pin) /* connect to front */
9765 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
9766 pin = spec->autocfg.speaker_pins[0];
9768 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
9771 static void alc882_auto_init_analog_input(struct hda_codec *codec)
9773 struct alc_spec *spec = codec->spec;
9776 for (i = 0; i < AUTO_PIN_LAST; i++) {
9777 hda_nid_t nid = spec->autocfg.input_pins[i];
9780 alc_set_input_pin(codec, nid, i);
9781 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
9782 snd_hda_codec_write(codec, nid, 0,
9783 AC_VERB_SET_AMP_GAIN_MUTE,
9788 static void alc882_auto_init_input_src(struct hda_codec *codec)
9790 struct alc_spec *spec = codec->spec;
9793 for (c = 0; c < spec->num_adc_nids; c++) {
9794 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
9795 hda_nid_t nid = spec->capsrc_nids[c];
9796 unsigned int mux_idx;
9797 const struct hda_input_mux *imux;
9798 int conns, mute, idx, item;
9800 conns = snd_hda_get_connections(codec, nid, conn_list,
9801 ARRAY_SIZE(conn_list));
9804 mux_idx = c >= spec->num_mux_defs ? 0 : c;
9805 imux = &spec->input_mux[mux_idx];
9806 for (idx = 0; idx < conns; idx++) {
9807 /* if the current connection is the selected one,
9808 * unmute it as default - otherwise mute it
9810 mute = AMP_IN_MUTE(idx);
9811 for (item = 0; item < imux->num_items; item++) {
9812 if (imux->items[item].index == idx) {
9813 if (spec->cur_mux[c] == item)
9814 mute = AMP_IN_UNMUTE(idx);
9818 /* check if we have a selector or mixer
9819 * we could check for the widget type instead, but
9820 * just check for Amp-In presence (in case of mixer
9821 * without amp-in there is something wrong, this
9822 * function shouldn't be used or capsrc nid is wrong)
9824 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
9825 snd_hda_codec_write(codec, nid, 0,
9826 AC_VERB_SET_AMP_GAIN_MUTE,
9828 else if (mute != AMP_IN_MUTE(idx))
9829 snd_hda_codec_write(codec, nid, 0,
9830 AC_VERB_SET_CONNECT_SEL,
9836 /* add mic boosts if needed */
9837 static int alc_auto_add_mic_boost(struct hda_codec *codec)
9839 struct alc_spec *spec = codec->spec;
9843 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
9844 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9845 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9847 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9851 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
9852 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9853 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9855 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9862 /* almost identical with ALC880 parser... */
9863 static int alc882_parse_auto_config(struct hda_codec *codec)
9865 struct alc_spec *spec = codec->spec;
9866 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
9869 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
9873 if (!spec->autocfg.line_outs)
9874 return 0; /* can't find valid BIOS pin config */
9876 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
9879 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
9882 err = alc880_auto_create_extra_out(spec,
9883 spec->autocfg.speaker_pins[0],
9887 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
9891 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
9895 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
9897 /* check multiple SPDIF-out (for recent codecs) */
9898 for (i = 0; i < spec->autocfg.dig_outs; i++) {
9900 err = snd_hda_get_connections(codec,
9901 spec->autocfg.dig_out_pins[i],
9906 spec->multiout.dig_out_nid = dig_nid;
9908 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
9909 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
9911 spec->slave_dig_outs[i - 1] = dig_nid;
9914 if (spec->autocfg.dig_in_pin)
9915 spec->dig_in_nid = ALC880_DIGIN_NID;
9917 if (spec->kctls.list)
9918 add_mixer(spec, spec->kctls.list);
9920 add_verb(spec, alc883_auto_init_verbs);
9921 /* if ADC 0x07 is available, initialize it, too */
9922 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
9923 add_verb(spec, alc882_adc1_init_verbs);
9925 spec->num_mux_defs = 1;
9926 spec->input_mux = &spec->private_imux[0];
9928 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
9930 err = alc_auto_add_mic_boost(codec);
9934 return 1; /* config found */
9937 /* additional initialization for auto-configuration model */
9938 static void alc882_auto_init(struct hda_codec *codec)
9940 struct alc_spec *spec = codec->spec;
9941 alc882_auto_init_multi_out(codec);
9942 alc882_auto_init_hp_out(codec);
9943 alc882_auto_init_analog_input(codec);
9944 alc882_auto_init_input_src(codec);
9945 if (spec->unsol_event)
9946 alc_inithook(codec);
9949 static int patch_alc882(struct hda_codec *codec)
9951 struct alc_spec *spec;
9952 int err, board_config;
9954 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9960 switch (codec->vendor_id) {
9965 /* ALC883 and variants */
9966 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
9970 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
9974 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
9975 board_config = snd_hda_check_board_codec_sid_config(codec,
9976 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
9978 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
9979 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
9981 board_config = ALC882_AUTO;
9984 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups);
9986 if (board_config == ALC882_AUTO) {
9987 /* automatic parse from the BIOS config */
9988 err = alc882_parse_auto_config(codec);
9994 "hda_codec: Cannot set up configuration "
9995 "from BIOS. Using base mode...\n");
9996 board_config = ALC882_3ST_DIG;
10000 err = snd_hda_attach_beep_device(codec, 0x1);
10006 if (board_config != ALC882_AUTO)
10007 setup_preset(codec, &alc882_presets[board_config]);
10009 spec->stream_analog_playback = &alc882_pcm_analog_playback;
10010 spec->stream_analog_capture = &alc882_pcm_analog_capture;
10011 /* FIXME: setup DAC5 */
10012 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
10013 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
10015 spec->stream_digital_playback = &alc882_pcm_digital_playback;
10016 spec->stream_digital_capture = &alc882_pcm_digital_capture;
10018 if (codec->vendor_id == 0x10ec0888)
10019 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
10021 if (!spec->adc_nids && spec->input_mux) {
10023 spec->num_adc_nids = 0;
10024 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
10026 hda_nid_t nid = alc882_adc_nids[i];
10027 unsigned int wcap = get_wcaps(codec, nid);
10029 wcap = get_wcaps_type(wcap);
10030 if (wcap != AC_WID_AUD_IN)
10032 spec->private_adc_nids[spec->num_adc_nids] = nid;
10033 err = snd_hda_get_connections(codec, nid, &cap, 1);
10036 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
10037 spec->num_adc_nids++;
10039 spec->adc_nids = spec->private_adc_nids;
10040 spec->capsrc_nids = spec->private_capsrc_nids;
10043 set_capture_mixer(codec);
10044 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10046 spec->vmaster_nid = 0x0c;
10048 codec->patch_ops = alc_patch_ops;
10049 if (board_config == ALC882_AUTO)
10050 spec->init_hook = alc882_auto_init;
10051 #ifdef CONFIG_SND_HDA_POWER_SAVE
10052 if (!spec->loopback.amplist)
10053 spec->loopback.amplist = alc882_loopbacks;
10055 codec->proc_widget_hook = print_realtek_coef;
10065 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
10066 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
10068 #define alc262_dac_nids alc260_dac_nids
10069 #define alc262_adc_nids alc882_adc_nids
10070 #define alc262_adc_nids_alt alc882_adc_nids_alt
10071 #define alc262_capsrc_nids alc882_capsrc_nids
10072 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
10074 #define alc262_modes alc260_modes
10075 #define alc262_capture_source alc882_capture_source
10077 static hda_nid_t alc262_dmic_adc_nids[1] = {
10082 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
10084 static struct snd_kcontrol_new alc262_base_mixer[] = {
10085 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10086 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10087 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10088 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10089 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10090 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10091 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10092 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10093 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10094 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10095 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10096 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10097 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
10098 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10099 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
10100 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
10104 /* update HP, line and mono-out pins according to the master switch */
10105 static void alc262_hp_master_update(struct hda_codec *codec)
10107 struct alc_spec *spec = codec->spec;
10108 int val = spec->master_sw;
10110 /* HP & line-out */
10111 snd_hda_codec_write_cache(codec, 0x1b, 0,
10112 AC_VERB_SET_PIN_WIDGET_CONTROL,
10114 snd_hda_codec_write_cache(codec, 0x15, 0,
10115 AC_VERB_SET_PIN_WIDGET_CONTROL,
10117 /* mono (speaker) depending on the HP jack sense */
10118 val = val && !spec->jack_present;
10119 snd_hda_codec_write_cache(codec, 0x16, 0,
10120 AC_VERB_SET_PIN_WIDGET_CONTROL,
10121 val ? PIN_OUT : 0);
10124 static void alc262_hp_bpc_automute(struct hda_codec *codec)
10126 struct alc_spec *spec = codec->spec;
10128 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
10129 alc262_hp_master_update(codec);
10132 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
10134 if ((res >> 26) != ALC880_HP_EVENT)
10136 alc262_hp_bpc_automute(codec);
10139 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
10141 struct alc_spec *spec = codec->spec;
10143 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
10144 alc262_hp_master_update(codec);
10147 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
10150 if ((res >> 26) != ALC880_HP_EVENT)
10152 alc262_hp_wildwest_automute(codec);
10155 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
10157 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
10158 struct snd_ctl_elem_value *ucontrol)
10160 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10161 struct alc_spec *spec = codec->spec;
10162 int val = !!*ucontrol->value.integer.value;
10164 if (val == spec->master_sw)
10166 spec->master_sw = val;
10167 alc262_hp_master_update(codec);
10171 #define ALC262_HP_MASTER_SWITCH \
10173 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10174 .name = "Master Playback Switch", \
10175 .info = snd_ctl_boolean_mono_info, \
10176 .get = alc262_hp_master_sw_get, \
10177 .put = alc262_hp_master_sw_put, \
10180 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
10181 ALC262_HP_MASTER_SWITCH,
10182 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10183 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10184 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10185 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10187 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10189 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10190 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10191 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10192 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10193 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10194 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10195 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10196 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10197 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10198 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10199 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
10200 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
10204 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
10205 ALC262_HP_MASTER_SWITCH,
10206 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10207 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10208 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10209 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10210 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10212 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10214 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
10215 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
10216 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
10217 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10218 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10219 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10220 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10224 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
10225 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10226 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10227 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
10231 /* mute/unmute internal speaker according to the hp jack and mute state */
10232 static void alc262_hp_t5735_setup(struct hda_codec *codec)
10234 struct alc_spec *spec = codec->spec;
10236 spec->autocfg.hp_pins[0] = 0x15;
10237 spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */
10240 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
10241 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10242 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10243 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10244 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10245 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10246 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10247 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10251 static struct hda_verb alc262_hp_t5735_verbs[] = {
10252 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10253 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10255 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10259 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
10260 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10261 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10262 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
10263 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
10264 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10265 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10269 static struct hda_verb alc262_hp_rp5700_verbs[] = {
10270 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10271 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10272 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10273 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10274 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10275 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10276 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10277 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10278 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10279 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10283 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
10290 /* bind hp and internal speaker mute (with plug check) as master switch */
10291 static void alc262_hippo_master_update(struct hda_codec *codec)
10293 struct alc_spec *spec = codec->spec;
10294 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10295 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10296 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10300 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
10301 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
10302 HDA_AMP_MUTE, mute);
10303 /* mute internal speaker per jack sense */
10304 if (spec->jack_present)
10305 mute = HDA_AMP_MUTE;
10307 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
10308 HDA_AMP_MUTE, mute);
10309 if (speaker_nid && speaker_nid != line_nid)
10310 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
10311 HDA_AMP_MUTE, mute);
10314 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
10316 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
10317 struct snd_ctl_elem_value *ucontrol)
10319 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10320 struct alc_spec *spec = codec->spec;
10321 int val = !!*ucontrol->value.integer.value;
10323 if (val == spec->master_sw)
10325 spec->master_sw = val;
10326 alc262_hippo_master_update(codec);
10330 #define ALC262_HIPPO_MASTER_SWITCH \
10332 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10333 .name = "Master Playback Switch", \
10334 .info = snd_ctl_boolean_mono_info, \
10335 .get = alc262_hippo_master_sw_get, \
10336 .put = alc262_hippo_master_sw_put, \
10339 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
10340 ALC262_HIPPO_MASTER_SWITCH,
10341 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10342 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10343 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10344 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10345 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10346 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10347 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10348 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10349 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10350 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10351 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10352 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10356 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
10357 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10358 ALC262_HIPPO_MASTER_SWITCH,
10359 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10360 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10361 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10362 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10363 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10364 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10365 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10366 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10367 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10368 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10372 /* mute/unmute internal speaker according to the hp jack and mute state */
10373 static void alc262_hippo_automute(struct hda_codec *codec)
10375 struct alc_spec *spec = codec->spec;
10376 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10378 spec->jack_present = snd_hda_jack_detect(codec, hp_nid);
10379 alc262_hippo_master_update(codec);
10382 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
10384 if ((res >> 26) != ALC880_HP_EVENT)
10386 alc262_hippo_automute(codec);
10389 static void alc262_hippo_setup(struct hda_codec *codec)
10391 struct alc_spec *spec = codec->spec;
10393 spec->autocfg.hp_pins[0] = 0x15;
10394 spec->autocfg.speaker_pins[0] = 0x14;
10397 static void alc262_hippo1_setup(struct hda_codec *codec)
10399 struct alc_spec *spec = codec->spec;
10401 spec->autocfg.hp_pins[0] = 0x1b;
10402 spec->autocfg.speaker_pins[0] = 0x14;
10406 static struct snd_kcontrol_new alc262_sony_mixer[] = {
10407 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10408 ALC262_HIPPO_MASTER_SWITCH,
10409 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10410 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10411 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10412 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10416 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
10417 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10418 ALC262_HIPPO_MASTER_SWITCH,
10419 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10420 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10421 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10422 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10423 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10427 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
10428 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10429 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10430 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
10431 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
10432 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10433 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10434 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10435 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10436 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10437 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10438 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10439 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10443 static struct hda_verb alc262_tyan_verbs[] = {
10444 /* Headphone automute */
10445 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10446 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10447 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10449 /* P11 AUX_IN, white 4-pin connector */
10450 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10451 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
10452 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
10453 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
10458 /* unsolicited event for HP jack sensing */
10459 static void alc262_tyan_setup(struct hda_codec *codec)
10461 struct alc_spec *spec = codec->spec;
10463 spec->autocfg.hp_pins[0] = 0x1b;
10464 spec->autocfg.speaker_pins[0] = 0x15;
10468 #define alc262_capture_mixer alc882_capture_mixer
10469 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
10472 * generic initialization of ADC, input mixers and output mixers
10474 static struct hda_verb alc262_init_verbs[] = {
10476 * Unmute ADC0-2 and set the default input to mic-in
10478 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10479 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10480 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10481 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10482 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10483 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10485 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10487 * Note: PASD motherboards uses the Line In 2 as the input for
10488 * front panel mic (mic 2)
10490 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10491 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10492 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10493 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10494 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10495 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10498 * Set up output mixers (0x0c - 0x0e)
10500 /* set vol=0 to output mixers */
10501 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10502 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10503 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10504 /* set up input amps for analog loopback */
10505 /* Amp Indices: DAC = 0, mixer = 1 */
10506 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10507 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10508 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10509 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10510 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10511 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10513 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10514 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10515 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10516 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10517 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10518 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10520 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10521 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10522 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10523 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10524 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10526 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10527 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10529 /* FIXME: use matrix-type input source selection */
10530 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10531 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10532 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10533 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10534 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10535 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10537 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10538 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10539 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10540 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10542 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10543 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10544 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10545 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10550 static struct hda_verb alc262_eapd_verbs[] = {
10551 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10552 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10556 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
10557 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10558 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10559 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10561 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10562 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10566 static struct hda_verb alc262_sony_unsol_verbs[] = {
10567 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10568 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10569 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
10571 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10572 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10576 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
10577 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10578 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10579 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10580 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10581 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10585 static struct hda_verb alc262_toshiba_s06_verbs[] = {
10586 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10587 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10588 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10589 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10590 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
10591 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10592 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10593 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10597 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
10599 struct alc_spec *spec = codec->spec;
10601 spec->autocfg.hp_pins[0] = 0x15;
10602 spec->autocfg.speaker_pins[0] = 0x14;
10603 spec->ext_mic.pin = 0x18;
10604 spec->ext_mic.mux_idx = 0;
10605 spec->int_mic.pin = 0x12;
10606 spec->int_mic.mux_idx = 9;
10607 spec->auto_mic = 1;
10613 * 0x16 = internal speaker
10614 * 0x18 = external mic
10617 static struct snd_kcontrol_new alc262_nec_mixer[] = {
10618 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
10619 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
10621 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10622 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10623 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10625 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10626 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10630 static struct hda_verb alc262_nec_verbs[] = {
10631 /* Unmute Speaker */
10632 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10635 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10636 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10638 /* External mic to headphone */
10639 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10640 /* External mic to speaker */
10641 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10647 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
10648 * 0x1b = port replicator headphone out
10651 #define ALC_HP_EVENT 0x37
10653 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
10654 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10655 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10656 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10657 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10661 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
10662 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10663 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10667 static struct hda_input_mux alc262_fujitsu_capture_source = {
10671 { "Int Mic", 0x1 },
10676 static struct hda_input_mux alc262_HP_capture_source = {
10680 { "Front Mic", 0x1 },
10687 static struct hda_input_mux alc262_HP_D7000_capture_source = {
10691 { "Front Mic", 0x2 },
10697 /* mute/unmute internal speaker according to the hp jacks and mute state */
10698 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
10700 struct alc_spec *spec = codec->spec;
10703 if (force || !spec->sense_updated) {
10704 spec->jack_present = snd_hda_jack_detect(codec, 0x14) ||
10705 snd_hda_jack_detect(codec, 0x1b);
10706 spec->sense_updated = 1;
10708 /* unmute internal speaker only if both HPs are unplugged and
10709 * master switch is on
10711 if (spec->jack_present)
10712 mute = HDA_AMP_MUTE;
10714 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10715 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10716 HDA_AMP_MUTE, mute);
10719 /* unsolicited event for HP jack sensing */
10720 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
10723 if ((res >> 26) != ALC_HP_EVENT)
10725 alc262_fujitsu_automute(codec, 1);
10728 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
10730 alc262_fujitsu_automute(codec, 1);
10733 /* bind volumes of both NID 0x0c and 0x0d */
10734 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
10735 .ops = &snd_hda_bind_vol,
10737 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
10738 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
10743 /* mute/unmute internal speaker according to the hp jack and mute state */
10744 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
10746 struct alc_spec *spec = codec->spec;
10749 if (force || !spec->sense_updated) {
10750 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
10751 spec->sense_updated = 1;
10753 if (spec->jack_present) {
10754 /* mute internal speaker */
10755 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10756 HDA_AMP_MUTE, HDA_AMP_MUTE);
10757 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10758 HDA_AMP_MUTE, HDA_AMP_MUTE);
10760 /* unmute internal speaker if necessary */
10761 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10762 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10763 HDA_AMP_MUTE, mute);
10764 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10765 HDA_AMP_MUTE, mute);
10769 /* unsolicited event for HP jack sensing */
10770 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
10773 if ((res >> 26) != ALC_HP_EVENT)
10775 alc262_lenovo_3000_automute(codec, 1);
10778 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
10779 int dir, int idx, long *valp)
10783 for (i = 0; i < 2; i++, valp++)
10784 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
10786 *valp ? 0 : HDA_AMP_MUTE);
10790 /* bind hp and internal speaker mute (with plug check) */
10791 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
10792 struct snd_ctl_elem_value *ucontrol)
10794 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10795 long *valp = ucontrol->value.integer.value;
10798 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
10799 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
10801 alc262_fujitsu_automute(codec, 0);
10805 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
10806 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10808 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10809 .name = "Master Playback Switch",
10810 .info = snd_hda_mixer_amp_switch_info,
10811 .get = snd_hda_mixer_amp_switch_get,
10812 .put = alc262_fujitsu_master_sw_put,
10813 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10815 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10816 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10817 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10818 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10819 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10820 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10821 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10822 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10826 /* bind hp and internal speaker mute (with plug check) */
10827 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
10828 struct snd_ctl_elem_value *ucontrol)
10830 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10831 long *valp = ucontrol->value.integer.value;
10834 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
10836 alc262_lenovo_3000_automute(codec, 0);
10840 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
10841 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10843 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10844 .name = "Master Playback Switch",
10845 .info = snd_hda_mixer_amp_switch_info,
10846 .get = snd_hda_mixer_amp_switch_get,
10847 .put = alc262_lenovo_3000_master_sw_put,
10848 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
10850 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10851 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10852 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10853 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10854 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10855 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10856 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10857 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10861 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
10862 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10863 ALC262_HIPPO_MASTER_SWITCH,
10864 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10865 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10866 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10867 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10868 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10869 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10873 /* additional init verbs for Benq laptops */
10874 static struct hda_verb alc262_EAPD_verbs[] = {
10875 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10876 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
10880 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
10881 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10882 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10884 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10885 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
10889 /* Samsung Q1 Ultra Vista model setup */
10890 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
10891 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10892 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10893 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10894 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10895 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
10896 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
10900 static struct hda_verb alc262_ultra_verbs[] = {
10902 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10903 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10904 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10906 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10907 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10908 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10909 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10911 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10912 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10913 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10914 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10915 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10917 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10918 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10919 /* ADC, choose mic */
10920 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10921 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10922 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10923 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10924 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10925 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10926 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10927 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10928 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10929 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
10933 /* mute/unmute internal speaker according to the hp jack and mute state */
10934 static void alc262_ultra_automute(struct hda_codec *codec)
10936 struct alc_spec *spec = codec->spec;
10940 /* auto-mute only when HP is used as HP */
10941 if (!spec->cur_mux[0]) {
10942 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
10943 if (spec->jack_present)
10944 mute = HDA_AMP_MUTE;
10946 /* mute/unmute internal speaker */
10947 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10948 HDA_AMP_MUTE, mute);
10949 /* mute/unmute HP */
10950 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10951 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
10954 /* unsolicited event for HP jack sensing */
10955 static void alc262_ultra_unsol_event(struct hda_codec *codec,
10958 if ((res >> 26) != ALC880_HP_EVENT)
10960 alc262_ultra_automute(codec);
10963 static struct hda_input_mux alc262_ultra_capture_source = {
10967 { "Headphone", 0x7 },
10971 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
10972 struct snd_ctl_elem_value *ucontrol)
10974 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10975 struct alc_spec *spec = codec->spec;
10978 ret = alc_mux_enum_put(kcontrol, ucontrol);
10981 /* reprogram the HP pin as mic or HP according to the input source */
10982 snd_hda_codec_write_cache(codec, 0x15, 0,
10983 AC_VERB_SET_PIN_WIDGET_CONTROL,
10984 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
10985 alc262_ultra_automute(codec); /* mute/unmute HP */
10989 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
10990 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10991 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10993 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10994 .name = "Capture Source",
10995 .info = alc_mux_enum_info,
10996 .get = alc_mux_enum_get,
10997 .put = alc262_ultra_mux_enum_put,
11002 /* We use two mixers depending on the output pin; 0x16 is a mono output
11003 * and thus it's bound with a different mixer.
11004 * This function returns which mixer amp should be used.
11006 static int alc262_check_volbit(hda_nid_t nid)
11010 else if (nid == 0x16)
11016 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
11017 const char *pfx, int *vbits)
11022 vbit = alc262_check_volbit(nid);
11025 if (*vbits & vbit) /* a volume control for this mixer already there */
11029 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
11031 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
11032 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, val);
11035 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
11043 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
11045 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
11046 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val);
11049 /* add playback controls from the parsed DAC table */
11050 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
11051 const struct auto_pin_cfg *cfg)
11057 spec->multiout.num_dacs = 1; /* only use one dac */
11058 spec->multiout.dac_nids = spec->private_dac_nids;
11059 spec->multiout.dac_nids[0] = 2;
11061 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
11063 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11067 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx);
11070 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker");
11073 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone");
11077 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
11078 alc262_check_volbit(cfg->speaker_pins[0]) |
11079 alc262_check_volbit(cfg->hp_pins[0]);
11080 if (vbits == 1 || vbits == 2)
11081 pfx = "Master"; /* only one mixer is used */
11082 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11087 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits);
11090 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker",
11094 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone",
11101 #define alc262_auto_create_input_ctls \
11102 alc880_auto_create_input_ctls
11105 * generic initialization of ADC, input mixers and output mixers
11107 static struct hda_verb alc262_volume_init_verbs[] = {
11109 * Unmute ADC0-2 and set the default input to mic-in
11111 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11112 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11113 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11114 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11115 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11116 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11118 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11120 * Note: PASD motherboards uses the Line In 2 as the input for
11121 * front panel mic (mic 2)
11123 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11124 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11125 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11126 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11127 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11128 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11131 * Set up output mixers (0x0c - 0x0f)
11133 /* set vol=0 to output mixers */
11134 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11135 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11136 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11138 /* set up input amps for analog loopback */
11139 /* Amp Indices: DAC = 0, mixer = 1 */
11140 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11141 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11142 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11143 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11144 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11145 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11147 /* FIXME: use matrix-type input source selection */
11148 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11149 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11150 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11151 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11152 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11153 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11155 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11156 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11157 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11158 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11160 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11161 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11162 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11163 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11168 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
11170 * Unmute ADC0-2 and set the default input to mic-in
11172 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11173 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11174 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11175 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11176 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11177 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11179 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11181 * Note: PASD motherboards uses the Line In 2 as the input for
11182 * front panel mic (mic 2)
11184 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11185 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11186 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11187 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11188 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11189 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11190 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11191 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11194 * Set up output mixers (0x0c - 0x0e)
11196 /* set vol=0 to output mixers */
11197 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11198 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11199 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11201 /* set up input amps for analog loopback */
11202 /* Amp Indices: DAC = 0, mixer = 1 */
11203 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11204 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11205 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11206 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11207 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11208 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11210 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11211 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11212 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11214 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11215 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11217 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11218 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11220 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11221 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11222 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11223 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11224 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11226 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11227 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11228 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11229 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11230 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11231 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11234 /* FIXME: use matrix-type input source selection */
11235 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
11236 /* Input mixer1: only unmute Mic */
11237 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11238 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11239 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11240 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11241 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11242 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11243 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11244 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11245 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11247 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11248 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11249 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11250 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11251 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11252 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11253 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11254 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11255 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11257 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11258 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11259 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11260 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11261 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11262 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11263 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11264 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11265 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11267 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11272 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
11274 * Unmute ADC0-2 and set the default input to mic-in
11276 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11277 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11278 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11279 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11280 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11281 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11283 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11285 * Note: PASD motherboards uses the Line In 2 as the input for front
11286 * panel mic (mic 2)
11288 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11289 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11290 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11291 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11292 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11293 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11294 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11295 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11296 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11298 * Set up output mixers (0x0c - 0x0e)
11300 /* set vol=0 to output mixers */
11301 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11302 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11303 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11305 /* set up input amps for analog loopback */
11306 /* Amp Indices: DAC = 0, mixer = 1 */
11307 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11308 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11309 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11310 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11311 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11312 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11315 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
11316 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
11317 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
11318 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
11319 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11320 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
11321 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
11323 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11324 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11326 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11327 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11329 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
11330 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11331 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11332 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
11333 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11334 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11336 /* FIXME: use matrix-type input source selection */
11337 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11338 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11339 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
11340 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
11341 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
11342 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
11343 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
11344 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11345 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
11347 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11348 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11349 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11350 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11351 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11352 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11353 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11355 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11356 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11357 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11358 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11359 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11360 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11361 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11363 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11368 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
11370 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
11371 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11372 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
11374 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
11375 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11376 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11377 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11379 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
11380 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11381 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11386 #ifdef CONFIG_SND_HDA_POWER_SAVE
11387 #define alc262_loopbacks alc880_loopbacks
11390 /* pcm configuration: identical with ALC880 */
11391 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
11392 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
11393 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
11394 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
11397 * BIOS auto configuration
11399 static int alc262_parse_auto_config(struct hda_codec *codec)
11401 struct alc_spec *spec = codec->spec;
11403 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
11405 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11409 if (!spec->autocfg.line_outs) {
11410 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11411 spec->multiout.max_channels = 2;
11412 spec->no_analog = 1;
11415 return 0; /* can't find valid BIOS pin config */
11417 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
11420 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
11424 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11427 if (spec->autocfg.dig_outs) {
11428 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
11429 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11431 if (spec->autocfg.dig_in_pin)
11432 spec->dig_in_nid = ALC262_DIGIN_NID;
11434 if (spec->kctls.list)
11435 add_mixer(spec, spec->kctls.list);
11437 add_verb(spec, alc262_volume_init_verbs);
11438 spec->num_mux_defs = 1;
11439 spec->input_mux = &spec->private_imux[0];
11441 err = alc_auto_add_mic_boost(codec);
11445 alc_ssid_check(codec, 0x15, 0x14, 0x1b);
11450 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
11451 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
11452 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
11453 #define alc262_auto_init_input_src alc882_auto_init_input_src
11456 /* init callback for auto-configuration model -- overriding the default init */
11457 static void alc262_auto_init(struct hda_codec *codec)
11459 struct alc_spec *spec = codec->spec;
11460 alc262_auto_init_multi_out(codec);
11461 alc262_auto_init_hp_out(codec);
11462 alc262_auto_init_analog_input(codec);
11463 alc262_auto_init_input_src(codec);
11464 if (spec->unsol_event)
11465 alc_inithook(codec);
11469 * configuration and preset
11471 static const char *alc262_models[ALC262_MODEL_LAST] = {
11472 [ALC262_BASIC] = "basic",
11473 [ALC262_HIPPO] = "hippo",
11474 [ALC262_HIPPO_1] = "hippo_1",
11475 [ALC262_FUJITSU] = "fujitsu",
11476 [ALC262_HP_BPC] = "hp-bpc",
11477 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
11478 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
11479 [ALC262_HP_RP5700] = "hp-rp5700",
11480 [ALC262_BENQ_ED8] = "benq",
11481 [ALC262_BENQ_T31] = "benq-t31",
11482 [ALC262_SONY_ASSAMD] = "sony-assamd",
11483 [ALC262_TOSHIBA_S06] = "toshiba-s06",
11484 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
11485 [ALC262_ULTRA] = "ultra",
11486 [ALC262_LENOVO_3000] = "lenovo-3000",
11487 [ALC262_NEC] = "nec",
11488 [ALC262_TYAN] = "tyan",
11489 [ALC262_AUTO] = "auto",
11492 static struct snd_pci_quirk alc262_cfg_tbl[] = {
11493 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
11494 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
11495 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
11497 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
11499 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
11501 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
11502 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
11503 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
11504 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
11505 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
11506 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
11507 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
11508 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
11509 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
11510 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
11511 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
11512 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
11513 ALC262_HP_TC_T5735),
11514 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
11515 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11516 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
11517 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11518 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
11519 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
11520 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
11521 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
11522 #if 0 /* disable the quirk since model=auto works better in recent versions */
11523 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
11524 ALC262_SONY_ASSAMD),
11526 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
11527 ALC262_TOSHIBA_RX1),
11528 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
11529 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
11530 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
11531 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
11532 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
11534 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
11535 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
11536 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
11537 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
11538 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
11542 static struct alc_config_preset alc262_presets[] = {
11544 .mixers = { alc262_base_mixer },
11545 .init_verbs = { alc262_init_verbs },
11546 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11547 .dac_nids = alc262_dac_nids,
11549 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11550 .channel_mode = alc262_modes,
11551 .input_mux = &alc262_capture_source,
11554 .mixers = { alc262_hippo_mixer },
11555 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
11556 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11557 .dac_nids = alc262_dac_nids,
11559 .dig_out_nid = ALC262_DIGOUT_NID,
11560 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11561 .channel_mode = alc262_modes,
11562 .input_mux = &alc262_capture_source,
11563 .unsol_event = alc262_hippo_unsol_event,
11564 .setup = alc262_hippo_setup,
11565 .init_hook = alc262_hippo_automute,
11567 [ALC262_HIPPO_1] = {
11568 .mixers = { alc262_hippo1_mixer },
11569 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
11570 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11571 .dac_nids = alc262_dac_nids,
11573 .dig_out_nid = ALC262_DIGOUT_NID,
11574 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11575 .channel_mode = alc262_modes,
11576 .input_mux = &alc262_capture_source,
11577 .unsol_event = alc262_hippo_unsol_event,
11578 .setup = alc262_hippo1_setup,
11579 .init_hook = alc262_hippo_automute,
11581 [ALC262_FUJITSU] = {
11582 .mixers = { alc262_fujitsu_mixer },
11583 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11584 alc262_fujitsu_unsol_verbs },
11585 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11586 .dac_nids = alc262_dac_nids,
11588 .dig_out_nid = ALC262_DIGOUT_NID,
11589 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11590 .channel_mode = alc262_modes,
11591 .input_mux = &alc262_fujitsu_capture_source,
11592 .unsol_event = alc262_fujitsu_unsol_event,
11593 .init_hook = alc262_fujitsu_init_hook,
11595 [ALC262_HP_BPC] = {
11596 .mixers = { alc262_HP_BPC_mixer },
11597 .init_verbs = { alc262_HP_BPC_init_verbs },
11598 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11599 .dac_nids = alc262_dac_nids,
11601 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11602 .channel_mode = alc262_modes,
11603 .input_mux = &alc262_HP_capture_source,
11604 .unsol_event = alc262_hp_bpc_unsol_event,
11605 .init_hook = alc262_hp_bpc_automute,
11607 [ALC262_HP_BPC_D7000_WF] = {
11608 .mixers = { alc262_HP_BPC_WildWest_mixer },
11609 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11610 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11611 .dac_nids = alc262_dac_nids,
11613 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11614 .channel_mode = alc262_modes,
11615 .input_mux = &alc262_HP_D7000_capture_source,
11616 .unsol_event = alc262_hp_wildwest_unsol_event,
11617 .init_hook = alc262_hp_wildwest_automute,
11619 [ALC262_HP_BPC_D7000_WL] = {
11620 .mixers = { alc262_HP_BPC_WildWest_mixer,
11621 alc262_HP_BPC_WildWest_option_mixer },
11622 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11623 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11624 .dac_nids = alc262_dac_nids,
11626 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11627 .channel_mode = alc262_modes,
11628 .input_mux = &alc262_HP_D7000_capture_source,
11629 .unsol_event = alc262_hp_wildwest_unsol_event,
11630 .init_hook = alc262_hp_wildwest_automute,
11632 [ALC262_HP_TC_T5735] = {
11633 .mixers = { alc262_hp_t5735_mixer },
11634 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
11635 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11636 .dac_nids = alc262_dac_nids,
11638 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11639 .channel_mode = alc262_modes,
11640 .input_mux = &alc262_capture_source,
11641 .unsol_event = alc_automute_amp_unsol_event,
11642 .setup = alc262_hp_t5735_setup,
11643 .init_hook = alc_automute_amp,
11645 [ALC262_HP_RP5700] = {
11646 .mixers = { alc262_hp_rp5700_mixer },
11647 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
11648 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11649 .dac_nids = alc262_dac_nids,
11650 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11651 .channel_mode = alc262_modes,
11652 .input_mux = &alc262_hp_rp5700_capture_source,
11654 [ALC262_BENQ_ED8] = {
11655 .mixers = { alc262_base_mixer },
11656 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
11657 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11658 .dac_nids = alc262_dac_nids,
11660 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11661 .channel_mode = alc262_modes,
11662 .input_mux = &alc262_capture_source,
11664 [ALC262_SONY_ASSAMD] = {
11665 .mixers = { alc262_sony_mixer },
11666 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
11667 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11668 .dac_nids = alc262_dac_nids,
11670 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11671 .channel_mode = alc262_modes,
11672 .input_mux = &alc262_capture_source,
11673 .unsol_event = alc262_hippo_unsol_event,
11674 .setup = alc262_hippo_setup,
11675 .init_hook = alc262_hippo_automute,
11677 [ALC262_BENQ_T31] = {
11678 .mixers = { alc262_benq_t31_mixer },
11679 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
11680 alc_hp15_unsol_verbs },
11681 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11682 .dac_nids = alc262_dac_nids,
11684 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11685 .channel_mode = alc262_modes,
11686 .input_mux = &alc262_capture_source,
11687 .unsol_event = alc262_hippo_unsol_event,
11688 .setup = alc262_hippo_setup,
11689 .init_hook = alc262_hippo_automute,
11692 .mixers = { alc262_ultra_mixer },
11693 .cap_mixer = alc262_ultra_capture_mixer,
11694 .init_verbs = { alc262_ultra_verbs },
11695 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11696 .dac_nids = alc262_dac_nids,
11697 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11698 .channel_mode = alc262_modes,
11699 .input_mux = &alc262_ultra_capture_source,
11700 .adc_nids = alc262_adc_nids, /* ADC0 */
11701 .capsrc_nids = alc262_capsrc_nids,
11702 .num_adc_nids = 1, /* single ADC */
11703 .unsol_event = alc262_ultra_unsol_event,
11704 .init_hook = alc262_ultra_automute,
11706 [ALC262_LENOVO_3000] = {
11707 .mixers = { alc262_lenovo_3000_mixer },
11708 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11709 alc262_lenovo_3000_unsol_verbs },
11710 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11711 .dac_nids = alc262_dac_nids,
11713 .dig_out_nid = ALC262_DIGOUT_NID,
11714 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11715 .channel_mode = alc262_modes,
11716 .input_mux = &alc262_fujitsu_capture_source,
11717 .unsol_event = alc262_lenovo_3000_unsol_event,
11720 .mixers = { alc262_nec_mixer },
11721 .init_verbs = { alc262_nec_verbs },
11722 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11723 .dac_nids = alc262_dac_nids,
11725 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11726 .channel_mode = alc262_modes,
11727 .input_mux = &alc262_capture_source,
11729 [ALC262_TOSHIBA_S06] = {
11730 .mixers = { alc262_toshiba_s06_mixer },
11731 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
11732 alc262_eapd_verbs },
11733 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11734 .capsrc_nids = alc262_dmic_capsrc_nids,
11735 .dac_nids = alc262_dac_nids,
11736 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
11737 .num_adc_nids = 1, /* single ADC */
11738 .dig_out_nid = ALC262_DIGOUT_NID,
11739 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11740 .channel_mode = alc262_modes,
11741 .unsol_event = alc_sku_unsol_event,
11742 .setup = alc262_toshiba_s06_setup,
11743 .init_hook = alc_inithook,
11745 [ALC262_TOSHIBA_RX1] = {
11746 .mixers = { alc262_toshiba_rx1_mixer },
11747 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
11748 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11749 .dac_nids = alc262_dac_nids,
11751 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11752 .channel_mode = alc262_modes,
11753 .input_mux = &alc262_capture_source,
11754 .unsol_event = alc262_hippo_unsol_event,
11755 .setup = alc262_hippo_setup,
11756 .init_hook = alc262_hippo_automute,
11759 .mixers = { alc262_tyan_mixer },
11760 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
11761 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11762 .dac_nids = alc262_dac_nids,
11764 .dig_out_nid = ALC262_DIGOUT_NID,
11765 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11766 .channel_mode = alc262_modes,
11767 .input_mux = &alc262_capture_source,
11768 .unsol_event = alc_automute_amp_unsol_event,
11769 .setup = alc262_tyan_setup,
11770 .init_hook = alc_automute_amp,
11774 static int patch_alc262(struct hda_codec *codec)
11776 struct alc_spec *spec;
11780 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11784 codec->spec = spec;
11786 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
11791 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11792 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
11793 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11794 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
11798 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11800 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
11804 if (board_config < 0) {
11805 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
11807 board_config = ALC262_AUTO;
11810 if (board_config == ALC262_AUTO) {
11811 /* automatic parse from the BIOS config */
11812 err = alc262_parse_auto_config(codec);
11818 "hda_codec: Cannot set up configuration "
11819 "from BIOS. Using base mode...\n");
11820 board_config = ALC262_BASIC;
11824 if (!spec->no_analog) {
11825 err = snd_hda_attach_beep_device(codec, 0x1);
11832 if (board_config != ALC262_AUTO)
11833 setup_preset(codec, &alc262_presets[board_config]);
11835 spec->stream_analog_playback = &alc262_pcm_analog_playback;
11836 spec->stream_analog_capture = &alc262_pcm_analog_capture;
11838 spec->stream_digital_playback = &alc262_pcm_digital_playback;
11839 spec->stream_digital_capture = &alc262_pcm_digital_capture;
11841 if (!spec->adc_nids && spec->input_mux) {
11843 /* check whether the digital-mic has to be supported */
11844 for (i = 0; i < spec->input_mux->num_items; i++) {
11845 if (spec->input_mux->items[i].index >= 9)
11848 if (i < spec->input_mux->num_items) {
11849 /* use only ADC0 */
11850 spec->adc_nids = alc262_dmic_adc_nids;
11851 spec->num_adc_nids = 1;
11852 spec->capsrc_nids = alc262_dmic_capsrc_nids;
11854 /* all analog inputs */
11855 /* check whether NID 0x07 is valid */
11856 unsigned int wcap = get_wcaps(codec, 0x07);
11859 wcap = get_wcaps_type(wcap);
11860 if (wcap != AC_WID_AUD_IN) {
11861 spec->adc_nids = alc262_adc_nids_alt;
11862 spec->num_adc_nids =
11863 ARRAY_SIZE(alc262_adc_nids_alt);
11864 spec->capsrc_nids = alc262_capsrc_nids_alt;
11866 spec->adc_nids = alc262_adc_nids;
11867 spec->num_adc_nids =
11868 ARRAY_SIZE(alc262_adc_nids);
11869 spec->capsrc_nids = alc262_capsrc_nids;
11873 if (!spec->cap_mixer && !spec->no_analog)
11874 set_capture_mixer(codec);
11875 if (!spec->no_analog)
11876 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11878 spec->vmaster_nid = 0x0c;
11880 codec->patch_ops = alc_patch_ops;
11881 if (board_config == ALC262_AUTO)
11882 spec->init_hook = alc262_auto_init;
11883 #ifdef CONFIG_SND_HDA_POWER_SAVE
11884 if (!spec->loopback.amplist)
11885 spec->loopback.amplist = alc262_loopbacks;
11887 codec->proc_widget_hook = print_realtek_coef;
11893 * ALC268 channel source setting (2 channel)
11895 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
11896 #define alc268_modes alc260_modes
11898 static hda_nid_t alc268_dac_nids[2] = {
11903 static hda_nid_t alc268_adc_nids[2] = {
11908 static hda_nid_t alc268_adc_nids_alt[1] = {
11913 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
11915 static struct snd_kcontrol_new alc268_base_mixer[] = {
11916 /* output mixer control */
11917 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11918 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11919 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11920 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11921 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11922 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11923 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11927 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
11928 /* output mixer control */
11929 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11930 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11931 ALC262_HIPPO_MASTER_SWITCH,
11932 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11933 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11934 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11938 /* bind Beep switches of both NID 0x0f and 0x10 */
11939 static struct hda_bind_ctls alc268_bind_beep_sw = {
11940 .ops = &snd_hda_bind_sw,
11942 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
11943 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
11948 static struct snd_kcontrol_new alc268_beep_mixer[] = {
11949 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
11950 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
11954 static struct hda_verb alc268_eapd_verbs[] = {
11955 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11956 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11960 /* Toshiba specific */
11961 static struct hda_verb alc268_toshiba_verbs[] = {
11962 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11966 /* Acer specific */
11967 /* bind volumes of both NID 0x02 and 0x03 */
11968 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
11969 .ops = &snd_hda_bind_vol,
11971 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
11972 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
11977 /* mute/unmute internal speaker according to the hp jack and mute state */
11978 static void alc268_acer_automute(struct hda_codec *codec, int force)
11980 struct alc_spec *spec = codec->spec;
11983 if (force || !spec->sense_updated) {
11984 spec->jack_present = snd_hda_jack_detect(codec, 0x14);
11985 spec->sense_updated = 1;
11987 if (spec->jack_present)
11988 mute = HDA_AMP_MUTE; /* mute internal speaker */
11989 else /* unmute internal speaker if necessary */
11990 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11991 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11992 HDA_AMP_MUTE, mute);
11996 /* bind hp and internal speaker mute (with plug check) */
11997 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
11998 struct snd_ctl_elem_value *ucontrol)
12000 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12001 long *valp = ucontrol->value.integer.value;
12004 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
12006 alc268_acer_automute(codec, 0);
12010 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
12011 /* output mixer control */
12012 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12014 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12015 .name = "Master Playback Switch",
12016 .info = snd_hda_mixer_amp_switch_info,
12017 .get = snd_hda_mixer_amp_switch_get,
12018 .put = alc268_acer_master_sw_put,
12019 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12021 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
12025 static struct snd_kcontrol_new alc268_acer_mixer[] = {
12026 /* output mixer control */
12027 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12029 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12030 .name = "Master Playback Switch",
12031 .info = snd_hda_mixer_amp_switch_info,
12032 .get = snd_hda_mixer_amp_switch_get,
12033 .put = alc268_acer_master_sw_put,
12034 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12036 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12037 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12038 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12042 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
12043 /* output mixer control */
12044 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12046 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12047 .name = "Master Playback Switch",
12048 .info = snd_hda_mixer_amp_switch_info,
12049 .get = snd_hda_mixer_amp_switch_get,
12050 .put = alc268_acer_master_sw_put,
12051 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12053 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12054 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12058 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
12059 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12060 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12061 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12062 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12063 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
12064 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
12068 static struct hda_verb alc268_acer_verbs[] = {
12069 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
12070 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12071 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12072 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12073 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12074 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12075 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12079 /* unsolicited event for HP jack sensing */
12080 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
12081 #define alc268_toshiba_setup alc262_hippo_setup
12082 #define alc268_toshiba_automute alc262_hippo_automute
12084 static void alc268_acer_unsol_event(struct hda_codec *codec,
12087 if ((res >> 26) != ALC880_HP_EVENT)
12089 alc268_acer_automute(codec, 1);
12092 static void alc268_acer_init_hook(struct hda_codec *codec)
12094 alc268_acer_automute(codec, 1);
12097 /* toggle speaker-output according to the hp-jack state */
12098 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
12100 unsigned int present;
12101 unsigned char bits;
12103 present = snd_hda_jack_detect(codec, 0x15);
12104 bits = present ? AMP_IN_MUTE(0) : 0;
12105 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
12106 AMP_IN_MUTE(0), bits);
12107 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
12108 AMP_IN_MUTE(0), bits);
12111 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
12114 switch (res >> 26) {
12115 case ALC880_HP_EVENT:
12116 alc268_aspire_one_speaker_automute(codec);
12118 case ALC880_MIC_EVENT:
12119 alc_mic_automute(codec);
12124 static void alc268_acer_lc_setup(struct hda_codec *codec)
12126 struct alc_spec *spec = codec->spec;
12127 spec->ext_mic.pin = 0x18;
12128 spec->ext_mic.mux_idx = 0;
12129 spec->int_mic.pin = 0x12;
12130 spec->int_mic.mux_idx = 6;
12131 spec->auto_mic = 1;
12134 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
12136 alc268_aspire_one_speaker_automute(codec);
12137 alc_mic_automute(codec);
12140 static struct snd_kcontrol_new alc268_dell_mixer[] = {
12141 /* output mixer control */
12142 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12143 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12144 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12145 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12146 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12147 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12151 static struct hda_verb alc268_dell_verbs[] = {
12152 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12153 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12154 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12155 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12159 /* mute/unmute internal speaker according to the hp jack and mute state */
12160 static void alc268_dell_setup(struct hda_codec *codec)
12162 struct alc_spec *spec = codec->spec;
12164 spec->autocfg.hp_pins[0] = 0x15;
12165 spec->autocfg.speaker_pins[0] = 0x14;
12166 spec->ext_mic.pin = 0x18;
12167 spec->ext_mic.mux_idx = 0;
12168 spec->int_mic.pin = 0x19;
12169 spec->int_mic.mux_idx = 1;
12170 spec->auto_mic = 1;
12173 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
12174 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12175 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12176 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12177 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12178 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12179 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
12180 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
12181 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
12185 static struct hda_verb alc267_quanta_il1_verbs[] = {
12186 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12187 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12191 static void alc267_quanta_il1_setup(struct hda_codec *codec)
12193 struct alc_spec *spec = codec->spec;
12194 spec->autocfg.hp_pins[0] = 0x15;
12195 spec->autocfg.speaker_pins[0] = 0x14;
12196 spec->ext_mic.pin = 0x18;
12197 spec->ext_mic.mux_idx = 0;
12198 spec->int_mic.pin = 0x19;
12199 spec->int_mic.mux_idx = 1;
12200 spec->auto_mic = 1;
12204 * generic initialization of ADC, input mixers and output mixers
12206 static struct hda_verb alc268_base_init_verbs[] = {
12207 /* Unmute DAC0-1 and set vol = 0 */
12208 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12209 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12212 * Set up output mixers (0x0c - 0x0e)
12214 /* set vol=0 to output mixers */
12215 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12216 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
12218 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12219 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12221 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12222 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
12223 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12224 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12225 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12226 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12227 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12228 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12230 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12231 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12232 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12233 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12234 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12236 /* set PCBEEP vol = 0, mute connections */
12237 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12238 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12239 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12241 /* Unmute Selector 23h,24h and set the default input to mic-in */
12243 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
12244 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12245 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
12246 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12252 * generic initialization of ADC, input mixers and output mixers
12254 static struct hda_verb alc268_volume_init_verbs[] = {
12255 /* set output DAC */
12256 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12257 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12259 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12260 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12261 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12262 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12263 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12265 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12266 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12267 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12269 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12270 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12272 /* set PCBEEP vol = 0, mute connections */
12273 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12274 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12275 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12280 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
12281 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12282 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12286 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
12287 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12288 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12293 static struct snd_kcontrol_new alc268_capture_mixer[] = {
12294 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12295 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12296 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
12297 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
12302 static struct hda_input_mux alc268_capture_source = {
12306 { "Front Mic", 0x1 },
12312 static struct hda_input_mux alc268_acer_capture_source = {
12316 { "Internal Mic", 0x1 },
12321 static struct hda_input_mux alc268_acer_dmic_capture_source = {
12325 { "Internal Mic", 0x6 },
12330 #ifdef CONFIG_SND_DEBUG
12331 static struct snd_kcontrol_new alc268_test_mixer[] = {
12332 /* Volume widgets */
12333 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12334 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12335 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12336 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
12337 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
12338 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
12339 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
12340 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
12341 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
12342 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
12343 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
12344 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
12345 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
12346 /* The below appears problematic on some hardwares */
12347 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
12348 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12349 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
12350 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
12351 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
12353 /* Modes for retasking pin widgets */
12354 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
12355 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
12356 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
12357 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
12359 /* Controls for GPIO pins, assuming they are configured as outputs */
12360 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
12361 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
12362 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
12363 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
12365 /* Switches to allow the digital SPDIF output pin to be enabled.
12366 * The ALC268 does not have an SPDIF input.
12368 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
12370 /* A switch allowing EAPD to be enabled. Some laptops seem to use
12371 * this output to turn on an external amplifier.
12373 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
12374 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
12380 /* create input playback/capture controls for the given pin */
12381 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12382 const char *ctlname, int idx)
12398 if (spec->multiout.dac_nids[0] != dac &&
12399 spec->multiout.dac_nids[1] != dac) {
12400 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
12401 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
12405 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
12409 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12410 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
12412 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12413 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
12419 /* add playback controls from the parsed DAC table */
12420 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
12421 const struct auto_pin_cfg *cfg)
12426 spec->multiout.dac_nids = spec->private_dac_nids;
12428 nid = cfg->line_out_pins[0];
12431 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
12435 err = alc268_new_analog_output(spec, nid, name, 0);
12440 nid = cfg->speaker_pins[0];
12442 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
12443 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
12447 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
12451 nid = cfg->hp_pins[0];
12453 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
12458 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
12460 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
12461 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
12468 /* create playback/capture controls for input pins */
12469 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
12470 const struct auto_pin_cfg *cfg)
12472 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
12475 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
12476 hda_nid_t nid, int pin_type)
12480 alc_set_pin_output(codec, nid, pin_type);
12481 if (nid == 0x14 || nid == 0x16)
12485 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
12488 static void alc268_auto_init_multi_out(struct hda_codec *codec)
12490 struct alc_spec *spec = codec->spec;
12491 hda_nid_t nid = spec->autocfg.line_out_pins[0];
12493 int pin_type = get_pin_type(spec->autocfg.line_out_type);
12494 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
12498 static void alc268_auto_init_hp_out(struct hda_codec *codec)
12500 struct alc_spec *spec = codec->spec;
12503 pin = spec->autocfg.hp_pins[0];
12505 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
12506 pin = spec->autocfg.speaker_pins[0];
12508 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
12511 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
12513 struct alc_spec *spec = codec->spec;
12514 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
12515 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
12516 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
12517 unsigned int dac_vol1, dac_vol2;
12519 if (line_nid == 0x1d || speaker_nid == 0x1d) {
12520 snd_hda_codec_write(codec, speaker_nid, 0,
12521 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
12522 /* mute mixer inputs from 0x1d */
12523 snd_hda_codec_write(codec, 0x0f, 0,
12524 AC_VERB_SET_AMP_GAIN_MUTE,
12526 snd_hda_codec_write(codec, 0x10, 0,
12527 AC_VERB_SET_AMP_GAIN_MUTE,
12530 /* unmute mixer inputs from 0x1d */
12531 snd_hda_codec_write(codec, 0x0f, 0,
12532 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12533 snd_hda_codec_write(codec, 0x10, 0,
12534 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12537 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
12538 if (line_nid == 0x14)
12539 dac_vol2 = AMP_OUT_ZERO;
12540 else if (line_nid == 0x15)
12541 dac_vol1 = AMP_OUT_ZERO;
12542 if (hp_nid == 0x14)
12543 dac_vol2 = AMP_OUT_ZERO;
12544 else if (hp_nid == 0x15)
12545 dac_vol1 = AMP_OUT_ZERO;
12546 if (line_nid != 0x16 || hp_nid != 0x16 ||
12547 spec->autocfg.line_out_pins[1] != 0x16 ||
12548 spec->autocfg.line_out_pins[2] != 0x16)
12549 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
12551 snd_hda_codec_write(codec, 0x02, 0,
12552 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
12553 snd_hda_codec_write(codec, 0x03, 0,
12554 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
12557 /* pcm configuration: identical with ALC880 */
12558 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
12559 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
12560 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
12561 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
12564 * BIOS auto configuration
12566 static int alc268_parse_auto_config(struct hda_codec *codec)
12568 struct alc_spec *spec = codec->spec;
12570 static hda_nid_t alc268_ignore[] = { 0 };
12572 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12576 if (!spec->autocfg.line_outs) {
12577 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12578 spec->multiout.max_channels = 2;
12579 spec->no_analog = 1;
12582 return 0; /* can't find valid BIOS pin config */
12584 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
12587 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
12591 spec->multiout.max_channels = 2;
12594 /* digital only support output */
12595 if (spec->autocfg.dig_outs) {
12596 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
12597 spec->dig_out_type = spec->autocfg.dig_out_type[0];
12599 if (spec->kctls.list)
12600 add_mixer(spec, spec->kctls.list);
12602 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
12603 add_mixer(spec, alc268_beep_mixer);
12605 add_verb(spec, alc268_volume_init_verbs);
12606 spec->num_mux_defs = 2;
12607 spec->input_mux = &spec->private_imux[0];
12609 err = alc_auto_add_mic_boost(codec);
12613 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
12618 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
12620 /* init callback for auto-configuration model -- overriding the default init */
12621 static void alc268_auto_init(struct hda_codec *codec)
12623 struct alc_spec *spec = codec->spec;
12624 alc268_auto_init_multi_out(codec);
12625 alc268_auto_init_hp_out(codec);
12626 alc268_auto_init_mono_speaker_out(codec);
12627 alc268_auto_init_analog_input(codec);
12628 if (spec->unsol_event)
12629 alc_inithook(codec);
12633 * configuration and preset
12635 static const char *alc268_models[ALC268_MODEL_LAST] = {
12636 [ALC267_QUANTA_IL1] = "quanta-il1",
12637 [ALC268_3ST] = "3stack",
12638 [ALC268_TOSHIBA] = "toshiba",
12639 [ALC268_ACER] = "acer",
12640 [ALC268_ACER_DMIC] = "acer-dmic",
12641 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
12642 [ALC268_DELL] = "dell",
12643 [ALC268_ZEPTO] = "zepto",
12644 #ifdef CONFIG_SND_DEBUG
12645 [ALC268_TEST] = "test",
12647 [ALC268_AUTO] = "auto",
12650 static struct snd_pci_quirk alc268_cfg_tbl[] = {
12651 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
12652 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
12653 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
12654 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
12655 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
12656 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
12657 ALC268_ACER_ASPIRE_ONE),
12658 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
12659 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
12660 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
12661 /* almost compatible with toshiba but with optional digital outs;
12662 * auto-probing seems working fine
12664 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
12666 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
12667 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
12668 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
12669 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
12670 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
12671 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
12675 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
12676 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
12677 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
12678 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
12679 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
12684 static struct alc_config_preset alc268_presets[] = {
12685 [ALC267_QUANTA_IL1] = {
12686 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
12687 alc268_capture_nosrc_mixer },
12688 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12689 alc267_quanta_il1_verbs },
12690 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12691 .dac_nids = alc268_dac_nids,
12692 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12693 .adc_nids = alc268_adc_nids_alt,
12695 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12696 .channel_mode = alc268_modes,
12697 .unsol_event = alc_sku_unsol_event,
12698 .setup = alc267_quanta_il1_setup,
12699 .init_hook = alc_inithook,
12702 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12703 alc268_beep_mixer },
12704 .init_verbs = { alc268_base_init_verbs },
12705 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12706 .dac_nids = alc268_dac_nids,
12707 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12708 .adc_nids = alc268_adc_nids_alt,
12709 .capsrc_nids = alc268_capsrc_nids,
12711 .dig_out_nid = ALC268_DIGOUT_NID,
12712 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12713 .channel_mode = alc268_modes,
12714 .input_mux = &alc268_capture_source,
12716 [ALC268_TOSHIBA] = {
12717 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
12718 alc268_beep_mixer },
12719 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12720 alc268_toshiba_verbs },
12721 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12722 .dac_nids = alc268_dac_nids,
12723 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12724 .adc_nids = alc268_adc_nids_alt,
12725 .capsrc_nids = alc268_capsrc_nids,
12727 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12728 .channel_mode = alc268_modes,
12729 .input_mux = &alc268_capture_source,
12730 .unsol_event = alc268_toshiba_unsol_event,
12731 .setup = alc268_toshiba_setup,
12732 .init_hook = alc268_toshiba_automute,
12735 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
12736 alc268_beep_mixer },
12737 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12738 alc268_acer_verbs },
12739 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12740 .dac_nids = alc268_dac_nids,
12741 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12742 .adc_nids = alc268_adc_nids_alt,
12743 .capsrc_nids = alc268_capsrc_nids,
12745 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12746 .channel_mode = alc268_modes,
12747 .input_mux = &alc268_acer_capture_source,
12748 .unsol_event = alc268_acer_unsol_event,
12749 .init_hook = alc268_acer_init_hook,
12751 [ALC268_ACER_DMIC] = {
12752 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
12753 alc268_beep_mixer },
12754 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12755 alc268_acer_verbs },
12756 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12757 .dac_nids = alc268_dac_nids,
12758 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12759 .adc_nids = alc268_adc_nids_alt,
12760 .capsrc_nids = alc268_capsrc_nids,
12762 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12763 .channel_mode = alc268_modes,
12764 .input_mux = &alc268_acer_dmic_capture_source,
12765 .unsol_event = alc268_acer_unsol_event,
12766 .init_hook = alc268_acer_init_hook,
12768 [ALC268_ACER_ASPIRE_ONE] = {
12769 .mixers = { alc268_acer_aspire_one_mixer,
12771 alc268_capture_nosrc_mixer },
12772 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12773 alc268_acer_aspire_one_verbs },
12774 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12775 .dac_nids = alc268_dac_nids,
12776 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12777 .adc_nids = alc268_adc_nids_alt,
12778 .capsrc_nids = alc268_capsrc_nids,
12780 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12781 .channel_mode = alc268_modes,
12782 .unsol_event = alc268_acer_lc_unsol_event,
12783 .setup = alc268_acer_lc_setup,
12784 .init_hook = alc268_acer_lc_init_hook,
12787 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
12788 alc268_capture_nosrc_mixer },
12789 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12790 alc268_dell_verbs },
12791 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12792 .dac_nids = alc268_dac_nids,
12793 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12794 .adc_nids = alc268_adc_nids_alt,
12795 .capsrc_nids = alc268_capsrc_nids,
12797 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12798 .channel_mode = alc268_modes,
12799 .unsol_event = alc_sku_unsol_event,
12800 .setup = alc268_dell_setup,
12801 .init_hook = alc_inithook,
12804 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12805 alc268_beep_mixer },
12806 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12807 alc268_toshiba_verbs },
12808 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12809 .dac_nids = alc268_dac_nids,
12810 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12811 .adc_nids = alc268_adc_nids_alt,
12812 .capsrc_nids = alc268_capsrc_nids,
12814 .dig_out_nid = ALC268_DIGOUT_NID,
12815 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12816 .channel_mode = alc268_modes,
12817 .input_mux = &alc268_capture_source,
12818 .setup = alc268_toshiba_setup,
12819 .init_hook = alc268_toshiba_automute,
12821 #ifdef CONFIG_SND_DEBUG
12823 .mixers = { alc268_test_mixer, alc268_capture_mixer },
12824 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12825 alc268_volume_init_verbs },
12826 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12827 .dac_nids = alc268_dac_nids,
12828 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12829 .adc_nids = alc268_adc_nids_alt,
12830 .capsrc_nids = alc268_capsrc_nids,
12832 .dig_out_nid = ALC268_DIGOUT_NID,
12833 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12834 .channel_mode = alc268_modes,
12835 .input_mux = &alc268_capture_source,
12840 static int patch_alc268(struct hda_codec *codec)
12842 struct alc_spec *spec;
12844 int i, has_beep, err;
12846 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
12850 codec->spec = spec;
12852 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
12856 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
12857 board_config = snd_hda_check_board_codec_sid_config(codec,
12858 ALC882_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
12860 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
12861 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12863 board_config = ALC268_AUTO;
12866 if (board_config == ALC268_AUTO) {
12867 /* automatic parse from the BIOS config */
12868 err = alc268_parse_auto_config(codec);
12874 "hda_codec: Cannot set up configuration "
12875 "from BIOS. Using base mode...\n");
12876 board_config = ALC268_3ST;
12880 if (board_config != ALC268_AUTO)
12881 setup_preset(codec, &alc268_presets[board_config]);
12883 spec->stream_analog_playback = &alc268_pcm_analog_playback;
12884 spec->stream_analog_capture = &alc268_pcm_analog_capture;
12885 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
12887 spec->stream_digital_playback = &alc268_pcm_digital_playback;
12890 for (i = 0; i < spec->num_mixers; i++) {
12891 if (spec->mixers[i] == alc268_beep_mixer) {
12898 err = snd_hda_attach_beep_device(codec, 0x1);
12903 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
12904 /* override the amp caps for beep generator */
12905 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
12906 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
12907 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
12908 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
12909 (0 << AC_AMPCAP_MUTE_SHIFT));
12912 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
12913 /* check whether NID 0x07 is valid */
12914 unsigned int wcap = get_wcaps(codec, 0x07);
12917 spec->capsrc_nids = alc268_capsrc_nids;
12919 wcap = get_wcaps_type(wcap);
12920 if (spec->auto_mic ||
12921 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
12922 spec->adc_nids = alc268_adc_nids_alt;
12923 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
12924 if (spec->auto_mic)
12925 fixup_automic_adc(codec);
12926 if (spec->auto_mic || spec->input_mux->num_items == 1)
12927 add_mixer(spec, alc268_capture_nosrc_mixer);
12929 add_mixer(spec, alc268_capture_alt_mixer);
12931 spec->adc_nids = alc268_adc_nids;
12932 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
12933 add_mixer(spec, alc268_capture_mixer);
12935 /* set default input source */
12936 for (i = 0; i < spec->num_adc_nids; i++)
12937 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
12938 0, AC_VERB_SET_CONNECT_SEL,
12939 i < spec->num_mux_defs ?
12940 spec->input_mux[i].items[0].index :
12941 spec->input_mux->items[0].index);
12944 spec->vmaster_nid = 0x02;
12946 codec->patch_ops = alc_patch_ops;
12947 if (board_config == ALC268_AUTO)
12948 spec->init_hook = alc268_auto_init;
12950 codec->proc_widget_hook = print_realtek_coef;
12956 * ALC269 channel source setting (2 channel)
12958 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
12960 #define alc269_dac_nids alc260_dac_nids
12962 static hda_nid_t alc269_adc_nids[1] = {
12967 static hda_nid_t alc269_capsrc_nids[1] = {
12971 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
12975 #define alc269_modes alc260_modes
12976 #define alc269_capture_source alc880_lg_lw_capture_source
12978 static struct snd_kcontrol_new alc269_base_mixer[] = {
12979 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12980 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12981 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12982 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12983 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12984 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12985 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12986 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12987 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12988 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12989 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12990 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
12994 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
12995 /* output mixer control */
12996 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12998 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12999 .name = "Master Playback Switch",
13000 .info = snd_hda_mixer_amp_switch_info,
13001 .get = snd_hda_mixer_amp_switch_get,
13002 .put = alc268_acer_master_sw_put,
13003 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13005 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13006 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13007 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13008 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13009 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13010 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13014 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
13015 /* output mixer control */
13016 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13018 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13019 .name = "Master Playback Switch",
13020 .info = snd_hda_mixer_amp_switch_info,
13021 .get = snd_hda_mixer_amp_switch_get,
13022 .put = alc268_acer_master_sw_put,
13023 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13025 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13026 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13027 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13028 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13029 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13030 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13031 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
13032 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
13033 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
13037 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
13038 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13039 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13040 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13041 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13045 /* capture mixer elements */
13046 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
13047 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13048 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13049 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13054 #define alc269_fujitsu_mixer alc269_eeepc_mixer
13056 static struct hda_verb alc269_quanta_fl1_verbs[] = {
13057 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13058 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13059 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13060 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13061 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13062 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13066 static struct hda_verb alc269_lifebook_verbs[] = {
13067 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13068 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
13069 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13070 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13071 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13072 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13073 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13074 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13075 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13076 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13080 /* toggle speaker-output according to the hp-jack state */
13081 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
13083 unsigned int present;
13084 unsigned char bits;
13086 present = snd_hda_jack_detect(codec, 0x15);
13087 bits = present ? AMP_IN_MUTE(0) : 0;
13088 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13089 AMP_IN_MUTE(0), bits);
13090 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13091 AMP_IN_MUTE(0), bits);
13093 snd_hda_codec_write(codec, 0x20, 0,
13094 AC_VERB_SET_COEF_INDEX, 0x0c);
13095 snd_hda_codec_write(codec, 0x20, 0,
13096 AC_VERB_SET_PROC_COEF, 0x680);
13098 snd_hda_codec_write(codec, 0x20, 0,
13099 AC_VERB_SET_COEF_INDEX, 0x0c);
13100 snd_hda_codec_write(codec, 0x20, 0,
13101 AC_VERB_SET_PROC_COEF, 0x480);
13104 /* toggle speaker-output according to the hp-jacks state */
13105 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
13107 unsigned int present;
13108 unsigned char bits;
13110 /* Check laptop headphone socket */
13111 present = snd_hda_jack_detect(codec, 0x15);
13113 /* Check port replicator headphone socket */
13114 present |= snd_hda_jack_detect(codec, 0x1a);
13116 bits = present ? AMP_IN_MUTE(0) : 0;
13117 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13118 AMP_IN_MUTE(0), bits);
13119 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13120 AMP_IN_MUTE(0), bits);
13122 snd_hda_codec_write(codec, 0x20, 0,
13123 AC_VERB_SET_COEF_INDEX, 0x0c);
13124 snd_hda_codec_write(codec, 0x20, 0,
13125 AC_VERB_SET_PROC_COEF, 0x680);
13127 snd_hda_codec_write(codec, 0x20, 0,
13128 AC_VERB_SET_COEF_INDEX, 0x0c);
13129 snd_hda_codec_write(codec, 0x20, 0,
13130 AC_VERB_SET_PROC_COEF, 0x480);
13133 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
13135 unsigned int present_laptop;
13136 unsigned int present_dock;
13138 present_laptop = snd_hda_jack_detect(codec, 0x18);
13139 present_dock = snd_hda_jack_detect(codec, 0x1b);
13141 /* Laptop mic port overrides dock mic port, design decision */
13143 snd_hda_codec_write(codec, 0x23, 0,
13144 AC_VERB_SET_CONNECT_SEL, 0x3);
13145 if (present_laptop)
13146 snd_hda_codec_write(codec, 0x23, 0,
13147 AC_VERB_SET_CONNECT_SEL, 0x0);
13148 if (!present_dock && !present_laptop)
13149 snd_hda_codec_write(codec, 0x23, 0,
13150 AC_VERB_SET_CONNECT_SEL, 0x1);
13153 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
13156 switch (res >> 26) {
13157 case ALC880_HP_EVENT:
13158 alc269_quanta_fl1_speaker_automute(codec);
13160 case ALC880_MIC_EVENT:
13161 alc_mic_automute(codec);
13166 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
13169 if ((res >> 26) == ALC880_HP_EVENT)
13170 alc269_lifebook_speaker_automute(codec);
13171 if ((res >> 26) == ALC880_MIC_EVENT)
13172 alc269_lifebook_mic_autoswitch(codec);
13175 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
13177 struct alc_spec *spec = codec->spec;
13178 spec->ext_mic.pin = 0x18;
13179 spec->ext_mic.mux_idx = 0;
13180 spec->int_mic.pin = 0x19;
13181 spec->int_mic.mux_idx = 1;
13182 spec->auto_mic = 1;
13185 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
13187 alc269_quanta_fl1_speaker_automute(codec);
13188 alc_mic_automute(codec);
13191 static void alc269_lifebook_init_hook(struct hda_codec *codec)
13193 alc269_lifebook_speaker_automute(codec);
13194 alc269_lifebook_mic_autoswitch(codec);
13197 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
13198 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13199 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
13200 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13201 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13202 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13203 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13204 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13208 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
13209 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13210 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
13211 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13212 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
13213 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13214 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13218 /* toggle speaker-output according to the hp-jack state */
13219 static void alc269_speaker_automute(struct hda_codec *codec)
13221 unsigned int present;
13222 unsigned char bits;
13224 present = snd_hda_jack_detect(codec, 0x15);
13225 bits = present ? AMP_IN_MUTE(0) : 0;
13226 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13227 AMP_IN_MUTE(0), bits);
13228 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13229 AMP_IN_MUTE(0), bits);
13232 /* unsolicited event for HP jack sensing */
13233 static void alc269_eeepc_unsol_event(struct hda_codec *codec,
13236 switch (res >> 26) {
13237 case ALC880_HP_EVENT:
13238 alc269_speaker_automute(codec);
13240 case ALC880_MIC_EVENT:
13241 alc_mic_automute(codec);
13246 static void alc269_eeepc_dmic_setup(struct hda_codec *codec)
13248 struct alc_spec *spec = codec->spec;
13249 spec->ext_mic.pin = 0x18;
13250 spec->ext_mic.mux_idx = 0;
13251 spec->int_mic.pin = 0x12;
13252 spec->int_mic.mux_idx = 5;
13253 spec->auto_mic = 1;
13256 static void alc269_eeepc_amic_setup(struct hda_codec *codec)
13258 struct alc_spec *spec = codec->spec;
13259 spec->ext_mic.pin = 0x18;
13260 spec->ext_mic.mux_idx = 0;
13261 spec->int_mic.pin = 0x19;
13262 spec->int_mic.mux_idx = 1;
13263 spec->auto_mic = 1;
13266 static void alc269_eeepc_inithook(struct hda_codec *codec)
13268 alc269_speaker_automute(codec);
13269 alc_mic_automute(codec);
13273 * generic initialization of ADC, input mixers and output mixers
13275 static struct hda_verb alc269_init_verbs[] = {
13277 * Unmute ADC0 and set the default input to mic-in
13279 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13281 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
13282 * analog-loopback mixer widget
13283 * Note: PASD motherboards uses the Line In 2 as the input for
13284 * front panel mic (mic 2)
13286 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13287 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13288 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13289 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13290 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13291 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13294 * Set up output mixers (0x0c - 0x0e)
13296 /* set vol=0 to output mixers */
13297 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13298 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13300 /* set up input amps for analog loopback */
13301 /* Amp Indices: DAC = 0, mixer = 1 */
13302 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13303 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13304 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13305 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13306 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13307 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13309 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13310 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13311 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13312 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13313 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13314 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13315 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13317 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13318 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13319 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13320 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13321 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13322 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13323 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13325 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
13326 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
13328 /* FIXME: use matrix-type input source selection */
13329 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13330 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13331 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13332 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13333 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13334 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13337 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13338 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13342 #define alc269_auto_create_multi_out_ctls \
13343 alc268_auto_create_multi_out_ctls
13344 #define alc269_auto_create_input_ctls \
13345 alc268_auto_create_input_ctls
13347 #ifdef CONFIG_SND_HDA_POWER_SAVE
13348 #define alc269_loopbacks alc880_loopbacks
13351 /* pcm configuration: identical with ALC880 */
13352 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
13353 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
13354 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
13355 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
13357 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
13361 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13362 /* NID is set in alc_build_pcms */
13364 .open = alc880_playback_pcm_open,
13365 .prepare = alc880_playback_pcm_prepare,
13366 .cleanup = alc880_playback_pcm_cleanup
13370 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
13374 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13375 /* NID is set in alc_build_pcms */
13379 * BIOS auto configuration
13381 static int alc269_parse_auto_config(struct hda_codec *codec)
13383 struct alc_spec *spec = codec->spec;
13385 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
13387 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13392 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
13395 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
13399 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13401 if (spec->autocfg.dig_outs)
13402 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
13404 if (spec->kctls.list)
13405 add_mixer(spec, spec->kctls.list);
13407 add_verb(spec, alc269_init_verbs);
13408 spec->num_mux_defs = 1;
13409 spec->input_mux = &spec->private_imux[0];
13410 /* set default input source */
13411 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
13412 0, AC_VERB_SET_CONNECT_SEL,
13413 spec->input_mux->items[0].index);
13415 err = alc_auto_add_mic_boost(codec);
13419 if (!spec->cap_mixer && !spec->no_analog)
13420 set_capture_mixer(codec);
13422 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
13427 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
13428 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
13429 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
13432 /* init callback for auto-configuration model -- overriding the default init */
13433 static void alc269_auto_init(struct hda_codec *codec)
13435 struct alc_spec *spec = codec->spec;
13436 alc269_auto_init_multi_out(codec);
13437 alc269_auto_init_hp_out(codec);
13438 alc269_auto_init_analog_input(codec);
13439 if (spec->unsol_event)
13440 alc_inithook(codec);
13444 * configuration and preset
13446 static const char *alc269_models[ALC269_MODEL_LAST] = {
13447 [ALC269_BASIC] = "basic",
13448 [ALC269_QUANTA_FL1] = "quanta",
13449 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
13450 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901",
13451 [ALC269_FUJITSU] = "fujitsu",
13452 [ALC269_LIFEBOOK] = "lifebook",
13453 [ALC269_AUTO] = "auto",
13456 static struct snd_pci_quirk alc269_cfg_tbl[] = {
13457 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
13458 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
13459 ALC269_ASUS_EEEPC_P703),
13460 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703),
13461 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703),
13462 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703),
13463 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703),
13464 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703),
13465 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703),
13466 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
13467 ALC269_ASUS_EEEPC_P901),
13468 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
13469 ALC269_ASUS_EEEPC_P901),
13470 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901),
13471 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
13472 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
13476 static struct alc_config_preset alc269_presets[] = {
13478 .mixers = { alc269_base_mixer },
13479 .init_verbs = { alc269_init_verbs },
13480 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13481 .dac_nids = alc269_dac_nids,
13483 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13484 .channel_mode = alc269_modes,
13485 .input_mux = &alc269_capture_source,
13487 [ALC269_QUANTA_FL1] = {
13488 .mixers = { alc269_quanta_fl1_mixer },
13489 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
13490 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13491 .dac_nids = alc269_dac_nids,
13493 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13494 .channel_mode = alc269_modes,
13495 .input_mux = &alc269_capture_source,
13496 .unsol_event = alc269_quanta_fl1_unsol_event,
13497 .setup = alc269_quanta_fl1_setup,
13498 .init_hook = alc269_quanta_fl1_init_hook,
13500 [ALC269_ASUS_EEEPC_P703] = {
13501 .mixers = { alc269_eeepc_mixer },
13502 .cap_mixer = alc269_epc_capture_mixer,
13503 .init_verbs = { alc269_init_verbs,
13504 alc269_eeepc_amic_init_verbs },
13505 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13506 .dac_nids = alc269_dac_nids,
13508 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13509 .channel_mode = alc269_modes,
13510 .unsol_event = alc269_eeepc_unsol_event,
13511 .setup = alc269_eeepc_amic_setup,
13512 .init_hook = alc269_eeepc_inithook,
13514 [ALC269_ASUS_EEEPC_P901] = {
13515 .mixers = { alc269_eeepc_mixer },
13516 .cap_mixer = alc269_epc_capture_mixer,
13517 .init_verbs = { alc269_init_verbs,
13518 alc269_eeepc_dmic_init_verbs },
13519 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13520 .dac_nids = alc269_dac_nids,
13522 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13523 .channel_mode = alc269_modes,
13524 .unsol_event = alc269_eeepc_unsol_event,
13525 .setup = alc269_eeepc_dmic_setup,
13526 .init_hook = alc269_eeepc_inithook,
13528 [ALC269_FUJITSU] = {
13529 .mixers = { alc269_fujitsu_mixer },
13530 .cap_mixer = alc269_epc_capture_mixer,
13531 .init_verbs = { alc269_init_verbs,
13532 alc269_eeepc_dmic_init_verbs },
13533 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13534 .dac_nids = alc269_dac_nids,
13536 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13537 .channel_mode = alc269_modes,
13538 .unsol_event = alc269_eeepc_unsol_event,
13539 .setup = alc269_eeepc_dmic_setup,
13540 .init_hook = alc269_eeepc_inithook,
13542 [ALC269_LIFEBOOK] = {
13543 .mixers = { alc269_lifebook_mixer },
13544 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
13545 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13546 .dac_nids = alc269_dac_nids,
13548 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13549 .channel_mode = alc269_modes,
13550 .input_mux = &alc269_capture_source,
13551 .unsol_event = alc269_lifebook_unsol_event,
13552 .init_hook = alc269_lifebook_init_hook,
13556 static int patch_alc269(struct hda_codec *codec)
13558 struct alc_spec *spec;
13562 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13566 codec->spec = spec;
13568 alc_fix_pll_init(codec, 0x20, 0x04, 15);
13570 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){
13571 kfree(codec->chip_name);
13572 codec->chip_name = kstrdup("ALC259", GFP_KERNEL);
13573 if (!codec->chip_name) {
13579 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
13583 if (board_config < 0) {
13584 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13586 board_config = ALC269_AUTO;
13589 if (board_config == ALC269_AUTO) {
13590 /* automatic parse from the BIOS config */
13591 err = alc269_parse_auto_config(codec);
13597 "hda_codec: Cannot set up configuration "
13598 "from BIOS. Using base mode...\n");
13599 board_config = ALC269_BASIC;
13603 err = snd_hda_attach_beep_device(codec, 0x1);
13609 if (board_config != ALC269_AUTO)
13610 setup_preset(codec, &alc269_presets[board_config]);
13612 if (codec->subsystem_id == 0x17aa3bf8) {
13613 /* Due to a hardware problem on Lenovo Ideadpad, we need to
13614 * fix the sample rate of analog I/O to 44.1kHz
13616 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
13617 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
13619 spec->stream_analog_playback = &alc269_pcm_analog_playback;
13620 spec->stream_analog_capture = &alc269_pcm_analog_capture;
13622 spec->stream_digital_playback = &alc269_pcm_digital_playback;
13623 spec->stream_digital_capture = &alc269_pcm_digital_capture;
13625 spec->adc_nids = alc269_adc_nids;
13626 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
13627 spec->capsrc_nids = alc269_capsrc_nids;
13628 if (!spec->cap_mixer)
13629 set_capture_mixer(codec);
13630 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
13632 spec->vmaster_nid = 0x02;
13634 codec->patch_ops = alc_patch_ops;
13635 if (board_config == ALC269_AUTO)
13636 spec->init_hook = alc269_auto_init;
13637 #ifdef CONFIG_SND_HDA_POWER_SAVE
13638 if (!spec->loopback.amplist)
13639 spec->loopback.amplist = alc269_loopbacks;
13641 codec->proc_widget_hook = print_realtek_coef;
13647 * ALC861 channel source setting (2/6 channel selection for 3-stack)
13651 * set the path ways for 2 channel output
13652 * need to set the codec line out and mic 1 pin widgets to inputs
13654 static struct hda_verb alc861_threestack_ch2_init[] = {
13655 /* set pin widget 1Ah (line in) for input */
13656 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13657 /* set pin widget 18h (mic1/2) for input, for mic also enable
13660 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13662 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13664 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13665 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13671 * need to set the codec line out and mic 1 pin widgets to outputs
13673 static struct hda_verb alc861_threestack_ch6_init[] = {
13674 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13675 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13676 /* set pin widget 18h (mic1) for output (CLFE)*/
13677 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13679 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13680 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13682 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13684 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13685 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13690 static struct hda_channel_mode alc861_threestack_modes[2] = {
13691 { 2, alc861_threestack_ch2_init },
13692 { 6, alc861_threestack_ch6_init },
13694 /* Set mic1 as input and unmute the mixer */
13695 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
13696 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13697 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13700 /* Set mic1 as output and mute mixer */
13701 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
13702 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13703 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13707 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
13708 { 2, alc861_uniwill_m31_ch2_init },
13709 { 4, alc861_uniwill_m31_ch4_init },
13712 /* Set mic1 and line-in as input and unmute the mixer */
13713 static struct hda_verb alc861_asus_ch2_init[] = {
13714 /* set pin widget 1Ah (line in) for input */
13715 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13716 /* set pin widget 18h (mic1/2) for input, for mic also enable
13719 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13721 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13723 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13724 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13728 /* Set mic1 nad line-in as output and mute mixer */
13729 static struct hda_verb alc861_asus_ch6_init[] = {
13730 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13731 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13732 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13733 /* set pin widget 18h (mic1) for output (CLFE)*/
13734 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13735 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13736 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13737 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13739 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13741 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13742 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13747 static struct hda_channel_mode alc861_asus_modes[2] = {
13748 { 2, alc861_asus_ch2_init },
13749 { 6, alc861_asus_ch6_init },
13754 static struct snd_kcontrol_new alc861_base_mixer[] = {
13755 /* output mixer control */
13756 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13757 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13758 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13759 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13760 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13762 /*Input mixer control */
13763 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13764 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13765 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13766 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13767 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13768 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13769 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13770 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13771 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13772 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13777 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
13778 /* output mixer control */
13779 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13780 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13781 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13782 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13783 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13785 /* Input mixer control */
13786 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13787 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13788 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13789 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13790 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13791 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13792 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13793 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13794 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13795 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13798 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13799 .name = "Channel Mode",
13800 .info = alc_ch_mode_info,
13801 .get = alc_ch_mode_get,
13802 .put = alc_ch_mode_put,
13803 .private_value = ARRAY_SIZE(alc861_threestack_modes),
13808 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
13809 /* output mixer control */
13810 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13811 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13812 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13817 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
13818 /* output mixer control */
13819 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13820 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13821 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13822 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13823 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13825 /* Input mixer control */
13826 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13827 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13828 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13829 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13830 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13831 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13832 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13833 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13834 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13835 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13838 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13839 .name = "Channel Mode",
13840 .info = alc_ch_mode_info,
13841 .get = alc_ch_mode_get,
13842 .put = alc_ch_mode_put,
13843 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
13848 static struct snd_kcontrol_new alc861_asus_mixer[] = {
13849 /* output mixer control */
13850 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13851 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13852 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13853 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13854 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13856 /* Input mixer control */
13857 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13858 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13859 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13860 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13861 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13862 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13863 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13864 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13865 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13866 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
13869 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13870 .name = "Channel Mode",
13871 .info = alc_ch_mode_info,
13872 .get = alc_ch_mode_get,
13873 .put = alc_ch_mode_put,
13874 .private_value = ARRAY_SIZE(alc861_asus_modes),
13879 /* additional mixer */
13880 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
13881 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13882 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13887 * generic initialization of ADC, input mixers and output mixers
13889 static struct hda_verb alc861_base_init_verbs[] = {
13891 * Unmute ADC0 and set the default input to mic-in
13893 /* port-A for surround (rear panel) */
13894 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13895 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
13896 /* port-B for mic-in (rear panel) with vref */
13897 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13898 /* port-C for line-in (rear panel) */
13899 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13900 /* port-D for Front */
13901 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13902 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13903 /* port-E for HP out (front panel) */
13904 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13905 /* route front PCM to HP */
13906 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13907 /* port-F for mic-in (front panel) with vref */
13908 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13909 /* port-G for CLFE (rear panel) */
13910 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13911 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13912 /* port-H for side (rear panel) */
13913 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13914 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
13916 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13917 /* route front mic to ADC1*/
13918 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13919 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13921 /* Unmute DAC0~3 & spdif out*/
13922 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13923 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13924 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13925 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13926 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13928 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13929 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13930 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13931 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13932 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13934 /* Unmute Stereo Mixer 15 */
13935 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13936 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13937 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13938 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13940 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13941 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13942 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13943 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13944 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13945 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13946 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13947 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13948 /* hp used DAC 3 (Front) */
13949 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13950 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13955 static struct hda_verb alc861_threestack_init_verbs[] = {
13957 * Unmute ADC0 and set the default input to mic-in
13959 /* port-A for surround (rear panel) */
13960 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13961 /* port-B for mic-in (rear panel) with vref */
13962 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13963 /* port-C for line-in (rear panel) */
13964 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13965 /* port-D for Front */
13966 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13967 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13968 /* port-E for HP out (front panel) */
13969 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13970 /* route front PCM to HP */
13971 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13972 /* port-F for mic-in (front panel) with vref */
13973 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13974 /* port-G for CLFE (rear panel) */
13975 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13976 /* port-H for side (rear panel) */
13977 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13979 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13980 /* route front mic to ADC1*/
13981 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13982 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13983 /* Unmute DAC0~3 & spdif out*/
13984 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13985 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13986 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13987 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13988 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13990 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13991 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13992 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13993 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13994 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13996 /* Unmute Stereo Mixer 15 */
13997 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13998 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13999 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14000 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14002 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14003 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14004 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14005 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14006 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14007 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14008 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14009 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14010 /* hp used DAC 3 (Front) */
14011 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14012 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14016 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
14018 * Unmute ADC0 and set the default input to mic-in
14020 /* port-A for surround (rear panel) */
14021 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14022 /* port-B for mic-in (rear panel) with vref */
14023 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14024 /* port-C for line-in (rear panel) */
14025 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14026 /* port-D for Front */
14027 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14028 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14029 /* port-E for HP out (front panel) */
14030 /* this has to be set to VREF80 */
14031 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14032 /* route front PCM to HP */
14033 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14034 /* port-F for mic-in (front panel) with vref */
14035 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14036 /* port-G for CLFE (rear panel) */
14037 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14038 /* port-H for side (rear panel) */
14039 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14041 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14042 /* route front mic to ADC1*/
14043 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14044 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14045 /* Unmute DAC0~3 & spdif out*/
14046 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14047 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14048 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14049 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14050 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14052 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14053 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14054 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14055 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14056 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14058 /* Unmute Stereo Mixer 15 */
14059 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14060 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14061 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14062 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14064 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14065 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14066 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14067 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14068 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14069 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14070 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14071 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14072 /* hp used DAC 3 (Front) */
14073 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14074 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14078 static struct hda_verb alc861_asus_init_verbs[] = {
14080 * Unmute ADC0 and set the default input to mic-in
14082 /* port-A for surround (rear panel)
14083 * according to codec#0 this is the HP jack
14085 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
14086 /* route front PCM to HP */
14087 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
14088 /* port-B for mic-in (rear panel) with vref */
14089 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14090 /* port-C for line-in (rear panel) */
14091 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14092 /* port-D for Front */
14093 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14094 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14095 /* port-E for HP out (front panel) */
14096 /* this has to be set to VREF80 */
14097 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14098 /* route front PCM to HP */
14099 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14100 /* port-F for mic-in (front panel) with vref */
14101 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14102 /* port-G for CLFE (rear panel) */
14103 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14104 /* port-H for side (rear panel) */
14105 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14107 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14108 /* route front mic to ADC1*/
14109 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14110 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14111 /* Unmute DAC0~3 & spdif out*/
14112 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14113 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14114 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14115 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14116 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14117 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14118 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14119 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14120 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14121 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14123 /* Unmute Stereo Mixer 15 */
14124 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14125 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14126 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14127 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14129 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14130 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14131 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14132 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14133 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14134 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14135 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14136 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14137 /* hp used DAC 3 (Front) */
14138 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14139 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14143 /* additional init verbs for ASUS laptops */
14144 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
14145 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
14146 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
14151 * generic initialization of ADC, input mixers and output mixers
14153 static struct hda_verb alc861_auto_init_verbs[] = {
14155 * Unmute ADC0 and set the default input to mic-in
14157 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
14158 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14160 /* Unmute DAC0~3 & spdif out*/
14161 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14162 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14163 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14164 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14165 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14167 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14168 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14169 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14170 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14171 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14173 /* Unmute Stereo Mixer 15 */
14174 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14175 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14176 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14177 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
14179 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14180 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14181 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14182 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14183 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14184 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14185 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14186 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14188 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14189 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14190 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14191 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14192 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14193 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14194 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14195 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14197 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
14202 static struct hda_verb alc861_toshiba_init_verbs[] = {
14203 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14208 /* toggle speaker-output according to the hp-jack state */
14209 static void alc861_toshiba_automute(struct hda_codec *codec)
14211 unsigned int present = snd_hda_jack_detect(codec, 0x0f);
14213 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
14214 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14215 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
14216 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
14219 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
14222 if ((res >> 26) == ALC880_HP_EVENT)
14223 alc861_toshiba_automute(codec);
14226 /* pcm configuration: identical with ALC880 */
14227 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
14228 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
14229 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
14230 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
14233 #define ALC861_DIGOUT_NID 0x07
14235 static struct hda_channel_mode alc861_8ch_modes[1] = {
14239 static hda_nid_t alc861_dac_nids[4] = {
14240 /* front, surround, clfe, side */
14241 0x03, 0x06, 0x05, 0x04
14244 static hda_nid_t alc660_dac_nids[3] = {
14245 /* front, clfe, surround */
14249 static hda_nid_t alc861_adc_nids[1] = {
14254 static struct hda_input_mux alc861_capture_source = {
14258 { "Front Mic", 0x3 },
14265 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
14267 struct alc_spec *spec = codec->spec;
14268 hda_nid_t mix, srcs[5];
14271 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
14273 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14276 for (i = 0; i < num; i++) {
14278 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
14279 if (type != AC_WID_AUD_OUT)
14281 for (j = 0; j < spec->multiout.num_dacs; j++)
14282 if (spec->multiout.dac_nids[j] == srcs[i])
14284 if (j >= spec->multiout.num_dacs)
14290 /* fill in the dac_nids table from the parsed pin configuration */
14291 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
14292 const struct auto_pin_cfg *cfg)
14294 struct alc_spec *spec = codec->spec;
14296 hda_nid_t nid, dac;
14298 spec->multiout.dac_nids = spec->private_dac_nids;
14299 for (i = 0; i < cfg->line_outs; i++) {
14300 nid = cfg->line_out_pins[i];
14301 dac = alc861_look_for_dac(codec, nid);
14304 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
14309 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
14310 hda_nid_t nid, unsigned int chs)
14312 return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx,
14313 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
14316 /* add playback controls from the parsed DAC table */
14317 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
14318 const struct auto_pin_cfg *cfg)
14320 struct alc_spec *spec = codec->spec;
14321 static const char *chname[4] = {
14322 "Front", "Surround", NULL /*CLFE*/, "Side"
14327 if (cfg->line_outs == 1) {
14328 const char *pfx = NULL;
14331 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
14334 nid = spec->multiout.dac_nids[0];
14335 return alc861_create_out_sw(codec, pfx, nid, 3);
14339 for (i = 0; i < cfg->line_outs; i++) {
14340 nid = spec->multiout.dac_nids[i];
14345 err = alc861_create_out_sw(codec, "Center", nid, 1);
14348 err = alc861_create_out_sw(codec, "LFE", nid, 2);
14352 err = alc861_create_out_sw(codec, chname[i], nid, 3);
14360 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
14362 struct alc_spec *spec = codec->spec;
14369 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
14370 nid = alc861_look_for_dac(codec, pin);
14372 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
14375 spec->multiout.hp_nid = nid;
14381 /* create playback/capture controls for input pins */
14382 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
14383 const struct auto_pin_cfg *cfg)
14385 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
14388 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
14390 int pin_type, hda_nid_t dac)
14392 hda_nid_t mix, srcs[5];
14395 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
14397 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14399 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
14401 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14404 for (i = 0; i < num; i++) {
14406 if (srcs[i] == dac || srcs[i] == 0x15)
14407 mute = AMP_IN_UNMUTE(i);
14409 mute = AMP_IN_MUTE(i);
14410 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14415 static void alc861_auto_init_multi_out(struct hda_codec *codec)
14417 struct alc_spec *spec = codec->spec;
14420 for (i = 0; i < spec->autocfg.line_outs; i++) {
14421 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14422 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14424 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
14425 spec->multiout.dac_nids[i]);
14429 static void alc861_auto_init_hp_out(struct hda_codec *codec)
14431 struct alc_spec *spec = codec->spec;
14433 if (spec->autocfg.hp_outs)
14434 alc861_auto_set_output_and_unmute(codec,
14435 spec->autocfg.hp_pins[0],
14437 spec->multiout.hp_nid);
14438 if (spec->autocfg.speaker_outs)
14439 alc861_auto_set_output_and_unmute(codec,
14440 spec->autocfg.speaker_pins[0],
14442 spec->multiout.dac_nids[0]);
14445 static void alc861_auto_init_analog_input(struct hda_codec *codec)
14447 struct alc_spec *spec = codec->spec;
14450 for (i = 0; i < AUTO_PIN_LAST; i++) {
14451 hda_nid_t nid = spec->autocfg.input_pins[i];
14452 if (nid >= 0x0c && nid <= 0x11)
14453 alc_set_input_pin(codec, nid, i);
14457 /* parse the BIOS configuration and set up the alc_spec */
14458 /* return 1 if successful, 0 if the proper config is not found,
14459 * or a negative error code
14461 static int alc861_parse_auto_config(struct hda_codec *codec)
14463 struct alc_spec *spec = codec->spec;
14465 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
14467 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14471 if (!spec->autocfg.line_outs)
14472 return 0; /* can't find valid BIOS pin config */
14474 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
14477 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
14480 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
14483 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
14487 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14489 if (spec->autocfg.dig_outs)
14490 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
14492 if (spec->kctls.list)
14493 add_mixer(spec, spec->kctls.list);
14495 add_verb(spec, alc861_auto_init_verbs);
14497 spec->num_mux_defs = 1;
14498 spec->input_mux = &spec->private_imux[0];
14500 spec->adc_nids = alc861_adc_nids;
14501 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
14502 set_capture_mixer(codec);
14504 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b);
14509 /* additional initialization for auto-configuration model */
14510 static void alc861_auto_init(struct hda_codec *codec)
14512 struct alc_spec *spec = codec->spec;
14513 alc861_auto_init_multi_out(codec);
14514 alc861_auto_init_hp_out(codec);
14515 alc861_auto_init_analog_input(codec);
14516 if (spec->unsol_event)
14517 alc_inithook(codec);
14520 #ifdef CONFIG_SND_HDA_POWER_SAVE
14521 static struct hda_amp_list alc861_loopbacks[] = {
14522 { 0x15, HDA_INPUT, 0 },
14523 { 0x15, HDA_INPUT, 1 },
14524 { 0x15, HDA_INPUT, 2 },
14525 { 0x15, HDA_INPUT, 3 },
14532 * configuration and preset
14534 static const char *alc861_models[ALC861_MODEL_LAST] = {
14535 [ALC861_3ST] = "3stack",
14536 [ALC660_3ST] = "3stack-660",
14537 [ALC861_3ST_DIG] = "3stack-dig",
14538 [ALC861_6ST_DIG] = "6stack-dig",
14539 [ALC861_UNIWILL_M31] = "uniwill-m31",
14540 [ALC861_TOSHIBA] = "toshiba",
14541 [ALC861_ASUS] = "asus",
14542 [ALC861_ASUS_LAPTOP] = "asus-laptop",
14543 [ALC861_AUTO] = "auto",
14546 static struct snd_pci_quirk alc861_cfg_tbl[] = {
14547 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
14548 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14549 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14550 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
14551 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
14552 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
14553 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
14554 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
14555 * Any other models that need this preset?
14557 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
14558 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
14559 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
14560 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
14561 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
14562 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
14563 /* FIXME: the below seems conflict */
14564 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
14565 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
14566 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
14570 static struct alc_config_preset alc861_presets[] = {
14572 .mixers = { alc861_3ST_mixer },
14573 .init_verbs = { alc861_threestack_init_verbs },
14574 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14575 .dac_nids = alc861_dac_nids,
14576 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14577 .channel_mode = alc861_threestack_modes,
14579 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14580 .adc_nids = alc861_adc_nids,
14581 .input_mux = &alc861_capture_source,
14583 [ALC861_3ST_DIG] = {
14584 .mixers = { alc861_base_mixer },
14585 .init_verbs = { alc861_threestack_init_verbs },
14586 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14587 .dac_nids = alc861_dac_nids,
14588 .dig_out_nid = ALC861_DIGOUT_NID,
14589 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14590 .channel_mode = alc861_threestack_modes,
14592 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14593 .adc_nids = alc861_adc_nids,
14594 .input_mux = &alc861_capture_source,
14596 [ALC861_6ST_DIG] = {
14597 .mixers = { alc861_base_mixer },
14598 .init_verbs = { alc861_base_init_verbs },
14599 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14600 .dac_nids = alc861_dac_nids,
14601 .dig_out_nid = ALC861_DIGOUT_NID,
14602 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
14603 .channel_mode = alc861_8ch_modes,
14604 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14605 .adc_nids = alc861_adc_nids,
14606 .input_mux = &alc861_capture_source,
14609 .mixers = { alc861_3ST_mixer },
14610 .init_verbs = { alc861_threestack_init_verbs },
14611 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
14612 .dac_nids = alc660_dac_nids,
14613 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14614 .channel_mode = alc861_threestack_modes,
14616 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14617 .adc_nids = alc861_adc_nids,
14618 .input_mux = &alc861_capture_source,
14620 [ALC861_UNIWILL_M31] = {
14621 .mixers = { alc861_uniwill_m31_mixer },
14622 .init_verbs = { alc861_uniwill_m31_init_verbs },
14623 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14624 .dac_nids = alc861_dac_nids,
14625 .dig_out_nid = ALC861_DIGOUT_NID,
14626 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
14627 .channel_mode = alc861_uniwill_m31_modes,
14629 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14630 .adc_nids = alc861_adc_nids,
14631 .input_mux = &alc861_capture_source,
14633 [ALC861_TOSHIBA] = {
14634 .mixers = { alc861_toshiba_mixer },
14635 .init_verbs = { alc861_base_init_verbs,
14636 alc861_toshiba_init_verbs },
14637 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14638 .dac_nids = alc861_dac_nids,
14639 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14640 .channel_mode = alc883_3ST_2ch_modes,
14641 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14642 .adc_nids = alc861_adc_nids,
14643 .input_mux = &alc861_capture_source,
14644 .unsol_event = alc861_toshiba_unsol_event,
14645 .init_hook = alc861_toshiba_automute,
14648 .mixers = { alc861_asus_mixer },
14649 .init_verbs = { alc861_asus_init_verbs },
14650 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14651 .dac_nids = alc861_dac_nids,
14652 .dig_out_nid = ALC861_DIGOUT_NID,
14653 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
14654 .channel_mode = alc861_asus_modes,
14657 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14658 .adc_nids = alc861_adc_nids,
14659 .input_mux = &alc861_capture_source,
14661 [ALC861_ASUS_LAPTOP] = {
14662 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
14663 .init_verbs = { alc861_asus_init_verbs,
14664 alc861_asus_laptop_init_verbs },
14665 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14666 .dac_nids = alc861_dac_nids,
14667 .dig_out_nid = ALC861_DIGOUT_NID,
14668 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14669 .channel_mode = alc883_3ST_2ch_modes,
14671 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14672 .adc_nids = alc861_adc_nids,
14673 .input_mux = &alc861_capture_source,
14677 /* Pin config fixes */
14679 PINFIX_FSC_AMILO_PI1505,
14682 static struct alc_pincfg alc861_fsc_amilo_pi1505_pinfix[] = {
14683 { 0x0b, 0x0221101f }, /* HP */
14684 { 0x0f, 0x90170310 }, /* speaker */
14688 static const struct alc_fixup alc861_fixups[] = {
14689 [PINFIX_FSC_AMILO_PI1505] = {
14690 .pins = alc861_fsc_amilo_pi1505_pinfix
14694 static struct snd_pci_quirk alc861_fixup_tbl[] = {
14695 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
14699 static int patch_alc861(struct hda_codec *codec)
14701 struct alc_spec *spec;
14705 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14709 codec->spec = spec;
14711 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
14715 if (board_config < 0) {
14716 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14718 board_config = ALC861_AUTO;
14721 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups);
14723 if (board_config == ALC861_AUTO) {
14724 /* automatic parse from the BIOS config */
14725 err = alc861_parse_auto_config(codec);
14731 "hda_codec: Cannot set up configuration "
14732 "from BIOS. Using base mode...\n");
14733 board_config = ALC861_3ST_DIG;
14737 err = snd_hda_attach_beep_device(codec, 0x23);
14743 if (board_config != ALC861_AUTO)
14744 setup_preset(codec, &alc861_presets[board_config]);
14746 spec->stream_analog_playback = &alc861_pcm_analog_playback;
14747 spec->stream_analog_capture = &alc861_pcm_analog_capture;
14749 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14750 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14752 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14754 spec->vmaster_nid = 0x03;
14756 codec->patch_ops = alc_patch_ops;
14757 if (board_config == ALC861_AUTO)
14758 spec->init_hook = alc861_auto_init;
14759 #ifdef CONFIG_SND_HDA_POWER_SAVE
14760 if (!spec->loopback.amplist)
14761 spec->loopback.amplist = alc861_loopbacks;
14763 codec->proc_widget_hook = print_realtek_coef;
14769 * ALC861-VD support
14773 * In addition, an independent DAC
14775 #define ALC861VD_DIGOUT_NID 0x06
14777 static hda_nid_t alc861vd_dac_nids[4] = {
14778 /* front, surr, clfe, side surr */
14779 0x02, 0x03, 0x04, 0x05
14782 /* dac_nids for ALC660vd are in a different order - according to
14783 * Realtek's driver.
14784 * This should probably result in a different mixer for 6stack models
14785 * of ALC660vd codecs, but for now there is only 3stack mixer
14786 * - and it is the same as in 861vd.
14787 * adc_nids in ALC660vd are (is) the same as in 861vd
14789 static hda_nid_t alc660vd_dac_nids[3] = {
14790 /* front, rear, clfe, rear_surr */
14794 static hda_nid_t alc861vd_adc_nids[1] = {
14799 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
14802 /* FIXME: should be a matrix-type input source selection */
14803 static struct hda_input_mux alc861vd_capture_source = {
14807 { "Front Mic", 0x1 },
14813 static struct hda_input_mux alc861vd_dallas_capture_source = {
14816 { "Ext Mic", 0x0 },
14817 { "Int Mic", 0x1 },
14821 static struct hda_input_mux alc861vd_hp_capture_source = {
14824 { "Front Mic", 0x0 },
14825 { "ATAPI Mic", 0x1 },
14832 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
14839 static struct hda_verb alc861vd_6stack_ch6_init[] = {
14840 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14841 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14842 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14843 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14850 static struct hda_verb alc861vd_6stack_ch8_init[] = {
14851 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14852 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14853 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14854 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14858 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
14859 { 6, alc861vd_6stack_ch6_init },
14860 { 8, alc861vd_6stack_ch8_init },
14863 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
14865 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14866 .name = "Channel Mode",
14867 .info = alc_ch_mode_info,
14868 .get = alc_ch_mode_get,
14869 .put = alc_ch_mode_put,
14874 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14875 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14877 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
14878 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14879 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14881 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14882 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
14884 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
14886 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
14888 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
14889 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
14891 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
14892 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
14894 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14896 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14897 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14898 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14900 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14901 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14902 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14904 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14905 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14907 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14908 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14913 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
14914 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14915 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14917 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14919 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14920 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14921 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14923 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14924 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14925 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14927 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14928 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14930 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14931 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14936 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
14937 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14938 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
14939 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14941 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14943 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14944 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14945 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14947 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14948 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14949 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14951 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14952 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14957 /* Pin assignment: Speaker=0x14, HP = 0x15,
14958 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
14960 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
14961 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14962 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
14963 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14964 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14965 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
14966 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14967 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14968 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
14969 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14970 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14974 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
14975 * Front Mic=0x18, ATAPI Mic = 0x19,
14977 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
14978 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14979 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14980 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14981 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14982 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14983 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14984 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14985 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14991 * generic initialization of ADC, input mixers and output mixers
14993 static struct hda_verb alc861vd_volume_init_verbs[] = {
14995 * Unmute ADC0 and set the default input to mic-in
14997 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14998 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15000 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
15001 * the analog-loopback mixer widget
15003 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15004 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15005 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15006 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15007 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15008 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15010 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
15011 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15012 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15013 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15014 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15017 * Set up output mixers (0x02 - 0x05)
15019 /* set vol=0 to output mixers */
15020 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15021 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15022 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15023 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15025 /* set up input amps for analog loopback */
15026 /* Amp Indices: DAC = 0, mixer = 1 */
15027 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15028 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15029 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15030 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15031 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15032 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15033 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15034 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15040 * 3-stack pin configuration:
15041 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
15043 static struct hda_verb alc861vd_3stack_init_verbs[] = {
15045 * Set pin mode and muting
15047 /* set front pin widgets 0x14 for output */
15048 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15049 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15050 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15052 /* Mic (rear) pin: input vref at 80% */
15053 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15054 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15055 /* Front Mic pin: input vref at 80% */
15056 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15057 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15058 /* Line In pin: input */
15059 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15060 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15061 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15062 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15063 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15064 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15065 /* CD pin widget for input */
15066 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15072 * 6-stack pin configuration:
15074 static struct hda_verb alc861vd_6stack_init_verbs[] = {
15076 * Set pin mode and muting
15078 /* set front pin widgets 0x14 for output */
15079 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15080 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15081 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15083 /* Rear Pin: output 1 (0x0d) */
15084 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15085 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15086 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
15087 /* CLFE Pin: output 2 (0x0e) */
15088 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15089 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15090 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
15091 /* Side Pin: output 3 (0x0f) */
15092 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15093 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15094 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
15096 /* Mic (rear) pin: input vref at 80% */
15097 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15098 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15099 /* Front Mic pin: input vref at 80% */
15100 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15101 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15102 /* Line In pin: input */
15103 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15104 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15105 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15106 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15107 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15108 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15109 /* CD pin widget for input */
15110 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15115 static struct hda_verb alc861vd_eapd_verbs[] = {
15116 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15120 static struct hda_verb alc660vd_eapd_verbs[] = {
15121 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15122 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15126 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
15127 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15128 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15129 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
15130 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15131 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15135 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
15137 unsigned int present;
15138 unsigned char bits;
15140 present = snd_hda_jack_detect(codec, 0x18);
15141 bits = present ? HDA_AMP_MUTE : 0;
15143 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
15144 HDA_AMP_MUTE, bits);
15147 static void alc861vd_lenovo_setup(struct hda_codec *codec)
15149 struct alc_spec *spec = codec->spec;
15150 spec->autocfg.hp_pins[0] = 0x1b;
15151 spec->autocfg.speaker_pins[0] = 0x14;
15154 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
15156 alc_automute_amp(codec);
15157 alc861vd_lenovo_mic_automute(codec);
15160 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
15163 switch (res >> 26) {
15164 case ALC880_MIC_EVENT:
15165 alc861vd_lenovo_mic_automute(codec);
15168 alc_automute_amp_unsol_event(codec, res);
15173 static struct hda_verb alc861vd_dallas_verbs[] = {
15174 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15175 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15176 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15177 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15179 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15180 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15181 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15182 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15183 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15184 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15185 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15186 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15188 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15189 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15190 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15191 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15192 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15193 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15194 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15195 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15197 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15198 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15199 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15200 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15201 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15202 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15203 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15204 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15206 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15207 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15208 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15209 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15211 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15212 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15213 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15218 /* toggle speaker-output according to the hp-jack state */
15219 static void alc861vd_dallas_setup(struct hda_codec *codec)
15221 struct alc_spec *spec = codec->spec;
15223 spec->autocfg.hp_pins[0] = 0x15;
15224 spec->autocfg.speaker_pins[0] = 0x14;
15227 #ifdef CONFIG_SND_HDA_POWER_SAVE
15228 #define alc861vd_loopbacks alc880_loopbacks
15231 /* pcm configuration: identical with ALC880 */
15232 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
15233 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
15234 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
15235 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
15238 * configuration and preset
15240 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
15241 [ALC660VD_3ST] = "3stack-660",
15242 [ALC660VD_3ST_DIG] = "3stack-660-digout",
15243 [ALC660VD_ASUS_V1S] = "asus-v1s",
15244 [ALC861VD_3ST] = "3stack",
15245 [ALC861VD_3ST_DIG] = "3stack-digout",
15246 [ALC861VD_6ST_DIG] = "6stack-digout",
15247 [ALC861VD_LENOVO] = "lenovo",
15248 [ALC861VD_DALLAS] = "dallas",
15249 [ALC861VD_HP] = "hp",
15250 [ALC861VD_AUTO] = "auto",
15253 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
15254 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
15255 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
15256 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
15257 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
15258 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
15259 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
15260 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
15261 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
15262 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
15263 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
15264 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
15265 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
15266 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
15267 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
15268 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
15272 static struct alc_config_preset alc861vd_presets[] = {
15274 .mixers = { alc861vd_3st_mixer },
15275 .init_verbs = { alc861vd_volume_init_verbs,
15276 alc861vd_3stack_init_verbs },
15277 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15278 .dac_nids = alc660vd_dac_nids,
15279 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15280 .channel_mode = alc861vd_3stack_2ch_modes,
15281 .input_mux = &alc861vd_capture_source,
15283 [ALC660VD_3ST_DIG] = {
15284 .mixers = { alc861vd_3st_mixer },
15285 .init_verbs = { alc861vd_volume_init_verbs,
15286 alc861vd_3stack_init_verbs },
15287 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15288 .dac_nids = alc660vd_dac_nids,
15289 .dig_out_nid = ALC861VD_DIGOUT_NID,
15290 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15291 .channel_mode = alc861vd_3stack_2ch_modes,
15292 .input_mux = &alc861vd_capture_source,
15295 .mixers = { alc861vd_3st_mixer },
15296 .init_verbs = { alc861vd_volume_init_verbs,
15297 alc861vd_3stack_init_verbs },
15298 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15299 .dac_nids = alc861vd_dac_nids,
15300 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15301 .channel_mode = alc861vd_3stack_2ch_modes,
15302 .input_mux = &alc861vd_capture_source,
15304 [ALC861VD_3ST_DIG] = {
15305 .mixers = { alc861vd_3st_mixer },
15306 .init_verbs = { alc861vd_volume_init_verbs,
15307 alc861vd_3stack_init_verbs },
15308 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15309 .dac_nids = alc861vd_dac_nids,
15310 .dig_out_nid = ALC861VD_DIGOUT_NID,
15311 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15312 .channel_mode = alc861vd_3stack_2ch_modes,
15313 .input_mux = &alc861vd_capture_source,
15315 [ALC861VD_6ST_DIG] = {
15316 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
15317 .init_verbs = { alc861vd_volume_init_verbs,
15318 alc861vd_6stack_init_verbs },
15319 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15320 .dac_nids = alc861vd_dac_nids,
15321 .dig_out_nid = ALC861VD_DIGOUT_NID,
15322 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
15323 .channel_mode = alc861vd_6stack_modes,
15324 .input_mux = &alc861vd_capture_source,
15326 [ALC861VD_LENOVO] = {
15327 .mixers = { alc861vd_lenovo_mixer },
15328 .init_verbs = { alc861vd_volume_init_verbs,
15329 alc861vd_3stack_init_verbs,
15330 alc861vd_eapd_verbs,
15331 alc861vd_lenovo_unsol_verbs },
15332 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15333 .dac_nids = alc660vd_dac_nids,
15334 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15335 .channel_mode = alc861vd_3stack_2ch_modes,
15336 .input_mux = &alc861vd_capture_source,
15337 .unsol_event = alc861vd_lenovo_unsol_event,
15338 .setup = alc861vd_lenovo_setup,
15339 .init_hook = alc861vd_lenovo_init_hook,
15341 [ALC861VD_DALLAS] = {
15342 .mixers = { alc861vd_dallas_mixer },
15343 .init_verbs = { alc861vd_dallas_verbs },
15344 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15345 .dac_nids = alc861vd_dac_nids,
15346 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15347 .channel_mode = alc861vd_3stack_2ch_modes,
15348 .input_mux = &alc861vd_dallas_capture_source,
15349 .unsol_event = alc_automute_amp_unsol_event,
15350 .setup = alc861vd_dallas_setup,
15351 .init_hook = alc_automute_amp,
15354 .mixers = { alc861vd_hp_mixer },
15355 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
15356 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15357 .dac_nids = alc861vd_dac_nids,
15358 .dig_out_nid = ALC861VD_DIGOUT_NID,
15359 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15360 .channel_mode = alc861vd_3stack_2ch_modes,
15361 .input_mux = &alc861vd_hp_capture_source,
15362 .unsol_event = alc_automute_amp_unsol_event,
15363 .setup = alc861vd_dallas_setup,
15364 .init_hook = alc_automute_amp,
15366 [ALC660VD_ASUS_V1S] = {
15367 .mixers = { alc861vd_lenovo_mixer },
15368 .init_verbs = { alc861vd_volume_init_verbs,
15369 alc861vd_3stack_init_verbs,
15370 alc861vd_eapd_verbs,
15371 alc861vd_lenovo_unsol_verbs },
15372 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15373 .dac_nids = alc660vd_dac_nids,
15374 .dig_out_nid = ALC861VD_DIGOUT_NID,
15375 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15376 .channel_mode = alc861vd_3stack_2ch_modes,
15377 .input_mux = &alc861vd_capture_source,
15378 .unsol_event = alc861vd_lenovo_unsol_event,
15379 .setup = alc861vd_lenovo_setup,
15380 .init_hook = alc861vd_lenovo_init_hook,
15385 * BIOS auto configuration
15387 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
15388 const struct auto_pin_cfg *cfg)
15390 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0);
15394 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
15395 hda_nid_t nid, int pin_type, int dac_idx)
15397 alc_set_pin_output(codec, nid, pin_type);
15400 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
15402 struct alc_spec *spec = codec->spec;
15405 for (i = 0; i <= HDA_SIDE; i++) {
15406 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15407 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15409 alc861vd_auto_set_output_and_unmute(codec, nid,
15415 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
15417 struct alc_spec *spec = codec->spec;
15420 pin = spec->autocfg.hp_pins[0];
15421 if (pin) /* connect to front and use dac 0 */
15422 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
15423 pin = spec->autocfg.speaker_pins[0];
15425 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
15428 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
15430 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
15432 struct alc_spec *spec = codec->spec;
15435 for (i = 0; i < AUTO_PIN_LAST; i++) {
15436 hda_nid_t nid = spec->autocfg.input_pins[i];
15437 if (alc_is_input_pin(codec, nid)) {
15438 alc_set_input_pin(codec, nid, i);
15439 if (nid != ALC861VD_PIN_CD_NID &&
15440 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
15441 snd_hda_codec_write(codec, nid, 0,
15442 AC_VERB_SET_AMP_GAIN_MUTE,
15448 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
15450 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
15451 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
15453 /* add playback controls from the parsed DAC table */
15454 /* Based on ALC880 version. But ALC861VD has separate,
15455 * different NIDs for mute/unmute switch and volume control */
15456 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
15457 const struct auto_pin_cfg *cfg)
15459 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
15460 hda_nid_t nid_v, nid_s;
15463 for (i = 0; i < cfg->line_outs; i++) {
15464 if (!spec->multiout.dac_nids[i])
15466 nid_v = alc861vd_idx_to_mixer_vol(
15468 spec->multiout.dac_nids[i]));
15469 nid_s = alc861vd_idx_to_mixer_switch(
15471 spec->multiout.dac_nids[i]));
15475 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
15477 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
15481 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
15483 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
15487 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
15489 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
15493 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
15495 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
15501 if (cfg->line_outs == 1 &&
15502 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
15509 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
15510 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
15514 if (cfg->line_outs == 1 &&
15515 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
15517 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
15518 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
15527 /* add playback controls for speaker and HP outputs */
15528 /* Based on ALC880 version. But ALC861VD has separate,
15529 * different NIDs for mute/unmute switch and volume control */
15530 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
15531 hda_nid_t pin, const char *pfx)
15533 hda_nid_t nid_v, nid_s;
15539 if (alc880_is_fixed_pin(pin)) {
15540 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
15541 /* specify the DAC as the extra output */
15542 if (!spec->multiout.hp_nid)
15543 spec->multiout.hp_nid = nid_v;
15545 spec->multiout.extra_out_nid[0] = nid_v;
15546 /* control HP volume/switch on the output mixer amp */
15547 nid_v = alc861vd_idx_to_mixer_vol(
15548 alc880_fixed_pin_idx(pin));
15549 nid_s = alc861vd_idx_to_mixer_switch(
15550 alc880_fixed_pin_idx(pin));
15552 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
15553 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
15556 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
15557 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
15560 } else if (alc880_is_multi_pin(pin)) {
15561 /* set manual connection */
15562 /* we have only a switch on HP-out PIN */
15563 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
15564 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
15571 /* parse the BIOS configuration and set up the alc_spec
15572 * return 1 if successful, 0 if the proper config is not found,
15573 * or a negative error code
15574 * Based on ALC880 version - had to change it to override
15575 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
15576 static int alc861vd_parse_auto_config(struct hda_codec *codec)
15578 struct alc_spec *spec = codec->spec;
15580 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
15582 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15586 if (!spec->autocfg.line_outs)
15587 return 0; /* can't find valid BIOS pin config */
15589 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
15592 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
15595 err = alc861vd_auto_create_extra_out(spec,
15596 spec->autocfg.speaker_pins[0],
15600 err = alc861vd_auto_create_extra_out(spec,
15601 spec->autocfg.hp_pins[0],
15605 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
15609 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15611 if (spec->autocfg.dig_outs)
15612 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
15614 if (spec->kctls.list)
15615 add_mixer(spec, spec->kctls.list);
15617 add_verb(spec, alc861vd_volume_init_verbs);
15619 spec->num_mux_defs = 1;
15620 spec->input_mux = &spec->private_imux[0];
15622 err = alc_auto_add_mic_boost(codec);
15626 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
15631 /* additional initialization for auto-configuration model */
15632 static void alc861vd_auto_init(struct hda_codec *codec)
15634 struct alc_spec *spec = codec->spec;
15635 alc861vd_auto_init_multi_out(codec);
15636 alc861vd_auto_init_hp_out(codec);
15637 alc861vd_auto_init_analog_input(codec);
15638 alc861vd_auto_init_input_src(codec);
15639 if (spec->unsol_event)
15640 alc_inithook(codec);
15644 ALC660VD_FIX_ASUS_GPIO1
15648 static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = {
15649 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
15650 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
15651 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
15655 static const struct alc_fixup alc861vd_fixups[] = {
15656 [ALC660VD_FIX_ASUS_GPIO1] = {
15657 .verbs = alc660vd_fix_asus_gpio1_verbs,
15661 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
15662 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
15666 static int patch_alc861vd(struct hda_codec *codec)
15668 struct alc_spec *spec;
15669 int err, board_config;
15671 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15675 codec->spec = spec;
15677 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
15681 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
15682 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15684 board_config = ALC861VD_AUTO;
15687 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups);
15689 if (board_config == ALC861VD_AUTO) {
15690 /* automatic parse from the BIOS config */
15691 err = alc861vd_parse_auto_config(codec);
15697 "hda_codec: Cannot set up configuration "
15698 "from BIOS. Using base mode...\n");
15699 board_config = ALC861VD_3ST;
15703 err = snd_hda_attach_beep_device(codec, 0x23);
15709 if (board_config != ALC861VD_AUTO)
15710 setup_preset(codec, &alc861vd_presets[board_config]);
15712 if (codec->vendor_id == 0x10ec0660) {
15713 /* always turn on EAPD */
15714 add_verb(spec, alc660vd_eapd_verbs);
15717 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
15718 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
15720 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
15721 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
15723 if (!spec->adc_nids) {
15724 spec->adc_nids = alc861vd_adc_nids;
15725 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
15727 if (!spec->capsrc_nids)
15728 spec->capsrc_nids = alc861vd_capsrc_nids;
15730 set_capture_mixer(codec);
15731 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
15733 spec->vmaster_nid = 0x02;
15735 codec->patch_ops = alc_patch_ops;
15737 if (board_config == ALC861VD_AUTO)
15738 spec->init_hook = alc861vd_auto_init;
15739 #ifdef CONFIG_SND_HDA_POWER_SAVE
15740 if (!spec->loopback.amplist)
15741 spec->loopback.amplist = alc861vd_loopbacks;
15743 codec->proc_widget_hook = print_realtek_coef;
15751 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
15752 * configuration. Each pin widget can choose any input DACs and a mixer.
15753 * Each ADC is connected from a mixer of all inputs. This makes possible
15754 * 6-channel independent captures.
15756 * In addition, an independent DAC for the multi-playback (not used in this
15759 #define ALC662_DIGOUT_NID 0x06
15760 #define ALC662_DIGIN_NID 0x0a
15762 static hda_nid_t alc662_dac_nids[4] = {
15763 /* front, rear, clfe, rear_surr */
15767 static hda_nid_t alc272_dac_nids[2] = {
15771 static hda_nid_t alc662_adc_nids[2] = {
15776 static hda_nid_t alc272_adc_nids[1] = {
15781 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
15782 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
15786 /* FIXME: should be a matrix-type input source selection */
15787 static struct hda_input_mux alc662_capture_source = {
15791 { "Front Mic", 0x1 },
15797 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
15805 static struct hda_input_mux alc663_capture_source = {
15809 { "Front Mic", 0x1 },
15814 #if 0 /* set to 1 for testing other input sources below */
15815 static struct hda_input_mux alc272_nc10_capture_source = {
15818 { "Autoselect Mic", 0x0 },
15819 { "Internal Mic", 0x1 },
15820 { "In-0x02", 0x2 },
15821 { "In-0x03", 0x3 },
15822 { "In-0x04", 0x4 },
15823 { "In-0x05", 0x5 },
15824 { "In-0x06", 0x6 },
15825 { "In-0x07", 0x7 },
15826 { "In-0x08", 0x8 },
15827 { "In-0x09", 0x9 },
15828 { "In-0x0a", 0x0a },
15829 { "In-0x0b", 0x0b },
15830 { "In-0x0c", 0x0c },
15831 { "In-0x0d", 0x0d },
15832 { "In-0x0e", 0x0e },
15833 { "In-0x0f", 0x0f },
15841 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
15848 static struct hda_verb alc662_3ST_ch2_init[] = {
15849 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
15850 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15851 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
15852 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15859 static struct hda_verb alc662_3ST_ch6_init[] = {
15860 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15861 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15862 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
15863 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15864 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15865 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
15869 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
15870 { 2, alc662_3ST_ch2_init },
15871 { 6, alc662_3ST_ch6_init },
15877 static struct hda_verb alc662_sixstack_ch6_init[] = {
15878 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15879 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15880 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15887 static struct hda_verb alc662_sixstack_ch8_init[] = {
15888 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15889 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15890 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15894 static struct hda_channel_mode alc662_5stack_modes[2] = {
15895 { 2, alc662_sixstack_ch6_init },
15896 { 6, alc662_sixstack_ch8_init },
15899 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15900 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15903 static struct snd_kcontrol_new alc662_base_mixer[] = {
15904 /* output mixer control */
15905 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
15906 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15907 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
15908 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15909 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15910 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15911 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15912 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15913 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15915 /*Input mixer control */
15916 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
15917 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
15918 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
15919 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
15920 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
15921 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
15922 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
15923 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
15927 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
15928 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15929 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15930 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15931 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15932 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15933 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15934 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15935 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15936 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15937 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15938 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15942 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
15943 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15944 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15945 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15946 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15947 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15948 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15949 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15950 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15951 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15952 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15953 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15954 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15955 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15956 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15957 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15958 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15959 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15963 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
15964 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15965 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
15966 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15967 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
15968 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15969 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15970 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15971 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15972 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15976 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
15977 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15978 ALC262_HIPPO_MASTER_SWITCH,
15980 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
15981 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15982 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15984 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15985 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15986 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15990 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
15991 ALC262_HIPPO_MASTER_SWITCH,
15992 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15993 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15994 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15995 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15996 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
15997 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15998 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15999 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16000 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16004 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
16005 .ops = &snd_hda_bind_vol,
16007 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16008 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
16013 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
16014 .ops = &snd_hda_bind_sw,
16016 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16017 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16022 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
16023 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16024 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
16025 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16026 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16030 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
16031 .ops = &snd_hda_bind_sw,
16033 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16034 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16035 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16040 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
16041 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16042 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
16043 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16044 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16045 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16046 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16051 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
16052 .ops = &snd_hda_bind_sw,
16054 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16055 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16056 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16061 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
16062 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16063 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
16064 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16065 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16066 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16067 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16071 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
16072 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16073 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16074 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16075 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16076 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16077 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16078 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16082 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
16083 .ops = &snd_hda_bind_vol,
16085 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16086 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
16091 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
16092 .ops = &snd_hda_bind_sw,
16094 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16095 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
16100 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
16101 HDA_BIND_VOL("Master Playback Volume",
16102 &alc663_asus_two_bind_master_vol),
16103 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16104 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16105 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16106 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16107 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16111 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
16112 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16113 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16114 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16115 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16116 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16117 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16121 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
16122 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16123 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16124 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16125 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16126 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16128 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16129 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16130 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16131 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16135 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
16136 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16137 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16138 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16140 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16141 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16142 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16143 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16144 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16145 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16149 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
16151 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16152 .name = "Channel Mode",
16153 .info = alc_ch_mode_info,
16154 .get = alc_ch_mode_get,
16155 .put = alc_ch_mode_put,
16160 static struct hda_verb alc662_init_verbs[] = {
16161 /* ADC: mute amp left and right */
16162 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16163 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16164 /* Front mixer: unmute input/output amp left and right (volume = 0) */
16166 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16167 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16168 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16169 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16170 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16172 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16173 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16174 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16175 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16176 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16177 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16179 /* Front Pin: output 0 (0x0c) */
16180 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16181 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16183 /* Rear Pin: output 1 (0x0d) */
16184 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16185 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16187 /* CLFE Pin: output 2 (0x0e) */
16188 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16189 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16191 /* Mic (rear) pin: input vref at 80% */
16192 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16193 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16194 /* Front Mic pin: input vref at 80% */
16195 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16196 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16197 /* Line In pin: input */
16198 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16199 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16200 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16201 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16202 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16203 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16204 /* CD pin widget for input */
16205 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16207 /* FIXME: use matrix-type input source selection */
16208 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16210 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16211 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16213 /* always trun on EAPD */
16214 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16215 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16220 static struct hda_verb alc662_sue_init_verbs[] = {
16221 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16222 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16226 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
16227 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16228 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16232 /* Set Unsolicited Event*/
16233 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
16234 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16235 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16240 * generic initialization of ADC, input mixers and output mixers
16242 static struct hda_verb alc662_auto_init_verbs[] = {
16244 * Unmute ADC and set the default input to mic-in
16246 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16247 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16249 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
16251 * Note: PASD motherboards uses the Line In 2 as the input for front
16252 * panel mic (mic 2)
16254 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16255 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16256 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16257 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16258 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16259 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16262 * Set up output mixers (0x0c - 0x0f)
16264 /* set vol=0 to output mixers */
16265 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16266 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16267 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16269 /* set up input amps for analog loopback */
16270 /* Amp Indices: DAC = 0, mixer = 1 */
16271 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16272 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16273 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16274 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16275 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16276 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16279 /* FIXME: use matrix-type input source selection */
16280 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16282 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16283 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16287 /* additional verbs for ALC663 */
16288 static struct hda_verb alc663_auto_init_verbs[] = {
16289 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16290 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16294 static struct hda_verb alc663_m51va_init_verbs[] = {
16295 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16296 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16297 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16298 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16299 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16300 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16301 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16302 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16303 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16307 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
16308 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16309 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16310 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16311 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16312 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16313 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16314 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16318 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
16319 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16320 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16321 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16322 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16323 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16324 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16325 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16326 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16330 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
16331 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16332 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16333 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16334 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16335 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16336 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16337 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16341 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
16342 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16343 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16344 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16345 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16346 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16347 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16348 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16349 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16350 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16351 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16352 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16353 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16357 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
16358 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16359 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16360 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16361 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16362 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16363 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16364 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16365 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16366 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16367 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16368 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16369 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16373 static struct hda_verb alc663_g71v_init_verbs[] = {
16374 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16375 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
16376 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
16378 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16379 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16380 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16382 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16383 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
16384 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16388 static struct hda_verb alc663_g50v_init_verbs[] = {
16389 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16390 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16391 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16393 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16394 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16398 static struct hda_verb alc662_ecs_init_verbs[] = {
16399 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
16400 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16401 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16402 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16406 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
16407 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16408 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16409 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16410 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16411 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16412 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16413 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16414 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16415 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16416 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16417 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16421 static struct hda_verb alc272_dell_init_verbs[] = {
16422 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16423 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16424 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16425 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16426 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16427 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16428 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16429 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16430 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16431 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16432 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16436 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
16437 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
16438 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
16442 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
16443 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
16444 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
16448 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
16450 unsigned int present;
16451 unsigned char bits;
16453 present = snd_hda_jack_detect(codec, 0x14);
16454 bits = present ? HDA_AMP_MUTE : 0;
16456 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16457 HDA_AMP_MUTE, bits);
16460 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
16462 unsigned int present;
16463 unsigned char bits;
16465 present = snd_hda_jack_detect(codec, 0x1b);
16466 bits = present ? HDA_AMP_MUTE : 0;
16468 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16469 HDA_AMP_MUTE, bits);
16470 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16471 HDA_AMP_MUTE, bits);
16474 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
16477 if ((res >> 26) == ALC880_HP_EVENT)
16478 alc662_lenovo_101e_all_automute(codec);
16479 if ((res >> 26) == ALC880_FRONT_EVENT)
16480 alc662_lenovo_101e_ispeaker_automute(codec);
16483 /* unsolicited event for HP jack sensing */
16484 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
16487 if ((res >> 26) == ALC880_MIC_EVENT)
16488 alc_mic_automute(codec);
16490 alc262_hippo_unsol_event(codec, res);
16493 static void alc662_eeepc_setup(struct hda_codec *codec)
16495 struct alc_spec *spec = codec->spec;
16497 alc262_hippo1_setup(codec);
16498 spec->ext_mic.pin = 0x18;
16499 spec->ext_mic.mux_idx = 0;
16500 spec->int_mic.pin = 0x19;
16501 spec->int_mic.mux_idx = 1;
16502 spec->auto_mic = 1;
16505 static void alc662_eeepc_inithook(struct hda_codec *codec)
16507 alc262_hippo_automute(codec);
16508 alc_mic_automute(codec);
16511 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
16513 struct alc_spec *spec = codec->spec;
16515 spec->autocfg.hp_pins[0] = 0x14;
16516 spec->autocfg.speaker_pins[0] = 0x1b;
16519 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
16521 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
16523 unsigned int present;
16524 unsigned char bits;
16526 present = snd_hda_jack_detect(codec, 0x21);
16527 bits = present ? HDA_AMP_MUTE : 0;
16528 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16529 AMP_IN_MUTE(0), bits);
16530 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16531 AMP_IN_MUTE(0), bits);
16534 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
16536 unsigned int present;
16537 unsigned char bits;
16539 present = snd_hda_jack_detect(codec, 0x21);
16540 bits = present ? HDA_AMP_MUTE : 0;
16541 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16542 AMP_IN_MUTE(0), bits);
16543 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16544 AMP_IN_MUTE(0), bits);
16545 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16546 AMP_IN_MUTE(0), bits);
16547 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16548 AMP_IN_MUTE(0), bits);
16551 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
16553 unsigned int present;
16554 unsigned char bits;
16556 present = snd_hda_jack_detect(codec, 0x15);
16557 bits = present ? HDA_AMP_MUTE : 0;
16558 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16559 AMP_IN_MUTE(0), bits);
16560 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16561 AMP_IN_MUTE(0), bits);
16562 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16563 AMP_IN_MUTE(0), bits);
16564 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16565 AMP_IN_MUTE(0), bits);
16568 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
16570 unsigned int present;
16571 unsigned char bits;
16573 present = snd_hda_jack_detect(codec, 0x1b);
16574 bits = present ? 0 : PIN_OUT;
16575 snd_hda_codec_write(codec, 0x14, 0,
16576 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
16579 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
16581 unsigned int present1, present2;
16583 present1 = snd_hda_jack_detect(codec, 0x21);
16584 present2 = snd_hda_jack_detect(codec, 0x15);
16586 if (present1 || present2) {
16587 snd_hda_codec_write_cache(codec, 0x14, 0,
16588 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16590 snd_hda_codec_write_cache(codec, 0x14, 0,
16591 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16595 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
16597 unsigned int present1, present2;
16599 present1 = snd_hda_jack_detect(codec, 0x1b);
16600 present2 = snd_hda_jack_detect(codec, 0x15);
16602 if (present1 || present2) {
16603 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16604 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16605 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16606 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16608 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16609 AMP_IN_MUTE(0), 0);
16610 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16611 AMP_IN_MUTE(0), 0);
16615 static void alc663_m51va_unsol_event(struct hda_codec *codec,
16618 switch (res >> 26) {
16619 case ALC880_HP_EVENT:
16620 alc663_m51va_speaker_automute(codec);
16622 case ALC880_MIC_EVENT:
16623 alc_mic_automute(codec);
16628 static void alc663_m51va_setup(struct hda_codec *codec)
16630 struct alc_spec *spec = codec->spec;
16631 spec->ext_mic.pin = 0x18;
16632 spec->ext_mic.mux_idx = 0;
16633 spec->int_mic.pin = 0x12;
16634 spec->int_mic.mux_idx = 1;
16635 spec->auto_mic = 1;
16638 static void alc663_m51va_inithook(struct hda_codec *codec)
16640 alc663_m51va_speaker_automute(codec);
16641 alc_mic_automute(codec);
16644 /* ***************** Mode1 ******************************/
16645 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
16646 #define alc663_mode1_setup alc663_m51va_setup
16647 #define alc663_mode1_inithook alc663_m51va_inithook
16649 /* ***************** Mode2 ******************************/
16650 static void alc662_mode2_unsol_event(struct hda_codec *codec,
16653 switch (res >> 26) {
16654 case ALC880_HP_EVENT:
16655 alc662_f5z_speaker_automute(codec);
16657 case ALC880_MIC_EVENT:
16658 alc_mic_automute(codec);
16663 #define alc662_mode2_setup alc663_m51va_setup
16665 static void alc662_mode2_inithook(struct hda_codec *codec)
16667 alc662_f5z_speaker_automute(codec);
16668 alc_mic_automute(codec);
16670 /* ***************** Mode3 ******************************/
16671 static void alc663_mode3_unsol_event(struct hda_codec *codec,
16674 switch (res >> 26) {
16675 case ALC880_HP_EVENT:
16676 alc663_two_hp_m1_speaker_automute(codec);
16678 case ALC880_MIC_EVENT:
16679 alc_mic_automute(codec);
16684 #define alc663_mode3_setup alc663_m51va_setup
16686 static void alc663_mode3_inithook(struct hda_codec *codec)
16688 alc663_two_hp_m1_speaker_automute(codec);
16689 alc_mic_automute(codec);
16691 /* ***************** Mode4 ******************************/
16692 static void alc663_mode4_unsol_event(struct hda_codec *codec,
16695 switch (res >> 26) {
16696 case ALC880_HP_EVENT:
16697 alc663_21jd_two_speaker_automute(codec);
16699 case ALC880_MIC_EVENT:
16700 alc_mic_automute(codec);
16705 #define alc663_mode4_setup alc663_m51va_setup
16707 static void alc663_mode4_inithook(struct hda_codec *codec)
16709 alc663_21jd_two_speaker_automute(codec);
16710 alc_mic_automute(codec);
16712 /* ***************** Mode5 ******************************/
16713 static void alc663_mode5_unsol_event(struct hda_codec *codec,
16716 switch (res >> 26) {
16717 case ALC880_HP_EVENT:
16718 alc663_15jd_two_speaker_automute(codec);
16720 case ALC880_MIC_EVENT:
16721 alc_mic_automute(codec);
16726 #define alc663_mode5_setup alc663_m51va_setup
16728 static void alc663_mode5_inithook(struct hda_codec *codec)
16730 alc663_15jd_two_speaker_automute(codec);
16731 alc_mic_automute(codec);
16733 /* ***************** Mode6 ******************************/
16734 static void alc663_mode6_unsol_event(struct hda_codec *codec,
16737 switch (res >> 26) {
16738 case ALC880_HP_EVENT:
16739 alc663_two_hp_m2_speaker_automute(codec);
16741 case ALC880_MIC_EVENT:
16742 alc_mic_automute(codec);
16747 #define alc663_mode6_setup alc663_m51va_setup
16749 static void alc663_mode6_inithook(struct hda_codec *codec)
16751 alc663_two_hp_m2_speaker_automute(codec);
16752 alc_mic_automute(codec);
16755 static void alc663_g71v_hp_automute(struct hda_codec *codec)
16757 unsigned int present;
16758 unsigned char bits;
16760 present = snd_hda_jack_detect(codec, 0x21);
16761 bits = present ? HDA_AMP_MUTE : 0;
16762 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16763 HDA_AMP_MUTE, bits);
16764 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16765 HDA_AMP_MUTE, bits);
16768 static void alc663_g71v_front_automute(struct hda_codec *codec)
16770 unsigned int present;
16771 unsigned char bits;
16773 present = snd_hda_jack_detect(codec, 0x15);
16774 bits = present ? HDA_AMP_MUTE : 0;
16775 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16776 HDA_AMP_MUTE, bits);
16779 static void alc663_g71v_unsol_event(struct hda_codec *codec,
16782 switch (res >> 26) {
16783 case ALC880_HP_EVENT:
16784 alc663_g71v_hp_automute(codec);
16786 case ALC880_FRONT_EVENT:
16787 alc663_g71v_front_automute(codec);
16789 case ALC880_MIC_EVENT:
16790 alc_mic_automute(codec);
16795 #define alc663_g71v_setup alc663_m51va_setup
16797 static void alc663_g71v_inithook(struct hda_codec *codec)
16799 alc663_g71v_front_automute(codec);
16800 alc663_g71v_hp_automute(codec);
16801 alc_mic_automute(codec);
16804 static void alc663_g50v_unsol_event(struct hda_codec *codec,
16807 switch (res >> 26) {
16808 case ALC880_HP_EVENT:
16809 alc663_m51va_speaker_automute(codec);
16811 case ALC880_MIC_EVENT:
16812 alc_mic_automute(codec);
16817 #define alc663_g50v_setup alc663_m51va_setup
16819 static void alc663_g50v_inithook(struct hda_codec *codec)
16821 alc663_m51va_speaker_automute(codec);
16822 alc_mic_automute(codec);
16825 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
16826 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16827 ALC262_HIPPO_MASTER_SWITCH,
16829 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
16830 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
16831 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
16833 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16834 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16835 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16839 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
16840 /* Master Playback automatically created from Speaker and Headphone */
16841 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16842 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16843 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16844 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16846 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16847 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16848 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
16850 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16851 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16852 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
16856 #ifdef CONFIG_SND_HDA_POWER_SAVE
16857 #define alc662_loopbacks alc880_loopbacks
16861 /* pcm configuration: identical with ALC880 */
16862 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
16863 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
16864 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
16865 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
16868 * configuration and preset
16870 static const char *alc662_models[ALC662_MODEL_LAST] = {
16871 [ALC662_3ST_2ch_DIG] = "3stack-dig",
16872 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
16873 [ALC662_3ST_6ch] = "3stack-6ch",
16874 [ALC662_5ST_DIG] = "6stack-dig",
16875 [ALC662_LENOVO_101E] = "lenovo-101e",
16876 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
16877 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
16878 [ALC662_ECS] = "ecs",
16879 [ALC663_ASUS_M51VA] = "m51va",
16880 [ALC663_ASUS_G71V] = "g71v",
16881 [ALC663_ASUS_H13] = "h13",
16882 [ALC663_ASUS_G50V] = "g50v",
16883 [ALC663_ASUS_MODE1] = "asus-mode1",
16884 [ALC662_ASUS_MODE2] = "asus-mode2",
16885 [ALC663_ASUS_MODE3] = "asus-mode3",
16886 [ALC663_ASUS_MODE4] = "asus-mode4",
16887 [ALC663_ASUS_MODE5] = "asus-mode5",
16888 [ALC663_ASUS_MODE6] = "asus-mode6",
16889 [ALC272_DELL] = "dell",
16890 [ALC272_DELL_ZM1] = "dell-zm1",
16891 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
16892 [ALC662_AUTO] = "auto",
16895 static struct snd_pci_quirk alc662_cfg_tbl[] = {
16896 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
16897 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
16898 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
16899 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
16900 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
16901 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
16902 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
16903 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
16904 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
16905 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
16906 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
16907 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
16908 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
16909 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
16910 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
16911 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
16912 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
16913 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
16914 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
16915 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
16916 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
16917 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
16918 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
16919 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
16920 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
16921 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
16922 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
16923 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
16924 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
16925 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
16926 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
16927 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
16928 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
16929 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
16930 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
16931 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
16932 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
16933 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
16934 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
16935 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
16936 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
16937 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
16938 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
16939 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
16940 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
16941 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
16942 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
16943 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
16944 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
16945 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
16946 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
16947 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
16948 ALC662_3ST_6ch_DIG),
16949 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB200", ALC663_ASUS_MODE4),
16950 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
16951 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
16952 ALC662_3ST_6ch_DIG),
16953 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
16954 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
16955 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
16956 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
16957 ALC662_3ST_6ch_DIG),
16958 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
16963 static struct alc_config_preset alc662_presets[] = {
16964 [ALC662_3ST_2ch_DIG] = {
16965 .mixers = { alc662_3ST_2ch_mixer },
16966 .init_verbs = { alc662_init_verbs },
16967 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16968 .dac_nids = alc662_dac_nids,
16969 .dig_out_nid = ALC662_DIGOUT_NID,
16970 .dig_in_nid = ALC662_DIGIN_NID,
16971 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16972 .channel_mode = alc662_3ST_2ch_modes,
16973 .input_mux = &alc662_capture_source,
16975 [ALC662_3ST_6ch_DIG] = {
16976 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16977 .init_verbs = { alc662_init_verbs },
16978 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16979 .dac_nids = alc662_dac_nids,
16980 .dig_out_nid = ALC662_DIGOUT_NID,
16981 .dig_in_nid = ALC662_DIGIN_NID,
16982 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16983 .channel_mode = alc662_3ST_6ch_modes,
16985 .input_mux = &alc662_capture_source,
16987 [ALC662_3ST_6ch] = {
16988 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16989 .init_verbs = { alc662_init_verbs },
16990 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16991 .dac_nids = alc662_dac_nids,
16992 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16993 .channel_mode = alc662_3ST_6ch_modes,
16995 .input_mux = &alc662_capture_source,
16997 [ALC662_5ST_DIG] = {
16998 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
16999 .init_verbs = { alc662_init_verbs },
17000 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17001 .dac_nids = alc662_dac_nids,
17002 .dig_out_nid = ALC662_DIGOUT_NID,
17003 .dig_in_nid = ALC662_DIGIN_NID,
17004 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
17005 .channel_mode = alc662_5stack_modes,
17006 .input_mux = &alc662_capture_source,
17008 [ALC662_LENOVO_101E] = {
17009 .mixers = { alc662_lenovo_101e_mixer },
17010 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
17011 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17012 .dac_nids = alc662_dac_nids,
17013 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17014 .channel_mode = alc662_3ST_2ch_modes,
17015 .input_mux = &alc662_lenovo_101e_capture_source,
17016 .unsol_event = alc662_lenovo_101e_unsol_event,
17017 .init_hook = alc662_lenovo_101e_all_automute,
17019 [ALC662_ASUS_EEEPC_P701] = {
17020 .mixers = { alc662_eeepc_p701_mixer },
17021 .init_verbs = { alc662_init_verbs,
17022 alc662_eeepc_sue_init_verbs },
17023 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17024 .dac_nids = alc662_dac_nids,
17025 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17026 .channel_mode = alc662_3ST_2ch_modes,
17027 .unsol_event = alc662_eeepc_unsol_event,
17028 .setup = alc662_eeepc_setup,
17029 .init_hook = alc662_eeepc_inithook,
17031 [ALC662_ASUS_EEEPC_EP20] = {
17032 .mixers = { alc662_eeepc_ep20_mixer,
17033 alc662_chmode_mixer },
17034 .init_verbs = { alc662_init_verbs,
17035 alc662_eeepc_ep20_sue_init_verbs },
17036 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17037 .dac_nids = alc662_dac_nids,
17038 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17039 .channel_mode = alc662_3ST_6ch_modes,
17040 .input_mux = &alc662_lenovo_101e_capture_source,
17041 .unsol_event = alc662_eeepc_unsol_event,
17042 .setup = alc662_eeepc_ep20_setup,
17043 .init_hook = alc662_eeepc_ep20_inithook,
17046 .mixers = { alc662_ecs_mixer },
17047 .init_verbs = { alc662_init_verbs,
17048 alc662_ecs_init_verbs },
17049 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17050 .dac_nids = alc662_dac_nids,
17051 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17052 .channel_mode = alc662_3ST_2ch_modes,
17053 .unsol_event = alc662_eeepc_unsol_event,
17054 .setup = alc662_eeepc_setup,
17055 .init_hook = alc662_eeepc_inithook,
17057 [ALC663_ASUS_M51VA] = {
17058 .mixers = { alc663_m51va_mixer },
17059 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17060 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17061 .dac_nids = alc662_dac_nids,
17062 .dig_out_nid = ALC662_DIGOUT_NID,
17063 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17064 .channel_mode = alc662_3ST_2ch_modes,
17065 .unsol_event = alc663_m51va_unsol_event,
17066 .setup = alc663_m51va_setup,
17067 .init_hook = alc663_m51va_inithook,
17069 [ALC663_ASUS_G71V] = {
17070 .mixers = { alc663_g71v_mixer },
17071 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
17072 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17073 .dac_nids = alc662_dac_nids,
17074 .dig_out_nid = ALC662_DIGOUT_NID,
17075 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17076 .channel_mode = alc662_3ST_2ch_modes,
17077 .unsol_event = alc663_g71v_unsol_event,
17078 .setup = alc663_g71v_setup,
17079 .init_hook = alc663_g71v_inithook,
17081 [ALC663_ASUS_H13] = {
17082 .mixers = { alc663_m51va_mixer },
17083 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17084 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17085 .dac_nids = alc662_dac_nids,
17086 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17087 .channel_mode = alc662_3ST_2ch_modes,
17088 .unsol_event = alc663_m51va_unsol_event,
17089 .init_hook = alc663_m51va_inithook,
17091 [ALC663_ASUS_G50V] = {
17092 .mixers = { alc663_g50v_mixer },
17093 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
17094 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17095 .dac_nids = alc662_dac_nids,
17096 .dig_out_nid = ALC662_DIGOUT_NID,
17097 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17098 .channel_mode = alc662_3ST_6ch_modes,
17099 .input_mux = &alc663_capture_source,
17100 .unsol_event = alc663_g50v_unsol_event,
17101 .setup = alc663_g50v_setup,
17102 .init_hook = alc663_g50v_inithook,
17104 [ALC663_ASUS_MODE1] = {
17105 .mixers = { alc663_m51va_mixer },
17106 .cap_mixer = alc662_auto_capture_mixer,
17107 .init_verbs = { alc662_init_verbs,
17108 alc663_21jd_amic_init_verbs },
17109 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17111 .dac_nids = alc662_dac_nids,
17112 .dig_out_nid = ALC662_DIGOUT_NID,
17113 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17114 .channel_mode = alc662_3ST_2ch_modes,
17115 .unsol_event = alc663_mode1_unsol_event,
17116 .setup = alc663_mode1_setup,
17117 .init_hook = alc663_mode1_inithook,
17119 [ALC662_ASUS_MODE2] = {
17120 .mixers = { alc662_1bjd_mixer },
17121 .cap_mixer = alc662_auto_capture_mixer,
17122 .init_verbs = { alc662_init_verbs,
17123 alc662_1bjd_amic_init_verbs },
17124 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17125 .dac_nids = alc662_dac_nids,
17126 .dig_out_nid = ALC662_DIGOUT_NID,
17127 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17128 .channel_mode = alc662_3ST_2ch_modes,
17129 .unsol_event = alc662_mode2_unsol_event,
17130 .setup = alc662_mode2_setup,
17131 .init_hook = alc662_mode2_inithook,
17133 [ALC663_ASUS_MODE3] = {
17134 .mixers = { alc663_two_hp_m1_mixer },
17135 .cap_mixer = alc662_auto_capture_mixer,
17136 .init_verbs = { alc662_init_verbs,
17137 alc663_two_hp_amic_m1_init_verbs },
17138 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17140 .dac_nids = alc662_dac_nids,
17141 .dig_out_nid = ALC662_DIGOUT_NID,
17142 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17143 .channel_mode = alc662_3ST_2ch_modes,
17144 .unsol_event = alc663_mode3_unsol_event,
17145 .setup = alc663_mode3_setup,
17146 .init_hook = alc663_mode3_inithook,
17148 [ALC663_ASUS_MODE4] = {
17149 .mixers = { alc663_asus_21jd_clfe_mixer },
17150 .cap_mixer = alc662_auto_capture_mixer,
17151 .init_verbs = { alc662_init_verbs,
17152 alc663_21jd_amic_init_verbs},
17153 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17155 .dac_nids = alc662_dac_nids,
17156 .dig_out_nid = ALC662_DIGOUT_NID,
17157 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17158 .channel_mode = alc662_3ST_2ch_modes,
17159 .unsol_event = alc663_mode4_unsol_event,
17160 .setup = alc663_mode4_setup,
17161 .init_hook = alc663_mode4_inithook,
17163 [ALC663_ASUS_MODE5] = {
17164 .mixers = { alc663_asus_15jd_clfe_mixer },
17165 .cap_mixer = alc662_auto_capture_mixer,
17166 .init_verbs = { alc662_init_verbs,
17167 alc663_15jd_amic_init_verbs },
17168 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17170 .dac_nids = alc662_dac_nids,
17171 .dig_out_nid = ALC662_DIGOUT_NID,
17172 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17173 .channel_mode = alc662_3ST_2ch_modes,
17174 .unsol_event = alc663_mode5_unsol_event,
17175 .setup = alc663_mode5_setup,
17176 .init_hook = alc663_mode5_inithook,
17178 [ALC663_ASUS_MODE6] = {
17179 .mixers = { alc663_two_hp_m2_mixer },
17180 .cap_mixer = alc662_auto_capture_mixer,
17181 .init_verbs = { alc662_init_verbs,
17182 alc663_two_hp_amic_m2_init_verbs },
17183 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17185 .dac_nids = alc662_dac_nids,
17186 .dig_out_nid = ALC662_DIGOUT_NID,
17187 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17188 .channel_mode = alc662_3ST_2ch_modes,
17189 .unsol_event = alc663_mode6_unsol_event,
17190 .setup = alc663_mode6_setup,
17191 .init_hook = alc663_mode6_inithook,
17194 .mixers = { alc663_m51va_mixer },
17195 .cap_mixer = alc272_auto_capture_mixer,
17196 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
17197 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17198 .dac_nids = alc662_dac_nids,
17199 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17200 .adc_nids = alc272_adc_nids,
17201 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
17202 .capsrc_nids = alc272_capsrc_nids,
17203 .channel_mode = alc662_3ST_2ch_modes,
17204 .unsol_event = alc663_m51va_unsol_event,
17205 .setup = alc663_m51va_setup,
17206 .init_hook = alc663_m51va_inithook,
17208 [ALC272_DELL_ZM1] = {
17209 .mixers = { alc663_m51va_mixer },
17210 .cap_mixer = alc662_auto_capture_mixer,
17211 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
17212 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17213 .dac_nids = alc662_dac_nids,
17214 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17215 .adc_nids = alc662_adc_nids,
17217 .capsrc_nids = alc662_capsrc_nids,
17218 .channel_mode = alc662_3ST_2ch_modes,
17219 .unsol_event = alc663_m51va_unsol_event,
17220 .setup = alc663_m51va_setup,
17221 .init_hook = alc663_m51va_inithook,
17223 [ALC272_SAMSUNG_NC10] = {
17224 .mixers = { alc272_nc10_mixer },
17225 .init_verbs = { alc662_init_verbs,
17226 alc663_21jd_amic_init_verbs },
17227 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17228 .dac_nids = alc272_dac_nids,
17229 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17230 .channel_mode = alc662_3ST_2ch_modes,
17231 /*.input_mux = &alc272_nc10_capture_source,*/
17232 .unsol_event = alc663_mode4_unsol_event,
17233 .setup = alc663_mode4_setup,
17234 .init_hook = alc663_mode4_inithook,
17240 * BIOS auto configuration
17243 /* convert from MIX nid to DAC */
17244 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
17248 else if (nid >= 0x0c && nid <= 0x0e)
17249 return nid - 0x0c + 0x02;
17254 /* get MIX nid connected to the given pin targeted to DAC */
17255 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
17261 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
17262 for (i = 0; i < num; i++) {
17263 if (alc662_mix_to_dac(mix[i]) == dac)
17269 /* look for an empty DAC slot */
17270 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
17272 struct alc_spec *spec = codec->spec;
17276 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
17279 for (i = 0; i < num; i++) {
17280 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
17283 for (j = 0; j < spec->multiout.num_dacs; j++)
17284 if (spec->multiout.dac_nids[j] == nid)
17286 if (j >= spec->multiout.num_dacs)
17292 /* fill in the dac_nids table from the parsed pin configuration */
17293 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
17294 const struct auto_pin_cfg *cfg)
17296 struct alc_spec *spec = codec->spec;
17300 spec->multiout.dac_nids = spec->private_dac_nids;
17301 for (i = 0; i < cfg->line_outs; i++) {
17302 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
17305 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
17310 static inline int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
17311 hda_nid_t nid, unsigned int chs)
17313 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
17314 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
17317 static inline int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
17318 hda_nid_t nid, unsigned int chs)
17320 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17321 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
17324 #define alc662_add_stereo_vol(spec, pfx, nid) \
17325 alc662_add_vol_ctl(spec, pfx, nid, 3)
17326 #define alc662_add_stereo_sw(spec, pfx, nid) \
17327 alc662_add_sw_ctl(spec, pfx, nid, 3)
17329 /* add playback controls from the parsed DAC table */
17330 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
17331 const struct auto_pin_cfg *cfg)
17333 struct alc_spec *spec = codec->spec;
17334 static const char *chname[4] = {
17335 "Front", "Surround", NULL /*CLFE*/, "Side"
17337 hda_nid_t nid, mix;
17340 for (i = 0; i < cfg->line_outs; i++) {
17341 nid = spec->multiout.dac_nids[i];
17344 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
17349 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
17352 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
17355 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
17358 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
17363 if (cfg->line_outs == 1 &&
17364 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
17371 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
17374 if (cfg->line_outs == 1 &&
17375 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
17377 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
17385 /* add playback controls for speaker and HP outputs */
17386 /* return DAC nid if any new DAC is assigned */
17387 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
17390 struct alc_spec *spec = codec->spec;
17391 hda_nid_t nid, mix;
17396 nid = alc662_look_for_dac(codec, pin);
17398 /* the corresponding DAC is already occupied */
17399 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
17400 return 0; /* no way */
17401 /* create a switch only */
17402 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17403 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17406 mix = alc662_dac_to_mix(codec, pin, nid);
17409 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
17412 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
17418 /* create playback/capture controls for input pins */
17419 #define alc662_auto_create_input_ctls \
17420 alc882_auto_create_input_ctls
17422 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
17423 hda_nid_t nid, int pin_type,
17429 alc_set_pin_output(codec, nid, pin_type);
17430 /* need the manual connection? */
17431 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
17434 for (i = 0; i < num; i++) {
17435 if (alc662_mix_to_dac(srcs[i]) != dac)
17437 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
17442 static void alc662_auto_init_multi_out(struct hda_codec *codec)
17444 struct alc_spec *spec = codec->spec;
17445 int pin_type = get_pin_type(spec->autocfg.line_out_type);
17448 for (i = 0; i <= HDA_SIDE; i++) {
17449 hda_nid_t nid = spec->autocfg.line_out_pins[i];
17451 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
17452 spec->multiout.dac_nids[i]);
17456 static void alc662_auto_init_hp_out(struct hda_codec *codec)
17458 struct alc_spec *spec = codec->spec;
17461 pin = spec->autocfg.hp_pins[0];
17463 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
17464 spec->multiout.hp_nid);
17465 pin = spec->autocfg.speaker_pins[0];
17467 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
17468 spec->multiout.extra_out_nid[0]);
17471 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
17473 static void alc662_auto_init_analog_input(struct hda_codec *codec)
17475 struct alc_spec *spec = codec->spec;
17478 for (i = 0; i < AUTO_PIN_LAST; i++) {
17479 hda_nid_t nid = spec->autocfg.input_pins[i];
17480 if (alc_is_input_pin(codec, nid)) {
17481 alc_set_input_pin(codec, nid, i);
17482 if (nid != ALC662_PIN_CD_NID &&
17483 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
17484 snd_hda_codec_write(codec, nid, 0,
17485 AC_VERB_SET_AMP_GAIN_MUTE,
17491 #define alc662_auto_init_input_src alc882_auto_init_input_src
17493 static int alc662_parse_auto_config(struct hda_codec *codec)
17495 struct alc_spec *spec = codec->spec;
17497 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
17499 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17503 if (!spec->autocfg.line_outs)
17504 return 0; /* can't find valid BIOS pin config */
17506 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
17509 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
17512 err = alc662_auto_create_extra_out(codec,
17513 spec->autocfg.speaker_pins[0],
17518 spec->multiout.extra_out_nid[0] = err;
17519 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
17524 spec->multiout.hp_nid = err;
17525 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
17529 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
17531 if (spec->autocfg.dig_outs)
17532 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
17534 if (spec->kctls.list)
17535 add_mixer(spec, spec->kctls.list);
17537 spec->num_mux_defs = 1;
17538 spec->input_mux = &spec->private_imux[0];
17540 add_verb(spec, alc662_auto_init_verbs);
17541 if (codec->vendor_id == 0x10ec0663)
17542 add_verb(spec, alc663_auto_init_verbs);
17544 err = alc_auto_add_mic_boost(codec);
17548 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
17553 /* additional initialization for auto-configuration model */
17554 static void alc662_auto_init(struct hda_codec *codec)
17556 struct alc_spec *spec = codec->spec;
17557 alc662_auto_init_multi_out(codec);
17558 alc662_auto_init_hp_out(codec);
17559 alc662_auto_init_analog_input(codec);
17560 alc662_auto_init_input_src(codec);
17561 if (spec->unsol_event)
17562 alc_inithook(codec);
17565 static int patch_alc662(struct hda_codec *codec)
17567 struct alc_spec *spec;
17568 int err, board_config;
17570 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
17574 codec->spec = spec;
17576 alc_fix_pll_init(codec, 0x20, 0x04, 15);
17578 if (alc_read_coef_idx(codec, 0)==0x8020){
17579 kfree(codec->chip_name);
17580 codec->chip_name = kstrdup("ALC661", GFP_KERNEL);
17581 if (!codec->chip_name) {
17587 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
17590 if (board_config < 0) {
17591 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
17593 board_config = ALC662_AUTO;
17596 if (board_config == ALC662_AUTO) {
17597 /* automatic parse from the BIOS config */
17598 err = alc662_parse_auto_config(codec);
17604 "hda_codec: Cannot set up configuration "
17605 "from BIOS. Using base mode...\n");
17606 board_config = ALC662_3ST_2ch_DIG;
17610 err = snd_hda_attach_beep_device(codec, 0x1);
17616 if (board_config != ALC662_AUTO)
17617 setup_preset(codec, &alc662_presets[board_config]);
17619 spec->stream_analog_playback = &alc662_pcm_analog_playback;
17620 spec->stream_analog_capture = &alc662_pcm_analog_capture;
17622 spec->stream_digital_playback = &alc662_pcm_digital_playback;
17623 spec->stream_digital_capture = &alc662_pcm_digital_capture;
17625 if (!spec->adc_nids) {
17626 spec->adc_nids = alc662_adc_nids;
17627 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
17629 if (!spec->capsrc_nids)
17630 spec->capsrc_nids = alc662_capsrc_nids;
17632 if (!spec->cap_mixer)
17633 set_capture_mixer(codec);
17634 if (codec->vendor_id == 0x10ec0662)
17635 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
17637 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
17639 spec->vmaster_nid = 0x02;
17641 codec->patch_ops = alc_patch_ops;
17642 if (board_config == ALC662_AUTO)
17643 spec->init_hook = alc662_auto_init;
17644 #ifdef CONFIG_SND_HDA_POWER_SAVE
17645 if (!spec->loopback.amplist)
17646 spec->loopback.amplist = alc662_loopbacks;
17648 codec->proc_widget_hook = print_realtek_coef;
17653 static int patch_alc888(struct hda_codec *codec)
17655 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
17656 kfree(codec->chip_name);
17657 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
17658 if (!codec->chip_name) {
17662 return patch_alc662(codec);
17664 return patch_alc882(codec);
17670 static struct hda_codec_preset snd_hda_preset_realtek[] = {
17671 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
17672 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
17673 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
17674 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
17675 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
17676 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
17677 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
17678 .patch = patch_alc861 },
17679 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
17680 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
17681 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
17682 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
17683 .patch = patch_alc882 },
17684 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
17685 .patch = patch_alc662 },
17686 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
17687 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
17688 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
17689 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
17690 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
17691 .patch = patch_alc882 },
17692 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
17693 .patch = patch_alc882 },
17694 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
17695 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
17696 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
17697 .patch = patch_alc882 },
17698 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
17699 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
17700 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
17701 {} /* terminator */
17704 MODULE_ALIAS("snd-hda-codec-id:10ec*");
17706 MODULE_LICENSE("GPL");
17707 MODULE_DESCRIPTION("Realtek HD-audio codec");
17709 static struct hda_codec_preset_list realtek_list = {
17710 .preset = snd_hda_preset_realtek,
17711 .owner = THIS_MODULE,
17714 static int __init patch_realtek_init(void)
17716 return snd_hda_add_codec_preset(&realtek_list);
17719 static void __exit patch_realtek_exit(void)
17721 snd_hda_delete_codec_preset(&realtek_list);
17724 module_init(patch_realtek_init)
17725 module_exit(patch_realtek_exit)