2 * Universal Interface for Intel High Definition Audio Codec
4 * HD audio interface patch for ALC 260/880/882 codecs
6 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
7 * PeiSen Hou <pshou@realtek.com.tw>
8 * Takashi Iwai <tiwai@suse.de>
9 * Jonathan Woithe <jwoithe@physics.adelaide.edu.au>
11 * This driver is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This driver is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include <linux/init.h>
27 #include <linux/delay.h>
28 #include <linux/slab.h>
29 #include <linux/pci.h>
30 #include <sound/core.h>
31 #include "hda_codec.h"
32 #include "hda_local.h"
35 #define ALC880_FRONT_EVENT 0x01
36 #define ALC880_DCVOL_EVENT 0x02
37 #define ALC880_HP_EVENT 0x04
38 #define ALC880_MIC_EVENT 0x08
40 /* ALC880 board config type */
64 #ifdef CONFIG_SND_DEBUG
68 ALC880_MODEL_LAST /* last tag */
82 #ifdef CONFIG_SND_DEBUG
86 ALC260_MODEL_LAST /* last tag */
96 ALC262_HP_BPC_D7000_WL,
97 ALC262_HP_BPC_D7000_WF,
110 ALC262_MODEL_LAST /* last tag */
120 ALC268_ACER_ASPIRE_ONE,
123 #ifdef CONFIG_SND_DEBUG
127 ALC268_MODEL_LAST /* last tag */
141 ALC269_MODEL_LAST /* last tag */
158 /* ALC861-VD models */
180 ALC662_ASUS_EEEPC_P701,
181 ALC662_ASUS_EEEPC_EP20,
221 ALC883_TARGA_2ch_DIG,
222 ALC883_TARGA_8ch_DIG,
225 ALC888_ACER_ASPIRE_4930G,
226 ALC888_ACER_ASPIRE_6530G,
227 ALC888_ACER_ASPIRE_8930G,
228 ALC888_ACER_ASPIRE_7730G,
232 ALC883_LENOVO_101E_2ch,
233 ALC883_LENOVO_NB0763,
234 ALC888_LENOVO_MS7195_DIG,
242 ALC883_FUJITSU_PI2515,
243 ALC888_FUJITSU_XA3530,
244 ALC883_3ST_6ch_INTEL,
257 #define GPIO_MASK 0x03
259 /* extra amp-initialization sequence types */
268 struct alc_mic_route {
270 unsigned char mux_idx;
271 unsigned char amix_idx;
274 #define MUX_IDX_UNDEF ((unsigned char)-1)
277 /* codec parameterization */
278 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
279 unsigned int num_mixers;
280 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
281 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
283 const struct hda_verb *init_verbs[10]; /* initialization verbs
287 unsigned int num_init_verbs;
289 char stream_name_analog[32]; /* analog PCM stream */
290 struct hda_pcm_stream *stream_analog_playback;
291 struct hda_pcm_stream *stream_analog_capture;
292 struct hda_pcm_stream *stream_analog_alt_playback;
293 struct hda_pcm_stream *stream_analog_alt_capture;
295 char stream_name_digital[32]; /* digital PCM stream */
296 struct hda_pcm_stream *stream_digital_playback;
297 struct hda_pcm_stream *stream_digital_capture;
300 struct hda_multi_out multiout; /* playback set-up
301 * max_channels, dacs must be set
302 * dig_out_nid and hp_nid are optional
304 hda_nid_t alt_dac_nid;
305 hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */
309 unsigned int num_adc_nids;
311 hda_nid_t *capsrc_nids;
312 hda_nid_t dig_in_nid; /* digital-in NID; optional */
315 unsigned int num_mux_defs;
316 const struct hda_input_mux *input_mux;
317 unsigned int cur_mux[3];
318 struct alc_mic_route ext_mic;
319 struct alc_mic_route int_mic;
322 const struct hda_channel_mode *channel_mode;
323 int num_channel_mode;
325 int const_channel_count;
326 int ext_channel_count;
328 /* PCM information */
329 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
331 /* dynamic controls, init_verbs and input_mux */
332 struct auto_pin_cfg autocfg;
333 struct snd_array kctls;
334 struct hda_input_mux private_imux[3];
335 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
336 hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS];
337 hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS];
340 void (*init_hook)(struct hda_codec *codec);
341 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
342 #ifdef CONFIG_SND_HDA_POWER_SAVE
343 void (*power_hook)(struct hda_codec *codec);
346 /* for pin sensing */
347 unsigned int sense_updated: 1;
348 unsigned int jack_present: 1;
349 unsigned int master_sw: 1;
350 unsigned int auto_mic:1;
353 unsigned int no_analog :1; /* digital I/O only */
356 /* for virtual master */
357 hda_nid_t vmaster_nid;
358 #ifdef CONFIG_SND_HDA_POWER_SAVE
359 struct hda_loopback_check loopback;
364 unsigned int pll_coef_idx, pll_coef_bit;
368 * configuration template - to be copied to the spec instance
370 struct alc_config_preset {
371 struct snd_kcontrol_new *mixers[5]; /* should be identical size
374 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
375 const struct hda_verb *init_verbs[5];
376 unsigned int num_dacs;
378 hda_nid_t dig_out_nid; /* optional */
379 hda_nid_t hp_nid; /* optional */
380 hda_nid_t *slave_dig_outs;
381 unsigned int num_adc_nids;
383 hda_nid_t *capsrc_nids;
384 hda_nid_t dig_in_nid;
385 unsigned int num_channel_mode;
386 const struct hda_channel_mode *channel_mode;
388 int const_channel_count;
389 unsigned int num_mux_defs;
390 const struct hda_input_mux *input_mux;
391 void (*unsol_event)(struct hda_codec *, unsigned int);
392 void (*setup)(struct hda_codec *);
393 void (*init_hook)(struct hda_codec *);
394 #ifdef CONFIG_SND_HDA_POWER_SAVE
395 struct hda_amp_list *loopbacks;
396 void (*power_hook)(struct hda_codec *codec);
404 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
405 struct snd_ctl_elem_info *uinfo)
407 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
408 struct alc_spec *spec = codec->spec;
409 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
410 if (mux_idx >= spec->num_mux_defs)
412 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
415 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
416 struct snd_ctl_elem_value *ucontrol)
418 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
419 struct alc_spec *spec = codec->spec;
420 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
422 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
426 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
427 struct snd_ctl_elem_value *ucontrol)
429 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
430 struct alc_spec *spec = codec->spec;
431 const struct hda_input_mux *imux;
432 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
433 unsigned int mux_idx;
434 hda_nid_t nid = spec->capsrc_nids ?
435 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
438 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
439 imux = &spec->input_mux[mux_idx];
441 type = get_wcaps_type(get_wcaps(codec, nid));
442 if (type == AC_WID_AUD_MIX) {
443 /* Matrix-mixer style (e.g. ALC882) */
444 unsigned int *cur_val = &spec->cur_mux[adc_idx];
447 idx = ucontrol->value.enumerated.item[0];
448 if (idx >= imux->num_items)
449 idx = imux->num_items - 1;
452 for (i = 0; i < imux->num_items; i++) {
453 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
454 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
455 imux->items[i].index,
461 /* MUX style (e.g. ALC880) */
462 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
463 &spec->cur_mux[adc_idx]);
468 * channel mode setting
470 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
471 struct snd_ctl_elem_info *uinfo)
473 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
474 struct alc_spec *spec = codec->spec;
475 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
476 spec->num_channel_mode);
479 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
480 struct snd_ctl_elem_value *ucontrol)
482 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
483 struct alc_spec *spec = codec->spec;
484 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
485 spec->num_channel_mode,
486 spec->ext_channel_count);
489 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
490 struct snd_ctl_elem_value *ucontrol)
492 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
493 struct alc_spec *spec = codec->spec;
494 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
495 spec->num_channel_mode,
496 &spec->ext_channel_count);
497 if (err >= 0 && !spec->const_channel_count) {
498 spec->multiout.max_channels = spec->ext_channel_count;
499 if (spec->need_dac_fix)
500 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
506 * Control the mode of pin widget settings via the mixer. "pc" is used
507 * instead of "%" to avoid consequences of accidently treating the % as
508 * being part of a format specifier. Maximum allowed length of a value is
509 * 63 characters plus NULL terminator.
511 * Note: some retasking pin complexes seem to ignore requests for input
512 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
513 * are requested. Therefore order this list so that this behaviour will not
514 * cause problems when mixer clients move through the enum sequentially.
515 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
518 static char *alc_pin_mode_names[] = {
519 "Mic 50pc bias", "Mic 80pc bias",
520 "Line in", "Line out", "Headphone out",
522 static unsigned char alc_pin_mode_values[] = {
523 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
525 /* The control can present all 5 options, or it can limit the options based
526 * in the pin being assumed to be exclusively an input or an output pin. In
527 * addition, "input" pins may or may not process the mic bias option
528 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
529 * accept requests for bias as of chip versions up to March 2006) and/or
530 * wiring in the computer.
532 #define ALC_PIN_DIR_IN 0x00
533 #define ALC_PIN_DIR_OUT 0x01
534 #define ALC_PIN_DIR_INOUT 0x02
535 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
536 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
538 /* Info about the pin modes supported by the different pin direction modes.
539 * For each direction the minimum and maximum values are given.
541 static signed char alc_pin_mode_dir_info[5][2] = {
542 { 0, 2 }, /* ALC_PIN_DIR_IN */
543 { 3, 4 }, /* ALC_PIN_DIR_OUT */
544 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
545 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
546 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
548 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
549 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
550 #define alc_pin_mode_n_items(_dir) \
551 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
553 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
554 struct snd_ctl_elem_info *uinfo)
556 unsigned int item_num = uinfo->value.enumerated.item;
557 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
559 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
561 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
563 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
564 item_num = alc_pin_mode_min(dir);
565 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
569 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
570 struct snd_ctl_elem_value *ucontrol)
573 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
574 hda_nid_t nid = kcontrol->private_value & 0xffff;
575 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
576 long *valp = ucontrol->value.integer.value;
577 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
578 AC_VERB_GET_PIN_WIDGET_CONTROL,
581 /* Find enumerated value for current pinctl setting */
582 i = alc_pin_mode_min(dir);
583 while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl)
585 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
589 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
590 struct snd_ctl_elem_value *ucontrol)
593 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
594 hda_nid_t nid = kcontrol->private_value & 0xffff;
595 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
596 long val = *ucontrol->value.integer.value;
597 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
598 AC_VERB_GET_PIN_WIDGET_CONTROL,
601 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
602 val = alc_pin_mode_min(dir);
604 change = pinctl != alc_pin_mode_values[val];
606 /* Set pin mode to that requested */
607 snd_hda_codec_write_cache(codec, nid, 0,
608 AC_VERB_SET_PIN_WIDGET_CONTROL,
609 alc_pin_mode_values[val]);
611 /* Also enable the retasking pin's input/output as required
612 * for the requested pin mode. Enum values of 2 or less are
615 * Dynamically switching the input/output buffers probably
616 * reduces noise slightly (particularly on input) so we'll
617 * do it. However, having both input and output buffers
618 * enabled simultaneously doesn't seem to be problematic if
619 * this turns out to be necessary in the future.
622 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
623 HDA_AMP_MUTE, HDA_AMP_MUTE);
624 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
627 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
628 HDA_AMP_MUTE, HDA_AMP_MUTE);
629 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
636 #define ALC_PIN_MODE(xname, nid, dir) \
637 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
638 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
639 .info = alc_pin_mode_info, \
640 .get = alc_pin_mode_get, \
641 .put = alc_pin_mode_put, \
642 .private_value = nid | (dir<<16) }
644 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
645 * together using a mask with more than one bit set. This control is
646 * currently used only by the ALC260 test model. At this stage they are not
647 * needed for any "production" models.
649 #ifdef CONFIG_SND_DEBUG
650 #define alc_gpio_data_info snd_ctl_boolean_mono_info
652 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
653 struct snd_ctl_elem_value *ucontrol)
655 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
656 hda_nid_t nid = kcontrol->private_value & 0xffff;
657 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
658 long *valp = ucontrol->value.integer.value;
659 unsigned int val = snd_hda_codec_read(codec, nid, 0,
660 AC_VERB_GET_GPIO_DATA, 0x00);
662 *valp = (val & mask) != 0;
665 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
666 struct snd_ctl_elem_value *ucontrol)
669 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
670 hda_nid_t nid = kcontrol->private_value & 0xffff;
671 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
672 long val = *ucontrol->value.integer.value;
673 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
674 AC_VERB_GET_GPIO_DATA,
677 /* Set/unset the masked GPIO bit(s) as needed */
678 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
683 snd_hda_codec_write_cache(codec, nid, 0,
684 AC_VERB_SET_GPIO_DATA, gpio_data);
688 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
689 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
690 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
691 .info = alc_gpio_data_info, \
692 .get = alc_gpio_data_get, \
693 .put = alc_gpio_data_put, \
694 .private_value = nid | (mask<<16) }
695 #endif /* CONFIG_SND_DEBUG */
697 /* A switch control to allow the enabling of the digital IO pins on the
698 * ALC260. This is incredibly simplistic; the intention of this control is
699 * to provide something in the test model allowing digital outputs to be
700 * identified if present. If models are found which can utilise these
701 * outputs a more complete mixer control can be devised for those models if
704 #ifdef CONFIG_SND_DEBUG
705 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
707 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
708 struct snd_ctl_elem_value *ucontrol)
710 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
711 hda_nid_t nid = kcontrol->private_value & 0xffff;
712 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
713 long *valp = ucontrol->value.integer.value;
714 unsigned int val = snd_hda_codec_read(codec, nid, 0,
715 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
717 *valp = (val & mask) != 0;
720 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
721 struct snd_ctl_elem_value *ucontrol)
724 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
725 hda_nid_t nid = kcontrol->private_value & 0xffff;
726 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
727 long val = *ucontrol->value.integer.value;
728 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
729 AC_VERB_GET_DIGI_CONVERT_1,
732 /* Set/unset the masked control bit(s) as needed */
733 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
738 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
743 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
744 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
745 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
746 .info = alc_spdif_ctrl_info, \
747 .get = alc_spdif_ctrl_get, \
748 .put = alc_spdif_ctrl_put, \
749 .private_value = nid | (mask<<16) }
750 #endif /* CONFIG_SND_DEBUG */
752 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
753 * Again, this is only used in the ALC26x test models to help identify when
754 * the EAPD line must be asserted for features to work.
756 #ifdef CONFIG_SND_DEBUG
757 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
759 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
760 struct snd_ctl_elem_value *ucontrol)
762 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
763 hda_nid_t nid = kcontrol->private_value & 0xffff;
764 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
765 long *valp = ucontrol->value.integer.value;
766 unsigned int val = snd_hda_codec_read(codec, nid, 0,
767 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
769 *valp = (val & mask) != 0;
773 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
774 struct snd_ctl_elem_value *ucontrol)
777 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
778 hda_nid_t nid = kcontrol->private_value & 0xffff;
779 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
780 long val = *ucontrol->value.integer.value;
781 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
782 AC_VERB_GET_EAPD_BTLENABLE,
785 /* Set/unset the masked control bit(s) as needed */
786 change = (!val ? 0 : mask) != (ctrl_data & mask);
791 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
797 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
798 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
799 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
800 .info = alc_eapd_ctrl_info, \
801 .get = alc_eapd_ctrl_get, \
802 .put = alc_eapd_ctrl_put, \
803 .private_value = nid | (mask<<16) }
804 #endif /* CONFIG_SND_DEBUG */
807 * set up the input pin config (depending on the given auto-pin type)
809 static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
812 unsigned int val = PIN_IN;
814 if (auto_pin_type <= AUTO_PIN_FRONT_MIC) {
816 pincap = snd_hda_query_pin_caps(codec, nid);
817 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
818 if (pincap & AC_PINCAP_VREF_80)
820 else if (pincap & AC_PINCAP_VREF_50)
822 else if (pincap & AC_PINCAP_VREF_100)
824 else if (pincap & AC_PINCAP_VREF_GRD)
827 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val);
832 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
834 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
836 spec->mixers[spec->num_mixers++] = mix;
839 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
841 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
843 spec->init_verbs[spec->num_init_verbs++] = verb;
847 * set up from the preset table
849 static void setup_preset(struct hda_codec *codec,
850 const struct alc_config_preset *preset)
852 struct alc_spec *spec = codec->spec;
855 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
856 add_mixer(spec, preset->mixers[i]);
857 spec->cap_mixer = preset->cap_mixer;
858 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
860 add_verb(spec, preset->init_verbs[i]);
862 spec->channel_mode = preset->channel_mode;
863 spec->num_channel_mode = preset->num_channel_mode;
864 spec->need_dac_fix = preset->need_dac_fix;
865 spec->const_channel_count = preset->const_channel_count;
867 if (preset->const_channel_count)
868 spec->multiout.max_channels = preset->const_channel_count;
870 spec->multiout.max_channels = spec->channel_mode[0].channels;
871 spec->ext_channel_count = spec->channel_mode[0].channels;
873 spec->multiout.num_dacs = preset->num_dacs;
874 spec->multiout.dac_nids = preset->dac_nids;
875 spec->multiout.dig_out_nid = preset->dig_out_nid;
876 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
877 spec->multiout.hp_nid = preset->hp_nid;
879 spec->num_mux_defs = preset->num_mux_defs;
880 if (!spec->num_mux_defs)
881 spec->num_mux_defs = 1;
882 spec->input_mux = preset->input_mux;
884 spec->num_adc_nids = preset->num_adc_nids;
885 spec->adc_nids = preset->adc_nids;
886 spec->capsrc_nids = preset->capsrc_nids;
887 spec->dig_in_nid = preset->dig_in_nid;
889 spec->unsol_event = preset->unsol_event;
890 spec->init_hook = preset->init_hook;
891 #ifdef CONFIG_SND_HDA_POWER_SAVE
892 spec->power_hook = preset->power_hook;
893 spec->loopback.amplist = preset->loopbacks;
897 preset->setup(codec);
900 /* Enable GPIO mask and set output */
901 static struct hda_verb alc_gpio1_init_verbs[] = {
902 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
903 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
904 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
908 static struct hda_verb alc_gpio2_init_verbs[] = {
909 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
910 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
911 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
915 static struct hda_verb alc_gpio3_init_verbs[] = {
916 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
917 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
918 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
923 * Fix hardware PLL issue
924 * On some codecs, the analog PLL gating control must be off while
925 * the default value is 1.
927 static void alc_fix_pll(struct hda_codec *codec)
929 struct alc_spec *spec = codec->spec;
934 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
936 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
937 AC_VERB_GET_PROC_COEF, 0);
938 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
940 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
941 val & ~(1 << spec->pll_coef_bit));
944 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
945 unsigned int coef_idx, unsigned int coef_bit)
947 struct alc_spec *spec = codec->spec;
949 spec->pll_coef_idx = coef_idx;
950 spec->pll_coef_bit = coef_bit;
954 static void alc_automute_pin(struct hda_codec *codec)
956 struct alc_spec *spec = codec->spec;
957 unsigned int nid = spec->autocfg.hp_pins[0];
962 spec->jack_present = snd_hda_jack_detect(codec, nid);
963 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
964 nid = spec->autocfg.speaker_pins[i];
967 snd_hda_codec_write(codec, nid, 0,
968 AC_VERB_SET_PIN_WIDGET_CONTROL,
969 spec->jack_present ? 0 : PIN_OUT);
973 static int get_connection_index(struct hda_codec *codec, hda_nid_t mux,
976 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
979 nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn));
980 for (i = 0; i < nums; i++)
986 static void alc_mic_automute(struct hda_codec *codec)
988 struct alc_spec *spec = codec->spec;
989 struct alc_mic_route *dead, *alive;
990 unsigned int present, type;
995 if (!spec->int_mic.pin || !spec->ext_mic.pin)
997 if (snd_BUG_ON(!spec->adc_nids))
1000 cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0];
1002 present = snd_hda_jack_detect(codec, spec->ext_mic.pin);
1004 alive = &spec->ext_mic;
1005 dead = &spec->int_mic;
1007 alive = &spec->int_mic;
1008 dead = &spec->ext_mic;
1011 type = get_wcaps_type(get_wcaps(codec, cap_nid));
1012 if (type == AC_WID_AUD_MIX) {
1013 /* Matrix-mixer style (e.g. ALC882) */
1014 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1017 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1019 HDA_AMP_MUTE, HDA_AMP_MUTE);
1021 /* MUX style (e.g. ALC880) */
1022 snd_hda_codec_write_cache(codec, cap_nid, 0,
1023 AC_VERB_SET_CONNECT_SEL,
1027 /* FIXME: analog mixer */
1030 /* unsolicited event for HP jack sensing */
1031 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
1033 if (codec->vendor_id == 0x10ec0880)
1038 case ALC880_HP_EVENT:
1039 alc_automute_pin(codec);
1041 case ALC880_MIC_EVENT:
1042 alc_mic_automute(codec);
1047 static void alc_inithook(struct hda_codec *codec)
1049 alc_automute_pin(codec);
1050 alc_mic_automute(codec);
1053 /* additional initialization for ALC888 variants */
1054 static void alc888_coef_init(struct hda_codec *codec)
1058 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
1059 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1060 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1061 if ((tmp & 0xf0) == 0x20)
1063 snd_hda_codec_read(codec, 0x20, 0,
1064 AC_VERB_SET_PROC_COEF, 0x830);
1067 snd_hda_codec_read(codec, 0x20, 0,
1068 AC_VERB_SET_PROC_COEF, 0x3030);
1071 static void alc889_coef_init(struct hda_codec *codec)
1075 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1076 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1077 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1078 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010);
1081 /* turn on/off EAPD control (only if available) */
1082 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
1084 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
1086 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
1087 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
1091 static void alc_auto_init_amp(struct hda_codec *codec, int type)
1096 case ALC_INIT_GPIO1:
1097 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1099 case ALC_INIT_GPIO2:
1100 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1102 case ALC_INIT_GPIO3:
1103 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1105 case ALC_INIT_DEFAULT:
1106 switch (codec->vendor_id) {
1108 set_eapd(codec, 0x0f, 1);
1109 set_eapd(codec, 0x10, 1);
1122 set_eapd(codec, 0x14, 1);
1123 set_eapd(codec, 0x15, 1);
1126 switch (codec->vendor_id) {
1128 snd_hda_codec_write(codec, 0x1a, 0,
1129 AC_VERB_SET_COEF_INDEX, 7);
1130 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1131 AC_VERB_GET_PROC_COEF, 0);
1132 snd_hda_codec_write(codec, 0x1a, 0,
1133 AC_VERB_SET_COEF_INDEX, 7);
1134 snd_hda_codec_write(codec, 0x1a, 0,
1135 AC_VERB_SET_PROC_COEF,
1145 alc889_coef_init(codec);
1148 alc888_coef_init(codec);
1150 #if 0 /* XXX: This may cause the silent output on speaker on some machines */
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,
1169 static void alc_init_auto_hp(struct hda_codec *codec)
1171 struct alc_spec *spec = codec->spec;
1173 if (!spec->autocfg.hp_pins[0])
1176 if (!spec->autocfg.speaker_pins[0]) {
1177 if (spec->autocfg.line_out_pins[0] &&
1178 spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT)
1179 spec->autocfg.speaker_pins[0] =
1180 spec->autocfg.line_out_pins[0];
1185 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1186 spec->autocfg.hp_pins[0]);
1187 snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0,
1188 AC_VERB_SET_UNSOLICITED_ENABLE,
1189 AC_USRSP_EN | ALC880_HP_EVENT);
1190 spec->unsol_event = alc_sku_unsol_event;
1193 static void alc_init_auto_mic(struct hda_codec *codec)
1195 struct alc_spec *spec = codec->spec;
1196 struct auto_pin_cfg *cfg = &spec->autocfg;
1197 hda_nid_t fixed, ext;
1200 /* there must be only two mic inputs exclusively */
1201 for (i = AUTO_PIN_LINE; i < AUTO_PIN_LAST; i++)
1202 if (cfg->input_pins[i])
1206 for (i = AUTO_PIN_MIC; i <= AUTO_PIN_FRONT_MIC; i++) {
1207 hda_nid_t nid = cfg->input_pins[i];
1208 unsigned int defcfg;
1211 defcfg = snd_hda_codec_get_pincfg(codec, nid);
1212 switch (get_defcfg_connect(defcfg)) {
1213 case AC_JACK_PORT_FIXED:
1215 return; /* already occupied */
1218 case AC_JACK_PORT_COMPLEX:
1220 return; /* already occupied */
1224 return; /* invalid entry */
1229 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP))
1230 return; /* no unsol support */
1231 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n",
1233 spec->ext_mic.pin = ext;
1234 spec->int_mic.pin = fixed;
1235 spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1236 spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1238 snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0,
1239 AC_VERB_SET_UNSOLICITED_ENABLE,
1240 AC_USRSP_EN | ALC880_MIC_EVENT);
1241 spec->unsol_event = alc_sku_unsol_event;
1244 /* check subsystem ID and set up device-specific initialization;
1245 * return 1 if initialized, 0 if invalid SSID
1247 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1248 * 31 ~ 16 : Manufacture ID
1250 * 7 ~ 0 : Assembly ID
1251 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1253 static int alc_subsystem_id(struct hda_codec *codec,
1254 hda_nid_t porta, hda_nid_t porte,
1257 unsigned int ass, tmp, i;
1259 struct alc_spec *spec = codec->spec;
1261 ass = codec->subsystem_id & 0xffff;
1262 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1265 /* invalid SSID, check the special NID pin defcfg instead */
1267 * 31~30 : port connectivity
1270 * 19~16 : Check sum (15:1)
1275 if (codec->vendor_id == 0x10ec0260)
1277 ass = snd_hda_codec_get_pincfg(codec, nid);
1278 snd_printd("realtek: No valid SSID, "
1279 "checking pincfg 0x%08x for NID 0x%x\n",
1281 if (!(ass & 1) && !(ass & 0x100000))
1283 if ((ass >> 30) != 1) /* no physical connection */
1288 for (i = 1; i < 16; i++) {
1292 if (((ass >> 16) & 0xf) != tmp)
1295 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1296 ass & 0xffff, codec->vendor_id);
1300 * 2 : 0 --> Desktop, 1 --> Laptop
1301 * 3~5 : External Amplifier control
1304 tmp = (ass & 0x38) >> 3; /* external Amp control */
1307 spec->init_amp = ALC_INIT_GPIO1;
1310 spec->init_amp = ALC_INIT_GPIO2;
1313 spec->init_amp = ALC_INIT_GPIO3;
1316 spec->init_amp = ALC_INIT_DEFAULT;
1320 /* is laptop or Desktop and enable the function "Mute internal speaker
1321 * when the external headphone out jack is plugged"
1323 if (!(ass & 0x8000))
1326 * 10~8 : Jack location
1327 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1329 * 15 : 1 --> enable the function "Mute internal speaker
1330 * when the external headphone out jack is plugged"
1332 if (!spec->autocfg.hp_pins[0]) {
1334 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1343 for (i = 0; i < spec->autocfg.line_outs; i++)
1344 if (spec->autocfg.line_out_pins[i] == nid)
1346 spec->autocfg.hp_pins[0] = nid;
1349 alc_init_auto_hp(codec);
1350 alc_init_auto_mic(codec);
1354 static void alc_ssid_check(struct hda_codec *codec,
1355 hda_nid_t porta, hda_nid_t porte, hda_nid_t portd)
1357 if (!alc_subsystem_id(codec, porta, porte, portd)) {
1358 struct alc_spec *spec = codec->spec;
1359 snd_printd("realtek: "
1360 "Enable default setup for auto mode as fallback\n");
1361 spec->init_amp = ALC_INIT_DEFAULT;
1362 alc_init_auto_hp(codec);
1363 alc_init_auto_mic(codec);
1368 * Fix-up pin default configurations and add default verbs
1377 const struct alc_pincfg *pins;
1378 const struct hda_verb *verbs;
1381 static void alc_pick_fixup(struct hda_codec *codec,
1382 const struct snd_pci_quirk *quirk,
1383 const struct alc_fixup *fix)
1385 const struct alc_pincfg *cfg;
1387 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1391 fix += quirk->value;
1394 for (; cfg->nid; cfg++)
1395 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1398 add_verb(codec->spec, fix->verbs);
1401 static int alc_read_coef_idx(struct hda_codec *codec,
1402 unsigned int coef_idx)
1405 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX,
1407 val = snd_hda_codec_read(codec, 0x20, 0,
1408 AC_VERB_GET_PROC_COEF, 0);
1419 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1420 /* Mic-in jack as mic in */
1421 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1422 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1423 /* Line-in jack as Line in */
1424 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1425 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1426 /* Line-Out as Front */
1427 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1434 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1435 /* Mic-in jack as mic in */
1436 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1437 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1438 /* Line-in jack as Surround */
1439 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1440 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1441 /* Line-Out as Front */
1442 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1449 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1450 /* Mic-in jack as CLFE */
1451 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1452 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1453 /* Line-in jack as Surround */
1454 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1455 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1456 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1457 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1464 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1465 /* Mic-in jack as CLFE */
1466 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1467 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1468 /* Line-in jack as Surround */
1469 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1470 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1471 /* Line-Out as Side */
1472 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1476 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1477 { 2, alc888_4ST_ch2_intel_init },
1478 { 4, alc888_4ST_ch4_intel_init },
1479 { 6, alc888_4ST_ch6_intel_init },
1480 { 8, alc888_4ST_ch8_intel_init },
1484 * ALC888 Fujitsu Siemens Amillo xa3530
1487 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1488 /* Front Mic: set to PIN_IN (empty by default) */
1489 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1490 /* Connect Internal HP to Front */
1491 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1492 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1493 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1494 /* Connect Bass HP to Front */
1495 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1496 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1497 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1498 /* Connect Line-Out side jack (SPDIF) to Side */
1499 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1500 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1501 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1502 /* Connect Mic jack to CLFE */
1503 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1504 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1505 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1506 /* Connect Line-in jack to Surround */
1507 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1508 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1509 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1510 /* Connect HP out jack to Front */
1511 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1512 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1513 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1514 /* Enable unsolicited event for HP jack and Line-out jack */
1515 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1516 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1520 static void alc_automute_amp(struct hda_codec *codec)
1522 struct alc_spec *spec = codec->spec;
1527 spec->jack_present = 0;
1528 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
1529 nid = spec->autocfg.hp_pins[i];
1532 if (snd_hda_jack_detect(codec, nid)) {
1533 spec->jack_present = 1;
1538 mute = spec->jack_present ? HDA_AMP_MUTE : 0;
1539 /* Toggle internal speakers muting */
1540 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1541 nid = spec->autocfg.speaker_pins[i];
1544 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1545 HDA_AMP_MUTE, mute);
1549 static void alc_automute_amp_unsol_event(struct hda_codec *codec,
1552 if (codec->vendor_id == 0x10ec0880)
1556 if (res == ALC880_HP_EVENT)
1557 alc_automute_amp(codec);
1560 static void alc889_automute_setup(struct hda_codec *codec)
1562 struct alc_spec *spec = codec->spec;
1564 spec->autocfg.hp_pins[0] = 0x15;
1565 spec->autocfg.speaker_pins[0] = 0x14;
1566 spec->autocfg.speaker_pins[1] = 0x16;
1567 spec->autocfg.speaker_pins[2] = 0x17;
1568 spec->autocfg.speaker_pins[3] = 0x19;
1569 spec->autocfg.speaker_pins[4] = 0x1a;
1572 static void alc889_intel_init_hook(struct hda_codec *codec)
1574 alc889_coef_init(codec);
1575 alc_automute_amp(codec);
1578 static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec)
1580 struct alc_spec *spec = codec->spec;
1582 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
1583 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
1584 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
1585 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
1589 * ALC888 Acer Aspire 4930G model
1592 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1593 /* Front Mic: set to PIN_IN (empty by default) */
1594 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1595 /* Unselect Front Mic by default in input mixer 3 */
1596 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1597 /* Enable unsolicited event for HP jack */
1598 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1599 /* Connect Internal HP to front */
1600 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1601 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1602 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1603 /* Connect HP out to front */
1604 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1605 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1606 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1611 * ALC888 Acer Aspire 6530G model
1614 static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
1615 /* Bias voltage on for external mic port */
1616 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
1617 /* Front Mic: set to PIN_IN (empty by default) */
1618 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1619 /* Unselect Front Mic by default in input mixer 3 */
1620 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1621 /* Enable unsolicited event for HP jack */
1622 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1623 /* Enable speaker output */
1624 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1625 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1626 /* Enable headphone output */
1627 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1628 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1629 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1634 * ALC889 Acer Aspire 8930G model
1637 static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
1638 /* Front Mic: set to PIN_IN (empty by default) */
1639 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1640 /* Unselect Front Mic by default in input mixer 3 */
1641 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1642 /* Enable unsolicited event for HP jack */
1643 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1644 /* Connect Internal Front to Front */
1645 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1646 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1647 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1648 /* Connect Internal Rear to Rear */
1649 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1650 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1651 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
1652 /* Connect Internal CLFE to CLFE */
1653 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1654 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1655 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
1656 /* Connect HP out to Front */
1657 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1658 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1659 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1660 /* Enable all DACs */
1661 /* DAC DISABLE/MUTE 1? */
1662 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
1663 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
1664 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1665 /* DAC DISABLE/MUTE 2? */
1666 /* some bit here disables the other DACs. Init=0x4900 */
1667 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
1668 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
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 struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = {
1782 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1783 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1784 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1785 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1786 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1788 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1789 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1790 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1791 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1792 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1793 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1794 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1795 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1800 static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
1802 struct alc_spec *spec = codec->spec;
1804 spec->autocfg.hp_pins[0] = 0x15;
1805 spec->autocfg.speaker_pins[0] = 0x14;
1806 spec->autocfg.speaker_pins[1] = 0x16;
1807 spec->autocfg.speaker_pins[2] = 0x17;
1810 static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
1812 struct alc_spec *spec = codec->spec;
1814 spec->autocfg.hp_pins[0] = 0x15;
1815 spec->autocfg.speaker_pins[0] = 0x14;
1816 spec->autocfg.speaker_pins[1] = 0x16;
1817 spec->autocfg.speaker_pins[2] = 0x17;
1820 static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
1822 struct alc_spec *spec = codec->spec;
1824 spec->autocfg.hp_pins[0] = 0x15;
1825 spec->autocfg.speaker_pins[0] = 0x14;
1826 spec->autocfg.speaker_pins[1] = 0x16;
1827 spec->autocfg.speaker_pins[2] = 0x1b;
1831 * ALC880 3-stack model
1833 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1834 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1835 * F-Mic = 0x1b, HP = 0x19
1838 static hda_nid_t alc880_dac_nids[4] = {
1839 /* front, rear, clfe, rear_surr */
1840 0x02, 0x05, 0x04, 0x03
1843 static hda_nid_t alc880_adc_nids[3] = {
1848 /* The datasheet says the node 0x07 is connected from inputs,
1849 * but it shows zero connection in the real implementation on some devices.
1850 * Note: this is a 915GAV bug, fixed on 915GLV
1852 static hda_nid_t alc880_adc_nids_alt[2] = {
1857 #define ALC880_DIGOUT_NID 0x06
1858 #define ALC880_DIGIN_NID 0x0a
1860 static struct hda_input_mux alc880_capture_source = {
1864 { "Front Mic", 0x3 },
1870 /* channel source setting (2/6 channel selection for 3-stack) */
1872 static struct hda_verb alc880_threestack_ch2_init[] = {
1873 /* set line-in to input, mute it */
1874 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1875 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1876 /* set mic-in to input vref 80%, mute it */
1877 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1878 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1883 static struct hda_verb alc880_threestack_ch6_init[] = {
1884 /* set line-in to output, unmute it */
1885 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1886 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1887 /* set mic-in to output, unmute it */
1888 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1889 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1893 static struct hda_channel_mode alc880_threestack_modes[2] = {
1894 { 2, alc880_threestack_ch2_init },
1895 { 6, alc880_threestack_ch6_init },
1898 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1899 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1900 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1901 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1902 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1903 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1904 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1905 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1906 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1907 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1908 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1909 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1910 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1911 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1912 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1913 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1914 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1915 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1917 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1918 .name = "Channel Mode",
1919 .info = alc_ch_mode_info,
1920 .get = alc_ch_mode_get,
1921 .put = alc_ch_mode_put,
1926 /* capture mixer elements */
1927 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1928 struct snd_ctl_elem_info *uinfo)
1930 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1931 struct alc_spec *spec = codec->spec;
1934 mutex_lock(&codec->control_mutex);
1935 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1937 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
1938 mutex_unlock(&codec->control_mutex);
1942 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1943 unsigned int size, unsigned int __user *tlv)
1945 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1946 struct alc_spec *spec = codec->spec;
1949 mutex_lock(&codec->control_mutex);
1950 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1952 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1953 mutex_unlock(&codec->control_mutex);
1957 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
1958 struct snd_ctl_elem_value *ucontrol);
1960 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1961 struct snd_ctl_elem_value *ucontrol,
1964 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1965 struct alc_spec *spec = codec->spec;
1966 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1969 mutex_lock(&codec->control_mutex);
1970 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1972 err = func(kcontrol, ucontrol);
1973 mutex_unlock(&codec->control_mutex);
1977 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
1978 struct snd_ctl_elem_value *ucontrol)
1980 return alc_cap_getput_caller(kcontrol, ucontrol,
1981 snd_hda_mixer_amp_volume_get);
1984 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
1985 struct snd_ctl_elem_value *ucontrol)
1987 return alc_cap_getput_caller(kcontrol, ucontrol,
1988 snd_hda_mixer_amp_volume_put);
1991 /* capture mixer elements */
1992 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
1994 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
1995 struct snd_ctl_elem_value *ucontrol)
1997 return alc_cap_getput_caller(kcontrol, ucontrol,
1998 snd_hda_mixer_amp_switch_get);
2001 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
2002 struct snd_ctl_elem_value *ucontrol)
2004 return alc_cap_getput_caller(kcontrol, ucontrol,
2005 snd_hda_mixer_amp_switch_put);
2008 #define _DEFINE_CAPMIX(num) \
2010 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2011 .name = "Capture Switch", \
2012 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
2014 .info = alc_cap_sw_info, \
2015 .get = alc_cap_sw_get, \
2016 .put = alc_cap_sw_put, \
2019 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2020 .name = "Capture Volume", \
2021 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
2022 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
2023 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
2025 .info = alc_cap_vol_info, \
2026 .get = alc_cap_vol_get, \
2027 .put = alc_cap_vol_put, \
2028 .tlv = { .c = alc_cap_vol_tlv }, \
2031 #define _DEFINE_CAPSRC(num) \
2033 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2034 /* .name = "Capture Source", */ \
2035 .name = "Input Source", \
2037 .info = alc_mux_enum_info, \
2038 .get = alc_mux_enum_get, \
2039 .put = alc_mux_enum_put, \
2042 #define DEFINE_CAPMIX(num) \
2043 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2044 _DEFINE_CAPMIX(num), \
2045 _DEFINE_CAPSRC(num), \
2049 #define DEFINE_CAPMIX_NOSRC(num) \
2050 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2051 _DEFINE_CAPMIX(num), \
2055 /* up to three ADCs */
2059 DEFINE_CAPMIX_NOSRC(1);
2060 DEFINE_CAPMIX_NOSRC(2);
2061 DEFINE_CAPMIX_NOSRC(3);
2064 * ALC880 5-stack model
2066 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2068 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2069 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2072 /* additional mixers to alc880_three_stack_mixer */
2073 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2074 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2075 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2079 /* channel source setting (6/8 channel selection for 5-stack) */
2081 static struct hda_verb alc880_fivestack_ch6_init[] = {
2082 /* set line-in to input, mute it */
2083 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2084 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2089 static struct hda_verb alc880_fivestack_ch8_init[] = {
2090 /* set line-in to output, unmute it */
2091 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2092 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2096 static struct hda_channel_mode alc880_fivestack_modes[2] = {
2097 { 6, alc880_fivestack_ch6_init },
2098 { 8, alc880_fivestack_ch8_init },
2103 * ALC880 6-stack model
2105 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2106 * Side = 0x05 (0x0f)
2107 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2108 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2111 static hda_nid_t alc880_6st_dac_nids[4] = {
2112 /* front, rear, clfe, rear_surr */
2113 0x02, 0x03, 0x04, 0x05
2116 static struct hda_input_mux alc880_6stack_capture_source = {
2120 { "Front Mic", 0x1 },
2126 /* fixed 8-channels */
2127 static struct hda_channel_mode alc880_sixstack_modes[1] = {
2131 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2132 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2133 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2134 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2135 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2136 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2137 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2138 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2139 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2140 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2141 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2142 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2143 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2144 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2145 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2146 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2147 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2148 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2149 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2151 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2152 .name = "Channel Mode",
2153 .info = alc_ch_mode_info,
2154 .get = alc_ch_mode_get,
2155 .put = alc_ch_mode_put,
2164 * W810 has rear IO for:
2167 * Center/LFE (DAC 04)
2170 * The system also has a pair of internal speakers, and a headphone jack.
2171 * These are both connected to Line2 on the codec, hence to DAC 02.
2173 * There is a variable resistor to control the speaker or headphone
2174 * volume. This is a hardware-only device without a software API.
2176 * Plugging headphones in will disable the internal speakers. This is
2177 * implemented in hardware, not via the driver using jack sense. In
2178 * a similar fashion, plugging into the rear socket marked "front" will
2179 * disable both the speakers and headphones.
2181 * For input, there's a microphone jack, and an "audio in" jack.
2182 * These may not do anything useful with this driver yet, because I
2183 * haven't setup any initialization verbs for these yet...
2186 static hda_nid_t alc880_w810_dac_nids[3] = {
2187 /* front, rear/surround, clfe */
2191 /* fixed 6 channels */
2192 static struct hda_channel_mode alc880_w810_modes[1] = {
2196 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2197 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2198 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2199 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2200 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2201 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2202 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2203 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2204 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2205 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2206 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2214 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2215 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2219 static hda_nid_t alc880_z71v_dac_nids[1] = {
2222 #define ALC880_Z71V_HP_DAC 0x03
2224 /* fixed 2 channels */
2225 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2229 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2230 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2231 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2232 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2233 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2234 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2235 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2236 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2237 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2243 * ALC880 F1734 model
2245 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2246 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2249 static hda_nid_t alc880_f1734_dac_nids[1] = {
2252 #define ALC880_F1734_HP_DAC 0x02
2254 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2255 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2256 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2257 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2258 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2259 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2260 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2261 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2262 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2266 static struct hda_input_mux alc880_f1734_capture_source = {
2278 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2279 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2280 * Mic = 0x18, Line = 0x1a
2283 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2284 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2286 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2287 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2288 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2289 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2290 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2291 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2292 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2293 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2294 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2295 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2296 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2297 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2298 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2299 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2300 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2302 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2303 .name = "Channel Mode",
2304 .info = alc_ch_mode_info,
2305 .get = alc_ch_mode_get,
2306 .put = alc_ch_mode_put,
2312 * ALC880 ASUS W1V model
2314 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2315 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2316 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2319 /* additional mixers to alc880_asus_mixer */
2320 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2321 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2322 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2327 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2328 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2329 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2330 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
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("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2334 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2335 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2336 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2341 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2342 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2343 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2344 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2345 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2346 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2347 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2348 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2349 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2350 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2351 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2352 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2353 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2354 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2355 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2356 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2357 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2359 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2360 .name = "Channel Mode",
2361 .info = alc_ch_mode_info,
2362 .get = alc_ch_mode_get,
2363 .put = alc_ch_mode_put,
2368 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2369 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2370 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2371 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2372 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2373 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2374 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2375 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2376 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2377 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2378 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2382 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2383 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2384 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2385 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2386 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2387 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2388 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2393 * virtual master controls
2397 * slave controls for virtual master
2399 static const char *alc_slave_vols[] = {
2400 "Front Playback Volume",
2401 "Surround Playback Volume",
2402 "Center Playback Volume",
2403 "LFE Playback Volume",
2404 "Side Playback Volume",
2405 "Headphone Playback Volume",
2406 "Speaker Playback Volume",
2407 "Mono Playback Volume",
2408 "Line-Out Playback Volume",
2409 "PCM Playback Volume",
2413 static const char *alc_slave_sws[] = {
2414 "Front Playback Switch",
2415 "Surround Playback Switch",
2416 "Center Playback Switch",
2417 "LFE Playback Switch",
2418 "Side Playback Switch",
2419 "Headphone Playback Switch",
2420 "Speaker Playback Switch",
2421 "Mono Playback Switch",
2422 "IEC958 Playback Switch",
2423 "Line-Out Playback Switch",
2424 "PCM Playback Switch",
2429 * build control elements
2432 #define NID_MAPPING (-1)
2434 #define SUBDEV_SPEAKER_ (0 << 6)
2435 #define SUBDEV_HP_ (1 << 6)
2436 #define SUBDEV_LINE_ (2 << 6)
2437 #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f))
2438 #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f))
2439 #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f))
2441 static void alc_free_kctls(struct hda_codec *codec);
2443 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2444 /* additional beep mixers; the actual parameters are overwritten at build */
2445 static struct snd_kcontrol_new alc_beep_mixer[] = {
2446 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2447 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
2452 static int alc_build_controls(struct hda_codec *codec)
2454 struct alc_spec *spec = codec->spec;
2455 struct snd_kcontrol *kctl;
2456 struct snd_kcontrol_new *knew;
2461 for (i = 0; i < spec->num_mixers; i++) {
2462 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2466 if (spec->cap_mixer) {
2467 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2471 if (spec->multiout.dig_out_nid) {
2472 err = snd_hda_create_spdif_out_ctls(codec,
2473 spec->multiout.dig_out_nid);
2476 if (!spec->no_analog) {
2477 err = snd_hda_create_spdif_share_sw(codec,
2481 spec->multiout.share_spdif = 1;
2484 if (spec->dig_in_nid) {
2485 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2490 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2491 /* create beep controls if needed */
2492 if (spec->beep_amp) {
2493 struct snd_kcontrol_new *knew;
2494 for (knew = alc_beep_mixer; knew->name; knew++) {
2495 struct snd_kcontrol *kctl;
2496 kctl = snd_ctl_new1(knew, codec);
2499 kctl->private_value = spec->beep_amp;
2500 err = snd_hda_ctl_add(codec, 0, kctl);
2507 /* if we have no master control, let's create it */
2508 if (!spec->no_analog &&
2509 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2510 unsigned int vmaster_tlv[4];
2511 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2512 HDA_OUTPUT, vmaster_tlv);
2513 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2514 vmaster_tlv, alc_slave_vols);
2518 if (!spec->no_analog &&
2519 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2520 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2521 NULL, alc_slave_sws);
2526 alc_free_kctls(codec); /* no longer needed */
2528 /* assign Capture Source enums to NID */
2529 kctl = snd_hda_find_mixer_ctl(codec, "Capture Source");
2531 kctl = snd_hda_find_mixer_ctl(codec, "Input Source");
2532 for (i = 0; kctl && i < kctl->count; i++) {
2533 hda_nid_t *nids = spec->capsrc_nids;
2535 nids = spec->adc_nids;
2536 err = snd_hda_add_nid(codec, kctl, i, nids[i]);
2540 if (spec->cap_mixer) {
2541 const char *kname = kctl ? kctl->id.name : NULL;
2542 for (knew = spec->cap_mixer; knew->name; knew++) {
2543 if (kname && strcmp(knew->name, kname) == 0)
2545 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2546 for (i = 0; kctl && i < kctl->count; i++) {
2547 err = snd_hda_add_nid(codec, kctl, i,
2555 /* other nid->control mapping */
2556 for (i = 0; i < spec->num_mixers; i++) {
2557 for (knew = spec->mixers[i]; knew->name; knew++) {
2558 if (knew->iface != NID_MAPPING)
2560 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2563 u = knew->subdevice;
2564 for (j = 0; j < 4; j++, u >>= 8) {
2569 case SUBDEV_SPEAKER_:
2570 nid = spec->autocfg.speaker_pins[nid];
2573 nid = spec->autocfg.line_out_pins[nid];
2576 nid = spec->autocfg.hp_pins[nid];
2581 err = snd_hda_add_nid(codec, kctl, 0, nid);
2585 u = knew->private_value;
2586 for (j = 0; j < 4; j++, u >>= 8) {
2590 err = snd_hda_add_nid(codec, kctl, 0, nid);
2601 * initialize the codec volumes, etc
2605 * generic initialization of ADC, input mixers and output mixers
2607 static struct hda_verb alc880_volume_init_verbs[] = {
2609 * Unmute ADC0-2 and set the default input to mic-in
2611 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2612 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2613 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2614 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2615 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2616 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2618 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2620 * Note: PASD motherboards uses the Line In 2 as the input for front
2623 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2624 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2625 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2626 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2627 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2628 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2629 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2630 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2633 * Set up output mixers (0x0c - 0x0f)
2635 /* set vol=0 to output mixers */
2636 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2637 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2638 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2639 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2640 /* set up input amps for analog loopback */
2641 /* Amp Indices: DAC = 0, mixer = 1 */
2642 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2643 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2644 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2645 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2646 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2647 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2648 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2649 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2655 * 3-stack pin configuration:
2656 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2658 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2660 * preset connection lists of input pins
2661 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2663 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2664 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2665 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2668 * Set pin mode and muting
2670 /* set front pin widgets 0x14 for output */
2671 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2672 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2673 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2674 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2675 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2676 /* Mic2 (as headphone out) for HP output */
2677 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2678 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2679 /* Line In pin widget for input */
2680 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2681 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2682 /* Line2 (as front mic) pin widget for input and vref at 80% */
2683 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2684 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2685 /* CD pin widget for input */
2686 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2692 * 5-stack pin configuration:
2693 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2694 * line-in/side = 0x1a, f-mic = 0x1b
2696 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2698 * preset connection lists of input pins
2699 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2701 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2702 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2705 * Set pin mode and muting
2707 /* set pin widgets 0x14-0x17 for output */
2708 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2709 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2710 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2711 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2712 /* unmute pins for output (no gain on this amp) */
2713 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2714 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2715 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2716 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2718 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2719 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2720 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2721 /* Mic2 (as headphone out) for HP output */
2722 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2723 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2724 /* Line In pin widget for input */
2725 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2726 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2727 /* Line2 (as front mic) pin widget for input and vref at 80% */
2728 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2729 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2730 /* CD pin widget for input */
2731 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2737 * W810 pin configuration:
2738 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2740 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2741 /* hphone/speaker input selector: front DAC */
2742 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2744 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2745 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2746 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2747 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2748 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2749 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2751 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2752 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2758 * Z71V pin configuration:
2759 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2761 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2762 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2763 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2764 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2765 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2767 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2768 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2769 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2770 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2776 * 6-stack pin configuration:
2777 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2778 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2780 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2781 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2783 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2784 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2785 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2786 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2787 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2788 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2789 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2790 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2792 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2793 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2794 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2795 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2796 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2797 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2798 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2799 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2800 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2806 * Uniwill pin configuration:
2807 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2810 static struct hda_verb alc880_uniwill_init_verbs[] = {
2811 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2813 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2814 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2815 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2816 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2817 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2818 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2819 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2820 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2821 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2822 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2823 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2824 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2825 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2826 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2828 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2829 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2830 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2831 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2832 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2833 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2834 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2835 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2836 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2838 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2839 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2846 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2848 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2849 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2851 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2852 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2853 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2854 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2855 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2856 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2857 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2858 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2859 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2860 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2861 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2862 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2864 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2865 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2866 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2867 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2868 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2869 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2871 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2872 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2877 static struct hda_verb alc880_beep_init_verbs[] = {
2878 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2882 /* auto-toggle front mic */
2883 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2885 unsigned int present;
2888 present = snd_hda_jack_detect(codec, 0x18);
2889 bits = present ? HDA_AMP_MUTE : 0;
2890 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2893 static void alc880_uniwill_setup(struct hda_codec *codec)
2895 struct alc_spec *spec = codec->spec;
2897 spec->autocfg.hp_pins[0] = 0x14;
2898 spec->autocfg.speaker_pins[0] = 0x15;
2899 spec->autocfg.speaker_pins[0] = 0x16;
2902 static void alc880_uniwill_init_hook(struct hda_codec *codec)
2904 alc_automute_amp(codec);
2905 alc880_uniwill_mic_automute(codec);
2908 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2911 /* Looks like the unsol event is incompatible with the standard
2912 * definition. 4bit tag is placed at 28 bit!
2914 switch (res >> 28) {
2915 case ALC880_MIC_EVENT:
2916 alc880_uniwill_mic_automute(codec);
2919 alc_automute_amp_unsol_event(codec, res);
2924 static void alc880_uniwill_p53_setup(struct hda_codec *codec)
2926 struct alc_spec *spec = codec->spec;
2928 spec->autocfg.hp_pins[0] = 0x14;
2929 spec->autocfg.speaker_pins[0] = 0x15;
2932 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2934 unsigned int present;
2936 present = snd_hda_codec_read(codec, 0x21, 0,
2937 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2938 present &= HDA_AMP_VOLMASK;
2939 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2940 HDA_AMP_VOLMASK, present);
2941 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2942 HDA_AMP_VOLMASK, present);
2945 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2948 /* Looks like the unsol event is incompatible with the standard
2949 * definition. 4bit tag is placed at 28 bit!
2951 if ((res >> 28) == ALC880_DCVOL_EVENT)
2952 alc880_uniwill_p53_dcvol_automute(codec);
2954 alc_automute_amp_unsol_event(codec, res);
2958 * F1734 pin configuration:
2959 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2961 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2962 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2963 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2964 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2965 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2966 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2968 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2969 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2970 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2971 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2973 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2974 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2975 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2976 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2977 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2978 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2979 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2980 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2981 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2983 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2984 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2990 * ASUS pin configuration:
2991 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2993 static struct hda_verb alc880_pin_asus_init_verbs[] = {
2994 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2995 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2996 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2997 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2999 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3000 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3001 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3002 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3003 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3004 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3005 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3006 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3008 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3009 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3010 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3011 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3012 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3013 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3014 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3015 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3016 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3021 /* Enable GPIO mask and set output */
3022 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
3023 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
3024 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
3026 /* Clevo m520g init */
3027 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
3028 /* headphone output */
3029 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3031 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3032 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3034 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3035 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3037 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3038 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3039 /* Mic1 (rear panel) */
3040 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3041 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3042 /* Mic2 (front panel) */
3043 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3044 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3046 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3047 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3048 /* change to EAPD mode */
3049 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3050 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3055 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
3056 /* change to EAPD mode */
3057 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3058 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3060 /* Headphone output */
3061 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3063 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3064 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
3066 /* Line In pin widget for input */
3067 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3068 /* CD pin widget for input */
3069 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3070 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3071 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3073 /* change to EAPD mode */
3074 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3075 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
3081 * LG m1 express dual
3084 * Rear Line-In/Out (blue): 0x14
3085 * Build-in Mic-In: 0x15
3087 * HP-Out (green): 0x1b
3088 * Mic-In/Out (red): 0x19
3092 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
3093 static hda_nid_t alc880_lg_dac_nids[3] = {
3097 /* seems analog CD is not working */
3098 static struct hda_input_mux alc880_lg_capture_source = {
3103 { "Internal Mic", 0x6 },
3107 /* 2,4,6 channel modes */
3108 static struct hda_verb alc880_lg_ch2_init[] = {
3109 /* set line-in and mic-in to input */
3110 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
3111 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3115 static struct hda_verb alc880_lg_ch4_init[] = {
3116 /* set line-in to out and mic-in to input */
3117 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3118 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3122 static struct hda_verb alc880_lg_ch6_init[] = {
3123 /* set line-in and mic-in to output */
3124 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3125 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3129 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
3130 { 2, alc880_lg_ch2_init },
3131 { 4, alc880_lg_ch4_init },
3132 { 6, alc880_lg_ch6_init },
3135 static struct snd_kcontrol_new alc880_lg_mixer[] = {
3136 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3137 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3138 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3139 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3140 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3141 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3142 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3143 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3144 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3145 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3146 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3147 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3148 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3149 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3151 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3152 .name = "Channel Mode",
3153 .info = alc_ch_mode_info,
3154 .get = alc_ch_mode_get,
3155 .put = alc_ch_mode_put,
3160 static struct hda_verb alc880_lg_init_verbs[] = {
3161 /* set capture source to mic-in */
3162 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3163 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3164 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3165 /* mute all amp mixer inputs */
3166 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3167 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3168 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3169 /* line-in to input */
3170 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3171 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3173 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3174 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3176 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3177 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3178 /* mic-in to input */
3179 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3180 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3181 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3183 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3184 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3185 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3187 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3191 /* toggle speaker-output according to the hp-jack state */
3192 static void alc880_lg_setup(struct hda_codec *codec)
3194 struct alc_spec *spec = codec->spec;
3196 spec->autocfg.hp_pins[0] = 0x1b;
3197 spec->autocfg.speaker_pins[0] = 0x17;
3206 * Built-in Mic-In: 0x19
3212 static struct hda_input_mux alc880_lg_lw_capture_source = {
3216 { "Internal Mic", 0x1 },
3221 #define alc880_lg_lw_modes alc880_threestack_modes
3223 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3224 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3225 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3226 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3227 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3228 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3229 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3230 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3231 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3232 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3233 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3234 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3235 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3236 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
3237 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
3239 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3240 .name = "Channel Mode",
3241 .info = alc_ch_mode_info,
3242 .get = alc_ch_mode_get,
3243 .put = alc_ch_mode_put,
3248 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3249 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3250 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3251 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3253 /* set capture source to mic-in */
3254 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3255 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3256 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3257 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3259 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3260 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3262 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3263 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3264 /* mic-in to input */
3265 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3266 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3268 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3269 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3271 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3275 /* toggle speaker-output according to the hp-jack state */
3276 static void alc880_lg_lw_setup(struct hda_codec *codec)
3278 struct alc_spec *spec = codec->spec;
3280 spec->autocfg.hp_pins[0] = 0x1b;
3281 spec->autocfg.speaker_pins[0] = 0x14;
3284 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3285 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3286 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3287 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3288 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3289 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3290 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3294 static struct hda_input_mux alc880_medion_rim_capture_source = {
3298 { "Internal Mic", 0x1 },
3302 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3303 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3305 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3306 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3308 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3309 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3310 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3311 /* Mic2 (as headphone out) for HP output */
3312 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3313 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3314 /* Internal Speaker */
3315 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3316 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3318 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3319 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3321 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3325 /* toggle speaker-output according to the hp-jack state */
3326 static void alc880_medion_rim_automute(struct hda_codec *codec)
3328 struct alc_spec *spec = codec->spec;
3329 alc_automute_amp(codec);
3331 if (spec->jack_present)
3332 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3334 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3337 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3340 /* Looks like the unsol event is incompatible with the standard
3341 * definition. 4bit tag is placed at 28 bit!
3343 if ((res >> 28) == ALC880_HP_EVENT)
3344 alc880_medion_rim_automute(codec);
3347 static void alc880_medion_rim_setup(struct hda_codec *codec)
3349 struct alc_spec *spec = codec->spec;
3351 spec->autocfg.hp_pins[0] = 0x14;
3352 spec->autocfg.speaker_pins[0] = 0x1b;
3355 #ifdef CONFIG_SND_HDA_POWER_SAVE
3356 static struct hda_amp_list alc880_loopbacks[] = {
3357 { 0x0b, HDA_INPUT, 0 },
3358 { 0x0b, HDA_INPUT, 1 },
3359 { 0x0b, HDA_INPUT, 2 },
3360 { 0x0b, HDA_INPUT, 3 },
3361 { 0x0b, HDA_INPUT, 4 },
3365 static struct hda_amp_list alc880_lg_loopbacks[] = {
3366 { 0x0b, HDA_INPUT, 1 },
3367 { 0x0b, HDA_INPUT, 6 },
3368 { 0x0b, HDA_INPUT, 7 },
3377 static int alc_init(struct hda_codec *codec)
3379 struct alc_spec *spec = codec->spec;
3383 alc_auto_init_amp(codec, spec->init_amp);
3385 for (i = 0; i < spec->num_init_verbs; i++)
3386 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3388 if (spec->init_hook)
3389 spec->init_hook(codec);
3394 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3396 struct alc_spec *spec = codec->spec;
3398 if (spec->unsol_event)
3399 spec->unsol_event(codec, res);
3402 #ifdef CONFIG_SND_HDA_POWER_SAVE
3403 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3405 struct alc_spec *spec = codec->spec;
3406 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3411 * Analog playback callbacks
3413 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3414 struct hda_codec *codec,
3415 struct snd_pcm_substream *substream)
3417 struct alc_spec *spec = codec->spec;
3418 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3422 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3423 struct hda_codec *codec,
3424 unsigned int stream_tag,
3425 unsigned int format,
3426 struct snd_pcm_substream *substream)
3428 struct alc_spec *spec = codec->spec;
3429 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3430 stream_tag, format, substream);
3433 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3434 struct hda_codec *codec,
3435 struct snd_pcm_substream *substream)
3437 struct alc_spec *spec = codec->spec;
3438 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3444 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3445 struct hda_codec *codec,
3446 struct snd_pcm_substream *substream)
3448 struct alc_spec *spec = codec->spec;
3449 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3452 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3453 struct hda_codec *codec,
3454 unsigned int stream_tag,
3455 unsigned int format,
3456 struct snd_pcm_substream *substream)
3458 struct alc_spec *spec = codec->spec;
3459 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3460 stream_tag, format, substream);
3463 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3464 struct hda_codec *codec,
3465 struct snd_pcm_substream *substream)
3467 struct alc_spec *spec = codec->spec;
3468 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3471 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3472 struct hda_codec *codec,
3473 struct snd_pcm_substream *substream)
3475 struct alc_spec *spec = codec->spec;
3476 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3482 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3483 struct hda_codec *codec,
3484 unsigned int stream_tag,
3485 unsigned int format,
3486 struct snd_pcm_substream *substream)
3488 struct alc_spec *spec = codec->spec;
3490 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3491 stream_tag, 0, format);
3495 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3496 struct hda_codec *codec,
3497 struct snd_pcm_substream *substream)
3499 struct alc_spec *spec = codec->spec;
3501 snd_hda_codec_cleanup_stream(codec,
3502 spec->adc_nids[substream->number + 1]);
3509 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3513 /* NID is set in alc_build_pcms */
3515 .open = alc880_playback_pcm_open,
3516 .prepare = alc880_playback_pcm_prepare,
3517 .cleanup = alc880_playback_pcm_cleanup
3521 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3525 /* NID is set in alc_build_pcms */
3528 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3532 /* NID is set in alc_build_pcms */
3535 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3536 .substreams = 2, /* can be overridden */
3539 /* NID is set in alc_build_pcms */
3541 .prepare = alc880_alt_capture_pcm_prepare,
3542 .cleanup = alc880_alt_capture_pcm_cleanup
3546 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3550 /* NID is set in alc_build_pcms */
3552 .open = alc880_dig_playback_pcm_open,
3553 .close = alc880_dig_playback_pcm_close,
3554 .prepare = alc880_dig_playback_pcm_prepare,
3555 .cleanup = alc880_dig_playback_pcm_cleanup
3559 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3563 /* NID is set in alc_build_pcms */
3566 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3567 static struct hda_pcm_stream alc_pcm_null_stream = {
3573 static int alc_build_pcms(struct hda_codec *codec)
3575 struct alc_spec *spec = codec->spec;
3576 struct hda_pcm *info = spec->pcm_rec;
3579 codec->num_pcms = 1;
3580 codec->pcm_info = info;
3582 if (spec->no_analog)
3585 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
3586 "%s Analog", codec->chip_name);
3587 info->name = spec->stream_name_analog;
3589 if (spec->stream_analog_playback) {
3590 if (snd_BUG_ON(!spec->multiout.dac_nids))
3592 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3593 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3595 if (spec->stream_analog_capture) {
3596 if (snd_BUG_ON(!spec->adc_nids))
3598 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3599 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3602 if (spec->channel_mode) {
3603 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3604 for (i = 0; i < spec->num_channel_mode; i++) {
3605 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3606 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3612 /* SPDIF for stream index #1 */
3613 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3614 snprintf(spec->stream_name_digital,
3615 sizeof(spec->stream_name_digital),
3616 "%s Digital", codec->chip_name);
3617 codec->num_pcms = 2;
3618 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3619 info = spec->pcm_rec + 1;
3620 info->name = spec->stream_name_digital;
3621 if (spec->dig_out_type)
3622 info->pcm_type = spec->dig_out_type;
3624 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3625 if (spec->multiout.dig_out_nid &&
3626 spec->stream_digital_playback) {
3627 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3628 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3630 if (spec->dig_in_nid &&
3631 spec->stream_digital_capture) {
3632 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3633 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3635 /* FIXME: do we need this for all Realtek codec models? */
3636 codec->spdif_status_reset = 1;
3639 if (spec->no_analog)
3642 /* If the use of more than one ADC is requested for the current
3643 * model, configure a second analog capture-only PCM.
3645 /* Additional Analaog capture for index #2 */
3646 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3647 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3648 codec->num_pcms = 3;
3649 info = spec->pcm_rec + 2;
3650 info->name = spec->stream_name_analog;
3651 if (spec->alt_dac_nid) {
3652 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3653 *spec->stream_analog_alt_playback;
3654 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3657 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3658 alc_pcm_null_stream;
3659 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3661 if (spec->num_adc_nids > 1) {
3662 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3663 *spec->stream_analog_alt_capture;
3664 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3666 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3667 spec->num_adc_nids - 1;
3669 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3670 alc_pcm_null_stream;
3671 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3678 static inline void alc_shutup(struct hda_codec *codec)
3680 snd_hda_shutup_pins(codec);
3683 static void alc_free_kctls(struct hda_codec *codec)
3685 struct alc_spec *spec = codec->spec;
3687 if (spec->kctls.list) {
3688 struct snd_kcontrol_new *kctl = spec->kctls.list;
3690 for (i = 0; i < spec->kctls.used; i++)
3691 kfree(kctl[i].name);
3693 snd_array_free(&spec->kctls);
3696 static void alc_free(struct hda_codec *codec)
3698 struct alc_spec *spec = codec->spec;
3704 alc_free_kctls(codec);
3706 snd_hda_detach_beep_device(codec);
3709 #ifdef CONFIG_SND_HDA_POWER_SAVE
3710 static void alc_power_eapd(struct hda_codec *codec)
3712 /* We currently only handle front, HP */
3713 switch (codec->vendor_id) {
3715 set_eapd(codec, 0x0f, 0);
3716 set_eapd(codec, 0x10, 0);
3729 set_eapd(codec, 0x14, 0);
3730 set_eapd(codec, 0x15, 0);
3735 static int alc_suspend(struct hda_codec *codec, pm_message_t state)
3737 struct alc_spec *spec = codec->spec;
3739 if (spec && spec->power_hook)
3740 spec->power_hook(codec);
3745 #ifdef SND_HDA_NEEDS_RESUME
3746 static int alc_resume(struct hda_codec *codec)
3748 codec->patch_ops.init(codec);
3749 snd_hda_codec_resume_amp(codec);
3750 snd_hda_codec_resume_cache(codec);
3757 static struct hda_codec_ops alc_patch_ops = {
3758 .build_controls = alc_build_controls,
3759 .build_pcms = alc_build_pcms,
3762 .unsol_event = alc_unsol_event,
3763 #ifdef SND_HDA_NEEDS_RESUME
3764 .resume = alc_resume,
3766 #ifdef CONFIG_SND_HDA_POWER_SAVE
3767 .suspend = alc_suspend,
3768 .check_power_status = alc_check_power_status,
3770 .reboot_notify = alc_shutup,
3775 * Test configuration for debugging
3777 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3780 #ifdef CONFIG_SND_DEBUG
3781 static hda_nid_t alc880_test_dac_nids[4] = {
3782 0x02, 0x03, 0x04, 0x05
3785 static struct hda_input_mux alc880_test_capture_source = {
3794 { "Surround", 0x6 },
3798 static struct hda_channel_mode alc880_test_modes[4] = {
3805 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3806 struct snd_ctl_elem_info *uinfo)
3808 static char *texts[] = {
3809 "N/A", "Line Out", "HP Out",
3810 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3812 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3814 uinfo->value.enumerated.items = 8;
3815 if (uinfo->value.enumerated.item >= 8)
3816 uinfo->value.enumerated.item = 7;
3817 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3821 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3822 struct snd_ctl_elem_value *ucontrol)
3824 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3825 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3826 unsigned int pin_ctl, item = 0;
3828 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3829 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3830 if (pin_ctl & AC_PINCTL_OUT_EN) {
3831 if (pin_ctl & AC_PINCTL_HP_EN)
3835 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3836 switch (pin_ctl & AC_PINCTL_VREFEN) {
3837 case AC_PINCTL_VREF_HIZ: item = 3; break;
3838 case AC_PINCTL_VREF_50: item = 4; break;
3839 case AC_PINCTL_VREF_GRD: item = 5; break;
3840 case AC_PINCTL_VREF_80: item = 6; break;
3841 case AC_PINCTL_VREF_100: item = 7; break;
3844 ucontrol->value.enumerated.item[0] = item;
3848 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3849 struct snd_ctl_elem_value *ucontrol)
3851 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3852 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3853 static unsigned int ctls[] = {
3854 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3855 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3856 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3857 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3858 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3859 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3861 unsigned int old_ctl, new_ctl;
3863 old_ctl = snd_hda_codec_read(codec, nid, 0,
3864 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3865 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3866 if (old_ctl != new_ctl) {
3868 snd_hda_codec_write_cache(codec, nid, 0,
3869 AC_VERB_SET_PIN_WIDGET_CONTROL,
3871 val = ucontrol->value.enumerated.item[0] >= 3 ?
3873 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3880 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3881 struct snd_ctl_elem_info *uinfo)
3883 static char *texts[] = {
3884 "Front", "Surround", "CLFE", "Side"
3886 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3888 uinfo->value.enumerated.items = 4;
3889 if (uinfo->value.enumerated.item >= 4)
3890 uinfo->value.enumerated.item = 3;
3891 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3895 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3896 struct snd_ctl_elem_value *ucontrol)
3898 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3899 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3902 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3903 ucontrol->value.enumerated.item[0] = sel & 3;
3907 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3908 struct snd_ctl_elem_value *ucontrol)
3910 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3911 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3914 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3915 if (ucontrol->value.enumerated.item[0] != sel) {
3916 sel = ucontrol->value.enumerated.item[0] & 3;
3917 snd_hda_codec_write_cache(codec, nid, 0,
3918 AC_VERB_SET_CONNECT_SEL, sel);
3924 #define PIN_CTL_TEST(xname,nid) { \
3925 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3927 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
3928 .info = alc_test_pin_ctl_info, \
3929 .get = alc_test_pin_ctl_get, \
3930 .put = alc_test_pin_ctl_put, \
3931 .private_value = nid \
3934 #define PIN_SRC_TEST(xname,nid) { \
3935 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3937 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
3938 .info = alc_test_pin_src_info, \
3939 .get = alc_test_pin_src_get, \
3940 .put = alc_test_pin_src_put, \
3941 .private_value = nid \
3944 static struct snd_kcontrol_new alc880_test_mixer[] = {
3945 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3946 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3947 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3948 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3949 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3950 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3951 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3952 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3953 PIN_CTL_TEST("Front Pin Mode", 0x14),
3954 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3955 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3956 PIN_CTL_TEST("Side Pin Mode", 0x17),
3957 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3958 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3959 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3960 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3961 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3962 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3963 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3964 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3965 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3966 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3967 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3968 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3969 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3970 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3971 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3972 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3973 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3974 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3976 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3977 .name = "Channel Mode",
3978 .info = alc_ch_mode_info,
3979 .get = alc_ch_mode_get,
3980 .put = alc_ch_mode_put,
3985 static struct hda_verb alc880_test_init_verbs[] = {
3986 /* Unmute inputs of 0x0c - 0x0f */
3987 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3988 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3989 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3990 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3991 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3992 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3993 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3994 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3995 /* Vol output for 0x0c-0x0f */
3996 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3997 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3998 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3999 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4000 /* Set output pins 0x14-0x17 */
4001 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4002 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4003 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4004 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4005 /* Unmute output pins 0x14-0x17 */
4006 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4007 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4008 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4009 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4010 /* Set input pins 0x18-0x1c */
4011 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4012 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4013 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4014 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4015 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4016 /* Mute input pins 0x18-0x1b */
4017 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4018 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4019 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4020 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4022 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4023 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
4024 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4025 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
4026 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4027 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
4028 /* Analog input/passthru */
4029 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4030 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4031 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4032 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4033 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4041 static const char *alc880_models[ALC880_MODEL_LAST] = {
4042 [ALC880_3ST] = "3stack",
4043 [ALC880_TCL_S700] = "tcl",
4044 [ALC880_3ST_DIG] = "3stack-digout",
4045 [ALC880_CLEVO] = "clevo",
4046 [ALC880_5ST] = "5stack",
4047 [ALC880_5ST_DIG] = "5stack-digout",
4048 [ALC880_W810] = "w810",
4049 [ALC880_Z71V] = "z71v",
4050 [ALC880_6ST] = "6stack",
4051 [ALC880_6ST_DIG] = "6stack-digout",
4052 [ALC880_ASUS] = "asus",
4053 [ALC880_ASUS_W1V] = "asus-w1v",
4054 [ALC880_ASUS_DIG] = "asus-dig",
4055 [ALC880_ASUS_DIG2] = "asus-dig2",
4056 [ALC880_UNIWILL_DIG] = "uniwill",
4057 [ALC880_UNIWILL_P53] = "uniwill-p53",
4058 [ALC880_FUJITSU] = "fujitsu",
4059 [ALC880_F1734] = "F1734",
4061 [ALC880_LG_LW] = "lg-lw",
4062 [ALC880_MEDION_RIM] = "medion",
4063 #ifdef CONFIG_SND_DEBUG
4064 [ALC880_TEST] = "test",
4066 [ALC880_AUTO] = "auto",
4069 static struct snd_pci_quirk alc880_cfg_tbl[] = {
4070 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
4071 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
4072 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
4073 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
4074 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
4075 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
4076 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
4077 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
4078 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
4079 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
4080 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
4081 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
4082 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
4083 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
4084 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
4085 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
4086 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
4087 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
4088 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
4089 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
4090 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
4091 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
4092 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
4093 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
4094 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
4095 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
4096 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
4097 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
4098 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
4099 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
4100 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
4101 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
4102 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
4103 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
4104 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
4105 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
4106 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
4107 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
4108 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
4109 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
4110 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
4111 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
4112 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
4113 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
4114 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
4115 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
4116 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
4117 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
4118 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
4119 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
4120 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
4121 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
4122 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
4123 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
4124 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
4125 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
4126 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
4127 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
4128 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
4129 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
4130 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
4131 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
4132 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
4133 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
4134 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
4135 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
4136 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
4137 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
4139 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
4140 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
4141 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
4146 * ALC880 codec presets
4148 static struct alc_config_preset alc880_presets[] = {
4150 .mixers = { alc880_three_stack_mixer },
4151 .init_verbs = { alc880_volume_init_verbs,
4152 alc880_pin_3stack_init_verbs },
4153 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4154 .dac_nids = alc880_dac_nids,
4155 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4156 .channel_mode = alc880_threestack_modes,
4158 .input_mux = &alc880_capture_source,
4160 [ALC880_3ST_DIG] = {
4161 .mixers = { alc880_three_stack_mixer },
4162 .init_verbs = { alc880_volume_init_verbs,
4163 alc880_pin_3stack_init_verbs },
4164 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4165 .dac_nids = alc880_dac_nids,
4166 .dig_out_nid = ALC880_DIGOUT_NID,
4167 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4168 .channel_mode = alc880_threestack_modes,
4170 .input_mux = &alc880_capture_source,
4172 [ALC880_TCL_S700] = {
4173 .mixers = { alc880_tcl_s700_mixer },
4174 .init_verbs = { alc880_volume_init_verbs,
4175 alc880_pin_tcl_S700_init_verbs,
4176 alc880_gpio2_init_verbs },
4177 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4178 .dac_nids = alc880_dac_nids,
4179 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4180 .num_adc_nids = 1, /* single ADC */
4182 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4183 .channel_mode = alc880_2_jack_modes,
4184 .input_mux = &alc880_capture_source,
4187 .mixers = { alc880_three_stack_mixer,
4188 alc880_five_stack_mixer},
4189 .init_verbs = { alc880_volume_init_verbs,
4190 alc880_pin_5stack_init_verbs },
4191 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4192 .dac_nids = alc880_dac_nids,
4193 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4194 .channel_mode = alc880_fivestack_modes,
4195 .input_mux = &alc880_capture_source,
4197 [ALC880_5ST_DIG] = {
4198 .mixers = { alc880_three_stack_mixer,
4199 alc880_five_stack_mixer },
4200 .init_verbs = { alc880_volume_init_verbs,
4201 alc880_pin_5stack_init_verbs },
4202 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4203 .dac_nids = alc880_dac_nids,
4204 .dig_out_nid = ALC880_DIGOUT_NID,
4205 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4206 .channel_mode = alc880_fivestack_modes,
4207 .input_mux = &alc880_capture_source,
4210 .mixers = { alc880_six_stack_mixer },
4211 .init_verbs = { alc880_volume_init_verbs,
4212 alc880_pin_6stack_init_verbs },
4213 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4214 .dac_nids = alc880_6st_dac_nids,
4215 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4216 .channel_mode = alc880_sixstack_modes,
4217 .input_mux = &alc880_6stack_capture_source,
4219 [ALC880_6ST_DIG] = {
4220 .mixers = { alc880_six_stack_mixer },
4221 .init_verbs = { alc880_volume_init_verbs,
4222 alc880_pin_6stack_init_verbs },
4223 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4224 .dac_nids = alc880_6st_dac_nids,
4225 .dig_out_nid = ALC880_DIGOUT_NID,
4226 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4227 .channel_mode = alc880_sixstack_modes,
4228 .input_mux = &alc880_6stack_capture_source,
4231 .mixers = { alc880_w810_base_mixer },
4232 .init_verbs = { alc880_volume_init_verbs,
4233 alc880_pin_w810_init_verbs,
4234 alc880_gpio2_init_verbs },
4235 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
4236 .dac_nids = alc880_w810_dac_nids,
4237 .dig_out_nid = ALC880_DIGOUT_NID,
4238 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4239 .channel_mode = alc880_w810_modes,
4240 .input_mux = &alc880_capture_source,
4243 .mixers = { alc880_z71v_mixer },
4244 .init_verbs = { alc880_volume_init_verbs,
4245 alc880_pin_z71v_init_verbs },
4246 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
4247 .dac_nids = alc880_z71v_dac_nids,
4248 .dig_out_nid = ALC880_DIGOUT_NID,
4250 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4251 .channel_mode = alc880_2_jack_modes,
4252 .input_mux = &alc880_capture_source,
4255 .mixers = { alc880_f1734_mixer },
4256 .init_verbs = { alc880_volume_init_verbs,
4257 alc880_pin_f1734_init_verbs },
4258 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
4259 .dac_nids = alc880_f1734_dac_nids,
4261 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4262 .channel_mode = alc880_2_jack_modes,
4263 .input_mux = &alc880_f1734_capture_source,
4264 .unsol_event = alc880_uniwill_p53_unsol_event,
4265 .setup = alc880_uniwill_p53_setup,
4266 .init_hook = alc_automute_amp,
4269 .mixers = { alc880_asus_mixer },
4270 .init_verbs = { alc880_volume_init_verbs,
4271 alc880_pin_asus_init_verbs,
4272 alc880_gpio1_init_verbs },
4273 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4274 .dac_nids = alc880_asus_dac_nids,
4275 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4276 .channel_mode = alc880_asus_modes,
4278 .input_mux = &alc880_capture_source,
4280 [ALC880_ASUS_DIG] = {
4281 .mixers = { alc880_asus_mixer },
4282 .init_verbs = { alc880_volume_init_verbs,
4283 alc880_pin_asus_init_verbs,
4284 alc880_gpio1_init_verbs },
4285 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4286 .dac_nids = alc880_asus_dac_nids,
4287 .dig_out_nid = ALC880_DIGOUT_NID,
4288 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4289 .channel_mode = alc880_asus_modes,
4291 .input_mux = &alc880_capture_source,
4293 [ALC880_ASUS_DIG2] = {
4294 .mixers = { alc880_asus_mixer },
4295 .init_verbs = { alc880_volume_init_verbs,
4296 alc880_pin_asus_init_verbs,
4297 alc880_gpio2_init_verbs }, /* use GPIO2 */
4298 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4299 .dac_nids = alc880_asus_dac_nids,
4300 .dig_out_nid = ALC880_DIGOUT_NID,
4301 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4302 .channel_mode = alc880_asus_modes,
4304 .input_mux = &alc880_capture_source,
4306 [ALC880_ASUS_W1V] = {
4307 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4308 .init_verbs = { alc880_volume_init_verbs,
4309 alc880_pin_asus_init_verbs,
4310 alc880_gpio1_init_verbs },
4311 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4312 .dac_nids = alc880_asus_dac_nids,
4313 .dig_out_nid = ALC880_DIGOUT_NID,
4314 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4315 .channel_mode = alc880_asus_modes,
4317 .input_mux = &alc880_capture_source,
4319 [ALC880_UNIWILL_DIG] = {
4320 .mixers = { alc880_asus_mixer },
4321 .init_verbs = { alc880_volume_init_verbs,
4322 alc880_pin_asus_init_verbs },
4323 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4324 .dac_nids = alc880_asus_dac_nids,
4325 .dig_out_nid = ALC880_DIGOUT_NID,
4326 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4327 .channel_mode = alc880_asus_modes,
4329 .input_mux = &alc880_capture_source,
4331 [ALC880_UNIWILL] = {
4332 .mixers = { alc880_uniwill_mixer },
4333 .init_verbs = { alc880_volume_init_verbs,
4334 alc880_uniwill_init_verbs },
4335 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4336 .dac_nids = alc880_asus_dac_nids,
4337 .dig_out_nid = ALC880_DIGOUT_NID,
4338 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4339 .channel_mode = alc880_threestack_modes,
4341 .input_mux = &alc880_capture_source,
4342 .unsol_event = alc880_uniwill_unsol_event,
4343 .setup = alc880_uniwill_setup,
4344 .init_hook = alc880_uniwill_init_hook,
4346 [ALC880_UNIWILL_P53] = {
4347 .mixers = { alc880_uniwill_p53_mixer },
4348 .init_verbs = { alc880_volume_init_verbs,
4349 alc880_uniwill_p53_init_verbs },
4350 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4351 .dac_nids = alc880_asus_dac_nids,
4352 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4353 .channel_mode = alc880_threestack_modes,
4354 .input_mux = &alc880_capture_source,
4355 .unsol_event = alc880_uniwill_p53_unsol_event,
4356 .setup = alc880_uniwill_p53_setup,
4357 .init_hook = alc_automute_amp,
4359 [ALC880_FUJITSU] = {
4360 .mixers = { alc880_fujitsu_mixer },
4361 .init_verbs = { alc880_volume_init_verbs,
4362 alc880_uniwill_p53_init_verbs,
4363 alc880_beep_init_verbs },
4364 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4365 .dac_nids = alc880_dac_nids,
4366 .dig_out_nid = ALC880_DIGOUT_NID,
4367 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4368 .channel_mode = alc880_2_jack_modes,
4369 .input_mux = &alc880_capture_source,
4370 .unsol_event = alc880_uniwill_p53_unsol_event,
4371 .setup = alc880_uniwill_p53_setup,
4372 .init_hook = alc_automute_amp,
4375 .mixers = { alc880_three_stack_mixer },
4376 .init_verbs = { alc880_volume_init_verbs,
4377 alc880_pin_clevo_init_verbs },
4378 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4379 .dac_nids = alc880_dac_nids,
4381 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4382 .channel_mode = alc880_threestack_modes,
4384 .input_mux = &alc880_capture_source,
4387 .mixers = { alc880_lg_mixer },
4388 .init_verbs = { alc880_volume_init_verbs,
4389 alc880_lg_init_verbs },
4390 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4391 .dac_nids = alc880_lg_dac_nids,
4392 .dig_out_nid = ALC880_DIGOUT_NID,
4393 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4394 .channel_mode = alc880_lg_ch_modes,
4396 .input_mux = &alc880_lg_capture_source,
4397 .unsol_event = alc_automute_amp_unsol_event,
4398 .setup = alc880_lg_setup,
4399 .init_hook = alc_automute_amp,
4400 #ifdef CONFIG_SND_HDA_POWER_SAVE
4401 .loopbacks = alc880_lg_loopbacks,
4405 .mixers = { alc880_lg_lw_mixer },
4406 .init_verbs = { alc880_volume_init_verbs,
4407 alc880_lg_lw_init_verbs },
4408 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4409 .dac_nids = alc880_dac_nids,
4410 .dig_out_nid = ALC880_DIGOUT_NID,
4411 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4412 .channel_mode = alc880_lg_lw_modes,
4413 .input_mux = &alc880_lg_lw_capture_source,
4414 .unsol_event = alc_automute_amp_unsol_event,
4415 .setup = alc880_lg_lw_setup,
4416 .init_hook = alc_automute_amp,
4418 [ALC880_MEDION_RIM] = {
4419 .mixers = { alc880_medion_rim_mixer },
4420 .init_verbs = { alc880_volume_init_verbs,
4421 alc880_medion_rim_init_verbs,
4422 alc_gpio2_init_verbs },
4423 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4424 .dac_nids = alc880_dac_nids,
4425 .dig_out_nid = ALC880_DIGOUT_NID,
4426 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4427 .channel_mode = alc880_2_jack_modes,
4428 .input_mux = &alc880_medion_rim_capture_source,
4429 .unsol_event = alc880_medion_rim_unsol_event,
4430 .setup = alc880_medion_rim_setup,
4431 .init_hook = alc880_medion_rim_automute,
4433 #ifdef CONFIG_SND_DEBUG
4435 .mixers = { alc880_test_mixer },
4436 .init_verbs = { alc880_test_init_verbs },
4437 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4438 .dac_nids = alc880_test_dac_nids,
4439 .dig_out_nid = ALC880_DIGOUT_NID,
4440 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4441 .channel_mode = alc880_test_modes,
4442 .input_mux = &alc880_test_capture_source,
4448 * Automatic parse of I/O pins from the BIOS configuration
4453 ALC_CTL_WIDGET_MUTE,
4456 static struct snd_kcontrol_new alc880_control_templates[] = {
4457 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4458 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4459 HDA_BIND_MUTE(NULL, 0, 0, 0),
4462 /* add dynamic controls */
4463 static int add_control(struct alc_spec *spec, int type, const char *name,
4466 struct snd_kcontrol_new *knew;
4468 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4469 knew = snd_array_new(&spec->kctls);
4472 *knew = alc880_control_templates[type];
4473 knew->name = kstrdup(name, GFP_KERNEL);
4476 if (get_amp_nid_(val))
4477 knew->subdevice = HDA_SUBDEV_AMP_FLAG;
4478 knew->private_value = val;
4482 static int add_control_with_pfx(struct alc_spec *spec, int type,
4483 const char *pfx, const char *dir,
4484 const char *sfx, unsigned long val)
4487 snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx);
4488 return add_control(spec, type, name, val);
4491 #define add_pb_vol_ctrl(spec, type, pfx, val) \
4492 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", val)
4493 #define add_pb_sw_ctrl(spec, type, pfx, val) \
4494 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", val)
4496 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4497 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4498 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4499 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4500 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4501 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4502 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4503 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4504 #define ALC880_PIN_CD_NID 0x1c
4506 /* fill in the dac_nids table from the parsed pin configuration */
4507 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4508 const struct auto_pin_cfg *cfg)
4514 memset(assigned, 0, sizeof(assigned));
4515 spec->multiout.dac_nids = spec->private_dac_nids;
4517 /* check the pins hardwired to audio widget */
4518 for (i = 0; i < cfg->line_outs; i++) {
4519 nid = cfg->line_out_pins[i];
4520 if (alc880_is_fixed_pin(nid)) {
4521 int idx = alc880_fixed_pin_idx(nid);
4522 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4526 /* left pins can be connect to any audio widget */
4527 for (i = 0; i < cfg->line_outs; i++) {
4528 nid = cfg->line_out_pins[i];
4529 if (alc880_is_fixed_pin(nid))
4531 /* search for an empty channel */
4532 for (j = 0; j < cfg->line_outs; j++) {
4534 spec->multiout.dac_nids[i] =
4535 alc880_idx_to_dac(j);
4541 spec->multiout.num_dacs = cfg->line_outs;
4545 /* add playback controls from the parsed DAC table */
4546 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4547 const struct auto_pin_cfg *cfg)
4549 static const char *chname[4] = {
4550 "Front", "Surround", NULL /*CLFE*/, "Side"
4555 for (i = 0; i < cfg->line_outs; i++) {
4556 if (!spec->multiout.dac_nids[i])
4558 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4561 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4563 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4567 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4569 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4573 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4575 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4579 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4581 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4587 if (cfg->line_outs == 1 &&
4588 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
4592 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4593 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4597 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4598 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4607 /* add playback controls for speaker and HP outputs */
4608 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4617 if (alc880_is_fixed_pin(pin)) {
4618 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4619 /* specify the DAC as the extra output */
4620 if (!spec->multiout.hp_nid)
4621 spec->multiout.hp_nid = nid;
4623 spec->multiout.extra_out_nid[0] = nid;
4624 /* control HP volume/switch on the output mixer amp */
4625 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4626 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4627 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4630 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4631 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4634 } else if (alc880_is_multi_pin(pin)) {
4635 /* set manual connection */
4636 /* we have only a switch on HP-out PIN */
4637 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
4638 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4645 /* create input playback/capture controls for the given pin */
4646 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4647 const char *ctlname,
4648 int idx, hda_nid_t mix_nid)
4652 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
4653 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4656 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
4657 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4663 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
4665 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
4666 return (pincap & AC_PINCAP_IN) != 0;
4669 /* create playback/capture controls for input pins */
4670 static int alc_auto_create_input_ctls(struct hda_codec *codec,
4671 const struct auto_pin_cfg *cfg,
4673 hda_nid_t cap1, hda_nid_t cap2)
4675 struct alc_spec *spec = codec->spec;
4676 struct hda_input_mux *imux = &spec->private_imux[0];
4679 for (i = 0; i < AUTO_PIN_LAST; i++) {
4682 pin = cfg->input_pins[i];
4683 if (!alc_is_input_pin(codec, pin))
4687 idx = get_connection_index(codec, mixer, pin);
4689 err = new_analog_input(spec, pin,
4690 auto_pin_cfg_labels[i],
4699 idx = get_connection_index(codec, cap1, pin);
4700 if (idx < 0 && cap2)
4701 idx = get_connection_index(codec, cap2, pin);
4703 imux->items[imux->num_items].label =
4704 auto_pin_cfg_labels[i];
4705 imux->items[imux->num_items].index = idx;
4712 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
4713 const struct auto_pin_cfg *cfg)
4715 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
4718 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4719 unsigned int pin_type)
4721 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4724 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4728 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4729 hda_nid_t nid, int pin_type,
4732 alc_set_pin_output(codec, nid, pin_type);
4733 /* need the manual connection? */
4734 if (alc880_is_multi_pin(nid)) {
4735 struct alc_spec *spec = codec->spec;
4736 int idx = alc880_multi_pin_idx(nid);
4737 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4738 AC_VERB_SET_CONNECT_SEL,
4739 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4743 static int get_pin_type(int line_out_type)
4745 if (line_out_type == AUTO_PIN_HP_OUT)
4751 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4753 struct alc_spec *spec = codec->spec;
4756 for (i = 0; i < spec->autocfg.line_outs; i++) {
4757 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4758 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4759 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4763 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4765 struct alc_spec *spec = codec->spec;
4768 pin = spec->autocfg.speaker_pins[0];
4769 if (pin) /* connect to front */
4770 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4771 pin = spec->autocfg.hp_pins[0];
4772 if (pin) /* connect to front */
4773 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4776 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4778 struct alc_spec *spec = codec->spec;
4781 for (i = 0; i < AUTO_PIN_LAST; i++) {
4782 hda_nid_t nid = spec->autocfg.input_pins[i];
4783 if (alc_is_input_pin(codec, nid)) {
4784 alc_set_input_pin(codec, nid, i);
4785 if (nid != ALC880_PIN_CD_NID &&
4786 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
4787 snd_hda_codec_write(codec, nid, 0,
4788 AC_VERB_SET_AMP_GAIN_MUTE,
4794 /* parse the BIOS configuration and set up the alc_spec */
4795 /* return 1 if successful, 0 if the proper config is not found,
4796 * or a negative error code
4798 static int alc880_parse_auto_config(struct hda_codec *codec)
4800 struct alc_spec *spec = codec->spec;
4802 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4804 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4808 if (!spec->autocfg.line_outs)
4809 return 0; /* can't find valid BIOS pin config */
4811 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4814 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4817 err = alc880_auto_create_extra_out(spec,
4818 spec->autocfg.speaker_pins[0],
4822 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4826 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
4830 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4832 /* check multiple SPDIF-out (for recent codecs) */
4833 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4835 err = snd_hda_get_connections(codec,
4836 spec->autocfg.dig_out_pins[i],
4841 spec->multiout.dig_out_nid = dig_nid;
4843 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4844 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
4846 spec->slave_dig_outs[i - 1] = dig_nid;
4849 if (spec->autocfg.dig_in_pin)
4850 spec->dig_in_nid = ALC880_DIGIN_NID;
4852 if (spec->kctls.list)
4853 add_mixer(spec, spec->kctls.list);
4855 add_verb(spec, alc880_volume_init_verbs);
4857 spec->num_mux_defs = 1;
4858 spec->input_mux = &spec->private_imux[0];
4860 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
4865 /* additional initialization for auto-configuration model */
4866 static void alc880_auto_init(struct hda_codec *codec)
4868 struct alc_spec *spec = codec->spec;
4869 alc880_auto_init_multi_out(codec);
4870 alc880_auto_init_extra_out(codec);
4871 alc880_auto_init_analog_input(codec);
4872 if (spec->unsol_event)
4873 alc_inithook(codec);
4876 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
4877 * one of two digital mic pins, e.g. on ALC272
4879 static void fixup_automic_adc(struct hda_codec *codec)
4881 struct alc_spec *spec = codec->spec;
4884 for (i = 0; i < spec->num_adc_nids; i++) {
4885 hda_nid_t cap = spec->capsrc_nids ?
4886 spec->capsrc_nids[i] : spec->adc_nids[i];
4889 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
4892 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
4895 spec->int_mic.mux_idx = iidx;
4896 spec->ext_mic.mux_idx = eidx;
4897 if (spec->capsrc_nids)
4898 spec->capsrc_nids += i;
4899 spec->adc_nids += i;
4900 spec->num_adc_nids = 1;
4903 snd_printd(KERN_INFO "hda_codec: %s: "
4904 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
4905 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
4906 spec->auto_mic = 0; /* disable auto-mic to be sure */
4909 /* choose the ADC/MUX containing the input pin and initialize the setup */
4910 static void fixup_single_adc(struct hda_codec *codec)
4912 struct alc_spec *spec = codec->spec;
4916 /* search for the input pin; there must be only one */
4917 for (i = 0; i < AUTO_PIN_LAST; i++) {
4918 if (spec->autocfg.input_pins[i]) {
4919 pin = spec->autocfg.input_pins[i];
4926 /* set the default connection to that pin */
4927 for (i = 0; i < spec->num_adc_nids; i++) {
4928 hda_nid_t cap = spec->capsrc_nids ?
4929 spec->capsrc_nids[i] : spec->adc_nids[i];
4932 idx = get_connection_index(codec, cap, pin);
4935 /* use only this ADC */
4936 if (spec->capsrc_nids)
4937 spec->capsrc_nids += i;
4938 spec->adc_nids += i;
4939 spec->num_adc_nids = 1;
4940 /* select or unmute this route */
4941 if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) {
4942 snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx,
4945 snd_hda_codec_write_cache(codec, cap, 0,
4946 AC_VERB_SET_CONNECT_SEL, idx);
4952 static void set_capture_mixer(struct hda_codec *codec)
4954 struct alc_spec *spec = codec->spec;
4955 static struct snd_kcontrol_new *caps[2][3] = {
4956 { alc_capture_mixer_nosrc1,
4957 alc_capture_mixer_nosrc2,
4958 alc_capture_mixer_nosrc3 },
4959 { alc_capture_mixer1,
4961 alc_capture_mixer3 },
4963 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
4966 fixup_automic_adc(codec);
4967 else if (spec->input_mux) {
4968 if (spec->input_mux->num_items > 1)
4970 else if (spec->input_mux->num_items == 1)
4971 fixup_single_adc(codec);
4973 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
4977 #ifdef CONFIG_SND_HDA_INPUT_BEEP
4978 #define set_beep_amp(spec, nid, idx, dir) \
4979 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
4981 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
4985 * OK, here we have finally the patch for ALC880
4988 static int patch_alc880(struct hda_codec *codec)
4990 struct alc_spec *spec;
4994 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5000 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
5003 if (board_config < 0) {
5004 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
5006 board_config = ALC880_AUTO;
5009 if (board_config == ALC880_AUTO) {
5010 /* automatic parse from the BIOS config */
5011 err = alc880_parse_auto_config(codec);
5017 "hda_codec: Cannot set up configuration "
5018 "from BIOS. Using 3-stack mode...\n");
5019 board_config = ALC880_3ST;
5023 err = snd_hda_attach_beep_device(codec, 0x1);
5029 if (board_config != ALC880_AUTO)
5030 setup_preset(codec, &alc880_presets[board_config]);
5032 spec->stream_analog_playback = &alc880_pcm_analog_playback;
5033 spec->stream_analog_capture = &alc880_pcm_analog_capture;
5034 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
5036 spec->stream_digital_playback = &alc880_pcm_digital_playback;
5037 spec->stream_digital_capture = &alc880_pcm_digital_capture;
5039 if (!spec->adc_nids && spec->input_mux) {
5040 /* check whether NID 0x07 is valid */
5041 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
5043 wcap = get_wcaps_type(wcap);
5044 if (wcap != AC_WID_AUD_IN) {
5045 spec->adc_nids = alc880_adc_nids_alt;
5046 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
5048 spec->adc_nids = alc880_adc_nids;
5049 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
5052 set_capture_mixer(codec);
5053 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
5055 spec->vmaster_nid = 0x0c;
5057 codec->patch_ops = alc_patch_ops;
5058 if (board_config == ALC880_AUTO)
5059 spec->init_hook = alc880_auto_init;
5060 #ifdef CONFIG_SND_HDA_POWER_SAVE
5061 if (!spec->loopback.amplist)
5062 spec->loopback.amplist = alc880_loopbacks;
5073 static hda_nid_t alc260_dac_nids[1] = {
5078 static hda_nid_t alc260_adc_nids[1] = {
5083 static hda_nid_t alc260_adc_nids_alt[1] = {
5088 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
5089 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
5091 static hda_nid_t alc260_dual_adc_nids[2] = {
5096 #define ALC260_DIGOUT_NID 0x03
5097 #define ALC260_DIGIN_NID 0x06
5099 static struct hda_input_mux alc260_capture_source = {
5103 { "Front Mic", 0x1 },
5109 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
5110 * headphone jack and the internal CD lines since these are the only pins at
5111 * which audio can appear. For flexibility, also allow the option of
5112 * recording the mixer output on the second ADC (ADC0 doesn't have a
5113 * connection to the mixer output).
5115 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
5119 { "Mic/Line", 0x0 },
5121 { "Headphone", 0x2 },
5127 { "Mic/Line", 0x0 },
5129 { "Headphone", 0x2 },
5136 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
5137 * the Fujitsu S702x, but jacks are marked differently.
5139 static struct hda_input_mux alc260_acer_capture_sources[2] = {
5146 { "Headphone", 0x5 },
5155 { "Headphone", 0x6 },
5161 /* Maxdata Favorit 100XS */
5162 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
5166 { "Line/Mic", 0x0 },
5173 { "Line/Mic", 0x0 },
5181 * This is just place-holder, so there's something for alc_build_pcms to look
5182 * at when it calculates the maximum number of channels. ALC260 has no mixer
5183 * element which allows changing the channel mode, so the verb list is
5186 static struct hda_channel_mode alc260_modes[1] = {
5191 /* Mixer combinations
5193 * basic: base_output + input + pc_beep + capture
5194 * HP: base_output + input + capture_alt
5195 * HP_3013: hp_3013 + input + capture
5196 * fujitsu: fujitsu + capture
5197 * acer: acer + capture
5200 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
5201 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5202 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5203 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5204 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5205 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5206 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5210 static struct snd_kcontrol_new alc260_input_mixer[] = {
5211 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5212 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5213 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5214 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5215 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5216 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5217 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
5218 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
5222 /* update HP, line and mono out pins according to the master switch */
5223 static void alc260_hp_master_update(struct hda_codec *codec,
5224 hda_nid_t hp, hda_nid_t line,
5227 struct alc_spec *spec = codec->spec;
5228 unsigned int val = spec->master_sw ? PIN_HP : 0;
5229 /* change HP and line-out pins */
5230 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5232 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5234 /* mono (speaker) depending on the HP jack sense */
5235 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5236 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5240 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5241 struct snd_ctl_elem_value *ucontrol)
5243 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5244 struct alc_spec *spec = codec->spec;
5245 *ucontrol->value.integer.value = spec->master_sw;
5249 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
5250 struct snd_ctl_elem_value *ucontrol)
5252 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5253 struct alc_spec *spec = codec->spec;
5254 int val = !!*ucontrol->value.integer.value;
5255 hda_nid_t hp, line, mono;
5257 if (val == spec->master_sw)
5259 spec->master_sw = val;
5260 hp = (kcontrol->private_value >> 16) & 0xff;
5261 line = (kcontrol->private_value >> 8) & 0xff;
5262 mono = kcontrol->private_value & 0xff;
5263 alc260_hp_master_update(codec, hp, line, mono);
5267 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5269 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5270 .name = "Master Playback Switch",
5271 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5272 .info = snd_ctl_boolean_mono_info,
5273 .get = alc260_hp_master_sw_get,
5274 .put = alc260_hp_master_sw_put,
5275 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5277 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5278 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5279 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5280 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5281 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5283 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5287 static struct hda_verb alc260_hp_unsol_verbs[] = {
5288 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5292 static void alc260_hp_automute(struct hda_codec *codec)
5294 struct alc_spec *spec = codec->spec;
5296 spec->jack_present = snd_hda_jack_detect(codec, 0x10);
5297 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5300 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5302 if ((res >> 26) == ALC880_HP_EVENT)
5303 alc260_hp_automute(codec);
5306 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5308 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5309 .name = "Master Playback Switch",
5310 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5311 .info = snd_ctl_boolean_mono_info,
5312 .get = alc260_hp_master_sw_get,
5313 .put = alc260_hp_master_sw_put,
5314 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5316 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5317 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5318 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
5319 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
5320 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5321 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5322 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5323 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
5327 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
5328 .ops = &snd_hda_bind_vol,
5330 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
5331 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
5332 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
5337 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
5338 .ops = &snd_hda_bind_sw,
5340 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
5341 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
5346 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
5347 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
5348 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
5349 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
5350 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5354 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
5355 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5359 static void alc260_hp_3013_automute(struct hda_codec *codec)
5361 struct alc_spec *spec = codec->spec;
5363 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
5364 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
5367 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
5370 if ((res >> 26) == ALC880_HP_EVENT)
5371 alc260_hp_3013_automute(codec);
5374 static void alc260_hp_3012_automute(struct hda_codec *codec)
5376 unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT;
5378 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5380 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5382 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5386 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
5389 if ((res >> 26) == ALC880_HP_EVENT)
5390 alc260_hp_3012_automute(codec);
5393 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
5394 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
5396 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
5397 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5398 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
5399 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5400 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5401 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5402 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
5403 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
5404 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
5405 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5406 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
5410 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
5411 * versions of the ALC260 don't act on requests to enable mic bias from NID
5412 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5413 * datasheet doesn't mention this restriction. At this stage it's not clear
5414 * whether this behaviour is intentional or is a hardware bug in chip
5415 * revisions available in early 2006. Therefore for now allow the
5416 * "Headphone Jack Mode" control to span all choices, but if it turns out
5417 * that the lack of mic bias for this NID is intentional we could change the
5418 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5420 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5421 * don't appear to make the mic bias available from the "line" jack, even
5422 * though the NID used for this jack (0x14) can supply it. The theory is
5423 * that perhaps Acer have included blocking capacitors between the ALC260
5424 * and the output jack. If this turns out to be the case for all such
5425 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5426 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5428 * The C20x Tablet series have a mono internal speaker which is controlled
5429 * via the chip's Mono sum widget and pin complex, so include the necessary
5430 * controls for such models. On models without a "mono speaker" the control
5431 * won't do anything.
5433 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5434 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5435 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5436 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5437 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5439 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5441 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5442 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5443 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5444 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5445 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5446 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5447 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5448 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5452 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5454 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
5455 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5456 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5457 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5458 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5459 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5460 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5464 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5465 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5467 static struct snd_kcontrol_new alc260_will_mixer[] = {
5468 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5469 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5470 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5471 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5472 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5473 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5474 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5475 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5476 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5477 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5481 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5482 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5484 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5485 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5486 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5487 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5488 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5489 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5490 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
5491 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
5492 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5493 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5494 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5499 * initialization verbs
5501 static struct hda_verb alc260_init_verbs[] = {
5502 /* Line In pin widget for input */
5503 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5504 /* CD pin widget for input */
5505 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5506 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5507 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5508 /* Mic2 (front panel) pin widget for input and vref at 80% */
5509 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5510 /* LINE-2 is used for line-out in rear */
5511 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5512 /* select line-out */
5513 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
5515 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5517 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5519 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5520 /* mute capture amp left and right */
5521 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5522 /* set connection select to line in (default select for this ADC) */
5523 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5524 /* mute capture amp left and right */
5525 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5526 /* set connection select to line in (default select for this ADC) */
5527 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
5528 /* set vol=0 Line-Out mixer amp left and right */
5529 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5530 /* unmute pin widget amp left and right (no gain on this amp) */
5531 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5532 /* set vol=0 HP mixer amp left and right */
5533 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5534 /* unmute pin widget amp left and right (no gain on this amp) */
5535 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5536 /* set vol=0 Mono mixer amp left and right */
5537 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5538 /* unmute pin widget amp left and right (no gain on this amp) */
5539 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5540 /* unmute LINE-2 out pin */
5541 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5542 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5545 /* mute analog inputs */
5546 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5547 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5548 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5549 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5550 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5551 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5552 /* mute Front out path */
5553 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5554 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5555 /* mute Headphone out path */
5556 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5557 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5558 /* mute Mono out path */
5559 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5560 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5564 #if 0 /* should be identical with alc260_init_verbs? */
5565 static struct hda_verb alc260_hp_init_verbs[] = {
5566 /* Headphone and output */
5567 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5569 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5570 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5571 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5572 /* Mic2 (front panel) pin widget for input and vref at 80% */
5573 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5574 /* Line In pin widget for input */
5575 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5576 /* Line-2 pin widget for output */
5577 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5578 /* CD pin widget for input */
5579 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5580 /* unmute amp left and right */
5581 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5582 /* set connection select to line in (default select for this ADC) */
5583 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5584 /* unmute Line-Out mixer amp left and right (volume = 0) */
5585 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5586 /* mute pin widget amp left and right (no gain on this amp) */
5587 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5588 /* unmute HP mixer amp left and right (volume = 0) */
5589 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5590 /* mute pin widget amp left and right (no gain on this amp) */
5591 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5592 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5595 /* mute analog inputs */
5596 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5597 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5598 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5599 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5600 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5601 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5602 /* Unmute Front out path */
5603 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5604 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5605 /* Unmute Headphone out path */
5606 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5607 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5608 /* Unmute Mono out path */
5609 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5610 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5615 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5616 /* Line out and output */
5617 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5619 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5620 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5621 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5622 /* Mic2 (front panel) pin widget for input and vref at 80% */
5623 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5624 /* Line In pin widget for input */
5625 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5626 /* Headphone pin widget for output */
5627 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5628 /* CD pin widget for input */
5629 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5630 /* unmute amp left and right */
5631 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5632 /* set connection select to line in (default select for this ADC) */
5633 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5634 /* unmute Line-Out mixer amp left and right (volume = 0) */
5635 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5636 /* mute pin widget amp left and right (no gain on this amp) */
5637 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5638 /* unmute HP mixer amp left and right (volume = 0) */
5639 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5640 /* mute pin widget amp left and right (no gain on this amp) */
5641 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5642 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5645 /* mute analog inputs */
5646 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5647 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5648 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5649 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5650 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5651 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5652 /* Unmute Front out path */
5653 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5654 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5655 /* Unmute Headphone out path */
5656 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5657 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5658 /* Unmute Mono out path */
5659 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5660 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5664 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5665 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5666 * audio = 0x16, internal speaker = 0x10.
5668 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5669 /* Disable all GPIOs */
5670 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5671 /* Internal speaker is connected to headphone pin */
5672 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5673 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5674 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5675 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5676 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5677 /* Ensure all other unused pins are disabled and muted. */
5678 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5679 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5680 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5681 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5682 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5683 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5684 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5685 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5687 /* Disable digital (SPDIF) pins */
5688 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5689 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5691 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5692 * when acting as an output.
5694 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5696 /* Start with output sum widgets muted and their output gains at min */
5697 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5698 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5699 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5700 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5701 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5702 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5703 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5704 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5705 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5707 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5708 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5709 /* Unmute Line1 pin widget output buffer since it starts as an output.
5710 * If the pin mode is changed by the user the pin mode control will
5711 * take care of enabling the pin's input/output buffers as needed.
5712 * Therefore there's no need to enable the input buffer at this
5715 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5716 /* Unmute input buffer of pin widget used for Line-in (no equiv
5719 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5721 /* Mute capture amp left and right */
5722 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5723 /* Set ADC connection select to match default mixer setting - line
5726 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5728 /* Do the same for the second ADC: mute capture input amp and
5729 * set ADC connection to line in (on mic1 pin)
5731 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5732 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5734 /* Mute all inputs to mixer widget (even unconnected ones) */
5735 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5736 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5737 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5738 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5739 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5740 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5741 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5742 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5747 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5748 * similar laptops (adapted from Fujitsu init verbs).
5750 static struct hda_verb alc260_acer_init_verbs[] = {
5751 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5752 * the headphone jack. Turn this on and rely on the standard mute
5753 * methods whenever the user wants to turn these outputs off.
5755 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5756 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5757 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5758 /* Internal speaker/Headphone jack is connected to Line-out pin */
5759 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5760 /* Internal microphone/Mic jack is connected to Mic1 pin */
5761 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5762 /* Line In jack is connected to Line1 pin */
5763 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5764 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5765 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5766 /* Ensure all other unused pins are disabled and muted. */
5767 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5768 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5769 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5770 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5771 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5772 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5773 /* Disable digital (SPDIF) pins */
5774 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5775 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5777 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5778 * bus when acting as outputs.
5780 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5781 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5783 /* Start with output sum widgets muted and their output gains at min */
5784 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5785 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5786 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5787 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5788 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5789 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5790 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5791 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5792 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5794 /* Unmute Line-out pin widget amp left and right
5795 * (no equiv mixer ctrl)
5797 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5798 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5799 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5800 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5801 * inputs. If the pin mode is changed by the user the pin mode control
5802 * will take care of enabling the pin's input/output buffers as needed.
5803 * Therefore there's no need to enable the input buffer at this
5806 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5807 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5809 /* Mute capture amp left and right */
5810 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5811 /* Set ADC connection select to match default mixer setting - mic
5814 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5816 /* Do similar with the second ADC: mute capture input amp and
5817 * set ADC connection to mic to match ALSA's default state.
5819 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5820 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5822 /* Mute all inputs to mixer widget (even unconnected ones) */
5823 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5824 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5825 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5826 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5827 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5828 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5829 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5830 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5835 /* Initialisation sequence for Maxdata Favorit 100XS
5836 * (adapted from Acer init verbs).
5838 static struct hda_verb alc260_favorit100_init_verbs[] = {
5839 /* GPIO 0 enables the output jack.
5840 * Turn this on and rely on the standard mute
5841 * methods whenever the user wants to turn these outputs off.
5843 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5844 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5845 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5846 /* Line/Mic input jack is connected to Mic1 pin */
5847 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5848 /* Ensure all other unused pins are disabled and muted. */
5849 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5850 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5851 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5852 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5853 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5854 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5855 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5856 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5857 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5858 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5859 /* Disable digital (SPDIF) pins */
5860 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5861 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5863 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5864 * bus when acting as outputs.
5866 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5867 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5869 /* Start with output sum widgets muted and their output gains at min */
5870 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5871 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5872 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5873 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5874 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5875 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5876 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5877 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5878 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5880 /* Unmute Line-out pin widget amp left and right
5881 * (no equiv mixer ctrl)
5883 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5884 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5885 * inputs. If the pin mode is changed by the user the pin mode control
5886 * will take care of enabling the pin's input/output buffers as needed.
5887 * Therefore there's no need to enable the input buffer at this
5890 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5892 /* Mute capture amp left and right */
5893 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5894 /* Set ADC connection select to match default mixer setting - mic
5897 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5899 /* Do similar with the second ADC: mute capture input amp and
5900 * set ADC connection to mic to match ALSA's default state.
5902 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5903 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5905 /* Mute all inputs to mixer widget (even unconnected ones) */
5906 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5907 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5908 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5909 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5910 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5911 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5912 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5913 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5918 static struct hda_verb alc260_will_verbs[] = {
5919 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5920 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5921 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5922 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5923 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5924 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5928 static struct hda_verb alc260_replacer_672v_verbs[] = {
5929 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5930 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5931 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5933 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5934 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5935 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5937 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5941 /* toggle speaker-output according to the hp-jack state */
5942 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5944 unsigned int present;
5946 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5947 present = snd_hda_jack_detect(codec, 0x0f);
5949 snd_hda_codec_write_cache(codec, 0x01, 0,
5950 AC_VERB_SET_GPIO_DATA, 1);
5951 snd_hda_codec_write_cache(codec, 0x0f, 0,
5952 AC_VERB_SET_PIN_WIDGET_CONTROL,
5955 snd_hda_codec_write_cache(codec, 0x01, 0,
5956 AC_VERB_SET_GPIO_DATA, 0);
5957 snd_hda_codec_write_cache(codec, 0x0f, 0,
5958 AC_VERB_SET_PIN_WIDGET_CONTROL,
5963 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5966 if ((res >> 26) == ALC880_HP_EVENT)
5967 alc260_replacer_672v_automute(codec);
5970 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5971 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5972 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5973 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5974 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5975 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5976 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5977 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5978 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5979 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5980 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5984 /* Test configuration for debugging, modelled after the ALC880 test
5987 #ifdef CONFIG_SND_DEBUG
5988 static hda_nid_t alc260_test_dac_nids[1] = {
5991 static hda_nid_t alc260_test_adc_nids[2] = {
5994 /* For testing the ALC260, each input MUX needs its own definition since
5995 * the signal assignments are different. This assumes that the first ADC
5998 static struct hda_input_mux alc260_test_capture_sources[2] = {
6002 { "MIC1 pin", 0x0 },
6003 { "MIC2 pin", 0x1 },
6004 { "LINE1 pin", 0x2 },
6005 { "LINE2 pin", 0x3 },
6007 { "LINE-OUT pin", 0x5 },
6008 { "HP-OUT pin", 0x6 },
6014 { "MIC1 pin", 0x0 },
6015 { "MIC2 pin", 0x1 },
6016 { "LINE1 pin", 0x2 },
6017 { "LINE2 pin", 0x3 },
6020 { "LINE-OUT pin", 0x6 },
6021 { "HP-OUT pin", 0x7 },
6025 static struct snd_kcontrol_new alc260_test_mixer[] = {
6026 /* Output driver widgets */
6027 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
6028 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
6029 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6030 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
6031 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6032 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
6034 /* Modes for retasking pin widgets
6035 * Note: the ALC260 doesn't seem to act on requests to enable mic
6036 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
6037 * mention this restriction. At this stage it's not clear whether
6038 * this behaviour is intentional or is a hardware bug in chip
6039 * revisions available at least up until early 2006. Therefore for
6040 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
6041 * choices, but if it turns out that the lack of mic bias for these
6042 * NIDs is intentional we could change their modes from
6043 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6045 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
6046 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
6047 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
6048 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
6049 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
6050 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
6052 /* Loopback mixer controls */
6053 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
6054 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
6055 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
6056 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
6057 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
6058 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
6059 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
6060 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
6061 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6062 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6063 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
6064 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
6065 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
6066 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
6068 /* Controls for GPIO pins, assuming they are configured as outputs */
6069 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
6070 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
6071 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
6072 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
6074 /* Switches to allow the digital IO pins to be enabled. The datasheet
6075 * is ambigious as to which NID is which; testing on laptops which
6076 * make this output available should provide clarification.
6078 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
6079 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
6081 /* A switch allowing EAPD to be enabled. Some laptops seem to use
6082 * this output to turn on an external amplifier.
6084 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
6085 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
6089 static struct hda_verb alc260_test_init_verbs[] = {
6090 /* Enable all GPIOs as outputs with an initial value of 0 */
6091 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
6092 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6093 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
6095 /* Enable retasking pins as output, initially without power amp */
6096 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6097 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6098 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6099 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6100 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6101 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6103 /* Disable digital (SPDIF) pins initially, but users can enable
6104 * them via a mixer switch. In the case of SPDIF-out, this initverb
6105 * payload also sets the generation to 0, output to be in "consumer"
6106 * PCM format, copyright asserted, no pre-emphasis and no validity
6109 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6110 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6112 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
6113 * OUT1 sum bus when acting as an output.
6115 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6116 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
6117 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6118 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
6120 /* Start with output sum widgets muted and their output gains at min */
6121 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6122 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6123 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6124 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6125 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6126 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6127 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6128 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6129 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6131 /* Unmute retasking pin widget output buffers since the default
6132 * state appears to be output. As the pin mode is changed by the
6133 * user the pin mode control will take care of enabling the pin's
6134 * input/output buffers as needed.
6136 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6137 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6138 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6139 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6140 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6141 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6142 /* Also unmute the mono-out pin widget */
6143 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6145 /* Mute capture amp left and right */
6146 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6147 /* Set ADC connection select to match default mixer setting (mic1
6150 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6152 /* Do the same for the second ADC: mute capture input amp and
6153 * set ADC connection to mic1 pin
6155 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6156 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6158 /* Mute all inputs to mixer widget (even unconnected ones) */
6159 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6160 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6161 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6162 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6163 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6164 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6165 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6166 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6172 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
6173 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
6175 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
6176 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
6179 * for BIOS auto-configuration
6182 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
6183 const char *pfx, int *vol_bits)
6186 unsigned long vol_val, sw_val;
6189 if (nid >= 0x0f && nid < 0x11) {
6190 nid_vol = nid - 0x7;
6191 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6192 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6193 } else if (nid == 0x11) {
6194 nid_vol = nid - 0x7;
6195 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
6196 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
6197 } else if (nid >= 0x12 && nid <= 0x15) {
6199 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6200 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6204 if (!(*vol_bits & (1 << nid_vol))) {
6205 /* first control for the volume widget */
6206 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val);
6209 *vol_bits |= (1 << nid_vol);
6211 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val);
6217 /* add playback controls from the parsed DAC table */
6218 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6219 const struct auto_pin_cfg *cfg)
6225 spec->multiout.num_dacs = 1;
6226 spec->multiout.dac_nids = spec->private_dac_nids;
6227 spec->multiout.dac_nids[0] = 0x02;
6229 nid = cfg->line_out_pins[0];
6232 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6234 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6238 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6243 nid = cfg->speaker_pins[0];
6245 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6250 nid = cfg->hp_pins[0];
6252 err = alc260_add_playback_controls(spec, nid, "Headphone",
6260 /* create playback/capture controls for input pins */
6261 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6262 const struct auto_pin_cfg *cfg)
6264 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
6267 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6268 hda_nid_t nid, int pin_type,
6271 alc_set_pin_output(codec, nid, pin_type);
6272 /* need the manual connection? */
6274 int idx = nid - 0x12;
6275 snd_hda_codec_write(codec, idx + 0x0b, 0,
6276 AC_VERB_SET_CONNECT_SEL, sel_idx);
6280 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6282 struct alc_spec *spec = codec->spec;
6285 nid = spec->autocfg.line_out_pins[0];
6287 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6288 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6291 nid = spec->autocfg.speaker_pins[0];
6293 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6295 nid = spec->autocfg.hp_pins[0];
6297 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6300 #define ALC260_PIN_CD_NID 0x16
6301 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6303 struct alc_spec *spec = codec->spec;
6306 for (i = 0; i < AUTO_PIN_LAST; i++) {
6307 hda_nid_t nid = spec->autocfg.input_pins[i];
6309 alc_set_input_pin(codec, nid, i);
6310 if (nid != ALC260_PIN_CD_NID &&
6311 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6312 snd_hda_codec_write(codec, nid, 0,
6313 AC_VERB_SET_AMP_GAIN_MUTE,
6320 * generic initialization of ADC, input mixers and output mixers
6322 static struct hda_verb alc260_volume_init_verbs[] = {
6324 * Unmute ADC0-1 and set the default input to mic-in
6326 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6327 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6328 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6329 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6331 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6333 * Note: PASD motherboards uses the Line In 2 as the input for
6334 * front panel mic (mic 2)
6336 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6337 /* mute analog inputs */
6338 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6339 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6340 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6341 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6342 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6345 * Set up output mixers (0x08 - 0x0a)
6347 /* set vol=0 to output mixers */
6348 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6349 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6350 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6351 /* set up input amps for analog loopback */
6352 /* Amp Indices: DAC = 0, mixer = 1 */
6353 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6354 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6355 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6356 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6357 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6358 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6363 static int alc260_parse_auto_config(struct hda_codec *codec)
6365 struct alc_spec *spec = codec->spec;
6367 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
6369 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
6373 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
6376 if (!spec->kctls.list)
6377 return 0; /* can't find valid BIOS pin config */
6378 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
6382 spec->multiout.max_channels = 2;
6384 if (spec->autocfg.dig_outs)
6385 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6386 if (spec->kctls.list)
6387 add_mixer(spec, spec->kctls.list);
6389 add_verb(spec, alc260_volume_init_verbs);
6391 spec->num_mux_defs = 1;
6392 spec->input_mux = &spec->private_imux[0];
6394 alc_ssid_check(codec, 0x10, 0x15, 0x0f);
6399 /* additional initialization for auto-configuration model */
6400 static void alc260_auto_init(struct hda_codec *codec)
6402 struct alc_spec *spec = codec->spec;
6403 alc260_auto_init_multi_out(codec);
6404 alc260_auto_init_analog_input(codec);
6405 if (spec->unsol_event)
6406 alc_inithook(codec);
6409 #ifdef CONFIG_SND_HDA_POWER_SAVE
6410 static struct hda_amp_list alc260_loopbacks[] = {
6411 { 0x07, HDA_INPUT, 0 },
6412 { 0x07, HDA_INPUT, 1 },
6413 { 0x07, HDA_INPUT, 2 },
6414 { 0x07, HDA_INPUT, 3 },
6415 { 0x07, HDA_INPUT, 4 },
6421 * ALC260 configurations
6423 static const char *alc260_models[ALC260_MODEL_LAST] = {
6424 [ALC260_BASIC] = "basic",
6426 [ALC260_HP_3013] = "hp-3013",
6427 [ALC260_HP_DC7600] = "hp-dc7600",
6428 [ALC260_FUJITSU_S702X] = "fujitsu",
6429 [ALC260_ACER] = "acer",
6430 [ALC260_WILL] = "will",
6431 [ALC260_REPLACER_672V] = "replacer",
6432 [ALC260_FAVORIT100] = "favorit100",
6433 #ifdef CONFIG_SND_DEBUG
6434 [ALC260_TEST] = "test",
6436 [ALC260_AUTO] = "auto",
6439 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6440 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6441 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
6442 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6443 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6444 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6445 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */
6446 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6447 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6448 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6449 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6450 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6451 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6452 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6453 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6454 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6455 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6456 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6457 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6458 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6459 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6463 static struct alc_config_preset alc260_presets[] = {
6465 .mixers = { alc260_base_output_mixer,
6466 alc260_input_mixer },
6467 .init_verbs = { alc260_init_verbs },
6468 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6469 .dac_nids = alc260_dac_nids,
6470 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6471 .adc_nids = alc260_adc_nids,
6472 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6473 .channel_mode = alc260_modes,
6474 .input_mux = &alc260_capture_source,
6477 .mixers = { alc260_hp_output_mixer,
6478 alc260_input_mixer },
6479 .init_verbs = { alc260_init_verbs,
6480 alc260_hp_unsol_verbs },
6481 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6482 .dac_nids = alc260_dac_nids,
6483 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6484 .adc_nids = alc260_adc_nids_alt,
6485 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6486 .channel_mode = alc260_modes,
6487 .input_mux = &alc260_capture_source,
6488 .unsol_event = alc260_hp_unsol_event,
6489 .init_hook = alc260_hp_automute,
6491 [ALC260_HP_DC7600] = {
6492 .mixers = { alc260_hp_dc7600_mixer,
6493 alc260_input_mixer },
6494 .init_verbs = { alc260_init_verbs,
6495 alc260_hp_dc7600_verbs },
6496 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6497 .dac_nids = alc260_dac_nids,
6498 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6499 .adc_nids = alc260_adc_nids_alt,
6500 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6501 .channel_mode = alc260_modes,
6502 .input_mux = &alc260_capture_source,
6503 .unsol_event = alc260_hp_3012_unsol_event,
6504 .init_hook = alc260_hp_3012_automute,
6506 [ALC260_HP_3013] = {
6507 .mixers = { alc260_hp_3013_mixer,
6508 alc260_input_mixer },
6509 .init_verbs = { alc260_hp_3013_init_verbs,
6510 alc260_hp_3013_unsol_verbs },
6511 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6512 .dac_nids = alc260_dac_nids,
6513 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6514 .adc_nids = alc260_adc_nids_alt,
6515 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6516 .channel_mode = alc260_modes,
6517 .input_mux = &alc260_capture_source,
6518 .unsol_event = alc260_hp_3013_unsol_event,
6519 .init_hook = alc260_hp_3013_automute,
6521 [ALC260_FUJITSU_S702X] = {
6522 .mixers = { alc260_fujitsu_mixer },
6523 .init_verbs = { alc260_fujitsu_init_verbs },
6524 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6525 .dac_nids = alc260_dac_nids,
6526 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6527 .adc_nids = alc260_dual_adc_nids,
6528 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6529 .channel_mode = alc260_modes,
6530 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
6531 .input_mux = alc260_fujitsu_capture_sources,
6534 .mixers = { alc260_acer_mixer },
6535 .init_verbs = { alc260_acer_init_verbs },
6536 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6537 .dac_nids = alc260_dac_nids,
6538 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6539 .adc_nids = alc260_dual_adc_nids,
6540 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6541 .channel_mode = alc260_modes,
6542 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
6543 .input_mux = alc260_acer_capture_sources,
6545 [ALC260_FAVORIT100] = {
6546 .mixers = { alc260_favorit100_mixer },
6547 .init_verbs = { alc260_favorit100_init_verbs },
6548 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6549 .dac_nids = alc260_dac_nids,
6550 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6551 .adc_nids = alc260_dual_adc_nids,
6552 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6553 .channel_mode = alc260_modes,
6554 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
6555 .input_mux = alc260_favorit100_capture_sources,
6558 .mixers = { alc260_will_mixer },
6559 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6560 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6561 .dac_nids = alc260_dac_nids,
6562 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6563 .adc_nids = alc260_adc_nids,
6564 .dig_out_nid = ALC260_DIGOUT_NID,
6565 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6566 .channel_mode = alc260_modes,
6567 .input_mux = &alc260_capture_source,
6569 [ALC260_REPLACER_672V] = {
6570 .mixers = { alc260_replacer_672v_mixer },
6571 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6572 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6573 .dac_nids = alc260_dac_nids,
6574 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6575 .adc_nids = alc260_adc_nids,
6576 .dig_out_nid = ALC260_DIGOUT_NID,
6577 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6578 .channel_mode = alc260_modes,
6579 .input_mux = &alc260_capture_source,
6580 .unsol_event = alc260_replacer_672v_unsol_event,
6581 .init_hook = alc260_replacer_672v_automute,
6583 #ifdef CONFIG_SND_DEBUG
6585 .mixers = { alc260_test_mixer },
6586 .init_verbs = { alc260_test_init_verbs },
6587 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6588 .dac_nids = alc260_test_dac_nids,
6589 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6590 .adc_nids = alc260_test_adc_nids,
6591 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6592 .channel_mode = alc260_modes,
6593 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6594 .input_mux = alc260_test_capture_sources,
6599 static int patch_alc260(struct hda_codec *codec)
6601 struct alc_spec *spec;
6602 int err, board_config;
6604 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6610 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6613 if (board_config < 0) {
6614 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6616 board_config = ALC260_AUTO;
6619 if (board_config == ALC260_AUTO) {
6620 /* automatic parse from the BIOS config */
6621 err = alc260_parse_auto_config(codec);
6627 "hda_codec: Cannot set up configuration "
6628 "from BIOS. Using base mode...\n");
6629 board_config = ALC260_BASIC;
6633 err = snd_hda_attach_beep_device(codec, 0x1);
6639 if (board_config != ALC260_AUTO)
6640 setup_preset(codec, &alc260_presets[board_config]);
6642 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6643 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6645 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6646 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6648 if (!spec->adc_nids && spec->input_mux) {
6649 /* check whether NID 0x04 is valid */
6650 unsigned int wcap = get_wcaps(codec, 0x04);
6651 wcap = get_wcaps_type(wcap);
6653 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6654 spec->adc_nids = alc260_adc_nids_alt;
6655 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6657 spec->adc_nids = alc260_adc_nids;
6658 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6661 set_capture_mixer(codec);
6662 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6664 spec->vmaster_nid = 0x08;
6666 codec->patch_ops = alc_patch_ops;
6667 if (board_config == ALC260_AUTO)
6668 spec->init_hook = alc260_auto_init;
6669 #ifdef CONFIG_SND_HDA_POWER_SAVE
6670 if (!spec->loopback.amplist)
6671 spec->loopback.amplist = alc260_loopbacks;
6679 * ALC882/883/885/888/889 support
6681 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6682 * configuration. Each pin widget can choose any input DACs and a mixer.
6683 * Each ADC is connected from a mixer of all inputs. This makes possible
6684 * 6-channel independent captures.
6686 * In addition, an independent DAC for the multi-playback (not used in this
6689 #define ALC882_DIGOUT_NID 0x06
6690 #define ALC882_DIGIN_NID 0x0a
6691 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
6692 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
6693 #define ALC1200_DIGOUT_NID 0x10
6696 static struct hda_channel_mode alc882_ch_modes[1] = {
6701 static hda_nid_t alc882_dac_nids[4] = {
6702 /* front, rear, clfe, rear_surr */
6703 0x02, 0x03, 0x04, 0x05
6705 #define alc883_dac_nids alc882_dac_nids
6708 #define alc882_adc_nids alc880_adc_nids
6709 #define alc882_adc_nids_alt alc880_adc_nids_alt
6710 #define alc883_adc_nids alc882_adc_nids_alt
6711 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
6712 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
6713 #define alc889_adc_nids alc880_adc_nids
6715 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6716 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6717 #define alc883_capsrc_nids alc882_capsrc_nids_alt
6718 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
6719 #define alc889_capsrc_nids alc882_capsrc_nids
6722 /* FIXME: should be a matrix-type input source selection */
6724 static struct hda_input_mux alc882_capture_source = {
6728 { "Front Mic", 0x1 },
6734 #define alc883_capture_source alc882_capture_source
6736 static struct hda_input_mux alc889_capture_source = {
6739 { "Front Mic", 0x0 },
6745 static struct hda_input_mux mb5_capture_source = {
6754 static struct hda_input_mux alc883_3stack_6ch_intel = {
6758 { "Front Mic", 0x0 },
6764 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6772 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6782 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6790 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
6794 { "Front Mic", 0x1 },
6799 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
6807 static struct hda_input_mux alc889A_mb31_capture_source = {
6811 /* Front Mic (0x01) unused */
6813 /* Line 2 (0x03) unused */
6814 /* CD (0x04) unused? */
6821 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6828 static struct hda_verb alc882_3ST_ch2_init[] = {
6829 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6830 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6831 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6832 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6839 static struct hda_verb alc882_3ST_ch4_init[] = {
6840 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6841 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6842 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6843 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6844 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6851 static struct hda_verb alc882_3ST_ch6_init[] = {
6852 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6853 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6854 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6855 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6856 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6857 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6861 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
6862 { 2, alc882_3ST_ch2_init },
6863 { 4, alc882_3ST_ch4_init },
6864 { 6, alc882_3ST_ch6_init },
6867 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
6872 static struct hda_verb alc883_3ST_ch2_clevo_init[] = {
6873 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
6874 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6875 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6876 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6877 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6884 static struct hda_verb alc883_3ST_ch4_clevo_init[] = {
6885 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6886 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6887 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6888 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6889 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6890 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6897 static struct hda_verb alc883_3ST_ch6_clevo_init[] = {
6898 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6899 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6900 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6901 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6902 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6903 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6904 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6908 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
6909 { 2, alc883_3ST_ch2_clevo_init },
6910 { 4, alc883_3ST_ch4_clevo_init },
6911 { 6, alc883_3ST_ch6_clevo_init },
6918 static struct hda_verb alc882_sixstack_ch6_init[] = {
6919 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6920 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6921 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6922 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6929 static struct hda_verb alc882_sixstack_ch8_init[] = {
6930 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6931 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6932 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6933 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6937 static struct hda_channel_mode alc882_sixstack_modes[2] = {
6938 { 6, alc882_sixstack_ch6_init },
6939 { 8, alc882_sixstack_ch8_init },
6943 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
6949 static struct hda_verb alc885_mbp_ch2_init[] = {
6950 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6951 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6952 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6959 static struct hda_verb alc885_mbp_ch4_init[] = {
6960 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6961 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6962 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6963 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6964 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6968 static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
6969 { 2, alc885_mbp_ch2_init },
6970 { 4, alc885_mbp_ch4_init },
6975 * Speakers/Woofer/HP = Front
6978 static struct hda_verb alc885_mb5_ch2_init[] = {
6979 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6980 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6986 * Speakers/HP = Front
6990 static struct hda_verb alc885_mb5_ch6_init[] = {
6991 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6992 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6993 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6997 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
6998 { 2, alc885_mb5_ch2_init },
6999 { 6, alc885_mb5_ch6_init },
7006 static struct hda_verb alc883_4ST_ch2_init[] = {
7007 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7008 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7009 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7010 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7011 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7012 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7019 static struct hda_verb alc883_4ST_ch4_init[] = {
7020 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7021 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7022 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7023 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7024 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7025 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7026 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7033 static struct hda_verb alc883_4ST_ch6_init[] = {
7034 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7035 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7036 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7037 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7038 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7039 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7040 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7041 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7048 static struct hda_verb alc883_4ST_ch8_init[] = {
7049 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7050 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7051 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7052 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7053 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7054 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7055 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7056 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7057 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7061 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
7062 { 2, alc883_4ST_ch2_init },
7063 { 4, alc883_4ST_ch4_init },
7064 { 6, alc883_4ST_ch6_init },
7065 { 8, alc883_4ST_ch8_init },
7072 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7073 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7074 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7075 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7076 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7083 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7084 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7085 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7086 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7087 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7088 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7095 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7096 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7097 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7098 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7099 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7100 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7101 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7105 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7106 { 2, alc883_3ST_ch2_intel_init },
7107 { 4, alc883_3ST_ch4_intel_init },
7108 { 6, alc883_3ST_ch6_intel_init },
7114 static struct hda_verb alc889_ch2_intel_init[] = {
7115 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7116 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
7117 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
7118 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
7119 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7120 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7127 static struct hda_verb alc889_ch6_intel_init[] = {
7128 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7129 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7130 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7131 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7132 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7133 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7140 static struct hda_verb alc889_ch8_intel_init[] = {
7141 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7142 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7143 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7144 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7145 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
7146 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7147 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7151 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
7152 { 2, alc889_ch2_intel_init },
7153 { 6, alc889_ch6_intel_init },
7154 { 8, alc889_ch8_intel_init },
7160 static struct hda_verb alc883_sixstack_ch6_init[] = {
7161 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7162 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7163 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7164 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7171 static struct hda_verb alc883_sixstack_ch8_init[] = {
7172 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7173 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7174 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7175 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7179 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7180 { 6, alc883_sixstack_ch6_init },
7181 { 8, alc883_sixstack_ch8_init },
7185 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7186 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7188 static struct snd_kcontrol_new alc882_base_mixer[] = {
7189 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7190 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7191 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7192 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7193 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7194 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7195 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7196 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7197 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7198 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7199 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7200 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7201 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7202 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7203 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7204 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7205 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7206 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7207 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7208 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7209 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7213 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
7214 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7215 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7216 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7217 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
7218 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7219 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7220 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7221 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7222 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7223 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
7224 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7228 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7229 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7230 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7231 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7232 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7233 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7234 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7235 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7236 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7237 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7238 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7239 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7240 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7241 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7242 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
7246 static struct snd_kcontrol_new alc885_imac91_mixer[] = {
7247 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7248 HDA_BIND_MUTE ("Line-Out Playback Switch", 0x0c, 0x02, HDA_INPUT),
7249 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
7250 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7251 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7252 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7253 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7254 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7255 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7260 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
7261 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7262 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7263 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7264 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7265 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7266 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7267 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7268 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7269 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7273 static struct snd_kcontrol_new alc882_targa_mixer[] = {
7274 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7275 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7276 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7277 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7278 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7279 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7280 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7281 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7282 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7283 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7284 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7285 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7286 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7290 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
7291 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
7293 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
7294 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7295 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7296 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7297 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
7298 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7299 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7300 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7301 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7302 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
7303 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
7304 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7305 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7306 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7310 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
7311 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7312 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7313 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7314 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7315 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7316 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7317 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7318 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7319 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7320 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7324 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
7326 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7327 .name = "Channel Mode",
7328 .info = alc_ch_mode_info,
7329 .get = alc_ch_mode_get,
7330 .put = alc_ch_mode_put,
7335 static struct hda_verb alc882_base_init_verbs[] = {
7336 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7337 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7338 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7340 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7341 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7343 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7344 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7346 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7347 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7349 /* Front Pin: output 0 (0x0c) */
7350 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7351 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7352 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7353 /* Rear Pin: output 1 (0x0d) */
7354 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7355 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7356 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7357 /* CLFE Pin: output 2 (0x0e) */
7358 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7359 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7360 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7361 /* Side Pin: output 3 (0x0f) */
7362 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7363 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7364 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7365 /* Mic (rear) pin: input vref at 80% */
7366 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7367 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
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 /* Line In pin: input */
7372 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7373 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7374 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7375 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7376 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7377 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7378 /* CD pin widget for input */
7379 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7381 /* FIXME: use matrix-type input source selection */
7382 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7384 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7386 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7387 /* ADC2: mute amp left and right */
7388 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7389 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7390 /* ADC3: mute amp left and right */
7391 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7392 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7397 static struct hda_verb alc882_adc1_init_verbs[] = {
7398 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7399 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7400 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7401 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7402 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7403 /* ADC1: mute amp left and right */
7404 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7405 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7409 static struct hda_verb alc882_eapd_verbs[] = {
7410 /* change to EAPD mode */
7411 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7412 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
7416 static struct hda_verb alc889_eapd_verbs[] = {
7417 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
7418 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
7422 static struct hda_verb alc_hp15_unsol_verbs[] = {
7423 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7424 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7428 static struct hda_verb alc885_init_verbs[] = {
7429 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7430 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7431 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7433 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7434 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7436 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7437 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7439 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7440 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7442 /* Front HP Pin: output 0 (0x0c) */
7443 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7444 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7445 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7446 /* Front Pin: output 0 (0x0c) */
7447 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7448 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7449 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7450 /* Rear Pin: output 1 (0x0d) */
7451 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7452 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7453 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
7454 /* CLFE Pin: output 2 (0x0e) */
7455 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7456 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7457 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7458 /* Side Pin: output 3 (0x0f) */
7459 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7460 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7461 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7462 /* Mic (rear) pin: input vref at 80% */
7463 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7464 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7465 /* Front Mic pin: input vref at 80% */
7466 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7467 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7468 /* Line In pin: input */
7469 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7470 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7472 /* Mixer elements: 0x18, , 0x1a, 0x1b */
7474 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7476 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7478 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7479 /* ADC2: mute amp left and right */
7480 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7481 /* ADC3: mute amp left and right */
7482 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7487 static struct hda_verb alc885_init_input_verbs[] = {
7488 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7489 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7490 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7495 /* Unmute Selector 24h and set the default input to front mic */
7496 static struct hda_verb alc889_init_input_verbs[] = {
7497 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
7498 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7503 #define alc883_init_verbs alc882_base_init_verbs
7506 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
7507 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7508 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7509 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
7510 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7511 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7512 /* FIXME: this looks suspicious...
7513 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
7514 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
7519 static struct hda_verb alc882_macpro_init_verbs[] = {
7520 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7521 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7522 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7523 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7524 /* Front Pin: output 0 (0x0c) */
7525 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7526 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7527 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7528 /* Front Mic pin: input vref at 80% */
7529 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7530 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7531 /* Speaker: output */
7532 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7533 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7534 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
7535 /* Headphone output (output 0 - 0x0c) */
7536 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7537 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7538 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7540 /* FIXME: use matrix-type input source selection */
7541 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7542 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7543 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7544 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7545 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7546 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7548 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7549 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7550 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7551 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7553 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7554 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7555 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7556 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7557 /* ADC1: mute amp left and right */
7558 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7559 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7560 /* ADC2: mute amp left and right */
7561 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7562 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7563 /* ADC3: mute amp left and right */
7564 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7565 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7571 static struct hda_verb alc885_mb5_init_verbs[] = {
7573 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7574 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7575 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7576 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7578 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7579 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7580 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7581 /* Surround mixer */
7582 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7583 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7584 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7586 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7587 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7588 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7590 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7591 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7592 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7593 /* Front Pin (0x0c) */
7594 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7595 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7596 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7597 /* LFE Pin (0x0e) */
7598 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7599 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7600 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7602 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7603 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7604 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7605 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7606 /* Front Mic pin: input vref at 80% */
7607 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7608 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7610 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7611 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7613 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7614 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7615 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7616 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7620 /* Macbook Pro rev3 */
7621 static struct hda_verb alc885_mbp3_init_verbs[] = {
7622 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7623 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7624 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7625 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7627 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7628 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7629 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7631 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7632 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7633 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7634 /* Front Pin: output 0 (0x0c) */
7635 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7636 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7637 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7638 /* HP Pin: output 0 (0x0e) */
7639 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7640 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7641 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
7642 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7643 /* Mic (rear) pin: input vref at 80% */
7644 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7645 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7646 /* Front Mic pin: input vref at 80% */
7647 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7648 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7649 /* Line In pin: use output 1 when in LineOut mode */
7650 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7651 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7652 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7654 /* FIXME: use matrix-type input source selection */
7655 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7656 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7657 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7658 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7659 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7660 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7662 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7663 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7664 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7665 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7667 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7668 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7669 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7670 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7671 /* ADC1: mute amp left and right */
7672 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7673 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7674 /* ADC2: mute amp left and right */
7675 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7676 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7677 /* ADC3: mute amp left and right */
7678 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7679 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7685 static struct hda_verb alc885_imac91_init_verbs[] = {
7686 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
7687 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7688 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7689 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7691 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7692 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7693 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7694 /* HP Pin: output 0 (0x0c) */
7695 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7696 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7697 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7698 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7699 /* Internal Speakers: output 0 (0x0d) */
7700 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7701 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7702 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7703 /* Mic (rear) pin: input vref at 80% */
7704 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7705 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7706 /* Front Mic pin: input vref at 80% */
7707 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7708 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7709 /* Line In pin: use output 1 when in LineOut mode */
7710 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7711 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7712 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7714 /* FIXME: use matrix-type input source selection */
7715 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7716 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7717 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7718 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7719 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7720 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7722 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7723 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7724 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7725 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7727 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7728 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7729 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7730 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7731 /* ADC1: mute amp left and right */
7732 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7733 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7734 /* ADC2: mute amp left and right */
7735 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7736 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7737 /* ADC3: mute amp left and right */
7738 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7739 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7744 /* iMac 24 mixer. */
7745 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
7746 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7747 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
7751 /* iMac 24 init verbs. */
7752 static struct hda_verb alc885_imac24_init_verbs[] = {
7753 /* Internal speakers: output 0 (0x0c) */
7754 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7755 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7756 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7757 /* Internal speakers: output 0 (0x0c) */
7758 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7759 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7760 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7761 /* Headphone: output 0 (0x0c) */
7762 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7763 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7764 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7765 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7766 /* Front Mic: input vref at 80% */
7767 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7768 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7772 /* Toggle speaker-output according to the hp-jack state */
7773 static void alc885_imac24_setup(struct hda_codec *codec)
7775 struct alc_spec *spec = codec->spec;
7777 spec->autocfg.hp_pins[0] = 0x14;
7778 spec->autocfg.speaker_pins[0] = 0x18;
7779 spec->autocfg.speaker_pins[1] = 0x1a;
7782 static void alc885_mbp3_setup(struct hda_codec *codec)
7784 struct alc_spec *spec = codec->spec;
7786 spec->autocfg.hp_pins[0] = 0x15;
7787 spec->autocfg.speaker_pins[0] = 0x14;
7790 static void alc885_mb5_automute(struct hda_codec *codec)
7792 unsigned int present;
7794 present = snd_hda_codec_read(codec, 0x14, 0,
7795 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7796 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
7797 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7798 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
7799 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7803 static void alc885_mb5_unsol_event(struct hda_codec *codec,
7806 /* Headphone insertion or removal. */
7807 if ((res >> 26) == ALC880_HP_EVENT)
7808 alc885_mb5_automute(codec);
7811 static void alc885_imac91_automute(struct hda_codec *codec)
7813 unsigned int present;
7815 present = snd_hda_codec_read(codec, 0x14, 0,
7816 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7817 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7818 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7819 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
7820 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7824 static void alc885_imac91_unsol_event(struct hda_codec *codec,
7827 /* Headphone insertion or removal. */
7828 if ((res >> 26) == ALC880_HP_EVENT)
7829 alc885_imac91_automute(codec);
7832 static struct hda_verb alc882_targa_verbs[] = {
7833 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7834 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7836 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7837 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7839 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7840 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7841 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7843 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7847 /* toggle speaker-output according to the hp-jack state */
7848 static void alc882_targa_automute(struct hda_codec *codec)
7850 struct alc_spec *spec = codec->spec;
7851 alc_automute_amp(codec);
7852 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7853 spec->jack_present ? 1 : 3);
7856 static void alc882_targa_setup(struct hda_codec *codec)
7858 struct alc_spec *spec = codec->spec;
7860 spec->autocfg.hp_pins[0] = 0x14;
7861 spec->autocfg.speaker_pins[0] = 0x1b;
7864 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
7866 if ((res >> 26) == ALC880_HP_EVENT)
7867 alc882_targa_automute(codec);
7870 static struct hda_verb alc882_asus_a7j_verbs[] = {
7871 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7872 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7874 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7875 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7876 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7878 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7879 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7880 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7882 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7883 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7884 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7888 static struct hda_verb alc882_asus_a7m_verbs[] = {
7889 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7890 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7892 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7893 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7894 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7896 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7897 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7898 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7900 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7901 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7902 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7906 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
7908 unsigned int gpiostate, gpiomask, gpiodir;
7910 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
7911 AC_VERB_GET_GPIO_DATA, 0);
7914 gpiostate |= (1 << pin);
7916 gpiostate &= ~(1 << pin);
7918 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
7919 AC_VERB_GET_GPIO_MASK, 0);
7920 gpiomask |= (1 << pin);
7922 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
7923 AC_VERB_GET_GPIO_DIRECTION, 0);
7924 gpiodir |= (1 << pin);
7927 snd_hda_codec_write(codec, codec->afg, 0,
7928 AC_VERB_SET_GPIO_MASK, gpiomask);
7929 snd_hda_codec_write(codec, codec->afg, 0,
7930 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
7934 snd_hda_codec_write(codec, codec->afg, 0,
7935 AC_VERB_SET_GPIO_DATA, gpiostate);
7938 /* set up GPIO at initialization */
7939 static void alc885_macpro_init_hook(struct hda_codec *codec)
7941 alc882_gpio_mute(codec, 0, 0);
7942 alc882_gpio_mute(codec, 1, 0);
7945 /* set up GPIO and update auto-muting at initialization */
7946 static void alc885_imac24_init_hook(struct hda_codec *codec)
7948 alc885_macpro_init_hook(codec);
7949 alc_automute_amp(codec);
7953 * generic initialization of ADC, input mixers and output mixers
7955 static struct hda_verb alc883_auto_init_verbs[] = {
7957 * Unmute ADC0-2 and set the default input to mic-in
7959 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7960 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7961 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7962 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7965 * Set up output mixers (0x0c - 0x0f)
7967 /* set vol=0 to output mixers */
7968 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7969 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7970 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7971 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7972 /* set up input amps for analog loopback */
7973 /* Amp Indices: DAC = 0, mixer = 1 */
7974 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7975 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7976 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7977 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7978 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7979 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7980 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7981 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7982 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7983 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7985 /* FIXME: use matrix-type input source selection */
7986 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7988 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7990 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7994 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
7995 static struct hda_verb alc889A_mb31_ch2_init[] = {
7996 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7997 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7998 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7999 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8003 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
8004 static struct hda_verb alc889A_mb31_ch4_init[] = {
8005 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8006 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8007 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8008 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8012 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
8013 static struct hda_verb alc889A_mb31_ch5_init[] = {
8014 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
8015 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8016 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8017 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8021 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
8022 static struct hda_verb alc889A_mb31_ch6_init[] = {
8023 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
8024 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
8025 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8026 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8030 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
8031 { 2, alc889A_mb31_ch2_init },
8032 { 4, alc889A_mb31_ch4_init },
8033 { 5, alc889A_mb31_ch5_init },
8034 { 6, alc889A_mb31_ch6_init },
8037 static struct hda_verb alc883_medion_eapd_verbs[] = {
8038 /* eanable EAPD on medion laptop */
8039 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8040 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
8044 #define alc883_base_mixer alc882_base_mixer
8046 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
8047 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8048 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8049 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8050 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8051 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8052 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8053 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
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),
8057 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8058 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8059 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8063 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
8064 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8065 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8066 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8067 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8068 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8069 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8070 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8071 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8072 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8073 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8077 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
8078 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8079 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8080 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8081 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8082 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8083 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8084 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8085 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8086 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8087 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8091 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
8092 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8093 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8094 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8095 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8096 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8097 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8098 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8099 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8100 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8101 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8102 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8103 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8104 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8108 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
8109 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8110 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8111 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8112 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8113 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8114 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8115 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8116 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8117 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8118 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8119 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8120 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8121 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8122 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8123 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8124 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8125 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8126 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8127 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8131 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
8132 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8133 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8134 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8135 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8136 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8138 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8139 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8140 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8141 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
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("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8145 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8146 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8147 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8148 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8149 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8150 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8151 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8155 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
8156 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8157 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8158 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8159 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8160 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8162 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8163 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8164 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8165 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8166 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
8167 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8168 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8169 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8170 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
8171 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT),
8172 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
8173 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8174 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8175 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8179 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
8180 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8181 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8182 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8183 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8184 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8185 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8186 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8187 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8188 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8189 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8190 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8191 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8192 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8193 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8194 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8195 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8196 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8197 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8198 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8202 static struct snd_kcontrol_new alc883_targa_mixer[] = {
8203 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8204 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8205 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8206 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8207 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8208 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8209 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8210 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8211 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8212 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8213 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8214 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8215 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8216 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8217 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8218 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8219 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8223 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
8224 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8225 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8226 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8227 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8228 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8229 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8230 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8231 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8232 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8233 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8234 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8235 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8239 static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
8240 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8241 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8242 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8243 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8244 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8248 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
8249 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8250 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8251 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8252 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8253 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8254 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8255 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8256 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8260 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
8261 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8262 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
8263 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8264 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8265 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8266 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8267 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8268 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8269 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8273 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
8274 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8275 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8276 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8277 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8278 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8279 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8280 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8281 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8282 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8286 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
8287 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8288 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8289 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8290 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8291 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8292 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8293 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8294 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8298 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
8299 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8300 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8301 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8302 HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT),
8303 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8304 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8305 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8306 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8307 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8308 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8309 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8313 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
8314 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8315 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8316 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8317 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
8318 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
8319 0x0d, 1, 0x0, HDA_OUTPUT),
8320 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
8321 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
8322 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
8323 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8324 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8325 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8326 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8327 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8328 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8329 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8330 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8331 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8332 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8333 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8334 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8338 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
8340 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8341 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8342 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8343 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8344 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
8346 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
8347 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
8348 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
8349 /* Output switches */
8350 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
8351 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
8352 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
8354 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
8355 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
8357 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8358 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8359 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8360 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8364 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
8365 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8366 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8367 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8368 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8369 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8370 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8374 static struct hda_bind_ctls alc883_bind_cap_vol = {
8375 .ops = &snd_hda_bind_vol,
8377 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8378 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8383 static struct hda_bind_ctls alc883_bind_cap_switch = {
8384 .ops = &snd_hda_bind_sw,
8386 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8387 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8392 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
8393 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8394 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8395 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8396 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8397 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8398 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8399 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8400 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8404 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
8405 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
8406 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
8408 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8409 /* .name = "Capture Source", */
8410 .name = "Input Source",
8412 .info = alc_mux_enum_info,
8413 .get = alc_mux_enum_get,
8414 .put = alc_mux_enum_put,
8419 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
8421 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8422 .name = "Channel Mode",
8423 .info = alc_ch_mode_info,
8424 .get = alc_ch_mode_get,
8425 .put = alc_ch_mode_put,
8430 /* toggle speaker-output according to the hp-jack state */
8431 static void alc883_mitac_setup(struct hda_codec *codec)
8433 struct alc_spec *spec = codec->spec;
8435 spec->autocfg.hp_pins[0] = 0x15;
8436 spec->autocfg.speaker_pins[0] = 0x14;
8437 spec->autocfg.speaker_pins[1] = 0x17;
8440 /* auto-toggle front mic */
8442 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8444 unsigned char bits = snd_hda_jack_detect(codec, 0x18) ? HDA_AMP_MUTE : 0;
8446 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8450 static struct hda_verb alc883_mitac_verbs[] = {
8452 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8453 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8455 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8456 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8458 /* enable unsolicited event */
8459 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8460 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8465 static struct hda_verb alc883_clevo_m540r_verbs[] = {
8467 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8468 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8470 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
8472 /* enable unsolicited event */
8474 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8475 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8481 static struct hda_verb alc883_clevo_m720_verbs[] = {
8483 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8484 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8486 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
8487 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8489 /* enable unsolicited event */
8490 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8491 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8496 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8498 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8499 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8501 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8502 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8504 /* enable unsolicited event */
8505 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8510 static struct hda_verb alc883_targa_verbs[] = {
8511 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8512 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8514 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8515 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8517 /* Connect Line-Out side jack (SPDIF) to Side */
8518 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8519 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8520 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8521 /* Connect Mic jack to CLFE */
8522 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8523 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8524 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
8525 /* Connect Line-in jack to Surround */
8526 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8527 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8528 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8529 /* Connect HP out jack to Front */
8530 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8531 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8532 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8534 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8539 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8540 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8541 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8542 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8546 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8547 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8548 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8549 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8550 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8554 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8555 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8556 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8557 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8558 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8559 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8563 static struct hda_verb alc883_haier_w66_verbs[] = {
8564 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8565 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8567 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8569 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8570 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8571 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8572 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8576 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8577 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8578 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8579 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8580 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8581 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8582 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8583 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8584 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8588 static struct hda_verb alc888_6st_dell_verbs[] = {
8589 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8593 static struct hda_verb alc883_vaiott_verbs[] = {
8595 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8596 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8598 /* enable unsolicited event */
8599 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8604 static void alc888_3st_hp_setup(struct hda_codec *codec)
8606 struct alc_spec *spec = codec->spec;
8608 spec->autocfg.hp_pins[0] = 0x1b;
8609 spec->autocfg.speaker_pins[0] = 0x14;
8610 spec->autocfg.speaker_pins[1] = 0x16;
8611 spec->autocfg.speaker_pins[2] = 0x18;
8614 static struct hda_verb alc888_3st_hp_verbs[] = {
8615 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8616 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8617 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8618 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8625 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8626 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8627 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8628 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8629 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8636 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8637 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8638 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8639 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8640 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8641 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8648 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8649 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8650 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8651 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8652 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8653 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8654 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8658 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8659 { 2, alc888_3st_hp_2ch_init },
8660 { 4, alc888_3st_hp_4ch_init },
8661 { 6, alc888_3st_hp_6ch_init },
8664 /* toggle front-jack and RCA according to the hp-jack state */
8665 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8667 unsigned int present = snd_hda_jack_detect(codec, 0x1b);
8669 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8670 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8671 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8672 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8675 /* toggle RCA according to the front-jack state */
8676 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8678 unsigned int present = snd_hda_jack_detect(codec, 0x14);
8680 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8681 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8684 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8687 if ((res >> 26) == ALC880_HP_EVENT)
8688 alc888_lenovo_ms7195_front_automute(codec);
8689 if ((res >> 26) == ALC880_FRONT_EVENT)
8690 alc888_lenovo_ms7195_rca_automute(codec);
8693 static struct hda_verb alc883_medion_md2_verbs[] = {
8694 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8695 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8697 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8699 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8703 /* toggle speaker-output according to the hp-jack state */
8704 static void alc883_medion_md2_setup(struct hda_codec *codec)
8706 struct alc_spec *spec = codec->spec;
8708 spec->autocfg.hp_pins[0] = 0x14;
8709 spec->autocfg.speaker_pins[0] = 0x15;
8712 /* toggle speaker-output according to the hp-jack state */
8713 #define alc883_targa_init_hook alc882_targa_init_hook
8714 #define alc883_targa_unsol_event alc882_targa_unsol_event
8716 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8718 unsigned int present;
8720 present = snd_hda_jack_detect(codec, 0x18);
8721 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8722 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8725 static void alc883_clevo_m720_setup(struct hda_codec *codec)
8727 struct alc_spec *spec = codec->spec;
8729 spec->autocfg.hp_pins[0] = 0x15;
8730 spec->autocfg.speaker_pins[0] = 0x14;
8733 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
8735 alc_automute_amp(codec);
8736 alc883_clevo_m720_mic_automute(codec);
8739 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8742 switch (res >> 26) {
8743 case ALC880_MIC_EVENT:
8744 alc883_clevo_m720_mic_automute(codec);
8747 alc_automute_amp_unsol_event(codec, res);
8752 /* toggle speaker-output according to the hp-jack state */
8753 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
8755 struct alc_spec *spec = codec->spec;
8757 spec->autocfg.hp_pins[0] = 0x14;
8758 spec->autocfg.speaker_pins[0] = 0x15;
8761 static void alc883_haier_w66_setup(struct hda_codec *codec)
8763 struct alc_spec *spec = codec->spec;
8765 spec->autocfg.hp_pins[0] = 0x1b;
8766 spec->autocfg.speaker_pins[0] = 0x14;
8769 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8771 int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0;
8773 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8774 HDA_AMP_MUTE, bits);
8777 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8779 int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0;
8781 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8782 HDA_AMP_MUTE, bits);
8783 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8784 HDA_AMP_MUTE, bits);
8787 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8790 if ((res >> 26) == ALC880_HP_EVENT)
8791 alc883_lenovo_101e_all_automute(codec);
8792 if ((res >> 26) == ALC880_FRONT_EVENT)
8793 alc883_lenovo_101e_ispeaker_automute(codec);
8796 /* toggle speaker-output according to the hp-jack state */
8797 static void alc883_acer_aspire_setup(struct hda_codec *codec)
8799 struct alc_spec *spec = codec->spec;
8801 spec->autocfg.hp_pins[0] = 0x14;
8802 spec->autocfg.speaker_pins[0] = 0x15;
8803 spec->autocfg.speaker_pins[1] = 0x16;
8806 static struct hda_verb alc883_acer_eapd_verbs[] = {
8807 /* HP Pin: output 0 (0x0c) */
8808 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8809 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8810 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8811 /* Front Pin: output 0 (0x0c) */
8812 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8813 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8814 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8815 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8816 /* eanable EAPD on medion laptop */
8817 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8818 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8819 /* enable unsolicited event */
8820 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8824 static struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
8825 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8826 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8827 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8831 static void alc888_6st_dell_setup(struct hda_codec *codec)
8833 struct alc_spec *spec = codec->spec;
8835 spec->autocfg.hp_pins[0] = 0x1b;
8836 spec->autocfg.speaker_pins[0] = 0x14;
8837 spec->autocfg.speaker_pins[1] = 0x15;
8838 spec->autocfg.speaker_pins[2] = 0x16;
8839 spec->autocfg.speaker_pins[3] = 0x17;
8842 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
8844 struct alc_spec *spec = codec->spec;
8846 spec->autocfg.hp_pins[0] = 0x1b;
8847 spec->autocfg.speaker_pins[0] = 0x14;
8848 spec->autocfg.speaker_pins[1] = 0x15;
8849 spec->autocfg.speaker_pins[2] = 0x16;
8850 spec->autocfg.speaker_pins[3] = 0x17;
8851 spec->autocfg.speaker_pins[4] = 0x1a;
8854 static void alc883_vaiott_setup(struct hda_codec *codec)
8856 struct alc_spec *spec = codec->spec;
8858 spec->autocfg.hp_pins[0] = 0x15;
8859 spec->autocfg.speaker_pins[0] = 0x14;
8860 spec->autocfg.speaker_pins[1] = 0x17;
8863 static struct hda_verb alc888_asus_m90v_verbs[] = {
8864 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8865 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8866 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8867 /* enable unsolicited event */
8868 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8869 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8873 static void alc883_mode2_setup(struct hda_codec *codec)
8875 struct alc_spec *spec = codec->spec;
8877 spec->autocfg.hp_pins[0] = 0x1b;
8878 spec->autocfg.speaker_pins[0] = 0x14;
8879 spec->autocfg.speaker_pins[1] = 0x15;
8880 spec->autocfg.speaker_pins[2] = 0x16;
8881 spec->ext_mic.pin = 0x18;
8882 spec->int_mic.pin = 0x19;
8883 spec->ext_mic.mux_idx = 0;
8884 spec->int_mic.mux_idx = 1;
8888 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8889 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8890 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8891 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8892 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8893 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8894 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8895 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8896 /* enable unsolicited event */
8897 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8901 static void alc883_eee1601_inithook(struct hda_codec *codec)
8903 struct alc_spec *spec = codec->spec;
8905 spec->autocfg.hp_pins[0] = 0x14;
8906 spec->autocfg.speaker_pins[0] = 0x1b;
8907 alc_automute_pin(codec);
8910 static struct hda_verb alc889A_mb31_verbs[] = {
8911 /* Init rear pin (used as headphone output) */
8912 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
8913 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
8914 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8915 /* Init line pin (used as output in 4ch and 6ch mode) */
8916 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
8917 /* Init line 2 pin (used as headphone out by default) */
8918 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
8919 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
8923 /* Mute speakers according to the headphone jack state */
8924 static void alc889A_mb31_automute(struct hda_codec *codec)
8926 unsigned int present;
8928 /* Mute only in 2ch or 4ch mode */
8929 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
8931 present = snd_hda_jack_detect(codec, 0x15);
8932 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8933 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8934 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8935 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8939 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
8941 if ((res >> 26) == ALC880_HP_EVENT)
8942 alc889A_mb31_automute(codec);
8946 #ifdef CONFIG_SND_HDA_POWER_SAVE
8947 #define alc882_loopbacks alc880_loopbacks
8950 /* pcm configuration: identical with ALC880 */
8951 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
8952 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
8953 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
8954 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
8956 static hda_nid_t alc883_slave_dig_outs[] = {
8957 ALC1200_DIGOUT_NID, 0,
8960 static hda_nid_t alc1200_slave_dig_outs[] = {
8961 ALC883_DIGOUT_NID, 0,
8965 * configuration and preset
8967 static const char *alc882_models[ALC882_MODEL_LAST] = {
8968 [ALC882_3ST_DIG] = "3stack-dig",
8969 [ALC882_6ST_DIG] = "6stack-dig",
8970 [ALC882_ARIMA] = "arima",
8971 [ALC882_W2JC] = "w2jc",
8972 [ALC882_TARGA] = "targa",
8973 [ALC882_ASUS_A7J] = "asus-a7j",
8974 [ALC882_ASUS_A7M] = "asus-a7m",
8975 [ALC885_MACPRO] = "macpro",
8976 [ALC885_MB5] = "mb5",
8977 [ALC885_MBP3] = "mbp3",
8978 [ALC885_IMAC24] = "imac24",
8979 [ALC885_IMAC91] = "imac91",
8980 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
8981 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8982 [ALC883_3ST_6ch] = "3stack-6ch",
8983 [ALC883_6ST_DIG] = "alc883-6stack-dig",
8984 [ALC883_TARGA_DIG] = "targa-dig",
8985 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8986 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
8987 [ALC883_ACER] = "acer",
8988 [ALC883_ACER_ASPIRE] = "acer-aspire",
8989 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
8990 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
8991 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
8992 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
8993 [ALC883_MEDION] = "medion",
8994 [ALC883_MEDION_MD2] = "medion-md2",
8995 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8996 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8997 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8998 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8999 [ALC888_LENOVO_SKY] = "lenovo-sky",
9000 [ALC883_HAIER_W66] = "haier-w66",
9001 [ALC888_3ST_HP] = "3stack-hp",
9002 [ALC888_6ST_DELL] = "6stack-dell",
9003 [ALC883_MITAC] = "mitac",
9004 [ALC883_CLEVO_M540R] = "clevo-m540r",
9005 [ALC883_CLEVO_M720] = "clevo-m720",
9006 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
9007 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
9008 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
9009 [ALC889A_INTEL] = "intel-alc889a",
9010 [ALC889_INTEL] = "intel-x58",
9011 [ALC1200_ASUS_P5Q] = "asus-p5q",
9012 [ALC889A_MB31] = "mb31",
9013 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
9014 [ALC882_AUTO] = "auto",
9017 static struct snd_pci_quirk alc882_cfg_tbl[] = {
9018 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
9020 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
9021 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
9022 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
9023 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
9024 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
9025 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
9026 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
9027 ALC888_ACER_ASPIRE_4930G),
9028 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
9029 ALC888_ACER_ASPIRE_4930G),
9030 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
9031 ALC888_ACER_ASPIRE_8930G),
9032 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
9033 ALC888_ACER_ASPIRE_8930G),
9034 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
9035 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
9036 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
9037 ALC888_ACER_ASPIRE_6530G),
9038 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
9039 ALC888_ACER_ASPIRE_6530G),
9040 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
9041 ALC888_ACER_ASPIRE_7730G),
9042 /* default Acer -- disabled as it causes more problems.
9043 * model=auto should work fine now
9045 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
9047 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
9049 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
9050 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
9051 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
9052 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
9053 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
9054 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
9056 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
9057 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
9058 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
9059 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
9060 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
9061 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
9062 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
9063 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
9064 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
9065 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
9066 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
9068 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
9069 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
9070 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
9071 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
9072 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
9073 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
9074 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
9075 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
9076 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
9078 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
9079 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
9080 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
9081 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
9082 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
9083 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
9084 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
9085 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
9086 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
9087 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
9088 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
9089 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
9090 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
9091 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
9092 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
9093 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
9094 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
9095 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
9096 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
9097 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
9098 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
9099 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
9100 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
9101 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
9102 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
9103 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
9104 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
9105 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
9106 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
9108 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
9109 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
9110 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
9111 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
9112 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
9113 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
9114 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
9115 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
9116 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9117 ALC883_FUJITSU_PI2515),
9118 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9119 ALC888_FUJITSU_XA3530),
9120 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
9121 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9122 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9123 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9124 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
9125 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
9126 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
9127 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
9128 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
9130 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
9131 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
9132 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
9133 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
9134 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
9135 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
9136 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
9141 /* codec SSID table for Intel Mac */
9142 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
9143 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
9144 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
9145 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
9146 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
9147 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
9148 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
9149 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
9150 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
9151 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
9152 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
9153 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
9154 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
9155 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
9156 * so apparently no perfect solution yet
9158 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
9159 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
9163 static struct alc_config_preset alc882_presets[] = {
9164 [ALC882_3ST_DIG] = {
9165 .mixers = { alc882_base_mixer },
9166 .init_verbs = { alc882_base_init_verbs,
9167 alc882_adc1_init_verbs },
9168 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9169 .dac_nids = alc882_dac_nids,
9170 .dig_out_nid = ALC882_DIGOUT_NID,
9171 .dig_in_nid = ALC882_DIGIN_NID,
9172 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9173 .channel_mode = alc882_ch_modes,
9175 .input_mux = &alc882_capture_source,
9177 [ALC882_6ST_DIG] = {
9178 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9179 .init_verbs = { alc882_base_init_verbs,
9180 alc882_adc1_init_verbs },
9181 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9182 .dac_nids = alc882_dac_nids,
9183 .dig_out_nid = ALC882_DIGOUT_NID,
9184 .dig_in_nid = ALC882_DIGIN_NID,
9185 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9186 .channel_mode = alc882_sixstack_modes,
9187 .input_mux = &alc882_capture_source,
9190 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9191 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9192 alc882_eapd_verbs },
9193 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9194 .dac_nids = alc882_dac_nids,
9195 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9196 .channel_mode = alc882_sixstack_modes,
9197 .input_mux = &alc882_capture_source,
9200 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
9201 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9202 alc882_eapd_verbs, alc880_gpio1_init_verbs },
9203 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9204 .dac_nids = alc882_dac_nids,
9205 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9206 .channel_mode = alc880_threestack_modes,
9208 .input_mux = &alc882_capture_source,
9209 .dig_out_nid = ALC882_DIGOUT_NID,
9212 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
9213 .init_verbs = { alc885_mbp3_init_verbs,
9214 alc880_gpio1_init_verbs },
9216 .dac_nids = alc882_dac_nids,
9218 .channel_mode = alc885_mbp_4ch_modes,
9219 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9220 .input_mux = &alc882_capture_source,
9221 .dig_out_nid = ALC882_DIGOUT_NID,
9222 .dig_in_nid = ALC882_DIGIN_NID,
9223 .unsol_event = alc_automute_amp_unsol_event,
9224 .setup = alc885_mbp3_setup,
9225 .init_hook = alc_automute_amp,
9228 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
9229 .init_verbs = { alc885_mb5_init_verbs,
9230 alc880_gpio1_init_verbs },
9231 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9232 .dac_nids = alc882_dac_nids,
9233 .channel_mode = alc885_mb5_6ch_modes,
9234 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
9235 .input_mux = &mb5_capture_source,
9236 .dig_out_nid = ALC882_DIGOUT_NID,
9237 .dig_in_nid = ALC882_DIGIN_NID,
9238 .unsol_event = alc885_mb5_unsol_event,
9239 .init_hook = alc885_mb5_automute,
9242 .mixers = { alc882_macpro_mixer },
9243 .init_verbs = { alc882_macpro_init_verbs },
9244 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9245 .dac_nids = alc882_dac_nids,
9246 .dig_out_nid = ALC882_DIGOUT_NID,
9247 .dig_in_nid = ALC882_DIGIN_NID,
9248 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9249 .channel_mode = alc882_ch_modes,
9250 .input_mux = &alc882_capture_source,
9251 .init_hook = alc885_macpro_init_hook,
9254 .mixers = { alc885_imac24_mixer },
9255 .init_verbs = { alc885_imac24_init_verbs },
9256 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9257 .dac_nids = alc882_dac_nids,
9258 .dig_out_nid = ALC882_DIGOUT_NID,
9259 .dig_in_nid = ALC882_DIGIN_NID,
9260 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9261 .channel_mode = alc882_ch_modes,
9262 .input_mux = &alc882_capture_source,
9263 .unsol_event = alc_automute_amp_unsol_event,
9264 .setup = alc885_imac24_setup,
9265 .init_hook = alc885_imac24_init_hook,
9268 .mixers = { alc885_imac91_mixer, alc882_chmode_mixer },
9269 .init_verbs = { alc885_imac91_init_verbs,
9270 alc880_gpio1_init_verbs },
9271 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9272 .dac_nids = alc882_dac_nids,
9273 .channel_mode = alc885_mbp_4ch_modes,
9274 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9275 .input_mux = &alc882_capture_source,
9276 .dig_out_nid = ALC882_DIGOUT_NID,
9277 .dig_in_nid = ALC882_DIGIN_NID,
9278 .unsol_event = alc885_imac91_unsol_event,
9279 .init_hook = alc885_imac91_automute,
9282 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
9283 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9284 alc880_gpio3_init_verbs, alc882_targa_verbs},
9285 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9286 .dac_nids = alc882_dac_nids,
9287 .dig_out_nid = ALC882_DIGOUT_NID,
9288 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9289 .adc_nids = alc882_adc_nids,
9290 .capsrc_nids = alc882_capsrc_nids,
9291 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9292 .channel_mode = alc882_3ST_6ch_modes,
9294 .input_mux = &alc882_capture_source,
9295 .unsol_event = alc882_targa_unsol_event,
9296 .setup = alc882_targa_setup,
9297 .init_hook = alc882_targa_automute,
9299 [ALC882_ASUS_A7J] = {
9300 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
9301 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9302 alc882_asus_a7j_verbs},
9303 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9304 .dac_nids = alc882_dac_nids,
9305 .dig_out_nid = ALC882_DIGOUT_NID,
9306 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9307 .adc_nids = alc882_adc_nids,
9308 .capsrc_nids = alc882_capsrc_nids,
9309 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9310 .channel_mode = alc882_3ST_6ch_modes,
9312 .input_mux = &alc882_capture_source,
9314 [ALC882_ASUS_A7M] = {
9315 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
9316 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9317 alc882_eapd_verbs, alc880_gpio1_init_verbs,
9318 alc882_asus_a7m_verbs },
9319 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9320 .dac_nids = alc882_dac_nids,
9321 .dig_out_nid = ALC882_DIGOUT_NID,
9322 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9323 .channel_mode = alc880_threestack_modes,
9325 .input_mux = &alc882_capture_source,
9327 [ALC883_3ST_2ch_DIG] = {
9328 .mixers = { alc883_3ST_2ch_mixer },
9329 .init_verbs = { alc883_init_verbs },
9330 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9331 .dac_nids = alc883_dac_nids,
9332 .dig_out_nid = ALC883_DIGOUT_NID,
9333 .dig_in_nid = ALC883_DIGIN_NID,
9334 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9335 .channel_mode = alc883_3ST_2ch_modes,
9336 .input_mux = &alc883_capture_source,
9338 [ALC883_3ST_6ch_DIG] = {
9339 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9340 .init_verbs = { alc883_init_verbs },
9341 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9342 .dac_nids = alc883_dac_nids,
9343 .dig_out_nid = ALC883_DIGOUT_NID,
9344 .dig_in_nid = ALC883_DIGIN_NID,
9345 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9346 .channel_mode = alc883_3ST_6ch_modes,
9348 .input_mux = &alc883_capture_source,
9350 [ALC883_3ST_6ch] = {
9351 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9352 .init_verbs = { alc883_init_verbs },
9353 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9354 .dac_nids = alc883_dac_nids,
9355 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9356 .channel_mode = alc883_3ST_6ch_modes,
9358 .input_mux = &alc883_capture_source,
9360 [ALC883_3ST_6ch_INTEL] = {
9361 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
9362 .init_verbs = { alc883_init_verbs },
9363 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9364 .dac_nids = alc883_dac_nids,
9365 .dig_out_nid = ALC883_DIGOUT_NID,
9366 .dig_in_nid = ALC883_DIGIN_NID,
9367 .slave_dig_outs = alc883_slave_dig_outs,
9368 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
9369 .channel_mode = alc883_3ST_6ch_intel_modes,
9371 .input_mux = &alc883_3stack_6ch_intel,
9374 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9375 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
9376 alc_hp15_unsol_verbs },
9377 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9378 .dac_nids = alc883_dac_nids,
9379 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9380 .adc_nids = alc889_adc_nids,
9381 .dig_out_nid = ALC883_DIGOUT_NID,
9382 .dig_in_nid = ALC883_DIGIN_NID,
9383 .slave_dig_outs = alc883_slave_dig_outs,
9384 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9385 .channel_mode = alc889_8ch_intel_modes,
9386 .capsrc_nids = alc889_capsrc_nids,
9387 .input_mux = &alc889_capture_source,
9388 .setup = alc889_automute_setup,
9389 .init_hook = alc_automute_amp,
9390 .unsol_event = alc_automute_amp_unsol_event,
9394 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9395 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
9396 alc889_eapd_verbs, alc_hp15_unsol_verbs},
9397 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9398 .dac_nids = alc883_dac_nids,
9399 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9400 .adc_nids = alc889_adc_nids,
9401 .dig_out_nid = ALC883_DIGOUT_NID,
9402 .dig_in_nid = ALC883_DIGIN_NID,
9403 .slave_dig_outs = alc883_slave_dig_outs,
9404 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9405 .channel_mode = alc889_8ch_intel_modes,
9406 .capsrc_nids = alc889_capsrc_nids,
9407 .input_mux = &alc889_capture_source,
9408 .setup = alc889_automute_setup,
9409 .init_hook = alc889_intel_init_hook,
9410 .unsol_event = alc_automute_amp_unsol_event,
9413 [ALC883_6ST_DIG] = {
9414 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9415 .init_verbs = { alc883_init_verbs },
9416 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9417 .dac_nids = alc883_dac_nids,
9418 .dig_out_nid = ALC883_DIGOUT_NID,
9419 .dig_in_nid = ALC883_DIGIN_NID,
9420 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9421 .channel_mode = alc883_sixstack_modes,
9422 .input_mux = &alc883_capture_source,
9424 [ALC883_TARGA_DIG] = {
9425 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
9426 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9427 alc883_targa_verbs},
9428 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9429 .dac_nids = alc883_dac_nids,
9430 .dig_out_nid = ALC883_DIGOUT_NID,
9431 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9432 .channel_mode = alc883_3ST_6ch_modes,
9434 .input_mux = &alc883_capture_source,
9435 .unsol_event = alc883_targa_unsol_event,
9436 .setup = alc882_targa_setup,
9437 .init_hook = alc882_targa_automute,
9439 [ALC883_TARGA_2ch_DIG] = {
9440 .mixers = { alc883_targa_2ch_mixer},
9441 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9442 alc883_targa_verbs},
9443 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9444 .dac_nids = alc883_dac_nids,
9445 .adc_nids = alc883_adc_nids_alt,
9446 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9447 .capsrc_nids = alc883_capsrc_nids,
9448 .dig_out_nid = ALC883_DIGOUT_NID,
9449 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9450 .channel_mode = alc883_3ST_2ch_modes,
9451 .input_mux = &alc883_capture_source,
9452 .unsol_event = alc883_targa_unsol_event,
9453 .setup = alc882_targa_setup,
9454 .init_hook = alc882_targa_automute,
9456 [ALC883_TARGA_8ch_DIG] = {
9457 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
9458 alc883_chmode_mixer },
9459 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9460 alc883_targa_verbs },
9461 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9462 .dac_nids = alc883_dac_nids,
9463 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9464 .adc_nids = alc883_adc_nids_rev,
9465 .capsrc_nids = alc883_capsrc_nids_rev,
9466 .dig_out_nid = ALC883_DIGOUT_NID,
9467 .dig_in_nid = ALC883_DIGIN_NID,
9468 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
9469 .channel_mode = alc883_4ST_8ch_modes,
9471 .input_mux = &alc883_capture_source,
9472 .unsol_event = alc883_targa_unsol_event,
9473 .setup = alc882_targa_setup,
9474 .init_hook = alc882_targa_automute,
9477 .mixers = { alc883_base_mixer },
9478 /* On TravelMate laptops, GPIO 0 enables the internal speaker
9479 * and the headphone jack. Turn this on and rely on the
9480 * standard mute methods whenever the user wants to turn
9481 * these outputs off.
9483 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
9484 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9485 .dac_nids = alc883_dac_nids,
9486 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9487 .channel_mode = alc883_3ST_2ch_modes,
9488 .input_mux = &alc883_capture_source,
9490 [ALC883_ACER_ASPIRE] = {
9491 .mixers = { alc883_acer_aspire_mixer },
9492 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
9493 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9494 .dac_nids = alc883_dac_nids,
9495 .dig_out_nid = ALC883_DIGOUT_NID,
9496 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9497 .channel_mode = alc883_3ST_2ch_modes,
9498 .input_mux = &alc883_capture_source,
9499 .unsol_event = alc_automute_amp_unsol_event,
9500 .setup = alc883_acer_aspire_setup,
9501 .init_hook = alc_automute_amp,
9503 [ALC888_ACER_ASPIRE_4930G] = {
9504 .mixers = { alc888_base_mixer,
9505 alc883_chmode_mixer },
9506 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9507 alc888_acer_aspire_4930g_verbs },
9508 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9509 .dac_nids = alc883_dac_nids,
9510 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9511 .adc_nids = alc883_adc_nids_rev,
9512 .capsrc_nids = alc883_capsrc_nids_rev,
9513 .dig_out_nid = ALC883_DIGOUT_NID,
9514 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9515 .channel_mode = alc883_3ST_6ch_modes,
9518 ARRAY_SIZE(alc888_2_capture_sources),
9519 .input_mux = alc888_2_capture_sources,
9520 .unsol_event = alc_automute_amp_unsol_event,
9521 .setup = alc888_acer_aspire_4930g_setup,
9522 .init_hook = alc_automute_amp,
9524 [ALC888_ACER_ASPIRE_6530G] = {
9525 .mixers = { alc888_acer_aspire_6530_mixer },
9526 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9527 alc888_acer_aspire_6530g_verbs },
9528 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9529 .dac_nids = alc883_dac_nids,
9530 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9531 .adc_nids = alc883_adc_nids_rev,
9532 .capsrc_nids = alc883_capsrc_nids_rev,
9533 .dig_out_nid = ALC883_DIGOUT_NID,
9534 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9535 .channel_mode = alc883_3ST_2ch_modes,
9537 ARRAY_SIZE(alc888_2_capture_sources),
9538 .input_mux = alc888_acer_aspire_6530_sources,
9539 .unsol_event = alc_automute_amp_unsol_event,
9540 .setup = alc888_acer_aspire_6530g_setup,
9541 .init_hook = alc_automute_amp,
9543 [ALC888_ACER_ASPIRE_8930G] = {
9544 .mixers = { alc889_acer_aspire_8930g_mixer,
9545 alc883_chmode_mixer },
9546 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9547 alc889_acer_aspire_8930g_verbs,
9549 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9550 .dac_nids = alc883_dac_nids,
9551 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9552 .adc_nids = alc889_adc_nids,
9553 .capsrc_nids = alc889_capsrc_nids,
9554 .dig_out_nid = ALC883_DIGOUT_NID,
9555 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9556 .channel_mode = alc883_3ST_6ch_modes,
9558 .const_channel_count = 6,
9560 ARRAY_SIZE(alc889_capture_sources),
9561 .input_mux = alc889_capture_sources,
9562 .unsol_event = alc_automute_amp_unsol_event,
9563 .setup = alc889_acer_aspire_8930g_setup,
9564 .init_hook = alc_automute_amp,
9565 #ifdef CONFIG_SND_HDA_POWER_SAVE
9566 .power_hook = alc_power_eapd,
9569 [ALC888_ACER_ASPIRE_7730G] = {
9570 .mixers = { alc883_3ST_6ch_mixer,
9571 alc883_chmode_mixer },
9572 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9573 alc888_acer_aspire_7730G_verbs },
9574 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9575 .dac_nids = alc883_dac_nids,
9576 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9577 .adc_nids = alc883_adc_nids_rev,
9578 .capsrc_nids = alc883_capsrc_nids_rev,
9579 .dig_out_nid = ALC883_DIGOUT_NID,
9580 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9581 .channel_mode = alc883_3ST_6ch_modes,
9583 .const_channel_count = 6,
9584 .input_mux = &alc883_capture_source,
9585 .unsol_event = alc_automute_amp_unsol_event,
9586 .setup = alc888_acer_aspire_6530g_setup,
9587 .init_hook = alc_automute_amp,
9590 .mixers = { alc883_fivestack_mixer,
9591 alc883_chmode_mixer },
9592 .init_verbs = { alc883_init_verbs,
9593 alc883_medion_eapd_verbs },
9594 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9595 .dac_nids = alc883_dac_nids,
9596 .adc_nids = alc883_adc_nids_alt,
9597 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9598 .capsrc_nids = alc883_capsrc_nids,
9599 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9600 .channel_mode = alc883_sixstack_modes,
9601 .input_mux = &alc883_capture_source,
9603 [ALC883_MEDION_MD2] = {
9604 .mixers = { alc883_medion_md2_mixer},
9605 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
9606 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9607 .dac_nids = alc883_dac_nids,
9608 .dig_out_nid = ALC883_DIGOUT_NID,
9609 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9610 .channel_mode = alc883_3ST_2ch_modes,
9611 .input_mux = &alc883_capture_source,
9612 .unsol_event = alc_automute_amp_unsol_event,
9613 .setup = alc883_medion_md2_setup,
9614 .init_hook = alc_automute_amp,
9616 [ALC883_LAPTOP_EAPD] = {
9617 .mixers = { alc883_base_mixer },
9618 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
9619 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9620 .dac_nids = alc883_dac_nids,
9621 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9622 .channel_mode = alc883_3ST_2ch_modes,
9623 .input_mux = &alc883_capture_source,
9625 [ALC883_CLEVO_M540R] = {
9626 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9627 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
9628 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9629 .dac_nids = alc883_dac_nids,
9630 .dig_out_nid = ALC883_DIGOUT_NID,
9631 .dig_in_nid = ALC883_DIGIN_NID,
9632 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
9633 .channel_mode = alc883_3ST_6ch_clevo_modes,
9635 .input_mux = &alc883_capture_source,
9636 /* This machine has the hardware HP auto-muting, thus
9637 * we need no software mute via unsol event
9640 [ALC883_CLEVO_M720] = {
9641 .mixers = { alc883_clevo_m720_mixer },
9642 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
9643 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9644 .dac_nids = alc883_dac_nids,
9645 .dig_out_nid = ALC883_DIGOUT_NID,
9646 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9647 .channel_mode = alc883_3ST_2ch_modes,
9648 .input_mux = &alc883_capture_source,
9649 .unsol_event = alc883_clevo_m720_unsol_event,
9650 .setup = alc883_clevo_m720_setup,
9651 .init_hook = alc883_clevo_m720_init_hook,
9653 [ALC883_LENOVO_101E_2ch] = {
9654 .mixers = { alc883_lenovo_101e_2ch_mixer},
9655 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
9656 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9657 .dac_nids = alc883_dac_nids,
9658 .adc_nids = alc883_adc_nids_alt,
9659 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9660 .capsrc_nids = alc883_capsrc_nids,
9661 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9662 .channel_mode = alc883_3ST_2ch_modes,
9663 .input_mux = &alc883_lenovo_101e_capture_source,
9664 .unsol_event = alc883_lenovo_101e_unsol_event,
9665 .init_hook = alc883_lenovo_101e_all_automute,
9667 [ALC883_LENOVO_NB0763] = {
9668 .mixers = { alc883_lenovo_nb0763_mixer },
9669 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
9670 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9671 .dac_nids = alc883_dac_nids,
9672 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9673 .channel_mode = alc883_3ST_2ch_modes,
9675 .input_mux = &alc883_lenovo_nb0763_capture_source,
9676 .unsol_event = alc_automute_amp_unsol_event,
9677 .setup = alc883_medion_md2_setup,
9678 .init_hook = alc_automute_amp,
9680 [ALC888_LENOVO_MS7195_DIG] = {
9681 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9682 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
9683 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9684 .dac_nids = alc883_dac_nids,
9685 .dig_out_nid = ALC883_DIGOUT_NID,
9686 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9687 .channel_mode = alc883_3ST_6ch_modes,
9689 .input_mux = &alc883_capture_source,
9690 .unsol_event = alc883_lenovo_ms7195_unsol_event,
9691 .init_hook = alc888_lenovo_ms7195_front_automute,
9693 [ALC883_HAIER_W66] = {
9694 .mixers = { alc883_targa_2ch_mixer},
9695 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
9696 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9697 .dac_nids = alc883_dac_nids,
9698 .dig_out_nid = ALC883_DIGOUT_NID,
9699 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9700 .channel_mode = alc883_3ST_2ch_modes,
9701 .input_mux = &alc883_capture_source,
9702 .unsol_event = alc_automute_amp_unsol_event,
9703 .setup = alc883_haier_w66_setup,
9704 .init_hook = alc_automute_amp,
9707 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9708 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
9709 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9710 .dac_nids = alc883_dac_nids,
9711 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
9712 .channel_mode = alc888_3st_hp_modes,
9714 .input_mux = &alc883_capture_source,
9715 .unsol_event = alc_automute_amp_unsol_event,
9716 .setup = alc888_3st_hp_setup,
9717 .init_hook = alc_automute_amp,
9719 [ALC888_6ST_DELL] = {
9720 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9721 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
9722 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9723 .dac_nids = alc883_dac_nids,
9724 .dig_out_nid = ALC883_DIGOUT_NID,
9725 .dig_in_nid = ALC883_DIGIN_NID,
9726 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9727 .channel_mode = alc883_sixstack_modes,
9728 .input_mux = &alc883_capture_source,
9729 .unsol_event = alc_automute_amp_unsol_event,
9730 .setup = alc888_6st_dell_setup,
9731 .init_hook = alc_automute_amp,
9734 .mixers = { alc883_mitac_mixer },
9735 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
9736 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9737 .dac_nids = alc883_dac_nids,
9738 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9739 .channel_mode = alc883_3ST_2ch_modes,
9740 .input_mux = &alc883_capture_source,
9741 .unsol_event = alc_automute_amp_unsol_event,
9742 .setup = alc883_mitac_setup,
9743 .init_hook = alc_automute_amp,
9745 [ALC883_FUJITSU_PI2515] = {
9746 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
9747 .init_verbs = { alc883_init_verbs,
9748 alc883_2ch_fujitsu_pi2515_verbs},
9749 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9750 .dac_nids = alc883_dac_nids,
9751 .dig_out_nid = ALC883_DIGOUT_NID,
9752 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9753 .channel_mode = alc883_3ST_2ch_modes,
9754 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9755 .unsol_event = alc_automute_amp_unsol_event,
9756 .setup = alc883_2ch_fujitsu_pi2515_setup,
9757 .init_hook = alc_automute_amp,
9759 [ALC888_FUJITSU_XA3530] = {
9760 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
9761 .init_verbs = { alc883_init_verbs,
9762 alc888_fujitsu_xa3530_verbs },
9763 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9764 .dac_nids = alc883_dac_nids,
9765 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9766 .adc_nids = alc883_adc_nids_rev,
9767 .capsrc_nids = alc883_capsrc_nids_rev,
9768 .dig_out_nid = ALC883_DIGOUT_NID,
9769 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
9770 .channel_mode = alc888_4ST_8ch_intel_modes,
9772 ARRAY_SIZE(alc888_2_capture_sources),
9773 .input_mux = alc888_2_capture_sources,
9774 .unsol_event = alc_automute_amp_unsol_event,
9775 .setup = alc888_fujitsu_xa3530_setup,
9776 .init_hook = alc_automute_amp,
9778 [ALC888_LENOVO_SKY] = {
9779 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
9780 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
9781 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9782 .dac_nids = alc883_dac_nids,
9783 .dig_out_nid = ALC883_DIGOUT_NID,
9784 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9785 .channel_mode = alc883_sixstack_modes,
9787 .input_mux = &alc883_lenovo_sky_capture_source,
9788 .unsol_event = alc_automute_amp_unsol_event,
9789 .setup = alc888_lenovo_sky_setup,
9790 .init_hook = alc_automute_amp,
9792 [ALC888_ASUS_M90V] = {
9793 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9794 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
9795 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9796 .dac_nids = alc883_dac_nids,
9797 .dig_out_nid = ALC883_DIGOUT_NID,
9798 .dig_in_nid = ALC883_DIGIN_NID,
9799 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9800 .channel_mode = alc883_3ST_6ch_modes,
9802 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9803 .unsol_event = alc_sku_unsol_event,
9804 .setup = alc883_mode2_setup,
9805 .init_hook = alc_inithook,
9807 [ALC888_ASUS_EEE1601] = {
9808 .mixers = { alc883_asus_eee1601_mixer },
9809 .cap_mixer = alc883_asus_eee1601_cap_mixer,
9810 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
9811 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9812 .dac_nids = alc883_dac_nids,
9813 .dig_out_nid = ALC883_DIGOUT_NID,
9814 .dig_in_nid = ALC883_DIGIN_NID,
9815 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9816 .channel_mode = alc883_3ST_2ch_modes,
9818 .input_mux = &alc883_asus_eee1601_capture_source,
9819 .unsol_event = alc_sku_unsol_event,
9820 .init_hook = alc883_eee1601_inithook,
9822 [ALC1200_ASUS_P5Q] = {
9823 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9824 .init_verbs = { alc883_init_verbs },
9825 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9826 .dac_nids = alc883_dac_nids,
9827 .dig_out_nid = ALC1200_DIGOUT_NID,
9828 .dig_in_nid = ALC883_DIGIN_NID,
9829 .slave_dig_outs = alc1200_slave_dig_outs,
9830 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9831 .channel_mode = alc883_sixstack_modes,
9832 .input_mux = &alc883_capture_source,
9835 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
9836 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
9837 alc880_gpio1_init_verbs },
9838 .adc_nids = alc883_adc_nids,
9839 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
9840 .capsrc_nids = alc883_capsrc_nids,
9841 .dac_nids = alc883_dac_nids,
9842 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9843 .channel_mode = alc889A_mb31_6ch_modes,
9844 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
9845 .input_mux = &alc889A_mb31_capture_source,
9846 .dig_out_nid = ALC883_DIGOUT_NID,
9847 .unsol_event = alc889A_mb31_unsol_event,
9848 .init_hook = alc889A_mb31_automute,
9850 [ALC883_SONY_VAIO_TT] = {
9851 .mixers = { alc883_vaiott_mixer },
9852 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
9853 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9854 .dac_nids = alc883_dac_nids,
9855 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9856 .channel_mode = alc883_3ST_2ch_modes,
9857 .input_mux = &alc883_capture_source,
9858 .unsol_event = alc_automute_amp_unsol_event,
9859 .setup = alc883_vaiott_setup,
9860 .init_hook = alc_automute_amp,
9869 PINFIX_ABIT_AW9D_MAX
9872 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
9873 { 0x15, 0x01080104 }, /* side */
9874 { 0x16, 0x01011012 }, /* rear */
9875 { 0x17, 0x01016011 }, /* clfe */
9879 static const struct alc_fixup alc882_fixups[] = {
9880 [PINFIX_ABIT_AW9D_MAX] = {
9881 .pins = alc882_abit_aw9d_pinfix
9885 static struct snd_pci_quirk alc882_fixup_tbl[] = {
9886 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
9891 * BIOS auto configuration
9893 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
9894 const struct auto_pin_cfg *cfg)
9896 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
9899 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
9900 hda_nid_t nid, int pin_type,
9904 struct alc_spec *spec = codec->spec;
9907 alc_set_pin_output(codec, nid, pin_type);
9908 if (spec->multiout.dac_nids[dac_idx] == 0x25)
9911 idx = spec->multiout.dac_nids[dac_idx] - 2;
9912 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
9916 static void alc882_auto_init_multi_out(struct hda_codec *codec)
9918 struct alc_spec *spec = codec->spec;
9921 for (i = 0; i <= HDA_SIDE; i++) {
9922 hda_nid_t nid = spec->autocfg.line_out_pins[i];
9923 int pin_type = get_pin_type(spec->autocfg.line_out_type);
9925 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
9930 static void alc882_auto_init_hp_out(struct hda_codec *codec)
9932 struct alc_spec *spec = codec->spec;
9935 pin = spec->autocfg.hp_pins[0];
9936 if (pin) /* connect to front */
9938 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
9939 pin = spec->autocfg.speaker_pins[0];
9941 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
9944 static void alc882_auto_init_analog_input(struct hda_codec *codec)
9946 struct alc_spec *spec = codec->spec;
9949 for (i = 0; i < AUTO_PIN_LAST; i++) {
9950 hda_nid_t nid = spec->autocfg.input_pins[i];
9953 alc_set_input_pin(codec, nid, i);
9954 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
9955 snd_hda_codec_write(codec, nid, 0,
9956 AC_VERB_SET_AMP_GAIN_MUTE,
9961 static void alc882_auto_init_input_src(struct hda_codec *codec)
9963 struct alc_spec *spec = codec->spec;
9966 for (c = 0; c < spec->num_adc_nids; c++) {
9967 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
9968 hda_nid_t nid = spec->capsrc_nids[c];
9969 unsigned int mux_idx;
9970 const struct hda_input_mux *imux;
9971 int conns, mute, idx, item;
9973 conns = snd_hda_get_connections(codec, nid, conn_list,
9974 ARRAY_SIZE(conn_list));
9977 mux_idx = c >= spec->num_mux_defs ? 0 : c;
9978 imux = &spec->input_mux[mux_idx];
9979 for (idx = 0; idx < conns; idx++) {
9980 /* if the current connection is the selected one,
9981 * unmute it as default - otherwise mute it
9983 mute = AMP_IN_MUTE(idx);
9984 for (item = 0; item < imux->num_items; item++) {
9985 if (imux->items[item].index == idx) {
9986 if (spec->cur_mux[c] == item)
9987 mute = AMP_IN_UNMUTE(idx);
9991 /* check if we have a selector or mixer
9992 * we could check for the widget type instead, but
9993 * just check for Amp-In presence (in case of mixer
9994 * without amp-in there is something wrong, this
9995 * function shouldn't be used or capsrc nid is wrong)
9997 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
9998 snd_hda_codec_write(codec, nid, 0,
9999 AC_VERB_SET_AMP_GAIN_MUTE,
10001 else if (mute != AMP_IN_MUTE(idx))
10002 snd_hda_codec_write(codec, nid, 0,
10003 AC_VERB_SET_CONNECT_SEL,
10009 /* add mic boosts if needed */
10010 static int alc_auto_add_mic_boost(struct hda_codec *codec)
10012 struct alc_spec *spec = codec->spec;
10016 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
10017 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
10018 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10020 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10024 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
10025 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
10026 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10028 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10035 /* almost identical with ALC880 parser... */
10036 static int alc882_parse_auto_config(struct hda_codec *codec)
10038 struct alc_spec *spec = codec->spec;
10039 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
10042 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10046 if (!spec->autocfg.line_outs)
10047 return 0; /* can't find valid BIOS pin config */
10049 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
10052 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
10055 err = alc880_auto_create_extra_out(spec,
10056 spec->autocfg.speaker_pins[0],
10060 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
10064 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
10068 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10070 /* check multiple SPDIF-out (for recent codecs) */
10071 for (i = 0; i < spec->autocfg.dig_outs; i++) {
10073 err = snd_hda_get_connections(codec,
10074 spec->autocfg.dig_out_pins[i],
10079 spec->multiout.dig_out_nid = dig_nid;
10081 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
10082 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
10084 spec->slave_dig_outs[i - 1] = dig_nid;
10087 if (spec->autocfg.dig_in_pin)
10088 spec->dig_in_nid = ALC880_DIGIN_NID;
10090 if (spec->kctls.list)
10091 add_mixer(spec, spec->kctls.list);
10093 add_verb(spec, alc883_auto_init_verbs);
10094 /* if ADC 0x07 is available, initialize it, too */
10095 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
10096 add_verb(spec, alc882_adc1_init_verbs);
10098 spec->num_mux_defs = 1;
10099 spec->input_mux = &spec->private_imux[0];
10101 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
10103 err = alc_auto_add_mic_boost(codec);
10107 return 1; /* config found */
10110 /* additional initialization for auto-configuration model */
10111 static void alc882_auto_init(struct hda_codec *codec)
10113 struct alc_spec *spec = codec->spec;
10114 alc882_auto_init_multi_out(codec);
10115 alc882_auto_init_hp_out(codec);
10116 alc882_auto_init_analog_input(codec);
10117 alc882_auto_init_input_src(codec);
10118 if (spec->unsol_event)
10119 alc_inithook(codec);
10122 static int patch_alc882(struct hda_codec *codec)
10124 struct alc_spec *spec;
10125 int err, board_config;
10127 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10131 codec->spec = spec;
10133 switch (codec->vendor_id) {
10138 /* ALC883 and variants */
10139 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10143 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
10147 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
10148 board_config = snd_hda_check_board_codec_sid_config(codec,
10149 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
10151 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
10152 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
10154 board_config = ALC882_AUTO;
10157 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups);
10159 if (board_config == ALC882_AUTO) {
10160 /* automatic parse from the BIOS config */
10161 err = alc882_parse_auto_config(codec);
10167 "hda_codec: Cannot set up configuration "
10168 "from BIOS. Using base mode...\n");
10169 board_config = ALC882_3ST_DIG;
10173 err = snd_hda_attach_beep_device(codec, 0x1);
10179 if (board_config != ALC882_AUTO)
10180 setup_preset(codec, &alc882_presets[board_config]);
10182 spec->stream_analog_playback = &alc882_pcm_analog_playback;
10183 spec->stream_analog_capture = &alc882_pcm_analog_capture;
10184 /* FIXME: setup DAC5 */
10185 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
10186 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
10188 spec->stream_digital_playback = &alc882_pcm_digital_playback;
10189 spec->stream_digital_capture = &alc882_pcm_digital_capture;
10191 if (codec->vendor_id == 0x10ec0888)
10192 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
10194 if (!spec->adc_nids && spec->input_mux) {
10196 spec->num_adc_nids = 0;
10197 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
10198 const struct hda_input_mux *imux = spec->input_mux;
10200 hda_nid_t items[16];
10201 hda_nid_t nid = alc882_adc_nids[i];
10202 unsigned int wcap = get_wcaps(codec, nid);
10204 wcap = get_wcaps_type(wcap);
10205 if (wcap != AC_WID_AUD_IN)
10207 spec->private_adc_nids[spec->num_adc_nids] = nid;
10208 err = snd_hda_get_connections(codec, nid, &cap, 1);
10211 err = snd_hda_get_connections(codec, cap, items,
10212 ARRAY_SIZE(items));
10215 for (j = 0; j < imux->num_items; j++)
10216 if (imux->items[j].index >= err)
10218 if (j < imux->num_items)
10220 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
10221 spec->num_adc_nids++;
10223 spec->adc_nids = spec->private_adc_nids;
10224 spec->capsrc_nids = spec->private_capsrc_nids;
10227 set_capture_mixer(codec);
10228 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10230 spec->vmaster_nid = 0x0c;
10232 codec->patch_ops = alc_patch_ops;
10233 if (board_config == ALC882_AUTO)
10234 spec->init_hook = alc882_auto_init;
10235 #ifdef CONFIG_SND_HDA_POWER_SAVE
10236 if (!spec->loopback.amplist)
10237 spec->loopback.amplist = alc882_loopbacks;
10248 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
10249 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
10251 #define alc262_dac_nids alc260_dac_nids
10252 #define alc262_adc_nids alc882_adc_nids
10253 #define alc262_adc_nids_alt alc882_adc_nids_alt
10254 #define alc262_capsrc_nids alc882_capsrc_nids
10255 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
10257 #define alc262_modes alc260_modes
10258 #define alc262_capture_source alc882_capture_source
10260 static hda_nid_t alc262_dmic_adc_nids[1] = {
10265 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
10267 static struct snd_kcontrol_new alc262_base_mixer[] = {
10268 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10269 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10270 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10271 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10272 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10273 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10274 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10275 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10276 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10277 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10278 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10279 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10280 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
10281 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10282 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
10283 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
10287 /* update HP, line and mono-out pins according to the master switch */
10288 static void alc262_hp_master_update(struct hda_codec *codec)
10290 struct alc_spec *spec = codec->spec;
10291 int val = spec->master_sw;
10293 /* HP & line-out */
10294 snd_hda_codec_write_cache(codec, 0x1b, 0,
10295 AC_VERB_SET_PIN_WIDGET_CONTROL,
10297 snd_hda_codec_write_cache(codec, 0x15, 0,
10298 AC_VERB_SET_PIN_WIDGET_CONTROL,
10300 /* mono (speaker) depending on the HP jack sense */
10301 val = val && !spec->jack_present;
10302 snd_hda_codec_write_cache(codec, 0x16, 0,
10303 AC_VERB_SET_PIN_WIDGET_CONTROL,
10304 val ? PIN_OUT : 0);
10307 static void alc262_hp_bpc_automute(struct hda_codec *codec)
10309 struct alc_spec *spec = codec->spec;
10311 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
10312 alc262_hp_master_update(codec);
10315 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
10317 if ((res >> 26) != ALC880_HP_EVENT)
10319 alc262_hp_bpc_automute(codec);
10322 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
10324 struct alc_spec *spec = codec->spec;
10326 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
10327 alc262_hp_master_update(codec);
10330 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
10333 if ((res >> 26) != ALC880_HP_EVENT)
10335 alc262_hp_wildwest_automute(codec);
10338 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
10340 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
10341 struct snd_ctl_elem_value *ucontrol)
10343 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10344 struct alc_spec *spec = codec->spec;
10345 int val = !!*ucontrol->value.integer.value;
10347 if (val == spec->master_sw)
10349 spec->master_sw = val;
10350 alc262_hp_master_update(codec);
10354 #define ALC262_HP_MASTER_SWITCH \
10356 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10357 .name = "Master Playback Switch", \
10358 .info = snd_ctl_boolean_mono_info, \
10359 .get = alc262_hp_master_sw_get, \
10360 .put = alc262_hp_master_sw_put, \
10363 .iface = NID_MAPPING, \
10364 .name = "Master Playback Switch", \
10365 .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \
10369 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
10370 ALC262_HP_MASTER_SWITCH,
10371 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10372 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10373 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10374 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10376 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10378 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10379 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10380 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10381 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10382 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10383 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10384 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10385 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10386 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10387 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10388 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
10389 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
10393 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
10394 ALC262_HP_MASTER_SWITCH,
10395 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10396 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10397 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10398 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10399 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10401 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10403 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
10404 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
10405 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
10406 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10407 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10408 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10409 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10413 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
10414 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10415 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10416 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
10420 /* mute/unmute internal speaker according to the hp jack and mute state */
10421 static void alc262_hp_t5735_setup(struct hda_codec *codec)
10423 struct alc_spec *spec = codec->spec;
10425 spec->autocfg.hp_pins[0] = 0x15;
10426 spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */
10429 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
10430 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10431 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10432 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10433 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
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),
10440 static struct hda_verb alc262_hp_t5735_verbs[] = {
10441 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10442 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10444 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10448 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
10449 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10450 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10451 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
10452 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
10453 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10454 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10458 static struct hda_verb alc262_hp_rp5700_verbs[] = {
10459 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10460 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10461 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10462 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10463 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10464 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10465 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10466 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10467 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10468 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10472 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
10479 /* bind hp and internal speaker mute (with plug check) as master switch */
10480 static void alc262_hippo_master_update(struct hda_codec *codec)
10482 struct alc_spec *spec = codec->spec;
10483 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10484 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10485 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10489 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
10490 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
10491 HDA_AMP_MUTE, mute);
10492 /* mute internal speaker per jack sense */
10493 if (spec->jack_present)
10494 mute = HDA_AMP_MUTE;
10496 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
10497 HDA_AMP_MUTE, mute);
10498 if (speaker_nid && speaker_nid != line_nid)
10499 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
10500 HDA_AMP_MUTE, mute);
10503 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
10505 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
10506 struct snd_ctl_elem_value *ucontrol)
10508 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10509 struct alc_spec *spec = codec->spec;
10510 int val = !!*ucontrol->value.integer.value;
10512 if (val == spec->master_sw)
10514 spec->master_sw = val;
10515 alc262_hippo_master_update(codec);
10519 #define ALC262_HIPPO_MASTER_SWITCH \
10521 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10522 .name = "Master Playback Switch", \
10523 .info = snd_ctl_boolean_mono_info, \
10524 .get = alc262_hippo_master_sw_get, \
10525 .put = alc262_hippo_master_sw_put, \
10528 .iface = NID_MAPPING, \
10529 .name = "Master Playback Switch", \
10530 .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \
10531 (SUBDEV_SPEAKER(0) << 16), \
10534 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
10535 ALC262_HIPPO_MASTER_SWITCH,
10536 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10537 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10538 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10539 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10540 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10541 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10542 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10543 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10544 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10545 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10546 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10547 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10551 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
10552 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10553 ALC262_HIPPO_MASTER_SWITCH,
10554 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10555 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10556 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10557 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10558 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10559 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10560 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10561 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10562 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10563 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10567 /* mute/unmute internal speaker according to the hp jack and mute state */
10568 static void alc262_hippo_automute(struct hda_codec *codec)
10570 struct alc_spec *spec = codec->spec;
10571 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10573 spec->jack_present = snd_hda_jack_detect(codec, hp_nid);
10574 alc262_hippo_master_update(codec);
10577 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
10579 if ((res >> 26) != ALC880_HP_EVENT)
10581 alc262_hippo_automute(codec);
10584 static void alc262_hippo_setup(struct hda_codec *codec)
10586 struct alc_spec *spec = codec->spec;
10588 spec->autocfg.hp_pins[0] = 0x15;
10589 spec->autocfg.speaker_pins[0] = 0x14;
10592 static void alc262_hippo1_setup(struct hda_codec *codec)
10594 struct alc_spec *spec = codec->spec;
10596 spec->autocfg.hp_pins[0] = 0x1b;
10597 spec->autocfg.speaker_pins[0] = 0x14;
10601 static struct snd_kcontrol_new alc262_sony_mixer[] = {
10602 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10603 ALC262_HIPPO_MASTER_SWITCH,
10604 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10605 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10606 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10607 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10611 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
10612 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10613 ALC262_HIPPO_MASTER_SWITCH,
10614 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10615 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10616 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10617 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10618 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10622 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
10623 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10624 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10625 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
10626 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
10627 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10628 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10629 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10630 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10631 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10632 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10633 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10634 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10638 static struct hda_verb alc262_tyan_verbs[] = {
10639 /* Headphone automute */
10640 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10641 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10642 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10644 /* P11 AUX_IN, white 4-pin connector */
10645 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10646 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
10647 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
10648 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
10653 /* unsolicited event for HP jack sensing */
10654 static void alc262_tyan_setup(struct hda_codec *codec)
10656 struct alc_spec *spec = codec->spec;
10658 spec->autocfg.hp_pins[0] = 0x1b;
10659 spec->autocfg.speaker_pins[0] = 0x15;
10663 #define alc262_capture_mixer alc882_capture_mixer
10664 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
10667 * generic initialization of ADC, input mixers and output mixers
10669 static struct hda_verb alc262_init_verbs[] = {
10671 * Unmute ADC0-2 and set the default input to mic-in
10673 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10674 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10675 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10676 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10677 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10678 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10680 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10682 * Note: PASD motherboards uses the Line In 2 as the input for
10683 * front panel mic (mic 2)
10685 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10686 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10687 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10688 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10689 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10690 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10693 * Set up output mixers (0x0c - 0x0e)
10695 /* set vol=0 to output mixers */
10696 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10697 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10698 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10699 /* set up input amps for analog loopback */
10700 /* Amp Indices: DAC = 0, mixer = 1 */
10701 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10702 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10703 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10704 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10705 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10706 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10708 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10709 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10710 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10711 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10712 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10713 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10715 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10716 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10717 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10718 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10719 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10721 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10722 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10724 /* FIXME: use matrix-type input source selection */
10725 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10726 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10727 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10728 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10729 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10730 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10732 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10733 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10734 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10735 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10737 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10738 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10739 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10740 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10745 static struct hda_verb alc262_eapd_verbs[] = {
10746 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10747 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10751 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
10752 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10753 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10754 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10756 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10757 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10761 static struct hda_verb alc262_sony_unsol_verbs[] = {
10762 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10763 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10764 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
10766 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10767 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10771 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
10772 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10773 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10774 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10775 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10776 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10780 static struct hda_verb alc262_toshiba_s06_verbs[] = {
10781 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10782 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10783 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10784 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10785 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
10786 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10787 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10788 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10792 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
10794 struct alc_spec *spec = codec->spec;
10796 spec->autocfg.hp_pins[0] = 0x15;
10797 spec->autocfg.speaker_pins[0] = 0x14;
10798 spec->ext_mic.pin = 0x18;
10799 spec->ext_mic.mux_idx = 0;
10800 spec->int_mic.pin = 0x12;
10801 spec->int_mic.mux_idx = 9;
10802 spec->auto_mic = 1;
10808 * 0x16 = internal speaker
10809 * 0x18 = external mic
10812 static struct snd_kcontrol_new alc262_nec_mixer[] = {
10813 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
10814 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
10816 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10817 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10818 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10820 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10821 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10825 static struct hda_verb alc262_nec_verbs[] = {
10826 /* Unmute Speaker */
10827 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10830 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10831 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10833 /* External mic to headphone */
10834 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10835 /* External mic to speaker */
10836 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10842 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
10843 * 0x1b = port replicator headphone out
10846 #define ALC_HP_EVENT 0x37
10848 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
10849 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10850 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10851 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10852 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10856 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
10857 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10858 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10862 static struct hda_verb alc262_lenovo_3000_init_verbs[] = {
10863 /* Front Mic pin: input vref at 50% */
10864 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
10865 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10869 static struct hda_input_mux alc262_fujitsu_capture_source = {
10873 { "Int Mic", 0x1 },
10878 static struct hda_input_mux alc262_HP_capture_source = {
10882 { "Front Mic", 0x1 },
10889 static struct hda_input_mux alc262_HP_D7000_capture_source = {
10893 { "Front Mic", 0x2 },
10899 /* mute/unmute internal speaker according to the hp jacks and mute state */
10900 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
10902 struct alc_spec *spec = codec->spec;
10905 if (force || !spec->sense_updated) {
10906 spec->jack_present = snd_hda_jack_detect(codec, 0x14) ||
10907 snd_hda_jack_detect(codec, 0x1b);
10908 spec->sense_updated = 1;
10910 /* unmute internal speaker only if both HPs are unplugged and
10911 * master switch is on
10913 if (spec->jack_present)
10914 mute = HDA_AMP_MUTE;
10916 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10917 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10918 HDA_AMP_MUTE, mute);
10921 /* unsolicited event for HP jack sensing */
10922 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
10925 if ((res >> 26) != ALC_HP_EVENT)
10927 alc262_fujitsu_automute(codec, 1);
10930 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
10932 alc262_fujitsu_automute(codec, 1);
10935 /* bind volumes of both NID 0x0c and 0x0d */
10936 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
10937 .ops = &snd_hda_bind_vol,
10939 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
10940 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
10945 /* mute/unmute internal speaker according to the hp jack and mute state */
10946 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
10948 struct alc_spec *spec = codec->spec;
10951 if (force || !spec->sense_updated) {
10952 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
10953 spec->sense_updated = 1;
10955 if (spec->jack_present) {
10956 /* mute internal speaker */
10957 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10958 HDA_AMP_MUTE, HDA_AMP_MUTE);
10959 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10960 HDA_AMP_MUTE, HDA_AMP_MUTE);
10962 /* unmute internal speaker if necessary */
10963 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10964 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10965 HDA_AMP_MUTE, mute);
10966 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10967 HDA_AMP_MUTE, mute);
10971 /* unsolicited event for HP jack sensing */
10972 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
10975 if ((res >> 26) != ALC_HP_EVENT)
10977 alc262_lenovo_3000_automute(codec, 1);
10980 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
10981 int dir, int idx, long *valp)
10985 for (i = 0; i < 2; i++, valp++)
10986 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
10988 *valp ? 0 : HDA_AMP_MUTE);
10992 /* bind hp and internal speaker mute (with plug check) */
10993 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
10994 struct snd_ctl_elem_value *ucontrol)
10996 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10997 long *valp = ucontrol->value.integer.value;
11000 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
11001 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11003 alc262_fujitsu_automute(codec, 0);
11007 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
11008 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11010 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11011 .name = "Master Playback Switch",
11012 .subdevice = HDA_SUBDEV_AMP_FLAG,
11013 .info = snd_hda_mixer_amp_switch_info,
11014 .get = snd_hda_mixer_amp_switch_get,
11015 .put = alc262_fujitsu_master_sw_put,
11016 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11019 .iface = NID_MAPPING,
11020 .name = "Master Playback Switch",
11021 .private_value = 0x1b,
11023 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11024 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11025 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11026 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11027 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11028 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11029 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11030 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11034 /* bind hp and internal speaker mute (with plug check) */
11035 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
11036 struct snd_ctl_elem_value *ucontrol)
11038 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11039 long *valp = ucontrol->value.integer.value;
11042 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11044 alc262_lenovo_3000_automute(codec, 0);
11048 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
11049 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11051 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11052 .name = "Master Playback Switch",
11053 .subdevice = HDA_SUBDEV_AMP_FLAG,
11054 .info = snd_hda_mixer_amp_switch_info,
11055 .get = snd_hda_mixer_amp_switch_get,
11056 .put = alc262_lenovo_3000_master_sw_put,
11057 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
11059 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11060 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11061 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11062 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11063 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11064 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11065 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11066 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11070 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
11071 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11072 ALC262_HIPPO_MASTER_SWITCH,
11073 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11074 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11075 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11076 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11077 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11078 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11082 /* additional init verbs for Benq laptops */
11083 static struct hda_verb alc262_EAPD_verbs[] = {
11084 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11085 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
11089 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
11090 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11091 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11093 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11094 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
11098 /* Samsung Q1 Ultra Vista model setup */
11099 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
11100 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11101 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11102 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11103 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11104 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
11105 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
11109 static struct hda_verb alc262_ultra_verbs[] = {
11111 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11112 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11113 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11115 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11116 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11117 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11118 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11120 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11121 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11122 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11123 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11124 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11126 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11127 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11128 /* ADC, choose mic */
11129 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11130 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11131 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11132 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11133 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11134 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11135 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11136 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11137 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11138 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
11142 /* mute/unmute internal speaker according to the hp jack and mute state */
11143 static void alc262_ultra_automute(struct hda_codec *codec)
11145 struct alc_spec *spec = codec->spec;
11149 /* auto-mute only when HP is used as HP */
11150 if (!spec->cur_mux[0]) {
11151 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11152 if (spec->jack_present)
11153 mute = HDA_AMP_MUTE;
11155 /* mute/unmute internal speaker */
11156 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11157 HDA_AMP_MUTE, mute);
11158 /* mute/unmute HP */
11159 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11160 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
11163 /* unsolicited event for HP jack sensing */
11164 static void alc262_ultra_unsol_event(struct hda_codec *codec,
11167 if ((res >> 26) != ALC880_HP_EVENT)
11169 alc262_ultra_automute(codec);
11172 static struct hda_input_mux alc262_ultra_capture_source = {
11176 { "Headphone", 0x7 },
11180 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
11181 struct snd_ctl_elem_value *ucontrol)
11183 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11184 struct alc_spec *spec = codec->spec;
11187 ret = alc_mux_enum_put(kcontrol, ucontrol);
11190 /* reprogram the HP pin as mic or HP according to the input source */
11191 snd_hda_codec_write_cache(codec, 0x15, 0,
11192 AC_VERB_SET_PIN_WIDGET_CONTROL,
11193 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
11194 alc262_ultra_automute(codec); /* mute/unmute HP */
11198 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
11199 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
11200 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
11202 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11203 .name = "Capture Source",
11204 .info = alc_mux_enum_info,
11205 .get = alc_mux_enum_get,
11206 .put = alc262_ultra_mux_enum_put,
11209 .iface = NID_MAPPING,
11210 .name = "Capture Source",
11211 .private_value = 0x15,
11216 /* We use two mixers depending on the output pin; 0x16 is a mono output
11217 * and thus it's bound with a different mixer.
11218 * This function returns which mixer amp should be used.
11220 static int alc262_check_volbit(hda_nid_t nid)
11224 else if (nid == 0x16)
11230 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
11231 const char *pfx, int *vbits)
11236 vbit = alc262_check_volbit(nid);
11239 if (*vbits & vbit) /* a volume control for this mixer already there */
11243 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
11245 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
11246 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, val);
11249 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
11257 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
11259 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
11260 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val);
11263 /* add playback controls from the parsed DAC table */
11264 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
11265 const struct auto_pin_cfg *cfg)
11271 spec->multiout.num_dacs = 1; /* only use one dac */
11272 spec->multiout.dac_nids = spec->private_dac_nids;
11273 spec->multiout.dac_nids[0] = 2;
11275 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
11277 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11281 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx);
11284 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker");
11287 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone");
11291 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
11292 alc262_check_volbit(cfg->speaker_pins[0]) |
11293 alc262_check_volbit(cfg->hp_pins[0]);
11294 if (vbits == 1 || vbits == 2)
11295 pfx = "Master"; /* only one mixer is used */
11296 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11301 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits);
11304 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker",
11308 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone",
11315 #define alc262_auto_create_input_ctls \
11316 alc882_auto_create_input_ctls
11319 * generic initialization of ADC, input mixers and output mixers
11321 static struct hda_verb alc262_volume_init_verbs[] = {
11323 * Unmute ADC0-2 and set the default input to mic-in
11325 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11326 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11327 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11328 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11329 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11330 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11332 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11334 * Note: PASD motherboards uses the Line In 2 as the input for
11335 * front panel mic (mic 2)
11337 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11338 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11339 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11340 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11341 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11342 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11345 * Set up output mixers (0x0c - 0x0f)
11347 /* set vol=0 to output mixers */
11348 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11349 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11350 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11352 /* set up input amps for analog loopback */
11353 /* Amp Indices: DAC = 0, mixer = 1 */
11354 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11355 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11356 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11357 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11358 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11359 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11361 /* FIXME: use matrix-type input source selection */
11362 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11363 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11364 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11365 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11366 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11367 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11369 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11370 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11371 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11372 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11374 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11375 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11376 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11377 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11382 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
11384 * Unmute ADC0-2 and set the default input to mic-in
11386 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11387 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11388 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11389 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11390 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11391 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11393 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11395 * Note: PASD motherboards uses the Line In 2 as the input for
11396 * front panel mic (mic 2)
11398 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11399 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11400 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11401 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11402 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11403 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11404 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11405 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11408 * Set up output mixers (0x0c - 0x0e)
11410 /* set vol=0 to output mixers */
11411 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11412 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11413 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11415 /* set up input amps for analog loopback */
11416 /* Amp Indices: DAC = 0, mixer = 1 */
11417 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11418 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11419 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11420 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11421 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11422 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11424 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11425 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11426 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11428 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11429 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11431 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11432 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11434 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11435 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11436 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11437 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11438 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11440 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11441 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11442 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11443 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11444 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11445 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11448 /* FIXME: use matrix-type input source selection */
11449 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
11450 /* Input mixer1: only unmute Mic */
11451 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11452 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11453 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11454 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11455 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11456 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11457 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11458 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11459 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11461 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11462 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11463 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11464 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11465 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11466 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11467 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11468 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11469 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11471 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11472 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11473 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11474 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11475 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11476 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11477 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11478 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11479 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11481 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11486 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
11488 * Unmute ADC0-2 and set the default input to mic-in
11490 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11491 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11492 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11493 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11494 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11495 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11497 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11499 * Note: PASD motherboards uses the Line In 2 as the input for front
11500 * panel mic (mic 2)
11502 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11503 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11504 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11505 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11506 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11507 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11508 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11509 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11510 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11512 * Set up output mixers (0x0c - 0x0e)
11514 /* set vol=0 to output mixers */
11515 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11516 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11517 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11519 /* set up input amps for analog loopback */
11520 /* Amp Indices: DAC = 0, mixer = 1 */
11521 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11522 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11523 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11524 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11525 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11526 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11529 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
11530 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
11531 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
11532 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
11533 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11534 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
11535 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
11537 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11538 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11540 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11541 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11543 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
11544 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11545 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11546 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
11547 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11548 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11550 /* FIXME: use matrix-type input source selection */
11551 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11552 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11553 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
11554 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
11555 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
11556 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
11557 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
11558 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11559 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
11561 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11562 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11563 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11564 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11565 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11566 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11567 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11569 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11570 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11571 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11572 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11573 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11574 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11575 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11577 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11582 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
11584 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
11585 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11586 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
11588 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
11589 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11590 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11591 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11593 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
11594 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11595 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11600 #ifdef CONFIG_SND_HDA_POWER_SAVE
11601 #define alc262_loopbacks alc880_loopbacks
11604 /* pcm configuration: identical with ALC880 */
11605 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
11606 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
11607 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
11608 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
11611 * BIOS auto configuration
11613 static int alc262_parse_auto_config(struct hda_codec *codec)
11615 struct alc_spec *spec = codec->spec;
11617 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
11619 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11623 if (!spec->autocfg.line_outs) {
11624 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11625 spec->multiout.max_channels = 2;
11626 spec->no_analog = 1;
11629 return 0; /* can't find valid BIOS pin config */
11631 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
11634 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
11638 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11641 if (spec->autocfg.dig_outs) {
11642 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
11643 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11645 if (spec->autocfg.dig_in_pin)
11646 spec->dig_in_nid = ALC262_DIGIN_NID;
11648 if (spec->kctls.list)
11649 add_mixer(spec, spec->kctls.list);
11651 add_verb(spec, alc262_volume_init_verbs);
11652 spec->num_mux_defs = 1;
11653 spec->input_mux = &spec->private_imux[0];
11655 err = alc_auto_add_mic_boost(codec);
11659 alc_ssid_check(codec, 0x15, 0x14, 0x1b);
11664 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
11665 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
11666 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
11667 #define alc262_auto_init_input_src alc882_auto_init_input_src
11670 /* init callback for auto-configuration model -- overriding the default init */
11671 static void alc262_auto_init(struct hda_codec *codec)
11673 struct alc_spec *spec = codec->spec;
11674 alc262_auto_init_multi_out(codec);
11675 alc262_auto_init_hp_out(codec);
11676 alc262_auto_init_analog_input(codec);
11677 alc262_auto_init_input_src(codec);
11678 if (spec->unsol_event)
11679 alc_inithook(codec);
11683 * configuration and preset
11685 static const char *alc262_models[ALC262_MODEL_LAST] = {
11686 [ALC262_BASIC] = "basic",
11687 [ALC262_HIPPO] = "hippo",
11688 [ALC262_HIPPO_1] = "hippo_1",
11689 [ALC262_FUJITSU] = "fujitsu",
11690 [ALC262_HP_BPC] = "hp-bpc",
11691 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
11692 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
11693 [ALC262_HP_RP5700] = "hp-rp5700",
11694 [ALC262_BENQ_ED8] = "benq",
11695 [ALC262_BENQ_T31] = "benq-t31",
11696 [ALC262_SONY_ASSAMD] = "sony-assamd",
11697 [ALC262_TOSHIBA_S06] = "toshiba-s06",
11698 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
11699 [ALC262_ULTRA] = "ultra",
11700 [ALC262_LENOVO_3000] = "lenovo-3000",
11701 [ALC262_NEC] = "nec",
11702 [ALC262_TYAN] = "tyan",
11703 [ALC262_AUTO] = "auto",
11706 static struct snd_pci_quirk alc262_cfg_tbl[] = {
11707 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
11708 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
11709 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
11711 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
11713 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
11715 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
11716 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
11717 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
11718 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
11719 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
11720 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
11721 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
11722 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
11723 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
11724 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
11725 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
11726 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
11727 ALC262_HP_TC_T5735),
11728 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
11729 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11730 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
11731 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11732 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
11733 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
11734 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
11735 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
11736 #if 0 /* disable the quirk since model=auto works better in recent versions */
11737 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
11738 ALC262_SONY_ASSAMD),
11740 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
11741 ALC262_TOSHIBA_RX1),
11742 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
11743 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
11744 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
11745 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
11746 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
11748 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
11749 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
11750 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
11751 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
11752 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
11756 static struct alc_config_preset alc262_presets[] = {
11758 .mixers = { alc262_base_mixer },
11759 .init_verbs = { alc262_init_verbs },
11760 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11761 .dac_nids = alc262_dac_nids,
11763 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11764 .channel_mode = alc262_modes,
11765 .input_mux = &alc262_capture_source,
11768 .mixers = { alc262_hippo_mixer },
11769 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
11770 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11771 .dac_nids = alc262_dac_nids,
11773 .dig_out_nid = ALC262_DIGOUT_NID,
11774 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11775 .channel_mode = alc262_modes,
11776 .input_mux = &alc262_capture_source,
11777 .unsol_event = alc262_hippo_unsol_event,
11778 .setup = alc262_hippo_setup,
11779 .init_hook = alc262_hippo_automute,
11781 [ALC262_HIPPO_1] = {
11782 .mixers = { alc262_hippo1_mixer },
11783 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
11784 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11785 .dac_nids = alc262_dac_nids,
11787 .dig_out_nid = ALC262_DIGOUT_NID,
11788 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11789 .channel_mode = alc262_modes,
11790 .input_mux = &alc262_capture_source,
11791 .unsol_event = alc262_hippo_unsol_event,
11792 .setup = alc262_hippo1_setup,
11793 .init_hook = alc262_hippo_automute,
11795 [ALC262_FUJITSU] = {
11796 .mixers = { alc262_fujitsu_mixer },
11797 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11798 alc262_fujitsu_unsol_verbs },
11799 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11800 .dac_nids = alc262_dac_nids,
11802 .dig_out_nid = ALC262_DIGOUT_NID,
11803 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11804 .channel_mode = alc262_modes,
11805 .input_mux = &alc262_fujitsu_capture_source,
11806 .unsol_event = alc262_fujitsu_unsol_event,
11807 .init_hook = alc262_fujitsu_init_hook,
11809 [ALC262_HP_BPC] = {
11810 .mixers = { alc262_HP_BPC_mixer },
11811 .init_verbs = { alc262_HP_BPC_init_verbs },
11812 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11813 .dac_nids = alc262_dac_nids,
11815 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11816 .channel_mode = alc262_modes,
11817 .input_mux = &alc262_HP_capture_source,
11818 .unsol_event = alc262_hp_bpc_unsol_event,
11819 .init_hook = alc262_hp_bpc_automute,
11821 [ALC262_HP_BPC_D7000_WF] = {
11822 .mixers = { alc262_HP_BPC_WildWest_mixer },
11823 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11824 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11825 .dac_nids = alc262_dac_nids,
11827 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11828 .channel_mode = alc262_modes,
11829 .input_mux = &alc262_HP_D7000_capture_source,
11830 .unsol_event = alc262_hp_wildwest_unsol_event,
11831 .init_hook = alc262_hp_wildwest_automute,
11833 [ALC262_HP_BPC_D7000_WL] = {
11834 .mixers = { alc262_HP_BPC_WildWest_mixer,
11835 alc262_HP_BPC_WildWest_option_mixer },
11836 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11837 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11838 .dac_nids = alc262_dac_nids,
11840 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11841 .channel_mode = alc262_modes,
11842 .input_mux = &alc262_HP_D7000_capture_source,
11843 .unsol_event = alc262_hp_wildwest_unsol_event,
11844 .init_hook = alc262_hp_wildwest_automute,
11846 [ALC262_HP_TC_T5735] = {
11847 .mixers = { alc262_hp_t5735_mixer },
11848 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
11849 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11850 .dac_nids = alc262_dac_nids,
11852 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11853 .channel_mode = alc262_modes,
11854 .input_mux = &alc262_capture_source,
11855 .unsol_event = alc_automute_amp_unsol_event,
11856 .setup = alc262_hp_t5735_setup,
11857 .init_hook = alc_automute_amp,
11859 [ALC262_HP_RP5700] = {
11860 .mixers = { alc262_hp_rp5700_mixer },
11861 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
11862 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11863 .dac_nids = alc262_dac_nids,
11864 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11865 .channel_mode = alc262_modes,
11866 .input_mux = &alc262_hp_rp5700_capture_source,
11868 [ALC262_BENQ_ED8] = {
11869 .mixers = { alc262_base_mixer },
11870 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
11871 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11872 .dac_nids = alc262_dac_nids,
11874 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11875 .channel_mode = alc262_modes,
11876 .input_mux = &alc262_capture_source,
11878 [ALC262_SONY_ASSAMD] = {
11879 .mixers = { alc262_sony_mixer },
11880 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
11881 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11882 .dac_nids = alc262_dac_nids,
11884 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11885 .channel_mode = alc262_modes,
11886 .input_mux = &alc262_capture_source,
11887 .unsol_event = alc262_hippo_unsol_event,
11888 .setup = alc262_hippo_setup,
11889 .init_hook = alc262_hippo_automute,
11891 [ALC262_BENQ_T31] = {
11892 .mixers = { alc262_benq_t31_mixer },
11893 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
11894 alc_hp15_unsol_verbs },
11895 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11896 .dac_nids = alc262_dac_nids,
11898 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11899 .channel_mode = alc262_modes,
11900 .input_mux = &alc262_capture_source,
11901 .unsol_event = alc262_hippo_unsol_event,
11902 .setup = alc262_hippo_setup,
11903 .init_hook = alc262_hippo_automute,
11906 .mixers = { alc262_ultra_mixer },
11907 .cap_mixer = alc262_ultra_capture_mixer,
11908 .init_verbs = { alc262_ultra_verbs },
11909 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11910 .dac_nids = alc262_dac_nids,
11911 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11912 .channel_mode = alc262_modes,
11913 .input_mux = &alc262_ultra_capture_source,
11914 .adc_nids = alc262_adc_nids, /* ADC0 */
11915 .capsrc_nids = alc262_capsrc_nids,
11916 .num_adc_nids = 1, /* single ADC */
11917 .unsol_event = alc262_ultra_unsol_event,
11918 .init_hook = alc262_ultra_automute,
11920 [ALC262_LENOVO_3000] = {
11921 .mixers = { alc262_lenovo_3000_mixer },
11922 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11923 alc262_lenovo_3000_unsol_verbs,
11924 alc262_lenovo_3000_init_verbs },
11925 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11926 .dac_nids = alc262_dac_nids,
11928 .dig_out_nid = ALC262_DIGOUT_NID,
11929 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11930 .channel_mode = alc262_modes,
11931 .input_mux = &alc262_fujitsu_capture_source,
11932 .unsol_event = alc262_lenovo_3000_unsol_event,
11935 .mixers = { alc262_nec_mixer },
11936 .init_verbs = { alc262_nec_verbs },
11937 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11938 .dac_nids = alc262_dac_nids,
11940 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11941 .channel_mode = alc262_modes,
11942 .input_mux = &alc262_capture_source,
11944 [ALC262_TOSHIBA_S06] = {
11945 .mixers = { alc262_toshiba_s06_mixer },
11946 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
11947 alc262_eapd_verbs },
11948 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11949 .capsrc_nids = alc262_dmic_capsrc_nids,
11950 .dac_nids = alc262_dac_nids,
11951 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
11952 .num_adc_nids = 1, /* single ADC */
11953 .dig_out_nid = ALC262_DIGOUT_NID,
11954 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11955 .channel_mode = alc262_modes,
11956 .unsol_event = alc_sku_unsol_event,
11957 .setup = alc262_toshiba_s06_setup,
11958 .init_hook = alc_inithook,
11960 [ALC262_TOSHIBA_RX1] = {
11961 .mixers = { alc262_toshiba_rx1_mixer },
11962 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
11963 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11964 .dac_nids = alc262_dac_nids,
11966 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11967 .channel_mode = alc262_modes,
11968 .input_mux = &alc262_capture_source,
11969 .unsol_event = alc262_hippo_unsol_event,
11970 .setup = alc262_hippo_setup,
11971 .init_hook = alc262_hippo_automute,
11974 .mixers = { alc262_tyan_mixer },
11975 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
11976 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11977 .dac_nids = alc262_dac_nids,
11979 .dig_out_nid = ALC262_DIGOUT_NID,
11980 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11981 .channel_mode = alc262_modes,
11982 .input_mux = &alc262_capture_source,
11983 .unsol_event = alc_automute_amp_unsol_event,
11984 .setup = alc262_tyan_setup,
11985 .init_hook = alc_automute_amp,
11989 static int patch_alc262(struct hda_codec *codec)
11991 struct alc_spec *spec;
11995 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11999 codec->spec = spec;
12001 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
12006 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12007 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
12008 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12009 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
12013 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
12015 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
12019 if (board_config < 0) {
12020 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12022 board_config = ALC262_AUTO;
12025 if (board_config == ALC262_AUTO) {
12026 /* automatic parse from the BIOS config */
12027 err = alc262_parse_auto_config(codec);
12033 "hda_codec: Cannot set up configuration "
12034 "from BIOS. Using base mode...\n");
12035 board_config = ALC262_BASIC;
12039 if (!spec->no_analog) {
12040 err = snd_hda_attach_beep_device(codec, 0x1);
12047 if (board_config != ALC262_AUTO)
12048 setup_preset(codec, &alc262_presets[board_config]);
12050 spec->stream_analog_playback = &alc262_pcm_analog_playback;
12051 spec->stream_analog_capture = &alc262_pcm_analog_capture;
12053 spec->stream_digital_playback = &alc262_pcm_digital_playback;
12054 spec->stream_digital_capture = &alc262_pcm_digital_capture;
12056 if (!spec->adc_nids && spec->input_mux) {
12058 /* check whether the digital-mic has to be supported */
12059 for (i = 0; i < spec->input_mux->num_items; i++) {
12060 if (spec->input_mux->items[i].index >= 9)
12063 if (i < spec->input_mux->num_items) {
12064 /* use only ADC0 */
12065 spec->adc_nids = alc262_dmic_adc_nids;
12066 spec->num_adc_nids = 1;
12067 spec->capsrc_nids = alc262_dmic_capsrc_nids;
12069 /* all analog inputs */
12070 /* check whether NID 0x07 is valid */
12071 unsigned int wcap = get_wcaps(codec, 0x07);
12074 wcap = get_wcaps_type(wcap);
12075 if (wcap != AC_WID_AUD_IN) {
12076 spec->adc_nids = alc262_adc_nids_alt;
12077 spec->num_adc_nids =
12078 ARRAY_SIZE(alc262_adc_nids_alt);
12079 spec->capsrc_nids = alc262_capsrc_nids_alt;
12081 spec->adc_nids = alc262_adc_nids;
12082 spec->num_adc_nids =
12083 ARRAY_SIZE(alc262_adc_nids);
12084 spec->capsrc_nids = alc262_capsrc_nids;
12088 if (!spec->cap_mixer && !spec->no_analog)
12089 set_capture_mixer(codec);
12090 if (!spec->no_analog)
12091 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12093 spec->vmaster_nid = 0x0c;
12095 codec->patch_ops = alc_patch_ops;
12096 if (board_config == ALC262_AUTO)
12097 spec->init_hook = alc262_auto_init;
12098 #ifdef CONFIG_SND_HDA_POWER_SAVE
12099 if (!spec->loopback.amplist)
12100 spec->loopback.amplist = alc262_loopbacks;
12107 * ALC268 channel source setting (2 channel)
12109 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
12110 #define alc268_modes alc260_modes
12112 static hda_nid_t alc268_dac_nids[2] = {
12117 static hda_nid_t alc268_adc_nids[2] = {
12122 static hda_nid_t alc268_adc_nids_alt[1] = {
12127 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
12129 static struct snd_kcontrol_new alc268_base_mixer[] = {
12130 /* output mixer control */
12131 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12132 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12133 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12134 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12135 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12136 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12137 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12141 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
12142 /* output mixer control */
12143 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12144 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12145 ALC262_HIPPO_MASTER_SWITCH,
12146 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12147 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12148 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12152 /* bind Beep switches of both NID 0x0f and 0x10 */
12153 static struct hda_bind_ctls alc268_bind_beep_sw = {
12154 .ops = &snd_hda_bind_sw,
12156 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
12157 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
12162 static struct snd_kcontrol_new alc268_beep_mixer[] = {
12163 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
12164 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
12168 static struct hda_verb alc268_eapd_verbs[] = {
12169 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12170 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12174 /* Toshiba specific */
12175 static struct hda_verb alc268_toshiba_verbs[] = {
12176 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12180 /* Acer specific */
12181 /* bind volumes of both NID 0x02 and 0x03 */
12182 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
12183 .ops = &snd_hda_bind_vol,
12185 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12186 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12191 /* mute/unmute internal speaker according to the hp jack and mute state */
12192 static void alc268_acer_automute(struct hda_codec *codec, int force)
12194 struct alc_spec *spec = codec->spec;
12197 if (force || !spec->sense_updated) {
12198 spec->jack_present = snd_hda_jack_detect(codec, 0x14);
12199 spec->sense_updated = 1;
12201 if (spec->jack_present)
12202 mute = HDA_AMP_MUTE; /* mute internal speaker */
12203 else /* unmute internal speaker if necessary */
12204 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
12205 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12206 HDA_AMP_MUTE, mute);
12210 /* bind hp and internal speaker mute (with plug check) */
12211 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
12212 struct snd_ctl_elem_value *ucontrol)
12214 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12215 long *valp = ucontrol->value.integer.value;
12218 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
12220 alc268_acer_automute(codec, 0);
12224 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
12225 /* output mixer control */
12226 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12228 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12229 .name = "Master Playback Switch",
12230 .subdevice = HDA_SUBDEV_AMP_FLAG,
12231 .info = snd_hda_mixer_amp_switch_info,
12232 .get = snd_hda_mixer_amp_switch_get,
12233 .put = alc268_acer_master_sw_put,
12234 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12236 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
12240 static struct snd_kcontrol_new alc268_acer_mixer[] = {
12241 /* output mixer control */
12242 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12244 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12245 .name = "Master Playback Switch",
12246 .subdevice = HDA_SUBDEV_AMP_FLAG,
12247 .info = snd_hda_mixer_amp_switch_info,
12248 .get = snd_hda_mixer_amp_switch_get,
12249 .put = alc268_acer_master_sw_put,
12250 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12252 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12253 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12254 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12258 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
12259 /* output mixer control */
12260 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12262 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12263 .name = "Master Playback Switch",
12264 .subdevice = HDA_SUBDEV_AMP_FLAG,
12265 .info = snd_hda_mixer_amp_switch_info,
12266 .get = snd_hda_mixer_amp_switch_get,
12267 .put = alc268_acer_master_sw_put,
12268 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12270 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12271 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12275 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
12276 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12277 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12278 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12279 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12280 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
12281 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
12285 static struct hda_verb alc268_acer_verbs[] = {
12286 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
12287 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12288 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12289 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12290 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12291 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12292 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12296 /* unsolicited event for HP jack sensing */
12297 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
12298 #define alc268_toshiba_setup alc262_hippo_setup
12299 #define alc268_toshiba_automute alc262_hippo_automute
12301 static void alc268_acer_unsol_event(struct hda_codec *codec,
12304 if ((res >> 26) != ALC880_HP_EVENT)
12306 alc268_acer_automute(codec, 1);
12309 static void alc268_acer_init_hook(struct hda_codec *codec)
12311 alc268_acer_automute(codec, 1);
12314 /* toggle speaker-output according to the hp-jack state */
12315 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
12317 unsigned int present;
12318 unsigned char bits;
12320 present = snd_hda_jack_detect(codec, 0x15);
12321 bits = present ? AMP_IN_MUTE(0) : 0;
12322 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
12323 AMP_IN_MUTE(0), bits);
12324 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
12325 AMP_IN_MUTE(0), bits);
12328 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
12331 switch (res >> 26) {
12332 case ALC880_HP_EVENT:
12333 alc268_aspire_one_speaker_automute(codec);
12335 case ALC880_MIC_EVENT:
12336 alc_mic_automute(codec);
12341 static void alc268_acer_lc_setup(struct hda_codec *codec)
12343 struct alc_spec *spec = codec->spec;
12344 spec->ext_mic.pin = 0x18;
12345 spec->ext_mic.mux_idx = 0;
12346 spec->int_mic.pin = 0x12;
12347 spec->int_mic.mux_idx = 6;
12348 spec->auto_mic = 1;
12351 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
12353 alc268_aspire_one_speaker_automute(codec);
12354 alc_mic_automute(codec);
12357 static struct snd_kcontrol_new alc268_dell_mixer[] = {
12358 /* output mixer control */
12359 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12360 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12361 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12362 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12363 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12364 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12368 static struct hda_verb alc268_dell_verbs[] = {
12369 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12370 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12371 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12372 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12376 /* mute/unmute internal speaker according to the hp jack and mute state */
12377 static void alc268_dell_setup(struct hda_codec *codec)
12379 struct alc_spec *spec = codec->spec;
12381 spec->autocfg.hp_pins[0] = 0x15;
12382 spec->autocfg.speaker_pins[0] = 0x14;
12383 spec->ext_mic.pin = 0x18;
12384 spec->ext_mic.mux_idx = 0;
12385 spec->int_mic.pin = 0x19;
12386 spec->int_mic.mux_idx = 1;
12387 spec->auto_mic = 1;
12390 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
12391 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12392 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12393 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12394 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12395 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12396 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
12397 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
12398 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
12402 static struct hda_verb alc267_quanta_il1_verbs[] = {
12403 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12404 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12408 static void alc267_quanta_il1_setup(struct hda_codec *codec)
12410 struct alc_spec *spec = codec->spec;
12411 spec->autocfg.hp_pins[0] = 0x15;
12412 spec->autocfg.speaker_pins[0] = 0x14;
12413 spec->ext_mic.pin = 0x18;
12414 spec->ext_mic.mux_idx = 0;
12415 spec->int_mic.pin = 0x19;
12416 spec->int_mic.mux_idx = 1;
12417 spec->auto_mic = 1;
12421 * generic initialization of ADC, input mixers and output mixers
12423 static struct hda_verb alc268_base_init_verbs[] = {
12424 /* Unmute DAC0-1 and set vol = 0 */
12425 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12426 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12429 * Set up output mixers (0x0c - 0x0e)
12431 /* set vol=0 to output mixers */
12432 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12433 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
12435 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12436 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12438 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12439 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
12440 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12441 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12442 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12443 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12444 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12445 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12447 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12448 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12449 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12450 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12451 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12453 /* set PCBEEP vol = 0, mute connections */
12454 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12455 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12456 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12458 /* Unmute Selector 23h,24h and set the default input to mic-in */
12460 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
12461 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12462 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
12463 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12469 * generic initialization of ADC, input mixers and output mixers
12471 static struct hda_verb alc268_volume_init_verbs[] = {
12472 /* set output DAC */
12473 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12474 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12476 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12477 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12478 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12479 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12480 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12482 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12483 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12484 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12486 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12487 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12489 /* set PCBEEP vol = 0, mute connections */
12490 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12491 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12492 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12497 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
12498 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12499 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12503 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
12504 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12505 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12510 static struct snd_kcontrol_new alc268_capture_mixer[] = {
12511 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12512 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12513 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
12514 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
12519 static struct hda_input_mux alc268_capture_source = {
12523 { "Front Mic", 0x1 },
12529 static struct hda_input_mux alc268_acer_capture_source = {
12533 { "Internal Mic", 0x1 },
12538 static struct hda_input_mux alc268_acer_dmic_capture_source = {
12542 { "Internal Mic", 0x6 },
12547 #ifdef CONFIG_SND_DEBUG
12548 static struct snd_kcontrol_new alc268_test_mixer[] = {
12549 /* Volume widgets */
12550 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12551 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12552 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12553 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
12554 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
12555 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
12556 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
12557 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
12558 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
12559 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
12560 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
12561 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
12562 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
12563 /* The below appears problematic on some hardwares */
12564 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
12565 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12566 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
12567 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
12568 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
12570 /* Modes for retasking pin widgets */
12571 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
12572 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
12573 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
12574 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
12576 /* Controls for GPIO pins, assuming they are configured as outputs */
12577 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
12578 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
12579 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
12580 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
12582 /* Switches to allow the digital SPDIF output pin to be enabled.
12583 * The ALC268 does not have an SPDIF input.
12585 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
12587 /* A switch allowing EAPD to be enabled. Some laptops seem to use
12588 * this output to turn on an external amplifier.
12590 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
12591 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
12597 /* create input playback/capture controls for the given pin */
12598 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12599 const char *ctlname, int idx)
12616 if (spec->multiout.dac_nids[0] != dac &&
12617 spec->multiout.dac_nids[1] != dac) {
12618 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
12619 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
12623 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
12627 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12628 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
12630 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12631 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
12637 /* add playback controls from the parsed DAC table */
12638 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
12639 const struct auto_pin_cfg *cfg)
12644 spec->multiout.dac_nids = spec->private_dac_nids;
12646 nid = cfg->line_out_pins[0];
12649 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
12653 err = alc268_new_analog_output(spec, nid, name, 0);
12658 nid = cfg->speaker_pins[0];
12660 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
12661 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
12665 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
12669 nid = cfg->hp_pins[0];
12671 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
12676 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
12678 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
12679 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
12686 /* create playback/capture controls for input pins */
12687 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
12688 const struct auto_pin_cfg *cfg)
12690 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
12693 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
12694 hda_nid_t nid, int pin_type)
12698 alc_set_pin_output(codec, nid, pin_type);
12699 if (nid == 0x14 || nid == 0x16)
12703 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
12706 static void alc268_auto_init_multi_out(struct hda_codec *codec)
12708 struct alc_spec *spec = codec->spec;
12709 hda_nid_t nid = spec->autocfg.line_out_pins[0];
12711 int pin_type = get_pin_type(spec->autocfg.line_out_type);
12712 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
12716 static void alc268_auto_init_hp_out(struct hda_codec *codec)
12718 struct alc_spec *spec = codec->spec;
12721 pin = spec->autocfg.hp_pins[0];
12723 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
12724 pin = spec->autocfg.speaker_pins[0];
12726 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
12729 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
12731 struct alc_spec *spec = codec->spec;
12732 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
12733 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
12734 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
12735 unsigned int dac_vol1, dac_vol2;
12737 if (line_nid == 0x1d || speaker_nid == 0x1d) {
12738 snd_hda_codec_write(codec, speaker_nid, 0,
12739 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
12740 /* mute mixer inputs from 0x1d */
12741 snd_hda_codec_write(codec, 0x0f, 0,
12742 AC_VERB_SET_AMP_GAIN_MUTE,
12744 snd_hda_codec_write(codec, 0x10, 0,
12745 AC_VERB_SET_AMP_GAIN_MUTE,
12748 /* unmute mixer inputs from 0x1d */
12749 snd_hda_codec_write(codec, 0x0f, 0,
12750 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12751 snd_hda_codec_write(codec, 0x10, 0,
12752 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12755 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
12756 if (line_nid == 0x14)
12757 dac_vol2 = AMP_OUT_ZERO;
12758 else if (line_nid == 0x15)
12759 dac_vol1 = AMP_OUT_ZERO;
12760 if (hp_nid == 0x14)
12761 dac_vol2 = AMP_OUT_ZERO;
12762 else if (hp_nid == 0x15)
12763 dac_vol1 = AMP_OUT_ZERO;
12764 if (line_nid != 0x16 || hp_nid != 0x16 ||
12765 spec->autocfg.line_out_pins[1] != 0x16 ||
12766 spec->autocfg.line_out_pins[2] != 0x16)
12767 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
12769 snd_hda_codec_write(codec, 0x02, 0,
12770 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
12771 snd_hda_codec_write(codec, 0x03, 0,
12772 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
12775 /* pcm configuration: identical with ALC880 */
12776 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
12777 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
12778 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
12779 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
12782 * BIOS auto configuration
12784 static int alc268_parse_auto_config(struct hda_codec *codec)
12786 struct alc_spec *spec = codec->spec;
12788 static hda_nid_t alc268_ignore[] = { 0 };
12790 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12794 if (!spec->autocfg.line_outs) {
12795 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12796 spec->multiout.max_channels = 2;
12797 spec->no_analog = 1;
12800 return 0; /* can't find valid BIOS pin config */
12802 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
12805 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
12809 spec->multiout.max_channels = 2;
12812 /* digital only support output */
12813 if (spec->autocfg.dig_outs) {
12814 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
12815 spec->dig_out_type = spec->autocfg.dig_out_type[0];
12817 if (spec->kctls.list)
12818 add_mixer(spec, spec->kctls.list);
12820 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
12821 add_mixer(spec, alc268_beep_mixer);
12823 add_verb(spec, alc268_volume_init_verbs);
12824 spec->num_mux_defs = 2;
12825 spec->input_mux = &spec->private_imux[0];
12827 err = alc_auto_add_mic_boost(codec);
12831 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
12836 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
12838 /* init callback for auto-configuration model -- overriding the default init */
12839 static void alc268_auto_init(struct hda_codec *codec)
12841 struct alc_spec *spec = codec->spec;
12842 alc268_auto_init_multi_out(codec);
12843 alc268_auto_init_hp_out(codec);
12844 alc268_auto_init_mono_speaker_out(codec);
12845 alc268_auto_init_analog_input(codec);
12846 if (spec->unsol_event)
12847 alc_inithook(codec);
12851 * configuration and preset
12853 static const char *alc268_models[ALC268_MODEL_LAST] = {
12854 [ALC267_QUANTA_IL1] = "quanta-il1",
12855 [ALC268_3ST] = "3stack",
12856 [ALC268_TOSHIBA] = "toshiba",
12857 [ALC268_ACER] = "acer",
12858 [ALC268_ACER_DMIC] = "acer-dmic",
12859 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
12860 [ALC268_DELL] = "dell",
12861 [ALC268_ZEPTO] = "zepto",
12862 #ifdef CONFIG_SND_DEBUG
12863 [ALC268_TEST] = "test",
12865 [ALC268_AUTO] = "auto",
12868 static struct snd_pci_quirk alc268_cfg_tbl[] = {
12869 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
12870 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
12871 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
12872 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
12873 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
12874 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
12875 ALC268_ACER_ASPIRE_ONE),
12876 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
12877 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
12878 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
12879 /* almost compatible with toshiba but with optional digital outs;
12880 * auto-probing seems working fine
12882 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
12884 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
12885 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
12886 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
12887 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
12888 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
12889 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
12893 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
12894 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
12895 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
12896 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
12897 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
12902 static struct alc_config_preset alc268_presets[] = {
12903 [ALC267_QUANTA_IL1] = {
12904 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
12905 alc268_capture_nosrc_mixer },
12906 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12907 alc267_quanta_il1_verbs },
12908 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12909 .dac_nids = alc268_dac_nids,
12910 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12911 .adc_nids = alc268_adc_nids_alt,
12913 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12914 .channel_mode = alc268_modes,
12915 .unsol_event = alc_sku_unsol_event,
12916 .setup = alc267_quanta_il1_setup,
12917 .init_hook = alc_inithook,
12920 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12921 alc268_beep_mixer },
12922 .init_verbs = { alc268_base_init_verbs },
12923 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12924 .dac_nids = alc268_dac_nids,
12925 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12926 .adc_nids = alc268_adc_nids_alt,
12927 .capsrc_nids = alc268_capsrc_nids,
12929 .dig_out_nid = ALC268_DIGOUT_NID,
12930 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12931 .channel_mode = alc268_modes,
12932 .input_mux = &alc268_capture_source,
12934 [ALC268_TOSHIBA] = {
12935 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
12936 alc268_beep_mixer },
12937 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12938 alc268_toshiba_verbs },
12939 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12940 .dac_nids = alc268_dac_nids,
12941 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12942 .adc_nids = alc268_adc_nids_alt,
12943 .capsrc_nids = alc268_capsrc_nids,
12945 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12946 .channel_mode = alc268_modes,
12947 .input_mux = &alc268_capture_source,
12948 .unsol_event = alc268_toshiba_unsol_event,
12949 .setup = alc268_toshiba_setup,
12950 .init_hook = alc268_toshiba_automute,
12953 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
12954 alc268_beep_mixer },
12955 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12956 alc268_acer_verbs },
12957 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12958 .dac_nids = alc268_dac_nids,
12959 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12960 .adc_nids = alc268_adc_nids_alt,
12961 .capsrc_nids = alc268_capsrc_nids,
12963 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12964 .channel_mode = alc268_modes,
12965 .input_mux = &alc268_acer_capture_source,
12966 .unsol_event = alc268_acer_unsol_event,
12967 .init_hook = alc268_acer_init_hook,
12969 [ALC268_ACER_DMIC] = {
12970 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
12971 alc268_beep_mixer },
12972 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12973 alc268_acer_verbs },
12974 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12975 .dac_nids = alc268_dac_nids,
12976 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12977 .adc_nids = alc268_adc_nids_alt,
12978 .capsrc_nids = alc268_capsrc_nids,
12980 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12981 .channel_mode = alc268_modes,
12982 .input_mux = &alc268_acer_dmic_capture_source,
12983 .unsol_event = alc268_acer_unsol_event,
12984 .init_hook = alc268_acer_init_hook,
12986 [ALC268_ACER_ASPIRE_ONE] = {
12987 .mixers = { alc268_acer_aspire_one_mixer,
12989 alc268_capture_nosrc_mixer },
12990 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12991 alc268_acer_aspire_one_verbs },
12992 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12993 .dac_nids = alc268_dac_nids,
12994 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12995 .adc_nids = alc268_adc_nids_alt,
12996 .capsrc_nids = alc268_capsrc_nids,
12998 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12999 .channel_mode = alc268_modes,
13000 .unsol_event = alc268_acer_lc_unsol_event,
13001 .setup = alc268_acer_lc_setup,
13002 .init_hook = alc268_acer_lc_init_hook,
13005 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
13006 alc268_capture_nosrc_mixer },
13007 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13008 alc268_dell_verbs },
13009 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13010 .dac_nids = alc268_dac_nids,
13011 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13012 .adc_nids = alc268_adc_nids_alt,
13013 .capsrc_nids = alc268_capsrc_nids,
13015 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13016 .channel_mode = alc268_modes,
13017 .unsol_event = alc_sku_unsol_event,
13018 .setup = alc268_dell_setup,
13019 .init_hook = alc_inithook,
13022 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13023 alc268_beep_mixer },
13024 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13025 alc268_toshiba_verbs },
13026 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13027 .dac_nids = alc268_dac_nids,
13028 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13029 .adc_nids = alc268_adc_nids_alt,
13030 .capsrc_nids = alc268_capsrc_nids,
13032 .dig_out_nid = ALC268_DIGOUT_NID,
13033 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13034 .channel_mode = alc268_modes,
13035 .input_mux = &alc268_capture_source,
13036 .setup = alc268_toshiba_setup,
13037 .init_hook = alc268_toshiba_automute,
13039 #ifdef CONFIG_SND_DEBUG
13041 .mixers = { alc268_test_mixer, alc268_capture_mixer },
13042 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13043 alc268_volume_init_verbs },
13044 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13045 .dac_nids = alc268_dac_nids,
13046 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13047 .adc_nids = alc268_adc_nids_alt,
13048 .capsrc_nids = alc268_capsrc_nids,
13050 .dig_out_nid = ALC268_DIGOUT_NID,
13051 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13052 .channel_mode = alc268_modes,
13053 .input_mux = &alc268_capture_source,
13058 static int patch_alc268(struct hda_codec *codec)
13060 struct alc_spec *spec;
13062 int i, has_beep, err;
13064 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13068 codec->spec = spec;
13070 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
13074 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
13075 board_config = snd_hda_check_board_codec_sid_config(codec,
13076 ALC882_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
13078 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
13079 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13081 board_config = ALC268_AUTO;
13084 if (board_config == ALC268_AUTO) {
13085 /* automatic parse from the BIOS config */
13086 err = alc268_parse_auto_config(codec);
13092 "hda_codec: Cannot set up configuration "
13093 "from BIOS. Using base mode...\n");
13094 board_config = ALC268_3ST;
13098 if (board_config != ALC268_AUTO)
13099 setup_preset(codec, &alc268_presets[board_config]);
13101 spec->stream_analog_playback = &alc268_pcm_analog_playback;
13102 spec->stream_analog_capture = &alc268_pcm_analog_capture;
13103 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
13105 spec->stream_digital_playback = &alc268_pcm_digital_playback;
13108 for (i = 0; i < spec->num_mixers; i++) {
13109 if (spec->mixers[i] == alc268_beep_mixer) {
13116 err = snd_hda_attach_beep_device(codec, 0x1);
13121 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
13122 /* override the amp caps for beep generator */
13123 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
13124 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
13125 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
13126 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
13127 (0 << AC_AMPCAP_MUTE_SHIFT));
13130 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
13131 /* check whether NID 0x07 is valid */
13132 unsigned int wcap = get_wcaps(codec, 0x07);
13135 spec->capsrc_nids = alc268_capsrc_nids;
13137 wcap = get_wcaps_type(wcap);
13138 if (spec->auto_mic ||
13139 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
13140 spec->adc_nids = alc268_adc_nids_alt;
13141 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
13142 if (spec->auto_mic)
13143 fixup_automic_adc(codec);
13144 if (spec->auto_mic || spec->input_mux->num_items == 1)
13145 add_mixer(spec, alc268_capture_nosrc_mixer);
13147 add_mixer(spec, alc268_capture_alt_mixer);
13149 spec->adc_nids = alc268_adc_nids;
13150 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
13151 add_mixer(spec, alc268_capture_mixer);
13153 /* set default input source */
13154 for (i = 0; i < spec->num_adc_nids; i++)
13155 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
13156 0, AC_VERB_SET_CONNECT_SEL,
13157 i < spec->num_mux_defs ?
13158 spec->input_mux[i].items[0].index :
13159 spec->input_mux->items[0].index);
13162 spec->vmaster_nid = 0x02;
13164 codec->patch_ops = alc_patch_ops;
13165 if (board_config == ALC268_AUTO)
13166 spec->init_hook = alc268_auto_init;
13172 * ALC269 channel source setting (2 channel)
13174 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
13176 #define alc269_dac_nids alc260_dac_nids
13178 static hda_nid_t alc269_adc_nids[1] = {
13183 static hda_nid_t alc269_capsrc_nids[1] = {
13187 static hda_nid_t alc269vb_adc_nids[1] = {
13192 static hda_nid_t alc269vb_capsrc_nids[1] = {
13196 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
13200 #define alc269_modes alc260_modes
13201 #define alc269_capture_source alc880_lg_lw_capture_source
13203 static struct snd_kcontrol_new alc269_base_mixer[] = {
13204 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13205 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13206 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13207 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13208 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13209 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13210 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13211 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13212 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13213 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13214 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13215 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
13219 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
13220 /* output mixer control */
13221 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13223 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13224 .name = "Master Playback Switch",
13225 .subdevice = HDA_SUBDEV_AMP_FLAG,
13226 .info = snd_hda_mixer_amp_switch_info,
13227 .get = snd_hda_mixer_amp_switch_get,
13228 .put = alc268_acer_master_sw_put,
13229 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13231 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13232 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13233 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13234 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13235 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13236 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13240 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
13241 /* output mixer control */
13242 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13244 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13245 .name = "Master Playback Switch",
13246 .subdevice = HDA_SUBDEV_AMP_FLAG,
13247 .info = snd_hda_mixer_amp_switch_info,
13248 .get = snd_hda_mixer_amp_switch_get,
13249 .put = alc268_acer_master_sw_put,
13250 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13252 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13253 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13254 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13255 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13256 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13257 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13258 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
13259 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
13260 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
13264 static struct snd_kcontrol_new alc269_laptop_mixer[] = {
13265 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13266 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13267 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13268 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13272 static struct snd_kcontrol_new alc269vb_laptop_mixer[] = {
13273 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13274 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13275 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
13276 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13280 /* capture mixer elements */
13281 static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = {
13282 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13283 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13284 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13285 HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT),
13289 static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = {
13290 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13291 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13292 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13296 static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = {
13297 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13298 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13299 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13300 HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT),
13304 static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = {
13305 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13306 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13307 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13312 #define alc269_fujitsu_mixer alc269_laptop_mixer
13314 static struct hda_verb alc269_quanta_fl1_verbs[] = {
13315 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13316 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13317 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13318 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13319 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13320 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13324 static struct hda_verb alc269_lifebook_verbs[] = {
13325 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13326 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
13327 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13328 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13329 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13330 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13331 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13332 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13333 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13334 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13338 /* toggle speaker-output according to the hp-jack state */
13339 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
13341 unsigned int present;
13342 unsigned char bits;
13344 present = snd_hda_jack_detect(codec, 0x15);
13345 bits = present ? AMP_IN_MUTE(0) : 0;
13346 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13347 AMP_IN_MUTE(0), bits);
13348 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13349 AMP_IN_MUTE(0), bits);
13351 snd_hda_codec_write(codec, 0x20, 0,
13352 AC_VERB_SET_COEF_INDEX, 0x0c);
13353 snd_hda_codec_write(codec, 0x20, 0,
13354 AC_VERB_SET_PROC_COEF, 0x680);
13356 snd_hda_codec_write(codec, 0x20, 0,
13357 AC_VERB_SET_COEF_INDEX, 0x0c);
13358 snd_hda_codec_write(codec, 0x20, 0,
13359 AC_VERB_SET_PROC_COEF, 0x480);
13362 /* toggle speaker-output according to the hp-jacks state */
13363 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
13365 unsigned int present;
13366 unsigned char bits;
13368 /* Check laptop headphone socket */
13369 present = snd_hda_jack_detect(codec, 0x15);
13371 /* Check port replicator headphone socket */
13372 present |= snd_hda_jack_detect(codec, 0x1a);
13374 bits = present ? AMP_IN_MUTE(0) : 0;
13375 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13376 AMP_IN_MUTE(0), bits);
13377 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13378 AMP_IN_MUTE(0), bits);
13380 snd_hda_codec_write(codec, 0x20, 0,
13381 AC_VERB_SET_COEF_INDEX, 0x0c);
13382 snd_hda_codec_write(codec, 0x20, 0,
13383 AC_VERB_SET_PROC_COEF, 0x680);
13385 snd_hda_codec_write(codec, 0x20, 0,
13386 AC_VERB_SET_COEF_INDEX, 0x0c);
13387 snd_hda_codec_write(codec, 0x20, 0,
13388 AC_VERB_SET_PROC_COEF, 0x480);
13391 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
13393 unsigned int present_laptop;
13394 unsigned int present_dock;
13396 present_laptop = snd_hda_jack_detect(codec, 0x18);
13397 present_dock = snd_hda_jack_detect(codec, 0x1b);
13399 /* Laptop mic port overrides dock mic port, design decision */
13401 snd_hda_codec_write(codec, 0x23, 0,
13402 AC_VERB_SET_CONNECT_SEL, 0x3);
13403 if (present_laptop)
13404 snd_hda_codec_write(codec, 0x23, 0,
13405 AC_VERB_SET_CONNECT_SEL, 0x0);
13406 if (!present_dock && !present_laptop)
13407 snd_hda_codec_write(codec, 0x23, 0,
13408 AC_VERB_SET_CONNECT_SEL, 0x1);
13411 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
13414 switch (res >> 26) {
13415 case ALC880_HP_EVENT:
13416 alc269_quanta_fl1_speaker_automute(codec);
13418 case ALC880_MIC_EVENT:
13419 alc_mic_automute(codec);
13424 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
13427 if ((res >> 26) == ALC880_HP_EVENT)
13428 alc269_lifebook_speaker_automute(codec);
13429 if ((res >> 26) == ALC880_MIC_EVENT)
13430 alc269_lifebook_mic_autoswitch(codec);
13433 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
13435 struct alc_spec *spec = codec->spec;
13436 spec->ext_mic.pin = 0x18;
13437 spec->ext_mic.mux_idx = 0;
13438 spec->int_mic.pin = 0x19;
13439 spec->int_mic.mux_idx = 1;
13440 spec->auto_mic = 1;
13443 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
13445 alc269_quanta_fl1_speaker_automute(codec);
13446 alc_mic_automute(codec);
13449 static void alc269_lifebook_init_hook(struct hda_codec *codec)
13451 alc269_lifebook_speaker_automute(codec);
13452 alc269_lifebook_mic_autoswitch(codec);
13455 static struct hda_verb alc269_laptop_dmic_init_verbs[] = {
13456 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13457 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
13458 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13459 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13460 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13461 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13462 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13466 static struct hda_verb alc269_laptop_amic_init_verbs[] = {
13467 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13468 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
13469 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13470 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
13471 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13472 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13476 static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = {
13477 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
13478 {0x22, AC_VERB_SET_CONNECT_SEL, 0x06},
13479 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13480 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13481 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13482 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13483 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13487 static struct hda_verb alc269vb_laptop_amic_init_verbs[] = {
13488 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
13489 {0x22, AC_VERB_SET_CONNECT_SEL, 0x01},
13490 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13491 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13492 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13493 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13494 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13498 /* toggle speaker-output according to the hp-jack state */
13499 static void alc269_speaker_automute(struct hda_codec *codec)
13501 struct alc_spec *spec = codec->spec;
13502 unsigned int nid = spec->autocfg.hp_pins[0];
13503 unsigned int present;
13504 unsigned char bits;
13506 present = snd_hda_jack_detect(codec, nid);
13507 bits = present ? AMP_IN_MUTE(0) : 0;
13508 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13509 AMP_IN_MUTE(0), bits);
13510 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13511 AMP_IN_MUTE(0), bits);
13514 /* unsolicited event for HP jack sensing */
13515 static void alc269_laptop_unsol_event(struct hda_codec *codec,
13518 switch (res >> 26) {
13519 case ALC880_HP_EVENT:
13520 alc269_speaker_automute(codec);
13522 case ALC880_MIC_EVENT:
13523 alc_mic_automute(codec);
13528 static void alc269_laptop_dmic_setup(struct hda_codec *codec)
13530 struct alc_spec *spec = codec->spec;
13531 spec->ext_mic.pin = 0x18;
13532 spec->ext_mic.mux_idx = 0;
13533 spec->int_mic.pin = 0x12;
13534 spec->int_mic.mux_idx = 5;
13535 spec->auto_mic = 1;
13538 static void alc269vb_laptop_dmic_setup(struct hda_codec *codec)
13540 struct alc_spec *spec = codec->spec;
13541 spec->ext_mic.pin = 0x18;
13542 spec->ext_mic.mux_idx = 0;
13543 spec->int_mic.pin = 0x12;
13544 spec->int_mic.mux_idx = 6;
13545 spec->auto_mic = 1;
13548 static void alc269_laptop_amic_setup(struct hda_codec *codec)
13550 struct alc_spec *spec = codec->spec;
13551 spec->ext_mic.pin = 0x18;
13552 spec->ext_mic.mux_idx = 0;
13553 spec->int_mic.pin = 0x19;
13554 spec->int_mic.mux_idx = 1;
13555 spec->auto_mic = 1;
13558 static void alc269_laptop_inithook(struct hda_codec *codec)
13560 alc269_speaker_automute(codec);
13561 alc_mic_automute(codec);
13565 * generic initialization of ADC, input mixers and output mixers
13567 static struct hda_verb alc269_init_verbs[] = {
13569 * Unmute ADC0 and set the default input to mic-in
13571 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13574 * Set up output mixers (0x02 - 0x03)
13576 /* set vol=0 to output mixers */
13577 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13578 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13580 /* set up input amps for analog loopback */
13581 /* Amp Indices: DAC = 0, mixer = 1 */
13582 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13583 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13584 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13585 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13586 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13587 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13589 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13590 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13591 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13592 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13593 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13594 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13595 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13597 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13598 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13600 /* FIXME: use Mux-type input source selection */
13601 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13602 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13603 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
13606 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13610 static struct hda_verb alc269vb_init_verbs[] = {
13612 * Unmute ADC0 and set the default input to mic-in
13614 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13617 * Set up output mixers (0x02 - 0x03)
13619 /* set vol=0 to output mixers */
13620 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13621 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13623 /* set up input amps for analog loopback */
13624 /* Amp Indices: DAC = 0, mixer = 1 */
13625 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13626 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13627 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13628 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13629 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13630 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13632 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13633 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13634 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13635 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13636 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13637 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13638 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13640 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13641 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13643 /* FIXME: use Mux-type input source selection */
13644 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13645 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13646 {0x22, AC_VERB_SET_CONNECT_SEL, 0x00},
13649 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13653 #define alc269_auto_create_multi_out_ctls \
13654 alc268_auto_create_multi_out_ctls
13655 #define alc269_auto_create_input_ctls \
13656 alc268_auto_create_input_ctls
13658 #ifdef CONFIG_SND_HDA_POWER_SAVE
13659 #define alc269_loopbacks alc880_loopbacks
13662 /* pcm configuration: identical with ALC880 */
13663 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
13664 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
13665 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
13666 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
13668 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
13672 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13673 /* NID is set in alc_build_pcms */
13675 .open = alc880_playback_pcm_open,
13676 .prepare = alc880_playback_pcm_prepare,
13677 .cleanup = alc880_playback_pcm_cleanup
13681 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
13685 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13686 /* NID is set in alc_build_pcms */
13690 * BIOS auto configuration
13692 static int alc269_parse_auto_config(struct hda_codec *codec)
13694 struct alc_spec *spec = codec->spec;
13696 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
13697 hda_nid_t real_capsrc_nids;
13699 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13704 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
13707 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
13711 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13713 if (spec->autocfg.dig_outs)
13714 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
13716 if (spec->kctls.list)
13717 add_mixer(spec, spec->kctls.list);
13719 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010) {
13720 add_verb(spec, alc269vb_init_verbs);
13721 real_capsrc_nids = alc269vb_capsrc_nids[0];
13722 alc_ssid_check(codec, 0x21, 0x1b, 0x14);
13724 add_verb(spec, alc269_init_verbs);
13725 real_capsrc_nids = alc269_capsrc_nids[0];
13726 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
13729 spec->num_mux_defs = 1;
13730 spec->input_mux = &spec->private_imux[0];
13731 /* set default input source */
13732 snd_hda_codec_write_cache(codec, real_capsrc_nids,
13733 0, AC_VERB_SET_CONNECT_SEL,
13734 spec->input_mux->items[0].index);
13736 err = alc_auto_add_mic_boost(codec);
13740 if (!spec->cap_mixer && !spec->no_analog)
13741 set_capture_mixer(codec);
13746 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
13747 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
13748 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
13751 /* init callback for auto-configuration model -- overriding the default init */
13752 static void alc269_auto_init(struct hda_codec *codec)
13754 struct alc_spec *spec = codec->spec;
13755 alc269_auto_init_multi_out(codec);
13756 alc269_auto_init_hp_out(codec);
13757 alc269_auto_init_analog_input(codec);
13758 if (spec->unsol_event)
13759 alc_inithook(codec);
13763 * configuration and preset
13765 static const char *alc269_models[ALC269_MODEL_LAST] = {
13766 [ALC269_BASIC] = "basic",
13767 [ALC269_QUANTA_FL1] = "quanta",
13768 [ALC269_AMIC] = "laptop-amic",
13769 [ALC269_DMIC] = "laptop-dmic",
13770 [ALC269_FUJITSU] = "fujitsu",
13771 [ALC269_LIFEBOOK] = "lifebook",
13772 [ALC269_AUTO] = "auto",
13775 static struct snd_pci_quirk alc269_cfg_tbl[] = {
13776 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
13777 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
13779 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC),
13780 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC),
13781 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC),
13782 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC),
13783 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC),
13784 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC),
13785 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC),
13786 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC),
13787 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC),
13788 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC),
13789 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC),
13790 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC),
13791 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC),
13792 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC),
13793 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC),
13794 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC),
13795 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC),
13796 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC),
13797 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC),
13798 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC),
13799 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC),
13800 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC),
13801 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC),
13802 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC),
13803 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC),
13804 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC),
13805 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC),
13806 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC),
13807 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC),
13808 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC),
13809 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC),
13810 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC),
13811 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC),
13812 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC),
13813 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC),
13814 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC),
13815 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
13817 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
13819 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC),
13820 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC),
13821 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
13822 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
13826 static struct alc_config_preset alc269_presets[] = {
13828 .mixers = { alc269_base_mixer },
13829 .init_verbs = { alc269_init_verbs },
13830 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13831 .dac_nids = alc269_dac_nids,
13833 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13834 .channel_mode = alc269_modes,
13835 .input_mux = &alc269_capture_source,
13837 [ALC269_QUANTA_FL1] = {
13838 .mixers = { alc269_quanta_fl1_mixer },
13839 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
13840 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13841 .dac_nids = alc269_dac_nids,
13843 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13844 .channel_mode = alc269_modes,
13845 .input_mux = &alc269_capture_source,
13846 .unsol_event = alc269_quanta_fl1_unsol_event,
13847 .setup = alc269_quanta_fl1_setup,
13848 .init_hook = alc269_quanta_fl1_init_hook,
13851 .mixers = { alc269_laptop_mixer },
13852 .cap_mixer = alc269_laptop_analog_capture_mixer,
13853 .init_verbs = { alc269_init_verbs,
13854 alc269_laptop_amic_init_verbs },
13855 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13856 .dac_nids = alc269_dac_nids,
13858 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13859 .channel_mode = alc269_modes,
13860 .unsol_event = alc269_laptop_unsol_event,
13861 .setup = alc269_laptop_amic_setup,
13862 .init_hook = alc269_laptop_inithook,
13865 .mixers = { alc269_laptop_mixer },
13866 .cap_mixer = alc269_laptop_digital_capture_mixer,
13867 .init_verbs = { alc269_init_verbs,
13868 alc269_laptop_dmic_init_verbs },
13869 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13870 .dac_nids = alc269_dac_nids,
13872 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13873 .channel_mode = alc269_modes,
13874 .unsol_event = alc269_laptop_unsol_event,
13875 .setup = alc269_laptop_dmic_setup,
13876 .init_hook = alc269_laptop_inithook,
13878 [ALC269VB_AMIC] = {
13879 .mixers = { alc269vb_laptop_mixer },
13880 .cap_mixer = alc269vb_laptop_analog_capture_mixer,
13881 .init_verbs = { alc269vb_init_verbs,
13882 alc269vb_laptop_amic_init_verbs },
13883 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13884 .dac_nids = alc269_dac_nids,
13886 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13887 .channel_mode = alc269_modes,
13888 .unsol_event = alc269_laptop_unsol_event,
13889 .setup = alc269_laptop_amic_setup,
13890 .init_hook = alc269_laptop_inithook,
13892 [ALC269VB_DMIC] = {
13893 .mixers = { alc269vb_laptop_mixer },
13894 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
13895 .init_verbs = { alc269vb_init_verbs,
13896 alc269vb_laptop_dmic_init_verbs },
13897 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13898 .dac_nids = alc269_dac_nids,
13900 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13901 .channel_mode = alc269_modes,
13902 .unsol_event = alc269_laptop_unsol_event,
13903 .setup = alc269vb_laptop_dmic_setup,
13904 .init_hook = alc269_laptop_inithook,
13906 [ALC269_FUJITSU] = {
13907 .mixers = { alc269_fujitsu_mixer },
13908 .cap_mixer = alc269_laptop_digital_capture_mixer,
13909 .init_verbs = { alc269_init_verbs,
13910 alc269_laptop_dmic_init_verbs },
13911 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13912 .dac_nids = alc269_dac_nids,
13914 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13915 .channel_mode = alc269_modes,
13916 .unsol_event = alc269_laptop_unsol_event,
13917 .setup = alc269_laptop_dmic_setup,
13918 .init_hook = alc269_laptop_inithook,
13920 [ALC269_LIFEBOOK] = {
13921 .mixers = { alc269_lifebook_mixer },
13922 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
13923 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13924 .dac_nids = alc269_dac_nids,
13926 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13927 .channel_mode = alc269_modes,
13928 .input_mux = &alc269_capture_source,
13929 .unsol_event = alc269_lifebook_unsol_event,
13930 .init_hook = alc269_lifebook_init_hook,
13934 static int patch_alc269(struct hda_codec *codec)
13936 struct alc_spec *spec;
13939 int is_alc269vb = 0;
13941 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13945 codec->spec = spec;
13947 alc_fix_pll_init(codec, 0x20, 0x04, 15);
13949 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){
13950 kfree(codec->chip_name);
13951 codec->chip_name = kstrdup("ALC259", GFP_KERNEL);
13952 if (!codec->chip_name) {
13959 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
13963 if (board_config < 0) {
13964 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13966 board_config = ALC269_AUTO;
13969 if (board_config == ALC269_AUTO) {
13970 /* automatic parse from the BIOS config */
13971 err = alc269_parse_auto_config(codec);
13977 "hda_codec: Cannot set up configuration "
13978 "from BIOS. Using base mode...\n");
13979 board_config = ALC269_BASIC;
13983 err = snd_hda_attach_beep_device(codec, 0x1);
13989 if (board_config != ALC269_AUTO)
13990 setup_preset(codec, &alc269_presets[board_config]);
13992 if (board_config == ALC269_QUANTA_FL1) {
13993 /* Due to a hardware problem on Lenovo Ideadpad, we need to
13994 * fix the sample rate of analog I/O to 44.1kHz
13996 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
13997 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
13999 spec->stream_analog_playback = &alc269_pcm_analog_playback;
14000 spec->stream_analog_capture = &alc269_pcm_analog_capture;
14002 spec->stream_digital_playback = &alc269_pcm_digital_playback;
14003 spec->stream_digital_capture = &alc269_pcm_digital_capture;
14005 if (!is_alc269vb) {
14006 spec->adc_nids = alc269_adc_nids;
14007 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
14008 spec->capsrc_nids = alc269_capsrc_nids;
14010 spec->adc_nids = alc269vb_adc_nids;
14011 spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids);
14012 spec->capsrc_nids = alc269vb_capsrc_nids;
14015 if (!spec->cap_mixer)
14016 set_capture_mixer(codec);
14017 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
14019 spec->vmaster_nid = 0x02;
14021 codec->patch_ops = alc_patch_ops;
14022 if (board_config == ALC269_AUTO)
14023 spec->init_hook = alc269_auto_init;
14024 #ifdef CONFIG_SND_HDA_POWER_SAVE
14025 if (!spec->loopback.amplist)
14026 spec->loopback.amplist = alc269_loopbacks;
14033 * ALC861 channel source setting (2/6 channel selection for 3-stack)
14037 * set the path ways for 2 channel output
14038 * need to set the codec line out and mic 1 pin widgets to inputs
14040 static struct hda_verb alc861_threestack_ch2_init[] = {
14041 /* set pin widget 1Ah (line in) for input */
14042 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14043 /* set pin widget 18h (mic1/2) for input, for mic also enable
14046 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14048 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
14050 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14051 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
14057 * need to set the codec line out and mic 1 pin widgets to outputs
14059 static struct hda_verb alc861_threestack_ch6_init[] = {
14060 /* set pin widget 1Ah (line in) for output (Back Surround)*/
14061 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14062 /* set pin widget 18h (mic1) for output (CLFE)*/
14063 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14065 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
14066 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
14068 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
14070 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14071 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
14076 static struct hda_channel_mode alc861_threestack_modes[2] = {
14077 { 2, alc861_threestack_ch2_init },
14078 { 6, alc861_threestack_ch6_init },
14080 /* Set mic1 as input and unmute the mixer */
14081 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
14082 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14083 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14086 /* Set mic1 as output and mute mixer */
14087 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
14088 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14089 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14093 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
14094 { 2, alc861_uniwill_m31_ch2_init },
14095 { 4, alc861_uniwill_m31_ch4_init },
14098 /* Set mic1 and line-in as input and unmute the mixer */
14099 static struct hda_verb alc861_asus_ch2_init[] = {
14100 /* set pin widget 1Ah (line in) for input */
14101 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14102 /* set pin widget 18h (mic1/2) for input, for mic also enable
14105 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14107 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
14109 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14110 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
14114 /* Set mic1 nad line-in as output and mute mixer */
14115 static struct hda_verb alc861_asus_ch6_init[] = {
14116 /* set pin widget 1Ah (line in) for output (Back Surround)*/
14117 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14118 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
14119 /* set pin widget 18h (mic1) for output (CLFE)*/
14120 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14121 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
14122 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
14123 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
14125 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
14127 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14128 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
14133 static struct hda_channel_mode alc861_asus_modes[2] = {
14134 { 2, alc861_asus_ch2_init },
14135 { 6, alc861_asus_ch6_init },
14140 static struct snd_kcontrol_new alc861_base_mixer[] = {
14141 /* output mixer control */
14142 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14143 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14144 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14145 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14146 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
14148 /*Input mixer control */
14149 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14150 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14151 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14152 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14153 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14154 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14155 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14156 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14157 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14158 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14163 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
14164 /* output mixer control */
14165 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14166 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14167 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14168 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14169 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
14171 /* Input mixer control */
14172 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14173 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14174 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14175 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14176 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14177 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14178 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14179 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14180 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14181 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14184 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14185 .name = "Channel Mode",
14186 .info = alc_ch_mode_info,
14187 .get = alc_ch_mode_get,
14188 .put = alc_ch_mode_put,
14189 .private_value = ARRAY_SIZE(alc861_threestack_modes),
14194 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
14195 /* output mixer control */
14196 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14197 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14198 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14203 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
14204 /* output mixer control */
14205 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14206 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14207 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14208 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14209 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
14211 /* Input mixer control */
14212 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14213 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14214 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14215 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14216 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14217 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14218 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14219 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14220 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14221 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14224 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14225 .name = "Channel Mode",
14226 .info = alc_ch_mode_info,
14227 .get = alc_ch_mode_get,
14228 .put = alc_ch_mode_put,
14229 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
14234 static struct snd_kcontrol_new alc861_asus_mixer[] = {
14235 /* output mixer control */
14236 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14237 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14238 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14239 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14240 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
14242 /* Input mixer control */
14243 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14244 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14245 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14246 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14247 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14248 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14249 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14250 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14251 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14252 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
14255 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14256 .name = "Channel Mode",
14257 .info = alc_ch_mode_info,
14258 .get = alc_ch_mode_get,
14259 .put = alc_ch_mode_put,
14260 .private_value = ARRAY_SIZE(alc861_asus_modes),
14265 /* additional mixer */
14266 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
14267 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14268 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14273 * generic initialization of ADC, input mixers and output mixers
14275 static struct hda_verb alc861_base_init_verbs[] = {
14277 * Unmute ADC0 and set the default input to mic-in
14279 /* port-A for surround (rear panel) */
14280 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14281 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
14282 /* port-B for mic-in (rear panel) with vref */
14283 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14284 /* port-C for line-in (rear panel) */
14285 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14286 /* port-D for Front */
14287 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14288 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14289 /* port-E for HP out (front panel) */
14290 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14291 /* route front PCM to HP */
14292 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14293 /* port-F for mic-in (front panel) with vref */
14294 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14295 /* port-G for CLFE (rear panel) */
14296 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14297 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14298 /* port-H for side (rear panel) */
14299 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14300 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
14302 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14303 /* route front mic to ADC1*/
14304 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14305 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14307 /* Unmute DAC0~3 & spdif out*/
14308 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14309 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14310 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14311 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14312 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14314 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14315 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14316 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14317 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14318 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14320 /* Unmute Stereo Mixer 15 */
14321 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14322 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14323 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14324 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14326 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14327 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14328 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14329 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14330 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14331 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14332 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14333 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14334 /* hp used DAC 3 (Front) */
14335 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14336 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14341 static struct hda_verb alc861_threestack_init_verbs[] = {
14343 * Unmute ADC0 and set the default input to mic-in
14345 /* port-A for surround (rear panel) */
14346 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14347 /* port-B for mic-in (rear panel) with vref */
14348 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14349 /* port-C for line-in (rear panel) */
14350 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14351 /* port-D for Front */
14352 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14353 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14354 /* port-E for HP out (front panel) */
14355 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14356 /* route front PCM to HP */
14357 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14358 /* port-F for mic-in (front panel) with vref */
14359 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14360 /* port-G for CLFE (rear panel) */
14361 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14362 /* port-H for side (rear panel) */
14363 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14365 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14366 /* route front mic to ADC1*/
14367 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14368 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14369 /* Unmute DAC0~3 & spdif out*/
14370 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14371 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14372 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14373 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14374 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14376 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14377 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14378 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14379 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14380 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14382 /* Unmute Stereo Mixer 15 */
14383 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14384 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14385 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14386 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14388 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14389 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14390 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14391 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14392 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14393 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14394 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14395 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14396 /* hp used DAC 3 (Front) */
14397 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14398 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14402 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
14404 * Unmute ADC0 and set the default input to mic-in
14406 /* port-A for surround (rear panel) */
14407 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14408 /* port-B for mic-in (rear panel) with vref */
14409 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14410 /* port-C for line-in (rear panel) */
14411 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14412 /* port-D for Front */
14413 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14414 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14415 /* port-E for HP out (front panel) */
14416 /* this has to be set to VREF80 */
14417 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14418 /* route front PCM to HP */
14419 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14420 /* port-F for mic-in (front panel) with vref */
14421 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14422 /* port-G for CLFE (rear panel) */
14423 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14424 /* port-H for side (rear panel) */
14425 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14427 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14428 /* route front mic to ADC1*/
14429 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14430 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14431 /* Unmute DAC0~3 & spdif out*/
14432 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14433 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14434 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14435 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14436 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14438 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14439 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14440 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14441 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14442 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14444 /* Unmute Stereo Mixer 15 */
14445 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14446 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14447 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14448 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14450 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14451 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14452 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14453 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14454 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14455 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14456 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14457 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14458 /* hp used DAC 3 (Front) */
14459 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14460 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14464 static struct hda_verb alc861_asus_init_verbs[] = {
14466 * Unmute ADC0 and set the default input to mic-in
14468 /* port-A for surround (rear panel)
14469 * according to codec#0 this is the HP jack
14471 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
14472 /* route front PCM to HP */
14473 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
14474 /* port-B for mic-in (rear panel) with vref */
14475 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14476 /* port-C for line-in (rear panel) */
14477 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14478 /* port-D for Front */
14479 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14480 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14481 /* port-E for HP out (front panel) */
14482 /* this has to be set to VREF80 */
14483 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14484 /* route front PCM to HP */
14485 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14486 /* port-F for mic-in (front panel) with vref */
14487 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14488 /* port-G for CLFE (rear panel) */
14489 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14490 /* port-H for side (rear panel) */
14491 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14493 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14494 /* route front mic to ADC1*/
14495 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14496 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14497 /* Unmute DAC0~3 & spdif out*/
14498 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14499 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14500 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14501 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14502 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14503 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14504 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14505 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14506 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14507 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14509 /* Unmute Stereo Mixer 15 */
14510 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14511 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14512 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14513 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14515 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14516 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14517 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14518 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14519 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14520 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14521 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14522 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14523 /* hp used DAC 3 (Front) */
14524 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14525 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14529 /* additional init verbs for ASUS laptops */
14530 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
14531 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
14532 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
14537 * generic initialization of ADC, input mixers and output mixers
14539 static struct hda_verb alc861_auto_init_verbs[] = {
14541 * Unmute ADC0 and set the default input to mic-in
14543 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
14544 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14546 /* Unmute DAC0~3 & spdif out*/
14547 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14548 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14549 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14550 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14551 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14553 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14554 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14555 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14556 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14557 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14559 /* Unmute Stereo Mixer 15 */
14560 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14561 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14562 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14563 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
14565 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14566 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14567 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14568 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14569 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14570 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14571 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14572 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14574 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14575 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14576 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14577 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14578 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14579 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14580 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14581 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14583 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
14588 static struct hda_verb alc861_toshiba_init_verbs[] = {
14589 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14594 /* toggle speaker-output according to the hp-jack state */
14595 static void alc861_toshiba_automute(struct hda_codec *codec)
14597 unsigned int present = snd_hda_jack_detect(codec, 0x0f);
14599 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
14600 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14601 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
14602 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
14605 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
14608 if ((res >> 26) == ALC880_HP_EVENT)
14609 alc861_toshiba_automute(codec);
14612 /* pcm configuration: identical with ALC880 */
14613 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
14614 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
14615 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
14616 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
14619 #define ALC861_DIGOUT_NID 0x07
14621 static struct hda_channel_mode alc861_8ch_modes[1] = {
14625 static hda_nid_t alc861_dac_nids[4] = {
14626 /* front, surround, clfe, side */
14627 0x03, 0x06, 0x05, 0x04
14630 static hda_nid_t alc660_dac_nids[3] = {
14631 /* front, clfe, surround */
14635 static hda_nid_t alc861_adc_nids[1] = {
14640 static struct hda_input_mux alc861_capture_source = {
14644 { "Front Mic", 0x3 },
14651 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
14653 struct alc_spec *spec = codec->spec;
14654 hda_nid_t mix, srcs[5];
14657 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
14659 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14662 for (i = 0; i < num; i++) {
14664 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
14665 if (type != AC_WID_AUD_OUT)
14667 for (j = 0; j < spec->multiout.num_dacs; j++)
14668 if (spec->multiout.dac_nids[j] == srcs[i])
14670 if (j >= spec->multiout.num_dacs)
14676 /* fill in the dac_nids table from the parsed pin configuration */
14677 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
14678 const struct auto_pin_cfg *cfg)
14680 struct alc_spec *spec = codec->spec;
14682 hda_nid_t nid, dac;
14684 spec->multiout.dac_nids = spec->private_dac_nids;
14685 for (i = 0; i < cfg->line_outs; i++) {
14686 nid = cfg->line_out_pins[i];
14687 dac = alc861_look_for_dac(codec, nid);
14690 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
14695 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
14696 hda_nid_t nid, unsigned int chs)
14698 return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx,
14699 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
14702 /* add playback controls from the parsed DAC table */
14703 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
14704 const struct auto_pin_cfg *cfg)
14706 struct alc_spec *spec = codec->spec;
14707 static const char *chname[4] = {
14708 "Front", "Surround", NULL /*CLFE*/, "Side"
14713 if (cfg->line_outs == 1) {
14714 const char *pfx = NULL;
14717 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
14720 nid = spec->multiout.dac_nids[0];
14721 return alc861_create_out_sw(codec, pfx, nid, 3);
14725 for (i = 0; i < cfg->line_outs; i++) {
14726 nid = spec->multiout.dac_nids[i];
14731 err = alc861_create_out_sw(codec, "Center", nid, 1);
14734 err = alc861_create_out_sw(codec, "LFE", nid, 2);
14738 err = alc861_create_out_sw(codec, chname[i], nid, 3);
14746 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
14748 struct alc_spec *spec = codec->spec;
14755 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
14756 nid = alc861_look_for_dac(codec, pin);
14758 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
14761 spec->multiout.hp_nid = nid;
14767 /* create playback/capture controls for input pins */
14768 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
14769 const struct auto_pin_cfg *cfg)
14771 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
14774 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
14776 int pin_type, hda_nid_t dac)
14778 hda_nid_t mix, srcs[5];
14781 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
14783 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14785 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
14787 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14790 for (i = 0; i < num; i++) {
14792 if (srcs[i] == dac || srcs[i] == 0x15)
14793 mute = AMP_IN_UNMUTE(i);
14795 mute = AMP_IN_MUTE(i);
14796 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14801 static void alc861_auto_init_multi_out(struct hda_codec *codec)
14803 struct alc_spec *spec = codec->spec;
14806 for (i = 0; i < spec->autocfg.line_outs; i++) {
14807 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14808 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14810 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
14811 spec->multiout.dac_nids[i]);
14815 static void alc861_auto_init_hp_out(struct hda_codec *codec)
14817 struct alc_spec *spec = codec->spec;
14819 if (spec->autocfg.hp_outs)
14820 alc861_auto_set_output_and_unmute(codec,
14821 spec->autocfg.hp_pins[0],
14823 spec->multiout.hp_nid);
14824 if (spec->autocfg.speaker_outs)
14825 alc861_auto_set_output_and_unmute(codec,
14826 spec->autocfg.speaker_pins[0],
14828 spec->multiout.dac_nids[0]);
14831 static void alc861_auto_init_analog_input(struct hda_codec *codec)
14833 struct alc_spec *spec = codec->spec;
14836 for (i = 0; i < AUTO_PIN_LAST; i++) {
14837 hda_nid_t nid = spec->autocfg.input_pins[i];
14838 if (nid >= 0x0c && nid <= 0x11)
14839 alc_set_input_pin(codec, nid, i);
14843 /* parse the BIOS configuration and set up the alc_spec */
14844 /* return 1 if successful, 0 if the proper config is not found,
14845 * or a negative error code
14847 static int alc861_parse_auto_config(struct hda_codec *codec)
14849 struct alc_spec *spec = codec->spec;
14851 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
14853 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14857 if (!spec->autocfg.line_outs)
14858 return 0; /* can't find valid BIOS pin config */
14860 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
14863 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
14866 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
14869 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
14873 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14875 if (spec->autocfg.dig_outs)
14876 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
14878 if (spec->kctls.list)
14879 add_mixer(spec, spec->kctls.list);
14881 add_verb(spec, alc861_auto_init_verbs);
14883 spec->num_mux_defs = 1;
14884 spec->input_mux = &spec->private_imux[0];
14886 spec->adc_nids = alc861_adc_nids;
14887 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
14888 set_capture_mixer(codec);
14890 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b);
14895 /* additional initialization for auto-configuration model */
14896 static void alc861_auto_init(struct hda_codec *codec)
14898 struct alc_spec *spec = codec->spec;
14899 alc861_auto_init_multi_out(codec);
14900 alc861_auto_init_hp_out(codec);
14901 alc861_auto_init_analog_input(codec);
14902 if (spec->unsol_event)
14903 alc_inithook(codec);
14906 #ifdef CONFIG_SND_HDA_POWER_SAVE
14907 static struct hda_amp_list alc861_loopbacks[] = {
14908 { 0x15, HDA_INPUT, 0 },
14909 { 0x15, HDA_INPUT, 1 },
14910 { 0x15, HDA_INPUT, 2 },
14911 { 0x15, HDA_INPUT, 3 },
14918 * configuration and preset
14920 static const char *alc861_models[ALC861_MODEL_LAST] = {
14921 [ALC861_3ST] = "3stack",
14922 [ALC660_3ST] = "3stack-660",
14923 [ALC861_3ST_DIG] = "3stack-dig",
14924 [ALC861_6ST_DIG] = "6stack-dig",
14925 [ALC861_UNIWILL_M31] = "uniwill-m31",
14926 [ALC861_TOSHIBA] = "toshiba",
14927 [ALC861_ASUS] = "asus",
14928 [ALC861_ASUS_LAPTOP] = "asus-laptop",
14929 [ALC861_AUTO] = "auto",
14932 static struct snd_pci_quirk alc861_cfg_tbl[] = {
14933 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
14934 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14935 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14936 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
14937 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
14938 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
14939 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
14940 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
14941 * Any other models that need this preset?
14943 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
14944 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
14945 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
14946 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
14947 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
14948 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
14949 /* FIXME: the below seems conflict */
14950 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
14951 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
14952 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
14956 static struct alc_config_preset alc861_presets[] = {
14958 .mixers = { alc861_3ST_mixer },
14959 .init_verbs = { alc861_threestack_init_verbs },
14960 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14961 .dac_nids = alc861_dac_nids,
14962 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14963 .channel_mode = alc861_threestack_modes,
14965 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14966 .adc_nids = alc861_adc_nids,
14967 .input_mux = &alc861_capture_source,
14969 [ALC861_3ST_DIG] = {
14970 .mixers = { alc861_base_mixer },
14971 .init_verbs = { alc861_threestack_init_verbs },
14972 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14973 .dac_nids = alc861_dac_nids,
14974 .dig_out_nid = ALC861_DIGOUT_NID,
14975 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14976 .channel_mode = alc861_threestack_modes,
14978 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14979 .adc_nids = alc861_adc_nids,
14980 .input_mux = &alc861_capture_source,
14982 [ALC861_6ST_DIG] = {
14983 .mixers = { alc861_base_mixer },
14984 .init_verbs = { alc861_base_init_verbs },
14985 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14986 .dac_nids = alc861_dac_nids,
14987 .dig_out_nid = ALC861_DIGOUT_NID,
14988 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
14989 .channel_mode = alc861_8ch_modes,
14990 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14991 .adc_nids = alc861_adc_nids,
14992 .input_mux = &alc861_capture_source,
14995 .mixers = { alc861_3ST_mixer },
14996 .init_verbs = { alc861_threestack_init_verbs },
14997 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
14998 .dac_nids = alc660_dac_nids,
14999 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15000 .channel_mode = alc861_threestack_modes,
15002 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15003 .adc_nids = alc861_adc_nids,
15004 .input_mux = &alc861_capture_source,
15006 [ALC861_UNIWILL_M31] = {
15007 .mixers = { alc861_uniwill_m31_mixer },
15008 .init_verbs = { alc861_uniwill_m31_init_verbs },
15009 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15010 .dac_nids = alc861_dac_nids,
15011 .dig_out_nid = ALC861_DIGOUT_NID,
15012 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
15013 .channel_mode = alc861_uniwill_m31_modes,
15015 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15016 .adc_nids = alc861_adc_nids,
15017 .input_mux = &alc861_capture_source,
15019 [ALC861_TOSHIBA] = {
15020 .mixers = { alc861_toshiba_mixer },
15021 .init_verbs = { alc861_base_init_verbs,
15022 alc861_toshiba_init_verbs },
15023 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15024 .dac_nids = alc861_dac_nids,
15025 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
15026 .channel_mode = alc883_3ST_2ch_modes,
15027 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15028 .adc_nids = alc861_adc_nids,
15029 .input_mux = &alc861_capture_source,
15030 .unsol_event = alc861_toshiba_unsol_event,
15031 .init_hook = alc861_toshiba_automute,
15034 .mixers = { alc861_asus_mixer },
15035 .init_verbs = { alc861_asus_init_verbs },
15036 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15037 .dac_nids = alc861_dac_nids,
15038 .dig_out_nid = ALC861_DIGOUT_NID,
15039 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
15040 .channel_mode = alc861_asus_modes,
15043 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15044 .adc_nids = alc861_adc_nids,
15045 .input_mux = &alc861_capture_source,
15047 [ALC861_ASUS_LAPTOP] = {
15048 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
15049 .init_verbs = { alc861_asus_init_verbs,
15050 alc861_asus_laptop_init_verbs },
15051 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15052 .dac_nids = alc861_dac_nids,
15053 .dig_out_nid = ALC861_DIGOUT_NID,
15054 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
15055 .channel_mode = alc883_3ST_2ch_modes,
15057 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15058 .adc_nids = alc861_adc_nids,
15059 .input_mux = &alc861_capture_source,
15063 /* Pin config fixes */
15065 PINFIX_FSC_AMILO_PI1505,
15068 static struct alc_pincfg alc861_fsc_amilo_pi1505_pinfix[] = {
15069 { 0x0b, 0x0221101f }, /* HP */
15070 { 0x0f, 0x90170310 }, /* speaker */
15074 static const struct alc_fixup alc861_fixups[] = {
15075 [PINFIX_FSC_AMILO_PI1505] = {
15076 .pins = alc861_fsc_amilo_pi1505_pinfix
15080 static struct snd_pci_quirk alc861_fixup_tbl[] = {
15081 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
15085 static int patch_alc861(struct hda_codec *codec)
15087 struct alc_spec *spec;
15091 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15095 codec->spec = spec;
15097 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
15101 if (board_config < 0) {
15102 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15104 board_config = ALC861_AUTO;
15107 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups);
15109 if (board_config == ALC861_AUTO) {
15110 /* automatic parse from the BIOS config */
15111 err = alc861_parse_auto_config(codec);
15117 "hda_codec: Cannot set up configuration "
15118 "from BIOS. Using base mode...\n");
15119 board_config = ALC861_3ST_DIG;
15123 err = snd_hda_attach_beep_device(codec, 0x23);
15129 if (board_config != ALC861_AUTO)
15130 setup_preset(codec, &alc861_presets[board_config]);
15132 spec->stream_analog_playback = &alc861_pcm_analog_playback;
15133 spec->stream_analog_capture = &alc861_pcm_analog_capture;
15135 spec->stream_digital_playback = &alc861_pcm_digital_playback;
15136 spec->stream_digital_capture = &alc861_pcm_digital_capture;
15138 if (!spec->cap_mixer)
15139 set_capture_mixer(codec);
15140 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
15142 spec->vmaster_nid = 0x03;
15144 codec->patch_ops = alc_patch_ops;
15145 if (board_config == ALC861_AUTO) {
15146 spec->init_hook = alc861_auto_init;
15147 #ifdef CONFIG_SND_HDA_POWER_SAVE
15148 spec->power_hook = alc_power_eapd;
15151 #ifdef CONFIG_SND_HDA_POWER_SAVE
15152 if (!spec->loopback.amplist)
15153 spec->loopback.amplist = alc861_loopbacks;
15160 * ALC861-VD support
15164 * In addition, an independent DAC
15166 #define ALC861VD_DIGOUT_NID 0x06
15168 static hda_nid_t alc861vd_dac_nids[4] = {
15169 /* front, surr, clfe, side surr */
15170 0x02, 0x03, 0x04, 0x05
15173 /* dac_nids for ALC660vd are in a different order - according to
15174 * Realtek's driver.
15175 * This should probably result in a different mixer for 6stack models
15176 * of ALC660vd codecs, but for now there is only 3stack mixer
15177 * - and it is the same as in 861vd.
15178 * adc_nids in ALC660vd are (is) the same as in 861vd
15180 static hda_nid_t alc660vd_dac_nids[3] = {
15181 /* front, rear, clfe, rear_surr */
15185 static hda_nid_t alc861vd_adc_nids[1] = {
15190 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
15193 /* FIXME: should be a matrix-type input source selection */
15194 static struct hda_input_mux alc861vd_capture_source = {
15198 { "Front Mic", 0x1 },
15204 static struct hda_input_mux alc861vd_dallas_capture_source = {
15207 { "Ext Mic", 0x0 },
15208 { "Int Mic", 0x1 },
15212 static struct hda_input_mux alc861vd_hp_capture_source = {
15215 { "Front Mic", 0x0 },
15216 { "ATAPI Mic", 0x1 },
15223 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
15230 static struct hda_verb alc861vd_6stack_ch6_init[] = {
15231 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15232 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15233 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15234 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15241 static struct hda_verb alc861vd_6stack_ch8_init[] = {
15242 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15243 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15244 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15245 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15249 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
15250 { 6, alc861vd_6stack_ch6_init },
15251 { 8, alc861vd_6stack_ch8_init },
15254 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
15256 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15257 .name = "Channel Mode",
15258 .info = alc_ch_mode_info,
15259 .get = alc_ch_mode_get,
15260 .put = alc_ch_mode_put,
15265 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15266 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15268 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
15269 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15270 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15272 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15273 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
15275 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
15277 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
15279 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
15280 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
15282 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
15283 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
15285 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15287 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15288 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15289 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15291 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15292 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15293 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15295 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15296 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15298 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15299 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15304 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
15305 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15306 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15308 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15310 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15311 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15312 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15314 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15315 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15316 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15318 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15319 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15321 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15322 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15327 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
15328 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15329 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
15330 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15332 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15334 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15335 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15336 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15338 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15339 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15340 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15342 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15343 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15348 /* Pin assignment: Speaker=0x14, HP = 0x15,
15349 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
15351 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
15352 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15353 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
15354 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15355 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15356 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
15357 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15358 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15359 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
15360 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15361 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15365 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
15366 * Front Mic=0x18, ATAPI Mic = 0x19,
15368 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
15369 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15370 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15371 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15372 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15373 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15374 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15375 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15376 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15382 * generic initialization of ADC, input mixers and output mixers
15384 static struct hda_verb alc861vd_volume_init_verbs[] = {
15386 * Unmute ADC0 and set the default input to mic-in
15388 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15389 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15391 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
15392 * the analog-loopback mixer widget
15394 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15395 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15396 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15397 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15398 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15399 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15401 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
15402 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15403 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15404 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15405 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15408 * Set up output mixers (0x02 - 0x05)
15410 /* set vol=0 to output mixers */
15411 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15412 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15413 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15414 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15416 /* set up input amps for analog loopback */
15417 /* Amp Indices: DAC = 0, mixer = 1 */
15418 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15419 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15420 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15421 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15422 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15423 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15424 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15425 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15431 * 3-stack pin configuration:
15432 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
15434 static struct hda_verb alc861vd_3stack_init_verbs[] = {
15436 * Set pin mode and muting
15438 /* set front pin widgets 0x14 for output */
15439 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15440 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15441 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15443 /* Mic (rear) pin: input vref at 80% */
15444 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15445 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15446 /* Front Mic pin: input vref at 80% */
15447 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15448 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15449 /* Line In pin: input */
15450 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15451 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15452 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15453 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15454 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15455 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15456 /* CD pin widget for input */
15457 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15463 * 6-stack pin configuration:
15465 static struct hda_verb alc861vd_6stack_init_verbs[] = {
15467 * Set pin mode and muting
15469 /* set front pin widgets 0x14 for output */
15470 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15471 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15472 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15474 /* Rear Pin: output 1 (0x0d) */
15475 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15476 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15477 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
15478 /* CLFE Pin: output 2 (0x0e) */
15479 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15480 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15481 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
15482 /* Side Pin: output 3 (0x0f) */
15483 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15484 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15485 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
15487 /* Mic (rear) pin: input vref at 80% */
15488 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15489 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15490 /* Front Mic pin: input vref at 80% */
15491 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15492 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15493 /* Line In pin: input */
15494 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15495 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15496 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15497 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15498 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15499 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15500 /* CD pin widget for input */
15501 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15506 static struct hda_verb alc861vd_eapd_verbs[] = {
15507 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15511 static struct hda_verb alc660vd_eapd_verbs[] = {
15512 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15513 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15517 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
15518 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15519 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15520 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
15521 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15522 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15526 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
15528 unsigned int present;
15529 unsigned char bits;
15531 present = snd_hda_jack_detect(codec, 0x18);
15532 bits = present ? HDA_AMP_MUTE : 0;
15534 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
15535 HDA_AMP_MUTE, bits);
15538 static void alc861vd_lenovo_setup(struct hda_codec *codec)
15540 struct alc_spec *spec = codec->spec;
15541 spec->autocfg.hp_pins[0] = 0x1b;
15542 spec->autocfg.speaker_pins[0] = 0x14;
15545 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
15547 alc_automute_amp(codec);
15548 alc861vd_lenovo_mic_automute(codec);
15551 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
15554 switch (res >> 26) {
15555 case ALC880_MIC_EVENT:
15556 alc861vd_lenovo_mic_automute(codec);
15559 alc_automute_amp_unsol_event(codec, res);
15564 static struct hda_verb alc861vd_dallas_verbs[] = {
15565 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15566 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15567 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15568 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15570 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15571 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15572 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15573 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15574 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15575 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15576 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15577 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15579 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15580 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15581 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15582 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15583 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15584 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15585 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15586 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15588 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15589 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15590 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15591 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15592 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15593 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15594 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15595 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15597 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15598 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15599 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15600 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15602 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15603 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15604 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15609 /* toggle speaker-output according to the hp-jack state */
15610 static void alc861vd_dallas_setup(struct hda_codec *codec)
15612 struct alc_spec *spec = codec->spec;
15614 spec->autocfg.hp_pins[0] = 0x15;
15615 spec->autocfg.speaker_pins[0] = 0x14;
15618 #ifdef CONFIG_SND_HDA_POWER_SAVE
15619 #define alc861vd_loopbacks alc880_loopbacks
15622 /* pcm configuration: identical with ALC880 */
15623 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
15624 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
15625 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
15626 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
15629 * configuration and preset
15631 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
15632 [ALC660VD_3ST] = "3stack-660",
15633 [ALC660VD_3ST_DIG] = "3stack-660-digout",
15634 [ALC660VD_ASUS_V1S] = "asus-v1s",
15635 [ALC861VD_3ST] = "3stack",
15636 [ALC861VD_3ST_DIG] = "3stack-digout",
15637 [ALC861VD_6ST_DIG] = "6stack-digout",
15638 [ALC861VD_LENOVO] = "lenovo",
15639 [ALC861VD_DALLAS] = "dallas",
15640 [ALC861VD_HP] = "hp",
15641 [ALC861VD_AUTO] = "auto",
15644 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
15645 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
15646 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
15647 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
15648 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
15649 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
15650 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
15651 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
15652 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
15653 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
15654 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
15655 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
15656 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
15657 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
15658 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
15659 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
15663 static struct alc_config_preset alc861vd_presets[] = {
15665 .mixers = { alc861vd_3st_mixer },
15666 .init_verbs = { alc861vd_volume_init_verbs,
15667 alc861vd_3stack_init_verbs },
15668 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15669 .dac_nids = alc660vd_dac_nids,
15670 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15671 .channel_mode = alc861vd_3stack_2ch_modes,
15672 .input_mux = &alc861vd_capture_source,
15674 [ALC660VD_3ST_DIG] = {
15675 .mixers = { alc861vd_3st_mixer },
15676 .init_verbs = { alc861vd_volume_init_verbs,
15677 alc861vd_3stack_init_verbs },
15678 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15679 .dac_nids = alc660vd_dac_nids,
15680 .dig_out_nid = ALC861VD_DIGOUT_NID,
15681 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15682 .channel_mode = alc861vd_3stack_2ch_modes,
15683 .input_mux = &alc861vd_capture_source,
15686 .mixers = { alc861vd_3st_mixer },
15687 .init_verbs = { alc861vd_volume_init_verbs,
15688 alc861vd_3stack_init_verbs },
15689 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15690 .dac_nids = alc861vd_dac_nids,
15691 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15692 .channel_mode = alc861vd_3stack_2ch_modes,
15693 .input_mux = &alc861vd_capture_source,
15695 [ALC861VD_3ST_DIG] = {
15696 .mixers = { alc861vd_3st_mixer },
15697 .init_verbs = { alc861vd_volume_init_verbs,
15698 alc861vd_3stack_init_verbs },
15699 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15700 .dac_nids = alc861vd_dac_nids,
15701 .dig_out_nid = ALC861VD_DIGOUT_NID,
15702 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15703 .channel_mode = alc861vd_3stack_2ch_modes,
15704 .input_mux = &alc861vd_capture_source,
15706 [ALC861VD_6ST_DIG] = {
15707 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
15708 .init_verbs = { alc861vd_volume_init_verbs,
15709 alc861vd_6stack_init_verbs },
15710 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15711 .dac_nids = alc861vd_dac_nids,
15712 .dig_out_nid = ALC861VD_DIGOUT_NID,
15713 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
15714 .channel_mode = alc861vd_6stack_modes,
15715 .input_mux = &alc861vd_capture_source,
15717 [ALC861VD_LENOVO] = {
15718 .mixers = { alc861vd_lenovo_mixer },
15719 .init_verbs = { alc861vd_volume_init_verbs,
15720 alc861vd_3stack_init_verbs,
15721 alc861vd_eapd_verbs,
15722 alc861vd_lenovo_unsol_verbs },
15723 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15724 .dac_nids = alc660vd_dac_nids,
15725 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15726 .channel_mode = alc861vd_3stack_2ch_modes,
15727 .input_mux = &alc861vd_capture_source,
15728 .unsol_event = alc861vd_lenovo_unsol_event,
15729 .setup = alc861vd_lenovo_setup,
15730 .init_hook = alc861vd_lenovo_init_hook,
15732 [ALC861VD_DALLAS] = {
15733 .mixers = { alc861vd_dallas_mixer },
15734 .init_verbs = { alc861vd_dallas_verbs },
15735 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15736 .dac_nids = alc861vd_dac_nids,
15737 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15738 .channel_mode = alc861vd_3stack_2ch_modes,
15739 .input_mux = &alc861vd_dallas_capture_source,
15740 .unsol_event = alc_automute_amp_unsol_event,
15741 .setup = alc861vd_dallas_setup,
15742 .init_hook = alc_automute_amp,
15745 .mixers = { alc861vd_hp_mixer },
15746 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
15747 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15748 .dac_nids = alc861vd_dac_nids,
15749 .dig_out_nid = ALC861VD_DIGOUT_NID,
15750 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15751 .channel_mode = alc861vd_3stack_2ch_modes,
15752 .input_mux = &alc861vd_hp_capture_source,
15753 .unsol_event = alc_automute_amp_unsol_event,
15754 .setup = alc861vd_dallas_setup,
15755 .init_hook = alc_automute_amp,
15757 [ALC660VD_ASUS_V1S] = {
15758 .mixers = { alc861vd_lenovo_mixer },
15759 .init_verbs = { alc861vd_volume_init_verbs,
15760 alc861vd_3stack_init_verbs,
15761 alc861vd_eapd_verbs,
15762 alc861vd_lenovo_unsol_verbs },
15763 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15764 .dac_nids = alc660vd_dac_nids,
15765 .dig_out_nid = ALC861VD_DIGOUT_NID,
15766 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15767 .channel_mode = alc861vd_3stack_2ch_modes,
15768 .input_mux = &alc861vd_capture_source,
15769 .unsol_event = alc861vd_lenovo_unsol_event,
15770 .setup = alc861vd_lenovo_setup,
15771 .init_hook = alc861vd_lenovo_init_hook,
15776 * BIOS auto configuration
15778 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
15779 const struct auto_pin_cfg *cfg)
15781 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x22, 0);
15785 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
15786 hda_nid_t nid, int pin_type, int dac_idx)
15788 alc_set_pin_output(codec, nid, pin_type);
15791 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
15793 struct alc_spec *spec = codec->spec;
15796 for (i = 0; i <= HDA_SIDE; i++) {
15797 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15798 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15800 alc861vd_auto_set_output_and_unmute(codec, nid,
15806 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
15808 struct alc_spec *spec = codec->spec;
15811 pin = spec->autocfg.hp_pins[0];
15812 if (pin) /* connect to front and use dac 0 */
15813 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
15814 pin = spec->autocfg.speaker_pins[0];
15816 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
15819 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
15821 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
15823 struct alc_spec *spec = codec->spec;
15826 for (i = 0; i < AUTO_PIN_LAST; i++) {
15827 hda_nid_t nid = spec->autocfg.input_pins[i];
15828 if (alc_is_input_pin(codec, nid)) {
15829 alc_set_input_pin(codec, nid, i);
15830 if (nid != ALC861VD_PIN_CD_NID &&
15831 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
15832 snd_hda_codec_write(codec, nid, 0,
15833 AC_VERB_SET_AMP_GAIN_MUTE,
15839 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
15841 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
15842 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
15844 /* add playback controls from the parsed DAC table */
15845 /* Based on ALC880 version. But ALC861VD has separate,
15846 * different NIDs for mute/unmute switch and volume control */
15847 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
15848 const struct auto_pin_cfg *cfg)
15850 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
15851 hda_nid_t nid_v, nid_s;
15854 for (i = 0; i < cfg->line_outs; i++) {
15855 if (!spec->multiout.dac_nids[i])
15857 nid_v = alc861vd_idx_to_mixer_vol(
15859 spec->multiout.dac_nids[i]));
15860 nid_s = alc861vd_idx_to_mixer_switch(
15862 spec->multiout.dac_nids[i]));
15866 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
15868 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
15872 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
15874 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
15878 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
15880 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
15884 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
15886 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
15892 if (cfg->line_outs == 1 &&
15893 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
15900 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
15901 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
15905 if (cfg->line_outs == 1 &&
15906 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
15908 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
15909 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
15918 /* add playback controls for speaker and HP outputs */
15919 /* Based on ALC880 version. But ALC861VD has separate,
15920 * different NIDs for mute/unmute switch and volume control */
15921 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
15922 hda_nid_t pin, const char *pfx)
15924 hda_nid_t nid_v, nid_s;
15930 if (alc880_is_fixed_pin(pin)) {
15931 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
15932 /* specify the DAC as the extra output */
15933 if (!spec->multiout.hp_nid)
15934 spec->multiout.hp_nid = nid_v;
15936 spec->multiout.extra_out_nid[0] = nid_v;
15937 /* control HP volume/switch on the output mixer amp */
15938 nid_v = alc861vd_idx_to_mixer_vol(
15939 alc880_fixed_pin_idx(pin));
15940 nid_s = alc861vd_idx_to_mixer_switch(
15941 alc880_fixed_pin_idx(pin));
15943 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
15944 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
15947 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
15948 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
15951 } else if (alc880_is_multi_pin(pin)) {
15952 /* set manual connection */
15953 /* we have only a switch on HP-out PIN */
15954 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
15955 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
15962 /* parse the BIOS configuration and set up the alc_spec
15963 * return 1 if successful, 0 if the proper config is not found,
15964 * or a negative error code
15965 * Based on ALC880 version - had to change it to override
15966 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
15967 static int alc861vd_parse_auto_config(struct hda_codec *codec)
15969 struct alc_spec *spec = codec->spec;
15971 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
15973 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15977 if (!spec->autocfg.line_outs)
15978 return 0; /* can't find valid BIOS pin config */
15980 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
15983 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
15986 err = alc861vd_auto_create_extra_out(spec,
15987 spec->autocfg.speaker_pins[0],
15991 err = alc861vd_auto_create_extra_out(spec,
15992 spec->autocfg.hp_pins[0],
15996 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
16000 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16002 if (spec->autocfg.dig_outs)
16003 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
16005 if (spec->kctls.list)
16006 add_mixer(spec, spec->kctls.list);
16008 add_verb(spec, alc861vd_volume_init_verbs);
16010 spec->num_mux_defs = 1;
16011 spec->input_mux = &spec->private_imux[0];
16013 err = alc_auto_add_mic_boost(codec);
16017 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
16022 /* additional initialization for auto-configuration model */
16023 static void alc861vd_auto_init(struct hda_codec *codec)
16025 struct alc_spec *spec = codec->spec;
16026 alc861vd_auto_init_multi_out(codec);
16027 alc861vd_auto_init_hp_out(codec);
16028 alc861vd_auto_init_analog_input(codec);
16029 alc861vd_auto_init_input_src(codec);
16030 if (spec->unsol_event)
16031 alc_inithook(codec);
16035 ALC660VD_FIX_ASUS_GPIO1
16039 static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = {
16040 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
16041 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
16042 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
16046 static const struct alc_fixup alc861vd_fixups[] = {
16047 [ALC660VD_FIX_ASUS_GPIO1] = {
16048 .verbs = alc660vd_fix_asus_gpio1_verbs,
16052 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
16053 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
16057 static int patch_alc861vd(struct hda_codec *codec)
16059 struct alc_spec *spec;
16060 int err, board_config;
16062 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16066 codec->spec = spec;
16068 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
16072 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
16073 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
16075 board_config = ALC861VD_AUTO;
16078 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups);
16080 if (board_config == ALC861VD_AUTO) {
16081 /* automatic parse from the BIOS config */
16082 err = alc861vd_parse_auto_config(codec);
16088 "hda_codec: Cannot set up configuration "
16089 "from BIOS. Using base mode...\n");
16090 board_config = ALC861VD_3ST;
16094 err = snd_hda_attach_beep_device(codec, 0x23);
16100 if (board_config != ALC861VD_AUTO)
16101 setup_preset(codec, &alc861vd_presets[board_config]);
16103 if (codec->vendor_id == 0x10ec0660) {
16104 /* always turn on EAPD */
16105 add_verb(spec, alc660vd_eapd_verbs);
16108 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
16109 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
16111 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
16112 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
16114 if (!spec->adc_nids) {
16115 spec->adc_nids = alc861vd_adc_nids;
16116 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
16118 if (!spec->capsrc_nids)
16119 spec->capsrc_nids = alc861vd_capsrc_nids;
16121 set_capture_mixer(codec);
16122 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
16124 spec->vmaster_nid = 0x02;
16126 codec->patch_ops = alc_patch_ops;
16128 if (board_config == ALC861VD_AUTO)
16129 spec->init_hook = alc861vd_auto_init;
16130 #ifdef CONFIG_SND_HDA_POWER_SAVE
16131 if (!spec->loopback.amplist)
16132 spec->loopback.amplist = alc861vd_loopbacks;
16141 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
16142 * configuration. Each pin widget can choose any input DACs and a mixer.
16143 * Each ADC is connected from a mixer of all inputs. This makes possible
16144 * 6-channel independent captures.
16146 * In addition, an independent DAC for the multi-playback (not used in this
16149 #define ALC662_DIGOUT_NID 0x06
16150 #define ALC662_DIGIN_NID 0x0a
16152 static hda_nid_t alc662_dac_nids[4] = {
16153 /* front, rear, clfe, rear_surr */
16157 static hda_nid_t alc272_dac_nids[2] = {
16161 static hda_nid_t alc662_adc_nids[2] = {
16166 static hda_nid_t alc272_adc_nids[1] = {
16171 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
16172 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
16176 /* FIXME: should be a matrix-type input source selection */
16177 static struct hda_input_mux alc662_capture_source = {
16181 { "Front Mic", 0x1 },
16187 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
16195 static struct hda_input_mux alc663_capture_source = {
16199 { "Front Mic", 0x1 },
16204 #if 0 /* set to 1 for testing other input sources below */
16205 static struct hda_input_mux alc272_nc10_capture_source = {
16208 { "Autoselect Mic", 0x0 },
16209 { "Internal Mic", 0x1 },
16210 { "In-0x02", 0x2 },
16211 { "In-0x03", 0x3 },
16212 { "In-0x04", 0x4 },
16213 { "In-0x05", 0x5 },
16214 { "In-0x06", 0x6 },
16215 { "In-0x07", 0x7 },
16216 { "In-0x08", 0x8 },
16217 { "In-0x09", 0x9 },
16218 { "In-0x0a", 0x0a },
16219 { "In-0x0b", 0x0b },
16220 { "In-0x0c", 0x0c },
16221 { "In-0x0d", 0x0d },
16222 { "In-0x0e", 0x0e },
16223 { "In-0x0f", 0x0f },
16231 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
16238 static struct hda_verb alc662_3ST_ch2_init[] = {
16239 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
16240 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
16241 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
16242 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
16249 static struct hda_verb alc662_3ST_ch6_init[] = {
16250 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16251 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
16252 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
16253 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16254 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
16255 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
16259 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
16260 { 2, alc662_3ST_ch2_init },
16261 { 6, alc662_3ST_ch6_init },
16267 static struct hda_verb alc662_sixstack_ch6_init[] = {
16268 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16269 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16270 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16277 static struct hda_verb alc662_sixstack_ch8_init[] = {
16278 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16279 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16280 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16284 static struct hda_channel_mode alc662_5stack_modes[2] = {
16285 { 2, alc662_sixstack_ch6_init },
16286 { 6, alc662_sixstack_ch8_init },
16289 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16290 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16293 static struct snd_kcontrol_new alc662_base_mixer[] = {
16294 /* output mixer control */
16295 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
16296 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16297 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
16298 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16299 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16300 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16301 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16302 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16303 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16305 /*Input mixer control */
16306 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
16307 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
16308 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
16309 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
16310 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
16311 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
16312 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
16313 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
16317 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
16318 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16319 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16320 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16321 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16322 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16323 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16324 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16325 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16326 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16327 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16328 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16332 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
16333 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16334 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16335 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16336 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16337 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16338 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16339 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16340 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16341 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16342 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16343 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16344 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16345 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16346 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16347 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16348 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16349 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16353 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
16354 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16355 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
16356 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16357 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
16358 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16359 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16360 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16361 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16362 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16366 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
16367 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16368 ALC262_HIPPO_MASTER_SWITCH,
16370 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
16371 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16372 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16374 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16375 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16376 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16380 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
16381 ALC262_HIPPO_MASTER_SWITCH,
16382 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16383 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16384 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16385 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16386 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
16387 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16388 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16389 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16390 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16394 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
16395 .ops = &snd_hda_bind_vol,
16397 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16398 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
16403 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
16404 .ops = &snd_hda_bind_sw,
16406 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16407 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16412 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
16413 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16414 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
16415 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16416 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16420 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
16421 .ops = &snd_hda_bind_sw,
16423 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16424 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16425 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16430 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
16431 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16432 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
16433 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16434 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16435 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16436 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16441 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
16442 .ops = &snd_hda_bind_sw,
16444 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16445 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16446 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16451 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
16452 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16453 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
16454 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16455 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16456 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16457 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16461 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
16462 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16463 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16464 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16465 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16466 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16467 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16468 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16472 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
16473 .ops = &snd_hda_bind_vol,
16475 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16476 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
16481 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
16482 .ops = &snd_hda_bind_sw,
16484 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16485 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
16490 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
16491 HDA_BIND_VOL("Master Playback Volume",
16492 &alc663_asus_two_bind_master_vol),
16493 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16494 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16495 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16496 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16497 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16501 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
16502 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16503 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16504 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16505 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16506 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16507 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16511 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
16512 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16513 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16514 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16515 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16516 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16518 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16519 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16520 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16521 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16525 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
16526 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16527 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16528 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16530 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16531 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16532 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16533 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16534 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16535 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16539 static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
16540 .ops = &snd_hda_bind_sw,
16542 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16543 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16544 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16545 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16546 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16551 static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
16552 .ops = &snd_hda_bind_sw,
16554 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16555 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16560 static struct snd_kcontrol_new alc663_mode7_mixer[] = {
16561 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16562 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16563 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16564 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16565 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16566 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16567 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16568 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16569 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16573 static struct snd_kcontrol_new alc663_mode8_mixer[] = {
16574 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16575 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16576 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16577 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16578 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16579 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16580 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16585 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
16587 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16588 .name = "Channel Mode",
16589 .info = alc_ch_mode_info,
16590 .get = alc_ch_mode_get,
16591 .put = alc_ch_mode_put,
16596 static struct hda_verb alc662_init_verbs[] = {
16597 /* ADC: mute amp left and right */
16598 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16599 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16601 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16602 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16603 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16604 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16605 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16606 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16608 /* Front Pin: output 0 (0x0c) */
16609 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16610 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16612 /* Rear Pin: output 1 (0x0d) */
16613 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16614 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16616 /* CLFE Pin: output 2 (0x0e) */
16617 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16618 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16620 /* Mic (rear) pin: input vref at 80% */
16621 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16622 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16623 /* Front Mic pin: input vref at 80% */
16624 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16625 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16626 /* Line In pin: input */
16627 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16628 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16629 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16630 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16631 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16632 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16633 /* CD pin widget for input */
16634 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16636 /* FIXME: use matrix-type input source selection */
16637 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16639 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16640 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16642 /* always trun on EAPD */
16643 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16644 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16649 static struct hda_verb alc663_init_verbs[] = {
16650 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16651 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16652 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16653 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16654 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16655 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16659 static struct hda_verb alc272_init_verbs[] = {
16660 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16661 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16662 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16663 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16664 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16665 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16666 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16667 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16671 static struct hda_verb alc662_sue_init_verbs[] = {
16672 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16673 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16677 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
16678 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16679 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16683 /* Set Unsolicited Event*/
16684 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
16685 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16686 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16690 static struct hda_verb alc663_m51va_init_verbs[] = {
16691 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16692 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16693 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16694 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16695 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16696 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16697 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16698 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16699 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16703 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
16704 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16705 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16706 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16707 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16708 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16709 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16710 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16714 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
16715 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16716 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16717 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16718 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16719 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16720 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16721 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16722 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16726 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
16727 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16728 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16729 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16730 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16731 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16732 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16733 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16737 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
16738 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16739 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16740 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16741 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16742 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16743 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16744 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16745 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16746 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16747 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16748 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16749 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16753 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
16754 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16755 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16756 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16757 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16758 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16759 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16760 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16761 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16762 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16763 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16764 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16765 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16769 static struct hda_verb alc663_g71v_init_verbs[] = {
16770 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16771 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
16772 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
16774 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16775 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16776 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16778 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16779 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
16780 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16784 static struct hda_verb alc663_g50v_init_verbs[] = {
16785 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16786 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16787 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16789 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16790 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16794 static struct hda_verb alc662_ecs_init_verbs[] = {
16795 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
16796 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16797 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16798 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16802 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
16803 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16804 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16805 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16806 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16807 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16808 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16809 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16810 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16811 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16812 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16813 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16817 static struct hda_verb alc272_dell_init_verbs[] = {
16818 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16819 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16820 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16821 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16822 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16823 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16824 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16825 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16826 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16827 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16828 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16832 static struct hda_verb alc663_mode7_init_verbs[] = {
16833 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16834 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16835 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16836 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16837 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16838 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16839 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
16840 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16841 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16842 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16843 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16844 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16845 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16846 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16847 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16851 static struct hda_verb alc663_mode8_init_verbs[] = {
16852 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16853 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16854 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16855 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
16856 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16857 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16858 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16859 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16860 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16861 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16862 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16863 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16864 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16865 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16866 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16867 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16871 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
16872 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
16873 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
16877 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
16878 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
16879 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
16883 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
16885 unsigned int present;
16886 unsigned char bits;
16888 present = snd_hda_jack_detect(codec, 0x14);
16889 bits = present ? HDA_AMP_MUTE : 0;
16891 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16892 HDA_AMP_MUTE, bits);
16895 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
16897 unsigned int present;
16898 unsigned char bits;
16900 present = snd_hda_jack_detect(codec, 0x1b);
16901 bits = present ? HDA_AMP_MUTE : 0;
16903 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16904 HDA_AMP_MUTE, bits);
16905 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16906 HDA_AMP_MUTE, bits);
16909 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
16912 if ((res >> 26) == ALC880_HP_EVENT)
16913 alc662_lenovo_101e_all_automute(codec);
16914 if ((res >> 26) == ALC880_FRONT_EVENT)
16915 alc662_lenovo_101e_ispeaker_automute(codec);
16918 /* unsolicited event for HP jack sensing */
16919 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
16922 if ((res >> 26) == ALC880_MIC_EVENT)
16923 alc_mic_automute(codec);
16925 alc262_hippo_unsol_event(codec, res);
16928 static void alc662_eeepc_setup(struct hda_codec *codec)
16930 struct alc_spec *spec = codec->spec;
16932 alc262_hippo1_setup(codec);
16933 spec->ext_mic.pin = 0x18;
16934 spec->ext_mic.mux_idx = 0;
16935 spec->int_mic.pin = 0x19;
16936 spec->int_mic.mux_idx = 1;
16937 spec->auto_mic = 1;
16940 static void alc662_eeepc_inithook(struct hda_codec *codec)
16942 alc262_hippo_automute(codec);
16943 alc_mic_automute(codec);
16946 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
16948 struct alc_spec *spec = codec->spec;
16950 spec->autocfg.hp_pins[0] = 0x14;
16951 spec->autocfg.speaker_pins[0] = 0x1b;
16954 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
16956 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
16958 unsigned int present;
16959 unsigned char bits;
16961 present = snd_hda_jack_detect(codec, 0x21);
16962 bits = present ? HDA_AMP_MUTE : 0;
16963 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16964 AMP_IN_MUTE(0), bits);
16965 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16966 AMP_IN_MUTE(0), bits);
16969 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
16971 unsigned int present;
16972 unsigned char bits;
16974 present = snd_hda_jack_detect(codec, 0x21);
16975 bits = present ? HDA_AMP_MUTE : 0;
16976 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16977 AMP_IN_MUTE(0), bits);
16978 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16979 AMP_IN_MUTE(0), bits);
16980 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16981 AMP_IN_MUTE(0), bits);
16982 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16983 AMP_IN_MUTE(0), bits);
16986 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
16988 unsigned int present;
16989 unsigned char bits;
16991 present = snd_hda_jack_detect(codec, 0x15);
16992 bits = present ? HDA_AMP_MUTE : 0;
16993 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16994 AMP_IN_MUTE(0), bits);
16995 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16996 AMP_IN_MUTE(0), bits);
16997 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16998 AMP_IN_MUTE(0), bits);
16999 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
17000 AMP_IN_MUTE(0), bits);
17003 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
17005 unsigned int present;
17006 unsigned char bits;
17008 present = snd_hda_jack_detect(codec, 0x1b);
17009 bits = present ? 0 : PIN_OUT;
17010 snd_hda_codec_write(codec, 0x14, 0,
17011 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
17014 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
17016 unsigned int present1, present2;
17018 present1 = snd_hda_jack_detect(codec, 0x21);
17019 present2 = snd_hda_jack_detect(codec, 0x15);
17021 if (present1 || present2) {
17022 snd_hda_codec_write_cache(codec, 0x14, 0,
17023 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17025 snd_hda_codec_write_cache(codec, 0x14, 0,
17026 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17030 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
17032 unsigned int present1, present2;
17034 present1 = snd_hda_jack_detect(codec, 0x1b);
17035 present2 = snd_hda_jack_detect(codec, 0x15);
17037 if (present1 || present2) {
17038 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17039 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
17040 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17041 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
17043 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17044 AMP_IN_MUTE(0), 0);
17045 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17046 AMP_IN_MUTE(0), 0);
17050 static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
17052 unsigned int present1, present2;
17054 present1 = snd_hda_codec_read(codec, 0x1b, 0,
17055 AC_VERB_GET_PIN_SENSE, 0)
17056 & AC_PINSENSE_PRESENCE;
17057 present2 = snd_hda_codec_read(codec, 0x21, 0,
17058 AC_VERB_GET_PIN_SENSE, 0)
17059 & AC_PINSENSE_PRESENCE;
17061 if (present1 || present2) {
17062 snd_hda_codec_write_cache(codec, 0x14, 0,
17063 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17064 snd_hda_codec_write_cache(codec, 0x17, 0,
17065 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17067 snd_hda_codec_write_cache(codec, 0x14, 0,
17068 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17069 snd_hda_codec_write_cache(codec, 0x17, 0,
17070 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17074 static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
17076 unsigned int present1, present2;
17078 present1 = snd_hda_codec_read(codec, 0x21, 0,
17079 AC_VERB_GET_PIN_SENSE, 0)
17080 & AC_PINSENSE_PRESENCE;
17081 present2 = snd_hda_codec_read(codec, 0x15, 0,
17082 AC_VERB_GET_PIN_SENSE, 0)
17083 & AC_PINSENSE_PRESENCE;
17085 if (present1 || present2) {
17086 snd_hda_codec_write_cache(codec, 0x14, 0,
17087 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17088 snd_hda_codec_write_cache(codec, 0x17, 0,
17089 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17091 snd_hda_codec_write_cache(codec, 0x14, 0,
17092 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17093 snd_hda_codec_write_cache(codec, 0x17, 0,
17094 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17098 static void alc663_m51va_unsol_event(struct hda_codec *codec,
17101 switch (res >> 26) {
17102 case ALC880_HP_EVENT:
17103 alc663_m51va_speaker_automute(codec);
17105 case ALC880_MIC_EVENT:
17106 alc_mic_automute(codec);
17111 static void alc663_m51va_setup(struct hda_codec *codec)
17113 struct alc_spec *spec = codec->spec;
17114 spec->ext_mic.pin = 0x18;
17115 spec->ext_mic.mux_idx = 0;
17116 spec->int_mic.pin = 0x12;
17117 spec->int_mic.mux_idx = 9;
17118 spec->auto_mic = 1;
17121 static void alc663_m51va_inithook(struct hda_codec *codec)
17123 alc663_m51va_speaker_automute(codec);
17124 alc_mic_automute(codec);
17127 /* ***************** Mode1 ******************************/
17128 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
17130 static void alc663_mode1_setup(struct hda_codec *codec)
17132 struct alc_spec *spec = codec->spec;
17133 spec->ext_mic.pin = 0x18;
17134 spec->ext_mic.mux_idx = 0;
17135 spec->int_mic.pin = 0x19;
17136 spec->int_mic.mux_idx = 1;
17137 spec->auto_mic = 1;
17140 #define alc663_mode1_inithook alc663_m51va_inithook
17142 /* ***************** Mode2 ******************************/
17143 static void alc662_mode2_unsol_event(struct hda_codec *codec,
17146 switch (res >> 26) {
17147 case ALC880_HP_EVENT:
17148 alc662_f5z_speaker_automute(codec);
17150 case ALC880_MIC_EVENT:
17151 alc_mic_automute(codec);
17156 #define alc662_mode2_setup alc663_mode1_setup
17158 static void alc662_mode2_inithook(struct hda_codec *codec)
17160 alc662_f5z_speaker_automute(codec);
17161 alc_mic_automute(codec);
17163 /* ***************** Mode3 ******************************/
17164 static void alc663_mode3_unsol_event(struct hda_codec *codec,
17167 switch (res >> 26) {
17168 case ALC880_HP_EVENT:
17169 alc663_two_hp_m1_speaker_automute(codec);
17171 case ALC880_MIC_EVENT:
17172 alc_mic_automute(codec);
17177 #define alc663_mode3_setup alc663_mode1_setup
17179 static void alc663_mode3_inithook(struct hda_codec *codec)
17181 alc663_two_hp_m1_speaker_automute(codec);
17182 alc_mic_automute(codec);
17184 /* ***************** Mode4 ******************************/
17185 static void alc663_mode4_unsol_event(struct hda_codec *codec,
17188 switch (res >> 26) {
17189 case ALC880_HP_EVENT:
17190 alc663_21jd_two_speaker_automute(codec);
17192 case ALC880_MIC_EVENT:
17193 alc_mic_automute(codec);
17198 #define alc663_mode4_setup alc663_mode1_setup
17200 static void alc663_mode4_inithook(struct hda_codec *codec)
17202 alc663_21jd_two_speaker_automute(codec);
17203 alc_mic_automute(codec);
17205 /* ***************** Mode5 ******************************/
17206 static void alc663_mode5_unsol_event(struct hda_codec *codec,
17209 switch (res >> 26) {
17210 case ALC880_HP_EVENT:
17211 alc663_15jd_two_speaker_automute(codec);
17213 case ALC880_MIC_EVENT:
17214 alc_mic_automute(codec);
17219 #define alc663_mode5_setup alc663_mode1_setup
17221 static void alc663_mode5_inithook(struct hda_codec *codec)
17223 alc663_15jd_two_speaker_automute(codec);
17224 alc_mic_automute(codec);
17226 /* ***************** Mode6 ******************************/
17227 static void alc663_mode6_unsol_event(struct hda_codec *codec,
17230 switch (res >> 26) {
17231 case ALC880_HP_EVENT:
17232 alc663_two_hp_m2_speaker_automute(codec);
17234 case ALC880_MIC_EVENT:
17235 alc_mic_automute(codec);
17240 #define alc663_mode6_setup alc663_mode1_setup
17242 static void alc663_mode6_inithook(struct hda_codec *codec)
17244 alc663_two_hp_m2_speaker_automute(codec);
17245 alc_mic_automute(codec);
17248 /* ***************** Mode7 ******************************/
17249 static void alc663_mode7_unsol_event(struct hda_codec *codec,
17252 switch (res >> 26) {
17253 case ALC880_HP_EVENT:
17254 alc663_two_hp_m7_speaker_automute(codec);
17256 case ALC880_MIC_EVENT:
17257 alc_mic_automute(codec);
17262 #define alc663_mode7_setup alc663_mode1_setup
17264 static void alc663_mode7_inithook(struct hda_codec *codec)
17266 alc663_two_hp_m7_speaker_automute(codec);
17267 alc_mic_automute(codec);
17270 /* ***************** Mode8 ******************************/
17271 static void alc663_mode8_unsol_event(struct hda_codec *codec,
17274 switch (res >> 26) {
17275 case ALC880_HP_EVENT:
17276 alc663_two_hp_m8_speaker_automute(codec);
17278 case ALC880_MIC_EVENT:
17279 alc_mic_automute(codec);
17284 #define alc663_mode8_setup alc663_m51va_setup
17286 static void alc663_mode8_inithook(struct hda_codec *codec)
17288 alc663_two_hp_m8_speaker_automute(codec);
17289 alc_mic_automute(codec);
17292 static void alc663_g71v_hp_automute(struct hda_codec *codec)
17294 unsigned int present;
17295 unsigned char bits;
17297 present = snd_hda_jack_detect(codec, 0x21);
17298 bits = present ? HDA_AMP_MUTE : 0;
17299 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17300 HDA_AMP_MUTE, bits);
17301 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17302 HDA_AMP_MUTE, bits);
17305 static void alc663_g71v_front_automute(struct hda_codec *codec)
17307 unsigned int present;
17308 unsigned char bits;
17310 present = snd_hda_jack_detect(codec, 0x15);
17311 bits = present ? HDA_AMP_MUTE : 0;
17312 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17313 HDA_AMP_MUTE, bits);
17316 static void alc663_g71v_unsol_event(struct hda_codec *codec,
17319 switch (res >> 26) {
17320 case ALC880_HP_EVENT:
17321 alc663_g71v_hp_automute(codec);
17323 case ALC880_FRONT_EVENT:
17324 alc663_g71v_front_automute(codec);
17326 case ALC880_MIC_EVENT:
17327 alc_mic_automute(codec);
17332 #define alc663_g71v_setup alc663_m51va_setup
17334 static void alc663_g71v_inithook(struct hda_codec *codec)
17336 alc663_g71v_front_automute(codec);
17337 alc663_g71v_hp_automute(codec);
17338 alc_mic_automute(codec);
17341 static void alc663_g50v_unsol_event(struct hda_codec *codec,
17344 switch (res >> 26) {
17345 case ALC880_HP_EVENT:
17346 alc663_m51va_speaker_automute(codec);
17348 case ALC880_MIC_EVENT:
17349 alc_mic_automute(codec);
17354 #define alc663_g50v_setup alc663_m51va_setup
17356 static void alc663_g50v_inithook(struct hda_codec *codec)
17358 alc663_m51va_speaker_automute(codec);
17359 alc_mic_automute(codec);
17362 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
17363 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17364 ALC262_HIPPO_MASTER_SWITCH,
17366 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
17367 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
17368 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
17370 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
17371 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17372 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17376 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
17377 /* Master Playback automatically created from Speaker and Headphone */
17378 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17379 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17380 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17381 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17383 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17384 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17385 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
17387 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17388 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17389 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
17393 #ifdef CONFIG_SND_HDA_POWER_SAVE
17394 #define alc662_loopbacks alc880_loopbacks
17398 /* pcm configuration: identical with ALC880 */
17399 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
17400 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
17401 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
17402 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
17405 * configuration and preset
17407 static const char *alc662_models[ALC662_MODEL_LAST] = {
17408 [ALC662_3ST_2ch_DIG] = "3stack-dig",
17409 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
17410 [ALC662_3ST_6ch] = "3stack-6ch",
17411 [ALC662_5ST_DIG] = "6stack-dig",
17412 [ALC662_LENOVO_101E] = "lenovo-101e",
17413 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
17414 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
17415 [ALC662_ECS] = "ecs",
17416 [ALC663_ASUS_M51VA] = "m51va",
17417 [ALC663_ASUS_G71V] = "g71v",
17418 [ALC663_ASUS_H13] = "h13",
17419 [ALC663_ASUS_G50V] = "g50v",
17420 [ALC663_ASUS_MODE1] = "asus-mode1",
17421 [ALC662_ASUS_MODE2] = "asus-mode2",
17422 [ALC663_ASUS_MODE3] = "asus-mode3",
17423 [ALC663_ASUS_MODE4] = "asus-mode4",
17424 [ALC663_ASUS_MODE5] = "asus-mode5",
17425 [ALC663_ASUS_MODE6] = "asus-mode6",
17426 [ALC663_ASUS_MODE7] = "asus-mode7",
17427 [ALC663_ASUS_MODE8] = "asus-mode8",
17428 [ALC272_DELL] = "dell",
17429 [ALC272_DELL_ZM1] = "dell-zm1",
17430 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
17431 [ALC662_AUTO] = "auto",
17434 static struct snd_pci_quirk alc662_cfg_tbl[] = {
17435 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
17436 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
17437 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
17438 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
17439 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
17440 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1),
17441 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
17442 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
17443 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
17444 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
17445 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
17446 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
17447 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
17448 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
17449 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
17450 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
17451 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
17452 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
17453 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
17454 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
17455 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
17456 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
17457 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
17458 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
17459 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
17460 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
17461 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
17462 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
17463 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
17464 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
17465 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
17466 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
17467 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
17468 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
17469 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
17470 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
17471 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
17472 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
17473 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
17474 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
17475 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
17476 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1),
17477 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
17478 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
17479 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
17480 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
17481 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
17482 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
17483 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
17484 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
17485 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
17486 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
17487 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
17488 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
17489 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
17490 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
17491 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
17492 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
17493 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
17494 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
17495 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
17496 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
17497 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
17498 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
17499 ALC662_3ST_6ch_DIG),
17500 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO),
17501 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
17502 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
17503 ALC662_3ST_6ch_DIG),
17504 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
17505 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
17506 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
17507 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
17508 ALC662_3ST_6ch_DIG),
17509 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
17511 SND_PCI_QUIRK(0x8086, 0xd604, "Intel mobo", ALC662_3ST_2ch_DIG),
17515 static struct alc_config_preset alc662_presets[] = {
17516 [ALC662_3ST_2ch_DIG] = {
17517 .mixers = { alc662_3ST_2ch_mixer },
17518 .init_verbs = { alc662_init_verbs },
17519 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17520 .dac_nids = alc662_dac_nids,
17521 .dig_out_nid = ALC662_DIGOUT_NID,
17522 .dig_in_nid = ALC662_DIGIN_NID,
17523 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17524 .channel_mode = alc662_3ST_2ch_modes,
17525 .input_mux = &alc662_capture_source,
17527 [ALC662_3ST_6ch_DIG] = {
17528 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17529 .init_verbs = { alc662_init_verbs },
17530 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17531 .dac_nids = alc662_dac_nids,
17532 .dig_out_nid = ALC662_DIGOUT_NID,
17533 .dig_in_nid = ALC662_DIGIN_NID,
17534 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17535 .channel_mode = alc662_3ST_6ch_modes,
17537 .input_mux = &alc662_capture_source,
17539 [ALC662_3ST_6ch] = {
17540 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17541 .init_verbs = { alc662_init_verbs },
17542 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17543 .dac_nids = alc662_dac_nids,
17544 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17545 .channel_mode = alc662_3ST_6ch_modes,
17547 .input_mux = &alc662_capture_source,
17549 [ALC662_5ST_DIG] = {
17550 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
17551 .init_verbs = { alc662_init_verbs },
17552 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17553 .dac_nids = alc662_dac_nids,
17554 .dig_out_nid = ALC662_DIGOUT_NID,
17555 .dig_in_nid = ALC662_DIGIN_NID,
17556 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
17557 .channel_mode = alc662_5stack_modes,
17558 .input_mux = &alc662_capture_source,
17560 [ALC662_LENOVO_101E] = {
17561 .mixers = { alc662_lenovo_101e_mixer },
17562 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
17563 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17564 .dac_nids = alc662_dac_nids,
17565 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17566 .channel_mode = alc662_3ST_2ch_modes,
17567 .input_mux = &alc662_lenovo_101e_capture_source,
17568 .unsol_event = alc662_lenovo_101e_unsol_event,
17569 .init_hook = alc662_lenovo_101e_all_automute,
17571 [ALC662_ASUS_EEEPC_P701] = {
17572 .mixers = { alc662_eeepc_p701_mixer },
17573 .init_verbs = { alc662_init_verbs,
17574 alc662_eeepc_sue_init_verbs },
17575 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17576 .dac_nids = alc662_dac_nids,
17577 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17578 .channel_mode = alc662_3ST_2ch_modes,
17579 .unsol_event = alc662_eeepc_unsol_event,
17580 .setup = alc662_eeepc_setup,
17581 .init_hook = alc662_eeepc_inithook,
17583 [ALC662_ASUS_EEEPC_EP20] = {
17584 .mixers = { alc662_eeepc_ep20_mixer,
17585 alc662_chmode_mixer },
17586 .init_verbs = { alc662_init_verbs,
17587 alc662_eeepc_ep20_sue_init_verbs },
17588 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17589 .dac_nids = alc662_dac_nids,
17590 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17591 .channel_mode = alc662_3ST_6ch_modes,
17592 .input_mux = &alc662_lenovo_101e_capture_source,
17593 .unsol_event = alc662_eeepc_unsol_event,
17594 .setup = alc662_eeepc_ep20_setup,
17595 .init_hook = alc662_eeepc_ep20_inithook,
17598 .mixers = { alc662_ecs_mixer },
17599 .init_verbs = { alc662_init_verbs,
17600 alc662_ecs_init_verbs },
17601 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17602 .dac_nids = alc662_dac_nids,
17603 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17604 .channel_mode = alc662_3ST_2ch_modes,
17605 .unsol_event = alc662_eeepc_unsol_event,
17606 .setup = alc662_eeepc_setup,
17607 .init_hook = alc662_eeepc_inithook,
17609 [ALC663_ASUS_M51VA] = {
17610 .mixers = { alc663_m51va_mixer },
17611 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17612 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17613 .dac_nids = alc662_dac_nids,
17614 .dig_out_nid = ALC662_DIGOUT_NID,
17615 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17616 .channel_mode = alc662_3ST_2ch_modes,
17617 .unsol_event = alc663_m51va_unsol_event,
17618 .setup = alc663_m51va_setup,
17619 .init_hook = alc663_m51va_inithook,
17621 [ALC663_ASUS_G71V] = {
17622 .mixers = { alc663_g71v_mixer },
17623 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
17624 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17625 .dac_nids = alc662_dac_nids,
17626 .dig_out_nid = ALC662_DIGOUT_NID,
17627 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17628 .channel_mode = alc662_3ST_2ch_modes,
17629 .unsol_event = alc663_g71v_unsol_event,
17630 .setup = alc663_g71v_setup,
17631 .init_hook = alc663_g71v_inithook,
17633 [ALC663_ASUS_H13] = {
17634 .mixers = { alc663_m51va_mixer },
17635 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17636 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17637 .dac_nids = alc662_dac_nids,
17638 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17639 .channel_mode = alc662_3ST_2ch_modes,
17640 .unsol_event = alc663_m51va_unsol_event,
17641 .init_hook = alc663_m51va_inithook,
17643 [ALC663_ASUS_G50V] = {
17644 .mixers = { alc663_g50v_mixer },
17645 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
17646 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17647 .dac_nids = alc662_dac_nids,
17648 .dig_out_nid = ALC662_DIGOUT_NID,
17649 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17650 .channel_mode = alc662_3ST_6ch_modes,
17651 .input_mux = &alc663_capture_source,
17652 .unsol_event = alc663_g50v_unsol_event,
17653 .setup = alc663_g50v_setup,
17654 .init_hook = alc663_g50v_inithook,
17656 [ALC663_ASUS_MODE1] = {
17657 .mixers = { alc663_m51va_mixer },
17658 .cap_mixer = alc662_auto_capture_mixer,
17659 .init_verbs = { alc662_init_verbs,
17660 alc663_21jd_amic_init_verbs },
17661 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17663 .dac_nids = alc662_dac_nids,
17664 .dig_out_nid = ALC662_DIGOUT_NID,
17665 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17666 .channel_mode = alc662_3ST_2ch_modes,
17667 .unsol_event = alc663_mode1_unsol_event,
17668 .setup = alc663_mode1_setup,
17669 .init_hook = alc663_mode1_inithook,
17671 [ALC662_ASUS_MODE2] = {
17672 .mixers = { alc662_1bjd_mixer },
17673 .cap_mixer = alc662_auto_capture_mixer,
17674 .init_verbs = { alc662_init_verbs,
17675 alc662_1bjd_amic_init_verbs },
17676 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17677 .dac_nids = alc662_dac_nids,
17678 .dig_out_nid = ALC662_DIGOUT_NID,
17679 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17680 .channel_mode = alc662_3ST_2ch_modes,
17681 .unsol_event = alc662_mode2_unsol_event,
17682 .setup = alc662_mode2_setup,
17683 .init_hook = alc662_mode2_inithook,
17685 [ALC663_ASUS_MODE3] = {
17686 .mixers = { alc663_two_hp_m1_mixer },
17687 .cap_mixer = alc662_auto_capture_mixer,
17688 .init_verbs = { alc662_init_verbs,
17689 alc663_two_hp_amic_m1_init_verbs },
17690 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17692 .dac_nids = alc662_dac_nids,
17693 .dig_out_nid = ALC662_DIGOUT_NID,
17694 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17695 .channel_mode = alc662_3ST_2ch_modes,
17696 .unsol_event = alc663_mode3_unsol_event,
17697 .setup = alc663_mode3_setup,
17698 .init_hook = alc663_mode3_inithook,
17700 [ALC663_ASUS_MODE4] = {
17701 .mixers = { alc663_asus_21jd_clfe_mixer },
17702 .cap_mixer = alc662_auto_capture_mixer,
17703 .init_verbs = { alc662_init_verbs,
17704 alc663_21jd_amic_init_verbs},
17705 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17707 .dac_nids = alc662_dac_nids,
17708 .dig_out_nid = ALC662_DIGOUT_NID,
17709 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17710 .channel_mode = alc662_3ST_2ch_modes,
17711 .unsol_event = alc663_mode4_unsol_event,
17712 .setup = alc663_mode4_setup,
17713 .init_hook = alc663_mode4_inithook,
17715 [ALC663_ASUS_MODE5] = {
17716 .mixers = { alc663_asus_15jd_clfe_mixer },
17717 .cap_mixer = alc662_auto_capture_mixer,
17718 .init_verbs = { alc662_init_verbs,
17719 alc663_15jd_amic_init_verbs },
17720 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17722 .dac_nids = alc662_dac_nids,
17723 .dig_out_nid = ALC662_DIGOUT_NID,
17724 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17725 .channel_mode = alc662_3ST_2ch_modes,
17726 .unsol_event = alc663_mode5_unsol_event,
17727 .setup = alc663_mode5_setup,
17728 .init_hook = alc663_mode5_inithook,
17730 [ALC663_ASUS_MODE6] = {
17731 .mixers = { alc663_two_hp_m2_mixer },
17732 .cap_mixer = alc662_auto_capture_mixer,
17733 .init_verbs = { alc662_init_verbs,
17734 alc663_two_hp_amic_m2_init_verbs },
17735 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17737 .dac_nids = alc662_dac_nids,
17738 .dig_out_nid = ALC662_DIGOUT_NID,
17739 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17740 .channel_mode = alc662_3ST_2ch_modes,
17741 .unsol_event = alc663_mode6_unsol_event,
17742 .setup = alc663_mode6_setup,
17743 .init_hook = alc663_mode6_inithook,
17745 [ALC663_ASUS_MODE7] = {
17746 .mixers = { alc663_mode7_mixer },
17747 .cap_mixer = alc662_auto_capture_mixer,
17748 .init_verbs = { alc662_init_verbs,
17749 alc663_mode7_init_verbs },
17750 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17752 .dac_nids = alc662_dac_nids,
17753 .dig_out_nid = ALC662_DIGOUT_NID,
17754 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17755 .channel_mode = alc662_3ST_2ch_modes,
17756 .unsol_event = alc663_mode7_unsol_event,
17757 .setup = alc663_mode7_setup,
17758 .init_hook = alc663_mode7_inithook,
17760 [ALC663_ASUS_MODE8] = {
17761 .mixers = { alc663_mode8_mixer },
17762 .cap_mixer = alc662_auto_capture_mixer,
17763 .init_verbs = { alc662_init_verbs,
17764 alc663_mode8_init_verbs },
17765 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17767 .dac_nids = alc662_dac_nids,
17768 .dig_out_nid = ALC662_DIGOUT_NID,
17769 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17770 .channel_mode = alc662_3ST_2ch_modes,
17771 .unsol_event = alc663_mode8_unsol_event,
17772 .setup = alc663_mode8_setup,
17773 .init_hook = alc663_mode8_inithook,
17776 .mixers = { alc663_m51va_mixer },
17777 .cap_mixer = alc272_auto_capture_mixer,
17778 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
17779 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17780 .dac_nids = alc662_dac_nids,
17781 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17782 .adc_nids = alc272_adc_nids,
17783 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
17784 .capsrc_nids = alc272_capsrc_nids,
17785 .channel_mode = alc662_3ST_2ch_modes,
17786 .unsol_event = alc663_m51va_unsol_event,
17787 .setup = alc663_m51va_setup,
17788 .init_hook = alc663_m51va_inithook,
17790 [ALC272_DELL_ZM1] = {
17791 .mixers = { alc663_m51va_mixer },
17792 .cap_mixer = alc662_auto_capture_mixer,
17793 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
17794 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17795 .dac_nids = alc662_dac_nids,
17796 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17797 .adc_nids = alc662_adc_nids,
17799 .capsrc_nids = alc662_capsrc_nids,
17800 .channel_mode = alc662_3ST_2ch_modes,
17801 .unsol_event = alc663_m51va_unsol_event,
17802 .setup = alc663_m51va_setup,
17803 .init_hook = alc663_m51va_inithook,
17805 [ALC272_SAMSUNG_NC10] = {
17806 .mixers = { alc272_nc10_mixer },
17807 .init_verbs = { alc662_init_verbs,
17808 alc663_21jd_amic_init_verbs },
17809 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17810 .dac_nids = alc272_dac_nids,
17811 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17812 .channel_mode = alc662_3ST_2ch_modes,
17813 /*.input_mux = &alc272_nc10_capture_source,*/
17814 .unsol_event = alc663_mode4_unsol_event,
17815 .setup = alc663_mode4_setup,
17816 .init_hook = alc663_mode4_inithook,
17822 * BIOS auto configuration
17825 /* convert from MIX nid to DAC */
17826 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
17830 else if (nid >= 0x0c && nid <= 0x0e)
17831 return nid - 0x0c + 0x02;
17836 /* get MIX nid connected to the given pin targeted to DAC */
17837 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
17843 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
17844 for (i = 0; i < num; i++) {
17845 if (alc662_mix_to_dac(mix[i]) == dac)
17851 /* look for an empty DAC slot */
17852 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
17854 struct alc_spec *spec = codec->spec;
17858 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
17861 for (i = 0; i < num; i++) {
17862 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
17865 for (j = 0; j < spec->multiout.num_dacs; j++)
17866 if (spec->multiout.dac_nids[j] == nid)
17868 if (j >= spec->multiout.num_dacs)
17874 /* fill in the dac_nids table from the parsed pin configuration */
17875 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
17876 const struct auto_pin_cfg *cfg)
17878 struct alc_spec *spec = codec->spec;
17882 spec->multiout.dac_nids = spec->private_dac_nids;
17883 for (i = 0; i < cfg->line_outs; i++) {
17884 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
17887 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
17892 static inline int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
17893 hda_nid_t nid, unsigned int chs)
17895 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
17896 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
17899 static inline int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
17900 hda_nid_t nid, unsigned int chs)
17902 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17903 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
17906 #define alc662_add_stereo_vol(spec, pfx, nid) \
17907 alc662_add_vol_ctl(spec, pfx, nid, 3)
17908 #define alc662_add_stereo_sw(spec, pfx, nid) \
17909 alc662_add_sw_ctl(spec, pfx, nid, 3)
17911 /* add playback controls from the parsed DAC table */
17912 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
17913 const struct auto_pin_cfg *cfg)
17915 struct alc_spec *spec = codec->spec;
17916 static const char *chname[4] = {
17917 "Front", "Surround", NULL /*CLFE*/, "Side"
17919 hda_nid_t nid, mix;
17922 for (i = 0; i < cfg->line_outs; i++) {
17923 nid = spec->multiout.dac_nids[i];
17926 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
17931 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
17934 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
17937 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
17940 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
17945 if (cfg->line_outs == 1 &&
17946 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
17953 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
17956 if (cfg->line_outs == 1 &&
17957 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
17959 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
17967 /* add playback controls for speaker and HP outputs */
17968 /* return DAC nid if any new DAC is assigned */
17969 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
17972 struct alc_spec *spec = codec->spec;
17973 hda_nid_t nid, mix;
17978 nid = alc662_look_for_dac(codec, pin);
17980 /* the corresponding DAC is already occupied */
17981 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
17982 return 0; /* no way */
17983 /* create a switch only */
17984 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17985 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17988 mix = alc662_dac_to_mix(codec, pin, nid);
17991 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
17994 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
18000 /* create playback/capture controls for input pins */
18001 #define alc662_auto_create_input_ctls \
18002 alc882_auto_create_input_ctls
18004 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
18005 hda_nid_t nid, int pin_type,
18011 alc_set_pin_output(codec, nid, pin_type);
18012 /* need the manual connection? */
18013 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
18016 for (i = 0; i < num; i++) {
18017 if (alc662_mix_to_dac(srcs[i]) != dac)
18019 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
18024 static void alc662_auto_init_multi_out(struct hda_codec *codec)
18026 struct alc_spec *spec = codec->spec;
18027 int pin_type = get_pin_type(spec->autocfg.line_out_type);
18030 for (i = 0; i <= HDA_SIDE; i++) {
18031 hda_nid_t nid = spec->autocfg.line_out_pins[i];
18033 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
18034 spec->multiout.dac_nids[i]);
18038 static void alc662_auto_init_hp_out(struct hda_codec *codec)
18040 struct alc_spec *spec = codec->spec;
18043 pin = spec->autocfg.hp_pins[0];
18045 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
18046 spec->multiout.hp_nid);
18047 pin = spec->autocfg.speaker_pins[0];
18049 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
18050 spec->multiout.extra_out_nid[0]);
18053 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
18055 static void alc662_auto_init_analog_input(struct hda_codec *codec)
18057 struct alc_spec *spec = codec->spec;
18060 for (i = 0; i < AUTO_PIN_LAST; i++) {
18061 hda_nid_t nid = spec->autocfg.input_pins[i];
18062 if (alc_is_input_pin(codec, nid)) {
18063 alc_set_input_pin(codec, nid, i);
18064 if (nid != ALC662_PIN_CD_NID &&
18065 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
18066 snd_hda_codec_write(codec, nid, 0,
18067 AC_VERB_SET_AMP_GAIN_MUTE,
18073 #define alc662_auto_init_input_src alc882_auto_init_input_src
18075 static int alc662_parse_auto_config(struct hda_codec *codec)
18077 struct alc_spec *spec = codec->spec;
18079 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
18081 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
18085 if (!spec->autocfg.line_outs)
18086 return 0; /* can't find valid BIOS pin config */
18088 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
18091 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
18094 err = alc662_auto_create_extra_out(codec,
18095 spec->autocfg.speaker_pins[0],
18100 spec->multiout.extra_out_nid[0] = err;
18101 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
18106 spec->multiout.hp_nid = err;
18107 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
18111 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
18113 if (spec->autocfg.dig_outs)
18114 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
18116 if (spec->kctls.list)
18117 add_mixer(spec, spec->kctls.list);
18119 spec->num_mux_defs = 1;
18120 spec->input_mux = &spec->private_imux[0];
18122 add_verb(spec, alc662_init_verbs);
18123 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
18124 codec->vendor_id == 0x10ec0665)
18125 add_verb(spec, alc663_init_verbs);
18127 if (codec->vendor_id == 0x10ec0272)
18128 add_verb(spec, alc272_init_verbs);
18130 err = alc_auto_add_mic_boost(codec);
18134 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
18139 /* additional initialization for auto-configuration model */
18140 static void alc662_auto_init(struct hda_codec *codec)
18142 struct alc_spec *spec = codec->spec;
18143 alc662_auto_init_multi_out(codec);
18144 alc662_auto_init_hp_out(codec);
18145 alc662_auto_init_analog_input(codec);
18146 alc662_auto_init_input_src(codec);
18147 if (spec->unsol_event)
18148 alc_inithook(codec);
18151 static int patch_alc662(struct hda_codec *codec)
18153 struct alc_spec *spec;
18154 int err, board_config;
18156 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
18160 codec->spec = spec;
18162 alc_fix_pll_init(codec, 0x20, 0x04, 15);
18164 if (alc_read_coef_idx(codec, 0)==0x8020){
18165 kfree(codec->chip_name);
18166 codec->chip_name = kstrdup("ALC661", GFP_KERNEL);
18167 if (!codec->chip_name) {
18173 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
18176 if (board_config < 0) {
18177 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
18179 board_config = ALC662_AUTO;
18182 if (board_config == ALC662_AUTO) {
18183 /* automatic parse from the BIOS config */
18184 err = alc662_parse_auto_config(codec);
18190 "hda_codec: Cannot set up configuration "
18191 "from BIOS. Using base mode...\n");
18192 board_config = ALC662_3ST_2ch_DIG;
18196 err = snd_hda_attach_beep_device(codec, 0x1);
18202 if (board_config != ALC662_AUTO)
18203 setup_preset(codec, &alc662_presets[board_config]);
18205 spec->stream_analog_playback = &alc662_pcm_analog_playback;
18206 spec->stream_analog_capture = &alc662_pcm_analog_capture;
18208 spec->stream_digital_playback = &alc662_pcm_digital_playback;
18209 spec->stream_digital_capture = &alc662_pcm_digital_capture;
18211 if (!spec->adc_nids) {
18212 spec->adc_nids = alc662_adc_nids;
18213 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
18215 if (!spec->capsrc_nids)
18216 spec->capsrc_nids = alc662_capsrc_nids;
18218 if (!spec->cap_mixer)
18219 set_capture_mixer(codec);
18221 switch (codec->vendor_id) {
18223 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
18228 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
18231 set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
18234 spec->vmaster_nid = 0x02;
18236 codec->patch_ops = alc_patch_ops;
18237 if (board_config == ALC662_AUTO)
18238 spec->init_hook = alc662_auto_init;
18239 #ifdef CONFIG_SND_HDA_POWER_SAVE
18240 if (!spec->loopback.amplist)
18241 spec->loopback.amplist = alc662_loopbacks;
18247 static int patch_alc888(struct hda_codec *codec)
18249 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
18250 kfree(codec->chip_name);
18251 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
18252 if (!codec->chip_name) {
18256 return patch_alc662(codec);
18258 return patch_alc882(codec);
18264 static struct hda_codec_preset snd_hda_preset_realtek[] = {
18265 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
18266 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
18267 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
18268 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
18269 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
18270 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
18271 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
18272 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
18273 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
18274 .patch = patch_alc861 },
18275 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
18276 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
18277 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
18278 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
18279 .patch = patch_alc882 },
18280 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
18281 .patch = patch_alc662 },
18282 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
18283 { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
18284 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
18285 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
18286 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
18287 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
18288 .patch = patch_alc882 },
18289 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
18290 .patch = patch_alc882 },
18291 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
18292 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
18293 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
18294 .patch = patch_alc882 },
18295 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
18296 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
18297 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
18298 {} /* terminator */
18301 MODULE_ALIAS("snd-hda-codec-id:10ec*");
18303 MODULE_LICENSE("GPL");
18304 MODULE_DESCRIPTION("Realtek HD-audio codec");
18306 static struct hda_codec_preset_list realtek_list = {
18307 .preset = snd_hda_preset_realtek,
18308 .owner = THIS_MODULE,
18311 static int __init patch_realtek_init(void)
18313 return snd_hda_add_codec_preset(&realtek_list);
18316 static void __exit patch_realtek_exit(void)
18318 snd_hda_delete_codec_preset(&realtek_list);
18321 module_init(patch_realtek_init)
18322 module_exit(patch_realtek_exit)