2 * Universal Interface for Intel High Definition Audio Codec
4 * HD audio interface patch for ALC 260/880/882 codecs
6 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
7 * PeiSen Hou <pshou@realtek.com.tw>
8 * Takashi Iwai <tiwai@suse.de>
9 * Jonathan Woithe <jwoithe@physics.adelaide.edu.au>
11 * This driver is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This driver is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include <linux/init.h>
27 #include <linux/delay.h>
28 #include <linux/slab.h>
29 #include <linux/pci.h>
30 #include <sound/core.h>
31 #include <sound/jack.h>
32 #include "hda_codec.h"
33 #include "hda_local.h"
36 #define ALC880_FRONT_EVENT 0x01
37 #define ALC880_DCVOL_EVENT 0x02
38 #define ALC880_HP_EVENT 0x04
39 #define ALC880_MIC_EVENT 0x08
41 /* ALC880 board config type */
65 #ifdef CONFIG_SND_DEBUG
69 ALC880_MODEL_LAST /* last tag */
83 #ifdef CONFIG_SND_DEBUG
87 ALC260_MODEL_LAST /* last tag */
97 ALC262_HP_BPC_D7000_WL,
98 ALC262_HP_BPC_D7000_WF,
111 ALC262_MODEL_LAST /* last tag */
121 ALC268_ACER_ASPIRE_ONE,
124 #ifdef CONFIG_SND_DEBUG
128 ALC268_MODEL_LAST /* last tag */
143 ALC269_MODEL_LAST /* last tag */
160 /* ALC861-VD models */
182 ALC662_ASUS_EEEPC_P701,
183 ALC662_ASUS_EEEPC_EP20,
225 ALC883_TARGA_2ch_DIG,
226 ALC883_TARGA_8ch_DIG,
229 ALC888_ACER_ASPIRE_4930G,
230 ALC888_ACER_ASPIRE_6530G,
231 ALC888_ACER_ASPIRE_8930G,
232 ALC888_ACER_ASPIRE_7730G,
234 ALC883_MEDION_WIM2160,
236 ALC883_LENOVO_101E_2ch,
237 ALC883_LENOVO_NB0763,
238 ALC888_LENOVO_MS7195_DIG,
246 ALC883_FUJITSU_PI2515,
247 ALC888_FUJITSU_XA3530,
248 ALC883_3ST_6ch_INTEL,
268 #define GPIO_MASK 0x03
270 /* extra amp-initialization sequence types */
279 struct alc_mic_route {
281 unsigned char mux_idx;
282 unsigned char amix_idx;
285 #define MUX_IDX_UNDEF ((unsigned char)-1)
287 struct alc_customize_define {
288 unsigned int sku_cfg;
289 unsigned char port_connectivity;
290 unsigned char check_sum;
291 unsigned char customization;
292 unsigned char external_amp;
293 unsigned int enable_pcbeep:1;
294 unsigned int platform_type:1;
296 unsigned int override:1;
297 unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */
302 struct alc_multi_io {
303 hda_nid_t pin; /* multi-io widget pin NID */
304 hda_nid_t dac; /* DAC to be connected */
305 unsigned int ctl_in; /* cached input-pin control value */
309 ALC_AUTOMUTE_PIN, /* change the pin control */
310 ALC_AUTOMUTE_AMP, /* mute/unmute the pin AMP */
311 ALC_AUTOMUTE_MIXER, /* mute/unmute mixer widget AMP */
315 /* codec parameterization */
316 const struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
317 unsigned int num_mixers;
318 const struct snd_kcontrol_new *cap_mixer; /* capture mixer */
319 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
321 const struct hda_verb *init_verbs[10]; /* initialization verbs
325 unsigned int num_init_verbs;
327 char stream_name_analog[32]; /* analog PCM stream */
328 const struct hda_pcm_stream *stream_analog_playback;
329 const struct hda_pcm_stream *stream_analog_capture;
330 const struct hda_pcm_stream *stream_analog_alt_playback;
331 const struct hda_pcm_stream *stream_analog_alt_capture;
333 char stream_name_digital[32]; /* digital PCM stream */
334 const struct hda_pcm_stream *stream_digital_playback;
335 const struct hda_pcm_stream *stream_digital_capture;
338 struct hda_multi_out multiout; /* playback set-up
339 * max_channels, dacs must be set
340 * dig_out_nid and hp_nid are optional
342 hda_nid_t alt_dac_nid;
343 hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */
347 unsigned int num_adc_nids;
348 const hda_nid_t *adc_nids;
349 const hda_nid_t *capsrc_nids;
350 hda_nid_t dig_in_nid; /* digital-in NID; optional */
351 hda_nid_t mixer_nid; /* analog-mixer NID */
353 /* capture setup for dynamic dual-adc switch */
354 unsigned int cur_adc_idx;
356 unsigned int cur_adc_stream_tag;
357 unsigned int cur_adc_format;
360 unsigned int num_mux_defs;
361 const struct hda_input_mux *input_mux;
362 unsigned int cur_mux[3];
363 struct alc_mic_route ext_mic;
364 struct alc_mic_route dock_mic;
365 struct alc_mic_route int_mic;
368 const struct hda_channel_mode *channel_mode;
369 int num_channel_mode;
371 int const_channel_count;
372 int ext_channel_count;
374 /* PCM information */
375 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
377 /* dynamic controls, init_verbs and input_mux */
378 struct auto_pin_cfg autocfg;
379 struct alc_customize_define cdefine;
380 struct snd_array kctls;
381 struct hda_input_mux private_imux[3];
382 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
383 hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS];
384 hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS];
387 void (*init_hook)(struct hda_codec *codec);
388 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
389 #ifdef CONFIG_SND_HDA_POWER_SAVE
390 void (*power_hook)(struct hda_codec *codec);
392 void (*shutup)(struct hda_codec *codec);
394 /* for pin sensing */
395 unsigned int jack_present: 1;
396 unsigned int line_jack_present:1;
397 unsigned int master_mute:1;
398 unsigned int auto_mic:1;
399 unsigned int automute:1; /* HP automute enabled */
400 unsigned int detect_line:1; /* Line-out detection enabled */
401 unsigned int automute_lines:1; /* automute line-out as well */
402 unsigned int automute_hp_lo:1; /* both HP and LO available */
405 unsigned int no_analog :1; /* digital I/O only */
406 unsigned int dual_adc_switch:1; /* switch ADCs (for ALC275) */
407 unsigned int single_input_src:1;
409 /* auto-mute control */
411 hda_nid_t automute_mixer_nid[AUTO_CFG_MAX_OUTS];
414 int codec_variant; /* flag for other variants */
416 /* for virtual master */
417 hda_nid_t vmaster_nid;
418 #ifdef CONFIG_SND_HDA_POWER_SAVE
419 struct hda_loopback_check loopback;
424 unsigned int pll_coef_idx, pll_coef_bit;
428 const struct alc_fixup *fixup_list;
429 const char *fixup_name;
433 struct alc_multi_io multi_io[4];
437 * configuration template - to be copied to the spec instance
439 struct alc_config_preset {
440 const struct snd_kcontrol_new *mixers[5]; /* should be identical size
443 const struct snd_kcontrol_new *cap_mixer; /* capture mixer */
444 const struct hda_verb *init_verbs[5];
445 unsigned int num_dacs;
446 const hda_nid_t *dac_nids;
447 hda_nid_t dig_out_nid; /* optional */
448 hda_nid_t hp_nid; /* optional */
449 const hda_nid_t *slave_dig_outs;
450 unsigned int num_adc_nids;
451 const hda_nid_t *adc_nids;
452 const hda_nid_t *capsrc_nids;
453 hda_nid_t dig_in_nid;
454 unsigned int num_channel_mode;
455 const struct hda_channel_mode *channel_mode;
457 int const_channel_count;
458 unsigned int num_mux_defs;
459 const struct hda_input_mux *input_mux;
460 void (*unsol_event)(struct hda_codec *, unsigned int);
461 void (*setup)(struct hda_codec *);
462 void (*init_hook)(struct hda_codec *);
463 #ifdef CONFIG_SND_HDA_POWER_SAVE
464 const struct hda_amp_list *loopbacks;
465 void (*power_hook)(struct hda_codec *codec);
473 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
474 struct snd_ctl_elem_info *uinfo)
476 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
477 struct alc_spec *spec = codec->spec;
478 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
479 if (mux_idx >= spec->num_mux_defs)
481 if (!spec->input_mux[mux_idx].num_items && mux_idx > 0)
483 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
486 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
487 struct snd_ctl_elem_value *ucontrol)
489 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
490 struct alc_spec *spec = codec->spec;
491 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
493 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
497 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
498 struct snd_ctl_elem_value *ucontrol)
500 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
501 struct alc_spec *spec = codec->spec;
502 const struct hda_input_mux *imux;
503 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
504 unsigned int mux_idx;
505 hda_nid_t nid = spec->capsrc_nids ?
506 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
509 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
510 imux = &spec->input_mux[mux_idx];
511 if (!imux->num_items && mux_idx > 0)
512 imux = &spec->input_mux[0];
514 type = get_wcaps_type(get_wcaps(codec, nid));
515 if (type == AC_WID_AUD_MIX) {
516 /* Matrix-mixer style (e.g. ALC882) */
517 unsigned int *cur_val = &spec->cur_mux[adc_idx];
520 idx = ucontrol->value.enumerated.item[0];
521 if (idx >= imux->num_items)
522 idx = imux->num_items - 1;
525 for (i = 0; i < imux->num_items; i++) {
526 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
527 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
528 imux->items[i].index,
534 /* MUX style (e.g. ALC880) */
535 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
536 &spec->cur_mux[adc_idx]);
541 * channel mode setting
543 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
544 struct snd_ctl_elem_info *uinfo)
546 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
547 struct alc_spec *spec = codec->spec;
548 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
549 spec->num_channel_mode);
552 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
553 struct snd_ctl_elem_value *ucontrol)
555 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
556 struct alc_spec *spec = codec->spec;
557 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
558 spec->num_channel_mode,
559 spec->ext_channel_count);
562 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
563 struct snd_ctl_elem_value *ucontrol)
565 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
566 struct alc_spec *spec = codec->spec;
567 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
568 spec->num_channel_mode,
569 &spec->ext_channel_count);
570 if (err >= 0 && !spec->const_channel_count) {
571 spec->multiout.max_channels = spec->ext_channel_count;
572 if (spec->need_dac_fix)
573 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
579 * Control the mode of pin widget settings via the mixer. "pc" is used
580 * instead of "%" to avoid consequences of accidentally treating the % as
581 * being part of a format specifier. Maximum allowed length of a value is
582 * 63 characters plus NULL terminator.
584 * Note: some retasking pin complexes seem to ignore requests for input
585 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
586 * are requested. Therefore order this list so that this behaviour will not
587 * cause problems when mixer clients move through the enum sequentially.
588 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
591 static const char * const alc_pin_mode_names[] = {
592 "Mic 50pc bias", "Mic 80pc bias",
593 "Line in", "Line out", "Headphone out",
595 static const unsigned char alc_pin_mode_values[] = {
596 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
598 /* The control can present all 5 options, or it can limit the options based
599 * in the pin being assumed to be exclusively an input or an output pin. In
600 * addition, "input" pins may or may not process the mic bias option
601 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
602 * accept requests for bias as of chip versions up to March 2006) and/or
603 * wiring in the computer.
605 #define ALC_PIN_DIR_IN 0x00
606 #define ALC_PIN_DIR_OUT 0x01
607 #define ALC_PIN_DIR_INOUT 0x02
608 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
609 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
611 /* Info about the pin modes supported by the different pin direction modes.
612 * For each direction the minimum and maximum values are given.
614 static const signed char alc_pin_mode_dir_info[5][2] = {
615 { 0, 2 }, /* ALC_PIN_DIR_IN */
616 { 3, 4 }, /* ALC_PIN_DIR_OUT */
617 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
618 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
619 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
621 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
622 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
623 #define alc_pin_mode_n_items(_dir) \
624 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
626 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
627 struct snd_ctl_elem_info *uinfo)
629 unsigned int item_num = uinfo->value.enumerated.item;
630 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
632 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
634 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
636 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
637 item_num = alc_pin_mode_min(dir);
638 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
642 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
643 struct snd_ctl_elem_value *ucontrol)
646 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
647 hda_nid_t nid = kcontrol->private_value & 0xffff;
648 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
649 long *valp = ucontrol->value.integer.value;
650 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
651 AC_VERB_GET_PIN_WIDGET_CONTROL,
654 /* Find enumerated value for current pinctl setting */
655 i = alc_pin_mode_min(dir);
656 while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl)
658 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
662 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
663 struct snd_ctl_elem_value *ucontrol)
666 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
667 hda_nid_t nid = kcontrol->private_value & 0xffff;
668 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
669 long val = *ucontrol->value.integer.value;
670 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
671 AC_VERB_GET_PIN_WIDGET_CONTROL,
674 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
675 val = alc_pin_mode_min(dir);
677 change = pinctl != alc_pin_mode_values[val];
679 /* Set pin mode to that requested */
680 snd_hda_codec_write_cache(codec, nid, 0,
681 AC_VERB_SET_PIN_WIDGET_CONTROL,
682 alc_pin_mode_values[val]);
684 /* Also enable the retasking pin's input/output as required
685 * for the requested pin mode. Enum values of 2 or less are
688 * Dynamically switching the input/output buffers probably
689 * reduces noise slightly (particularly on input) so we'll
690 * do it. However, having both input and output buffers
691 * enabled simultaneously doesn't seem to be problematic if
692 * this turns out to be necessary in the future.
695 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
696 HDA_AMP_MUTE, HDA_AMP_MUTE);
697 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
700 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
701 HDA_AMP_MUTE, HDA_AMP_MUTE);
702 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
709 #define ALC_PIN_MODE(xname, nid, dir) \
710 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
711 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
712 .info = alc_pin_mode_info, \
713 .get = alc_pin_mode_get, \
714 .put = alc_pin_mode_put, \
715 .private_value = nid | (dir<<16) }
717 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
718 * together using a mask with more than one bit set. This control is
719 * currently used only by the ALC260 test model. At this stage they are not
720 * needed for any "production" models.
722 #ifdef CONFIG_SND_DEBUG
723 #define alc_gpio_data_info snd_ctl_boolean_mono_info
725 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
726 struct snd_ctl_elem_value *ucontrol)
728 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
729 hda_nid_t nid = kcontrol->private_value & 0xffff;
730 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
731 long *valp = ucontrol->value.integer.value;
732 unsigned int val = snd_hda_codec_read(codec, nid, 0,
733 AC_VERB_GET_GPIO_DATA, 0x00);
735 *valp = (val & mask) != 0;
738 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
739 struct snd_ctl_elem_value *ucontrol)
742 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
743 hda_nid_t nid = kcontrol->private_value & 0xffff;
744 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
745 long val = *ucontrol->value.integer.value;
746 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
747 AC_VERB_GET_GPIO_DATA,
750 /* Set/unset the masked GPIO bit(s) as needed */
751 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
756 snd_hda_codec_write_cache(codec, nid, 0,
757 AC_VERB_SET_GPIO_DATA, gpio_data);
761 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
762 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
763 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
764 .info = alc_gpio_data_info, \
765 .get = alc_gpio_data_get, \
766 .put = alc_gpio_data_put, \
767 .private_value = nid | (mask<<16) }
768 #endif /* CONFIG_SND_DEBUG */
770 /* A switch control to allow the enabling of the digital IO pins on the
771 * ALC260. This is incredibly simplistic; the intention of this control is
772 * to provide something in the test model allowing digital outputs to be
773 * identified if present. If models are found which can utilise these
774 * outputs a more complete mixer control can be devised for those models if
777 #ifdef CONFIG_SND_DEBUG
778 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
780 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
781 struct snd_ctl_elem_value *ucontrol)
783 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
784 hda_nid_t nid = kcontrol->private_value & 0xffff;
785 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
786 long *valp = ucontrol->value.integer.value;
787 unsigned int val = snd_hda_codec_read(codec, nid, 0,
788 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
790 *valp = (val & mask) != 0;
793 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
794 struct snd_ctl_elem_value *ucontrol)
797 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
798 hda_nid_t nid = kcontrol->private_value & 0xffff;
799 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
800 long val = *ucontrol->value.integer.value;
801 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
802 AC_VERB_GET_DIGI_CONVERT_1,
805 /* Set/unset the masked control bit(s) as needed */
806 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
811 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
816 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
817 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
818 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
819 .info = alc_spdif_ctrl_info, \
820 .get = alc_spdif_ctrl_get, \
821 .put = alc_spdif_ctrl_put, \
822 .private_value = nid | (mask<<16) }
823 #endif /* CONFIG_SND_DEBUG */
825 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
826 * Again, this is only used in the ALC26x test models to help identify when
827 * the EAPD line must be asserted for features to work.
829 #ifdef CONFIG_SND_DEBUG
830 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
832 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
833 struct snd_ctl_elem_value *ucontrol)
835 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
836 hda_nid_t nid = kcontrol->private_value & 0xffff;
837 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
838 long *valp = ucontrol->value.integer.value;
839 unsigned int val = snd_hda_codec_read(codec, nid, 0,
840 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
842 *valp = (val & mask) != 0;
846 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
847 struct snd_ctl_elem_value *ucontrol)
850 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
851 hda_nid_t nid = kcontrol->private_value & 0xffff;
852 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
853 long val = *ucontrol->value.integer.value;
854 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
855 AC_VERB_GET_EAPD_BTLENABLE,
858 /* Set/unset the masked control bit(s) as needed */
859 change = (!val ? 0 : mask) != (ctrl_data & mask);
864 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
870 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
871 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
872 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
873 .info = alc_eapd_ctrl_info, \
874 .get = alc_eapd_ctrl_get, \
875 .put = alc_eapd_ctrl_put, \
876 .private_value = nid | (mask<<16) }
877 #endif /* CONFIG_SND_DEBUG */
880 * set up the input pin config (depending on the given auto-pin type)
882 static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
885 unsigned int val = PIN_IN;
887 if (auto_pin_type == AUTO_PIN_MIC) {
890 oldval = snd_hda_codec_read(codec, nid, 0,
891 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
892 pincap = snd_hda_query_pin_caps(codec, nid);
893 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
894 /* if the default pin setup is vref50, we give it priority */
895 if ((pincap & AC_PINCAP_VREF_80) && oldval != PIN_VREF50)
897 else if (pincap & AC_PINCAP_VREF_50)
899 else if (pincap & AC_PINCAP_VREF_100)
901 else if (pincap & AC_PINCAP_VREF_GRD)
904 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val);
907 static void alc_fixup_autocfg_pin_nums(struct hda_codec *codec)
909 struct alc_spec *spec = codec->spec;
910 struct auto_pin_cfg *cfg = &spec->autocfg;
912 if (!cfg->line_outs) {
913 while (cfg->line_outs < AUTO_CFG_MAX_OUTS &&
914 cfg->line_out_pins[cfg->line_outs])
917 if (!cfg->speaker_outs) {
918 while (cfg->speaker_outs < AUTO_CFG_MAX_OUTS &&
919 cfg->speaker_pins[cfg->speaker_outs])
923 while (cfg->hp_outs < AUTO_CFG_MAX_OUTS &&
924 cfg->hp_pins[cfg->hp_outs])
931 static void add_mixer(struct alc_spec *spec, const struct snd_kcontrol_new *mix)
933 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
935 spec->mixers[spec->num_mixers++] = mix;
938 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
940 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
942 spec->init_verbs[spec->num_init_verbs++] = verb;
946 * set up from the preset table
948 static void setup_preset(struct hda_codec *codec,
949 const struct alc_config_preset *preset)
951 struct alc_spec *spec = codec->spec;
954 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
955 add_mixer(spec, preset->mixers[i]);
956 spec->cap_mixer = preset->cap_mixer;
957 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
959 add_verb(spec, preset->init_verbs[i]);
961 spec->channel_mode = preset->channel_mode;
962 spec->num_channel_mode = preset->num_channel_mode;
963 spec->need_dac_fix = preset->need_dac_fix;
964 spec->const_channel_count = preset->const_channel_count;
966 if (preset->const_channel_count)
967 spec->multiout.max_channels = preset->const_channel_count;
969 spec->multiout.max_channels = spec->channel_mode[0].channels;
970 spec->ext_channel_count = spec->channel_mode[0].channels;
972 spec->multiout.num_dacs = preset->num_dacs;
973 spec->multiout.dac_nids = preset->dac_nids;
974 spec->multiout.dig_out_nid = preset->dig_out_nid;
975 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
976 spec->multiout.hp_nid = preset->hp_nid;
978 spec->num_mux_defs = preset->num_mux_defs;
979 if (!spec->num_mux_defs)
980 spec->num_mux_defs = 1;
981 spec->input_mux = preset->input_mux;
983 spec->num_adc_nids = preset->num_adc_nids;
984 spec->adc_nids = preset->adc_nids;
985 spec->capsrc_nids = preset->capsrc_nids;
986 spec->dig_in_nid = preset->dig_in_nid;
988 spec->unsol_event = preset->unsol_event;
989 spec->init_hook = preset->init_hook;
990 #ifdef CONFIG_SND_HDA_POWER_SAVE
991 spec->power_hook = preset->power_hook;
992 spec->loopback.amplist = preset->loopbacks;
996 preset->setup(codec);
998 alc_fixup_autocfg_pin_nums(codec);
1001 /* Enable GPIO mask and set output */
1002 static const struct hda_verb alc_gpio1_init_verbs[] = {
1003 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
1004 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
1005 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
1009 static const struct hda_verb alc_gpio2_init_verbs[] = {
1010 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
1011 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
1012 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
1016 static const struct hda_verb alc_gpio3_init_verbs[] = {
1017 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
1018 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
1019 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
1024 * Fix hardware PLL issue
1025 * On some codecs, the analog PLL gating control must be off while
1026 * the default value is 1.
1028 static void alc_fix_pll(struct hda_codec *codec)
1030 struct alc_spec *spec = codec->spec;
1035 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
1036 spec->pll_coef_idx);
1037 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
1038 AC_VERB_GET_PROC_COEF, 0);
1039 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
1040 spec->pll_coef_idx);
1041 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
1042 val & ~(1 << spec->pll_coef_bit));
1045 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
1046 unsigned int coef_idx, unsigned int coef_bit)
1048 struct alc_spec *spec = codec->spec;
1049 spec->pll_nid = nid;
1050 spec->pll_coef_idx = coef_idx;
1051 spec->pll_coef_bit = coef_bit;
1055 static int alc_init_jacks(struct hda_codec *codec)
1057 #ifdef CONFIG_SND_HDA_INPUT_JACK
1058 struct alc_spec *spec = codec->spec;
1060 unsigned int hp_nid = spec->autocfg.hp_pins[0];
1061 unsigned int mic_nid = spec->ext_mic.pin;
1062 unsigned int dock_nid = spec->dock_mic.pin;
1065 err = snd_hda_input_jack_add(codec, hp_nid,
1066 SND_JACK_HEADPHONE, NULL);
1069 snd_hda_input_jack_report(codec, hp_nid);
1073 err = snd_hda_input_jack_add(codec, mic_nid,
1074 SND_JACK_MICROPHONE, NULL);
1077 snd_hda_input_jack_report(codec, mic_nid);
1080 err = snd_hda_input_jack_add(codec, dock_nid,
1081 SND_JACK_MICROPHONE, NULL);
1084 snd_hda_input_jack_report(codec, dock_nid);
1086 #endif /* CONFIG_SND_HDA_INPUT_JACK */
1090 static int detect_jacks(struct hda_codec *codec, int num_pins, hda_nid_t *pins)
1094 for (i = 0; i < num_pins; i++) {
1095 hda_nid_t nid = pins[i];
1098 snd_hda_input_jack_report(codec, nid);
1099 present |= snd_hda_jack_detect(codec, nid);
1104 static void do_automute(struct hda_codec *codec, int num_pins, hda_nid_t *pins,
1105 bool mute, bool hp_out)
1107 struct alc_spec *spec = codec->spec;
1108 unsigned int mute_bits = mute ? HDA_AMP_MUTE : 0;
1109 unsigned int pin_bits = mute ? 0 : (hp_out ? PIN_HP : PIN_OUT);
1112 for (i = 0; i < num_pins; i++) {
1113 hda_nid_t nid = pins[i];
1116 switch (spec->automute_mode) {
1117 case ALC_AUTOMUTE_PIN:
1118 snd_hda_codec_write(codec, nid, 0,
1119 AC_VERB_SET_PIN_WIDGET_CONTROL,
1122 case ALC_AUTOMUTE_AMP:
1123 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1124 HDA_AMP_MUTE, mute_bits);
1126 case ALC_AUTOMUTE_MIXER:
1127 nid = spec->automute_mixer_nid[i];
1130 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
1131 HDA_AMP_MUTE, mute_bits);
1132 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 1,
1133 HDA_AMP_MUTE, mute_bits);
1139 /* Toggle internal speakers muting */
1140 static void update_speakers(struct hda_codec *codec)
1142 struct alc_spec *spec = codec->spec;
1145 /* Control HP pins/amps depending on master_mute state;
1146 * in general, HP pins/amps control should be enabled in all cases,
1147 * but currently set only for master_mute, just to be safe
1149 do_automute(codec, ARRAY_SIZE(spec->autocfg.hp_pins),
1150 spec->autocfg.hp_pins, spec->master_mute, true);
1152 if (!spec->automute)
1155 on = spec->jack_present | spec->line_jack_present;
1156 on |= spec->master_mute;
1157 do_automute(codec, ARRAY_SIZE(spec->autocfg.speaker_pins),
1158 spec->autocfg.speaker_pins, on, false);
1160 /* toggle line-out mutes if needed, too */
1161 /* if LO is a copy of either HP or Speaker, don't need to handle it */
1162 if (spec->autocfg.line_out_pins[0] == spec->autocfg.hp_pins[0] ||
1163 spec->autocfg.line_out_pins[0] == spec->autocfg.speaker_pins[0])
1165 if (!spec->automute_lines || !spec->automute)
1168 on = spec->jack_present;
1169 on |= spec->master_mute;
1170 do_automute(codec, ARRAY_SIZE(spec->autocfg.line_out_pins),
1171 spec->autocfg.line_out_pins, on, false);
1174 static void alc_hp_automute(struct hda_codec *codec)
1176 struct alc_spec *spec = codec->spec;
1178 if (!spec->automute)
1180 spec->jack_present =
1181 detect_jacks(codec, ARRAY_SIZE(spec->autocfg.hp_pins),
1182 spec->autocfg.hp_pins);
1183 update_speakers(codec);
1186 static void alc_line_automute(struct hda_codec *codec)
1188 struct alc_spec *spec = codec->spec;
1190 if (!spec->automute || !spec->detect_line)
1192 spec->line_jack_present =
1193 detect_jacks(codec, ARRAY_SIZE(spec->autocfg.line_out_pins),
1194 spec->autocfg.line_out_pins);
1195 update_speakers(codec);
1198 #define get_connection_index(codec, mux, nid) \
1199 snd_hda_get_conn_index(codec, mux, nid, 0)
1201 /* switch the current ADC according to the jack state */
1202 static void alc_dual_mic_adc_auto_switch(struct hda_codec *codec)
1204 struct alc_spec *spec = codec->spec;
1205 unsigned int present;
1208 present = snd_hda_jack_detect(codec, spec->ext_mic.pin);
1210 spec->cur_adc_idx = 1;
1212 spec->cur_adc_idx = 0;
1213 new_adc = spec->adc_nids[spec->cur_adc_idx];
1214 if (spec->cur_adc && spec->cur_adc != new_adc) {
1215 /* stream is running, let's swap the current ADC */
1216 __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1);
1217 spec->cur_adc = new_adc;
1218 snd_hda_codec_setup_stream(codec, new_adc,
1219 spec->cur_adc_stream_tag, 0,
1220 spec->cur_adc_format);
1224 static void alc_mic_automute(struct hda_codec *codec)
1226 struct alc_spec *spec = codec->spec;
1227 struct alc_mic_route *dead1, *dead2, *alive;
1228 unsigned int present, type;
1231 if (!spec->auto_mic)
1233 if (!spec->int_mic.pin || !spec->ext_mic.pin)
1235 if (snd_BUG_ON(!spec->adc_nids))
1238 if (spec->dual_adc_switch) {
1239 alc_dual_mic_adc_auto_switch(codec);
1243 cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0];
1245 alive = &spec->int_mic;
1246 dead1 = &spec->ext_mic;
1247 dead2 = &spec->dock_mic;
1249 present = snd_hda_jack_detect(codec, spec->ext_mic.pin);
1251 alive = &spec->ext_mic;
1252 dead1 = &spec->int_mic;
1253 dead2 = &spec->dock_mic;
1255 if (!present && spec->dock_mic.pin > 0) {
1256 present = snd_hda_jack_detect(codec, spec->dock_mic.pin);
1258 alive = &spec->dock_mic;
1259 dead1 = &spec->int_mic;
1260 dead2 = &spec->ext_mic;
1262 snd_hda_input_jack_report(codec, spec->dock_mic.pin);
1265 type = get_wcaps_type(get_wcaps(codec, cap_nid));
1266 if (type == AC_WID_AUD_MIX) {
1267 /* Matrix-mixer style (e.g. ALC882) */
1268 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1272 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1274 HDA_AMP_MUTE, HDA_AMP_MUTE);
1276 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1278 HDA_AMP_MUTE, HDA_AMP_MUTE);
1280 /* MUX style (e.g. ALC880) */
1281 snd_hda_codec_write_cache(codec, cap_nid, 0,
1282 AC_VERB_SET_CONNECT_SEL,
1285 snd_hda_input_jack_report(codec, spec->ext_mic.pin);
1287 /* FIXME: analog mixer */
1290 /* unsolicited event for HP jack sensing */
1291 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
1293 if (codec->vendor_id == 0x10ec0880)
1298 case ALC880_HP_EVENT:
1299 alc_hp_automute(codec);
1301 case ALC880_FRONT_EVENT:
1302 alc_line_automute(codec);
1304 case ALC880_MIC_EVENT:
1305 alc_mic_automute(codec);
1310 static void alc_inithook(struct hda_codec *codec)
1312 alc_hp_automute(codec);
1313 alc_line_automute(codec);
1314 alc_mic_automute(codec);
1317 /* additional initialization for ALC888 variants */
1318 static void alc888_coef_init(struct hda_codec *codec)
1322 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
1323 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1324 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1325 if ((tmp & 0xf0) == 0x20)
1327 snd_hda_codec_read(codec, 0x20, 0,
1328 AC_VERB_SET_PROC_COEF, 0x830);
1331 snd_hda_codec_read(codec, 0x20, 0,
1332 AC_VERB_SET_PROC_COEF, 0x3030);
1335 static void alc889_coef_init(struct hda_codec *codec)
1339 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1340 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1341 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1342 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010);
1345 /* turn on/off EAPD control (only if available) */
1346 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
1348 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
1350 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
1351 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
1355 /* turn on/off EAPD controls of the codec */
1356 static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
1358 /* We currently only handle front, HP */
1359 static hda_nid_t pins[] = {
1360 0x0f, 0x10, 0x14, 0x15, 0
1363 for (p = pins; *p; p++)
1364 set_eapd(codec, *p, on);
1367 /* generic shutup callback;
1368 * just turning off EPAD and a little pause for avoiding pop-noise
1370 static void alc_eapd_shutup(struct hda_codec *codec)
1372 alc_auto_setup_eapd(codec, false);
1376 static void alc_auto_init_amp(struct hda_codec *codec, int type)
1380 alc_auto_setup_eapd(codec, true);
1382 case ALC_INIT_GPIO1:
1383 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1385 case ALC_INIT_GPIO2:
1386 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1388 case ALC_INIT_GPIO3:
1389 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1391 case ALC_INIT_DEFAULT:
1392 switch (codec->vendor_id) {
1394 snd_hda_codec_write(codec, 0x1a, 0,
1395 AC_VERB_SET_COEF_INDEX, 7);
1396 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1397 AC_VERB_GET_PROC_COEF, 0);
1398 snd_hda_codec_write(codec, 0x1a, 0,
1399 AC_VERB_SET_COEF_INDEX, 7);
1400 snd_hda_codec_write(codec, 0x1a, 0,
1401 AC_VERB_SET_PROC_COEF,
1410 /*case 0x10ec0889:*/ /* this causes an SPDIF problem */
1411 alc889_coef_init(codec);
1414 alc888_coef_init(codec);
1416 #if 0 /* XXX: This may cause the silent output on speaker on some machines */
1419 snd_hda_codec_write(codec, 0x20, 0,
1420 AC_VERB_SET_COEF_INDEX, 7);
1421 tmp = snd_hda_codec_read(codec, 0x20, 0,
1422 AC_VERB_GET_PROC_COEF, 0);
1423 snd_hda_codec_write(codec, 0x20, 0,
1424 AC_VERB_SET_COEF_INDEX, 7);
1425 snd_hda_codec_write(codec, 0x20, 0,
1426 AC_VERB_SET_PROC_COEF,
1435 static int alc_automute_mode_info(struct snd_kcontrol *kcontrol,
1436 struct snd_ctl_elem_info *uinfo)
1438 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1439 struct alc_spec *spec = codec->spec;
1440 static const char * const texts2[] = {
1441 "Disabled", "Enabled"
1443 static const char * const texts3[] = {
1444 "Disabled", "Speaker Only", "Line-Out+Speaker"
1446 const char * const *texts;
1448 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
1450 if (spec->automute_hp_lo) {
1451 uinfo->value.enumerated.items = 3;
1454 uinfo->value.enumerated.items = 2;
1457 if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
1458 uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1;
1459 strcpy(uinfo->value.enumerated.name,
1460 texts[uinfo->value.enumerated.item]);
1464 static int alc_automute_mode_get(struct snd_kcontrol *kcontrol,
1465 struct snd_ctl_elem_value *ucontrol)
1467 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1468 struct alc_spec *spec = codec->spec;
1470 if (!spec->automute)
1472 else if (!spec->automute_lines)
1476 ucontrol->value.enumerated.item[0] = val;
1480 static int alc_automute_mode_put(struct snd_kcontrol *kcontrol,
1481 struct snd_ctl_elem_value *ucontrol)
1483 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1484 struct alc_spec *spec = codec->spec;
1486 switch (ucontrol->value.enumerated.item[0]) {
1488 if (!spec->automute)
1493 if (spec->automute && !spec->automute_lines)
1496 spec->automute_lines = 0;
1499 if (!spec->automute_hp_lo)
1501 if (spec->automute && spec->automute_lines)
1504 spec->automute_lines = 1;
1509 update_speakers(codec);
1513 static const struct snd_kcontrol_new alc_automute_mode_enum = {
1514 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1515 .name = "Auto-Mute Mode",
1516 .info = alc_automute_mode_info,
1517 .get = alc_automute_mode_get,
1518 .put = alc_automute_mode_put,
1521 static struct snd_kcontrol_new *alc_kcontrol_new(struct alc_spec *spec);
1523 static int alc_add_automute_mode_enum(struct hda_codec *codec)
1525 struct alc_spec *spec = codec->spec;
1526 struct snd_kcontrol_new *knew;
1528 knew = alc_kcontrol_new(spec);
1531 *knew = alc_automute_mode_enum;
1532 knew->name = kstrdup("Auto-Mute Mode", GFP_KERNEL);
1538 static void alc_init_auto_hp(struct hda_codec *codec)
1540 struct alc_spec *spec = codec->spec;
1541 struct auto_pin_cfg *cfg = &spec->autocfg;
1545 if (cfg->hp_pins[0])
1547 if (cfg->line_out_pins[0])
1549 if (cfg->speaker_pins[0])
1551 if (present < 2) /* need two different output types */
1554 spec->automute_hp_lo = 1; /* both HP and LO automute */
1556 if (!cfg->speaker_pins[0]) {
1557 memcpy(cfg->speaker_pins, cfg->line_out_pins,
1558 sizeof(cfg->speaker_pins));
1559 cfg->speaker_outs = cfg->line_outs;
1562 if (!cfg->hp_pins[0]) {
1563 memcpy(cfg->hp_pins, cfg->line_out_pins,
1564 sizeof(cfg->hp_pins));
1565 cfg->hp_outs = cfg->line_outs;
1568 for (i = 0; i < cfg->hp_outs; i++) {
1569 hda_nid_t nid = cfg->hp_pins[i];
1570 if (!is_jack_detectable(codec, nid))
1572 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1574 snd_hda_codec_write_cache(codec, nid, 0,
1575 AC_VERB_SET_UNSOLICITED_ENABLE,
1576 AC_USRSP_EN | ALC880_HP_EVENT);
1578 spec->automute_mode = ALC_AUTOMUTE_PIN;
1580 if (spec->automute && cfg->line_out_pins[0] &&
1581 cfg->line_out_pins[0] != cfg->hp_pins[0] &&
1582 cfg->line_out_pins[0] != cfg->speaker_pins[0]) {
1583 for (i = 0; i < cfg->line_outs; i++) {
1584 hda_nid_t nid = cfg->line_out_pins[i];
1585 if (!is_jack_detectable(codec, nid))
1587 snd_printdd("realtek: Enable Line-Out auto-muting "
1588 "on NID 0x%x\n", nid);
1589 snd_hda_codec_write_cache(codec, nid, 0,
1590 AC_VERB_SET_UNSOLICITED_ENABLE,
1591 AC_USRSP_EN | ALC880_FRONT_EVENT);
1592 spec->detect_line = 1;
1594 spec->automute_lines = spec->detect_line;
1597 if (spec->automute) {
1598 /* create a control for automute mode */
1599 alc_add_automute_mode_enum(codec);
1600 spec->unsol_event = alc_sku_unsol_event;
1604 static void alc_init_auto_mic(struct hda_codec *codec)
1606 struct alc_spec *spec = codec->spec;
1607 struct auto_pin_cfg *cfg = &spec->autocfg;
1608 hda_nid_t fixed, ext, dock;
1611 fixed = ext = dock = 0;
1612 for (i = 0; i < cfg->num_inputs; i++) {
1613 hda_nid_t nid = cfg->inputs[i].pin;
1614 unsigned int defcfg;
1615 defcfg = snd_hda_codec_get_pincfg(codec, nid);
1616 switch (snd_hda_get_input_pin_attr(defcfg)) {
1617 case INPUT_PIN_ATTR_INT:
1619 return; /* already occupied */
1620 if (cfg->inputs[i].type != AUTO_PIN_MIC)
1621 return; /* invalid type */
1624 case INPUT_PIN_ATTR_UNUSED:
1625 return; /* invalid entry */
1626 case INPUT_PIN_ATTR_DOCK:
1628 return; /* already occupied */
1629 if (cfg->inputs[i].type > AUTO_PIN_LINE_IN)
1630 return; /* invalid type */
1635 return; /* already occupied */
1636 if (cfg->inputs[i].type != AUTO_PIN_MIC)
1637 return; /* invalid type */
1648 if (!is_jack_detectable(codec, ext))
1649 return; /* no unsol support */
1650 if (dock && !is_jack_detectable(codec, dock))
1651 return; /* no unsol support */
1652 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x/0x%x\n",
1654 spec->ext_mic.pin = ext;
1655 spec->dock_mic.pin = dock;
1656 spec->int_mic.pin = fixed;
1657 spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1658 spec->dock_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1659 spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1661 snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0,
1662 AC_VERB_SET_UNSOLICITED_ENABLE,
1663 AC_USRSP_EN | ALC880_MIC_EVENT);
1664 spec->unsol_event = alc_sku_unsol_event;
1667 /* Could be any non-zero and even value. When used as fixup, tells
1668 * the driver to ignore any present sku defines.
1670 #define ALC_FIXUP_SKU_IGNORE (2)
1672 static int alc_auto_parse_customize_define(struct hda_codec *codec)
1674 unsigned int ass, tmp, i;
1676 struct alc_spec *spec = codec->spec;
1678 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
1680 if (spec->cdefine.fixup) {
1681 ass = spec->cdefine.sku_cfg;
1682 if (ass == ALC_FIXUP_SKU_IGNORE)
1687 ass = codec->subsystem_id & 0xffff;
1688 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
1692 if (codec->vendor_id == 0x10ec0260)
1694 ass = snd_hda_codec_get_pincfg(codec, nid);
1697 printk(KERN_INFO "hda_codec: %s: SKU not ready 0x%08x\n",
1698 codec->chip_name, ass);
1704 for (i = 1; i < 16; i++) {
1708 if (((ass >> 16) & 0xf) != tmp)
1711 spec->cdefine.port_connectivity = ass >> 30;
1712 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
1713 spec->cdefine.check_sum = (ass >> 16) & 0xf;
1714 spec->cdefine.customization = ass >> 8;
1716 spec->cdefine.sku_cfg = ass;
1717 spec->cdefine.external_amp = (ass & 0x38) >> 3;
1718 spec->cdefine.platform_type = (ass & 0x4) >> 2;
1719 spec->cdefine.swap = (ass & 0x2) >> 1;
1720 spec->cdefine.override = ass & 0x1;
1722 snd_printd("SKU: Nid=0x%x sku_cfg=0x%08x\n",
1723 nid, spec->cdefine.sku_cfg);
1724 snd_printd("SKU: port_connectivity=0x%x\n",
1725 spec->cdefine.port_connectivity);
1726 snd_printd("SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
1727 snd_printd("SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
1728 snd_printd("SKU: customization=0x%08x\n", spec->cdefine.customization);
1729 snd_printd("SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
1730 snd_printd("SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
1731 snd_printd("SKU: swap=0x%x\n", spec->cdefine.swap);
1732 snd_printd("SKU: override=0x%x\n", spec->cdefine.override);
1737 static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
1740 for (i = 0; i < nums; i++)
1746 /* check subsystem ID and set up device-specific initialization;
1747 * return 1 if initialized, 0 if invalid SSID
1749 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1750 * 31 ~ 16 : Manufacture ID
1752 * 7 ~ 0 : Assembly ID
1753 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1755 static int alc_subsystem_id(struct hda_codec *codec,
1756 hda_nid_t porta, hda_nid_t porte,
1757 hda_nid_t portd, hda_nid_t porti)
1759 unsigned int ass, tmp, i;
1761 struct alc_spec *spec = codec->spec;
1763 if (spec->cdefine.fixup) {
1764 ass = spec->cdefine.sku_cfg;
1765 if (ass == ALC_FIXUP_SKU_IGNORE)
1770 ass = codec->subsystem_id & 0xffff;
1771 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1774 /* invalid SSID, check the special NID pin defcfg instead */
1776 * 31~30 : port connectivity
1779 * 19~16 : Check sum (15:1)
1784 if (codec->vendor_id == 0x10ec0260)
1786 ass = snd_hda_codec_get_pincfg(codec, nid);
1787 snd_printd("realtek: No valid SSID, "
1788 "checking pincfg 0x%08x for NID 0x%x\n",
1792 if ((ass >> 30) != 1) /* no physical connection */
1797 for (i = 1; i < 16; i++) {
1801 if (((ass >> 16) & 0xf) != tmp)
1804 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1805 ass & 0xffff, codec->vendor_id);
1809 * 2 : 0 --> Desktop, 1 --> Laptop
1810 * 3~5 : External Amplifier control
1813 tmp = (ass & 0x38) >> 3; /* external Amp control */
1816 spec->init_amp = ALC_INIT_GPIO1;
1819 spec->init_amp = ALC_INIT_GPIO2;
1822 spec->init_amp = ALC_INIT_GPIO3;
1826 spec->init_amp = ALC_INIT_DEFAULT;
1830 /* is laptop or Desktop and enable the function "Mute internal speaker
1831 * when the external headphone out jack is plugged"
1833 if (!(ass & 0x8000))
1836 * 10~8 : Jack location
1837 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1839 * 15 : 1 --> enable the function "Mute internal speaker
1840 * when the external headphone out jack is plugged"
1842 if (!spec->autocfg.hp_pins[0]) {
1844 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1855 if (found_in_nid_list(nid, spec->autocfg.line_out_pins,
1856 spec->autocfg.line_outs))
1858 spec->autocfg.hp_pins[0] = nid;
1863 static void alc_ssid_check(struct hda_codec *codec,
1864 hda_nid_t porta, hda_nid_t porte,
1865 hda_nid_t portd, hda_nid_t porti)
1867 if (!alc_subsystem_id(codec, porta, porte, portd, porti)) {
1868 struct alc_spec *spec = codec->spec;
1869 snd_printd("realtek: "
1870 "Enable default setup for auto mode as fallback\n");
1871 spec->init_amp = ALC_INIT_DEFAULT;
1874 alc_init_auto_hp(codec);
1875 alc_init_auto_mic(codec);
1879 * Fix-up pin default configurations and add default verbs
1887 struct alc_model_fixup {
1898 const struct alc_pincfg *pins;
1899 const struct hda_verb *verbs;
1900 void (*func)(struct hda_codec *codec,
1901 const struct alc_fixup *fix,
1915 ALC_FIXUP_ACT_PRE_PROBE,
1916 ALC_FIXUP_ACT_PROBE,
1920 static void alc_apply_fixup(struct hda_codec *codec, int action)
1922 struct alc_spec *spec = codec->spec;
1923 int id = spec->fixup_id;
1924 #ifdef CONFIG_SND_DEBUG_VERBOSE
1925 const char *modelname = spec->fixup_name;
1929 if (!spec->fixup_list)
1933 const struct alc_fixup *fix = spec->fixup_list + id;
1934 const struct alc_pincfg *cfg;
1936 switch (fix->type) {
1938 if (action != ALC_FIXUP_ACT_PRE_PROBE || !fix->v.sku)
1940 snd_printdd(KERN_INFO "hda_codec: %s: "
1941 "Apply sku override for %s\n",
1942 codec->chip_name, modelname);
1943 spec->cdefine.sku_cfg = fix->v.sku;
1944 spec->cdefine.fixup = 1;
1946 case ALC_FIXUP_PINS:
1948 if (action != ALC_FIXUP_ACT_PRE_PROBE || !cfg)
1950 snd_printdd(KERN_INFO "hda_codec: %s: "
1951 "Apply pincfg for %s\n",
1952 codec->chip_name, modelname);
1953 for (; cfg->nid; cfg++)
1954 snd_hda_codec_set_pincfg(codec, cfg->nid,
1957 case ALC_FIXUP_VERBS:
1958 if (action != ALC_FIXUP_ACT_PROBE || !fix->v.verbs)
1960 snd_printdd(KERN_INFO "hda_codec: %s: "
1961 "Apply fix-verbs for %s\n",
1962 codec->chip_name, modelname);
1963 add_verb(codec->spec, fix->v.verbs);
1965 case ALC_FIXUP_FUNC:
1968 snd_printdd(KERN_INFO "hda_codec: %s: "
1969 "Apply fix-func for %s\n",
1970 codec->chip_name, modelname);
1971 fix->v.func(codec, fix, action);
1974 snd_printk(KERN_ERR "hda_codec: %s: "
1975 "Invalid fixup type %d\n",
1976 codec->chip_name, fix->type);
1987 static void alc_pick_fixup(struct hda_codec *codec,
1988 const struct alc_model_fixup *models,
1989 const struct snd_pci_quirk *quirk,
1990 const struct alc_fixup *fixlist)
1992 struct alc_spec *spec = codec->spec;
1994 const char *name = NULL;
1996 if (codec->modelname && models) {
1997 while (models->name) {
1998 if (!strcmp(codec->modelname, models->name)) {
2000 name = models->name;
2007 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
2010 #ifdef CONFIG_SND_DEBUG_VERBOSE
2016 spec->fixup_id = id;
2018 spec->fixup_list = fixlist;
2019 spec->fixup_name = name;
2023 static int alc_read_coef_idx(struct hda_codec *codec,
2024 unsigned int coef_idx)
2027 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX,
2029 val = snd_hda_codec_read(codec, 0x20, 0,
2030 AC_VERB_GET_PROC_COEF, 0);
2034 static void alc_write_coef_idx(struct hda_codec *codec, unsigned int coef_idx,
2035 unsigned int coef_val)
2037 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX,
2039 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF,
2043 /* set right pin controls for digital I/O */
2044 static void alc_auto_init_digital(struct hda_codec *codec)
2046 struct alc_spec *spec = codec->spec;
2050 for (i = 0; i < spec->autocfg.dig_outs; i++) {
2051 pin = spec->autocfg.dig_out_pins[i];
2054 snd_hda_codec_write(codec, pin, 0,
2055 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
2057 dac = spec->multiout.dig_out_nid;
2059 dac = spec->slave_dig_outs[i - 1];
2060 if (!dac || !(get_wcaps(codec, dac) & AC_WCAP_OUT_AMP))
2062 snd_hda_codec_write(codec, dac, 0,
2063 AC_VERB_SET_AMP_GAIN_MUTE,
2066 pin = spec->autocfg.dig_in_pin;
2068 snd_hda_codec_write(codec, pin, 0,
2069 AC_VERB_SET_PIN_WIDGET_CONTROL,
2073 /* parse digital I/Os and set up NIDs in BIOS auto-parse mode */
2074 static void alc_auto_parse_digital(struct hda_codec *codec)
2076 struct alc_spec *spec = codec->spec;
2080 /* support multiple SPDIFs; the secondary is set up as a slave */
2081 for (i = 0; i < spec->autocfg.dig_outs; i++) {
2082 err = snd_hda_get_connections(codec,
2083 spec->autocfg.dig_out_pins[i],
2088 spec->multiout.dig_out_nid = dig_nid;
2089 spec->dig_out_type = spec->autocfg.dig_out_type[0];
2091 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
2092 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
2094 spec->slave_dig_outs[i - 1] = dig_nid;
2098 if (spec->autocfg.dig_in_pin) {
2099 dig_nid = codec->start_nid;
2100 for (i = 0; i < codec->num_nodes; i++, dig_nid++) {
2101 unsigned int wcaps = get_wcaps(codec, dig_nid);
2102 if (get_wcaps_type(wcaps) != AC_WID_AUD_IN)
2104 if (!(wcaps & AC_WCAP_DIGITAL))
2106 if (!(wcaps & AC_WCAP_CONN_LIST))
2108 err = get_connection_index(codec, dig_nid,
2109 spec->autocfg.dig_in_pin);
2111 spec->dig_in_nid = dig_nid;
2125 static const struct hda_verb alc888_4ST_ch2_intel_init[] = {
2126 /* Mic-in jack as mic in */
2127 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2128 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2129 /* Line-in jack as Line in */
2130 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2131 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2132 /* Line-Out as Front */
2133 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
2140 static const struct hda_verb alc888_4ST_ch4_intel_init[] = {
2141 /* Mic-in jack as mic in */
2142 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2143 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2144 /* Line-in jack as Surround */
2145 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2146 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2147 /* Line-Out as Front */
2148 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
2155 static const struct hda_verb alc888_4ST_ch6_intel_init[] = {
2156 /* Mic-in jack as CLFE */
2157 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2158 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2159 /* Line-in jack as Surround */
2160 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2161 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2162 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
2163 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
2170 static const struct hda_verb alc888_4ST_ch8_intel_init[] = {
2171 /* Mic-in jack as CLFE */
2172 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2173 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2174 /* Line-in jack as Surround */
2175 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2176 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2177 /* Line-Out as Side */
2178 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
2182 static const struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
2183 { 2, alc888_4ST_ch2_intel_init },
2184 { 4, alc888_4ST_ch4_intel_init },
2185 { 6, alc888_4ST_ch6_intel_init },
2186 { 8, alc888_4ST_ch8_intel_init },
2190 * ALC888 Fujitsu Siemens Amillo xa3530
2193 static const struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
2194 /* Front Mic: set to PIN_IN (empty by default) */
2195 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2196 /* Connect Internal HP to Front */
2197 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2198 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2199 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
2200 /* Connect Bass HP to Front */
2201 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2202 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2203 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2204 /* Connect Line-Out side jack (SPDIF) to Side */
2205 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2206 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2207 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
2208 /* Connect Mic jack to CLFE */
2209 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2210 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2211 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
2212 /* Connect Line-in jack to Surround */
2213 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2214 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2215 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
2216 /* Connect HP out jack to Front */
2217 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2218 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2219 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2220 /* Enable unsolicited event for HP jack and Line-out jack */
2221 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2222 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2226 static void alc889_automute_setup(struct hda_codec *codec)
2228 struct alc_spec *spec = codec->spec;
2230 spec->autocfg.hp_pins[0] = 0x15;
2231 spec->autocfg.speaker_pins[0] = 0x14;
2232 spec->autocfg.speaker_pins[1] = 0x16;
2233 spec->autocfg.speaker_pins[2] = 0x17;
2234 spec->autocfg.speaker_pins[3] = 0x19;
2235 spec->autocfg.speaker_pins[4] = 0x1a;
2237 spec->automute_mode = ALC_AUTOMUTE_AMP;
2240 static void alc889_intel_init_hook(struct hda_codec *codec)
2242 alc889_coef_init(codec);
2243 alc_hp_automute(codec);
2246 static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec)
2248 struct alc_spec *spec = codec->spec;
2250 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
2251 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
2252 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
2253 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
2255 spec->automute_mode = ALC_AUTOMUTE_AMP;
2259 * ALC888 Acer Aspire 4930G model
2262 static const struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
2263 /* Front Mic: set to PIN_IN (empty by default) */
2264 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2265 /* Unselect Front Mic by default in input mixer 3 */
2266 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
2267 /* Enable unsolicited event for HP jack */
2268 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2269 /* Connect Internal HP to front */
2270 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2271 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2272 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
2273 /* Connect HP out to front */
2274 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2275 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2276 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2277 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
2282 * ALC888 Acer Aspire 6530G model
2285 static const struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
2286 /* Route to built-in subwoofer as well as speakers */
2287 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2288 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2289 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2290 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2291 /* Bias voltage on for external mic port */
2292 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
2293 /* Front Mic: set to PIN_IN (empty by default) */
2294 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2295 /* Unselect Front Mic by default in input mixer 3 */
2296 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
2297 /* Enable unsolicited event for HP jack */
2298 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2299 /* Enable speaker output */
2300 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2301 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2302 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
2303 /* Enable headphone output */
2304 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
2305 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2306 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2307 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
2312 *ALC888 Acer Aspire 7730G model
2315 static const struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
2316 /* Bias voltage on for external mic port */
2317 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
2318 /* Front Mic: set to PIN_IN (empty by default) */
2319 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2320 /* Unselect Front Mic by default in input mixer 3 */
2321 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
2322 /* Enable unsolicited event for HP jack */
2323 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2324 /* Enable speaker output */
2325 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2326 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2327 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
2328 /* Enable headphone output */
2329 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
2330 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2331 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2332 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
2333 /*Enable internal subwoofer */
2334 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2335 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2336 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
2337 {0x17, AC_VERB_SET_EAPD_BTLENABLE, 2},
2342 * ALC889 Acer Aspire 8930G model
2345 static const struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
2346 /* Front Mic: set to PIN_IN (empty by default) */
2347 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2348 /* Unselect Front Mic by default in input mixer 3 */
2349 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
2350 /* Enable unsolicited event for HP jack */
2351 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2352 /* Connect Internal Front to Front */
2353 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2354 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2355 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
2356 /* Connect Internal Rear to Rear */
2357 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2358 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2359 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
2360 /* Connect Internal CLFE to CLFE */
2361 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2362 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2363 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
2364 /* Connect HP out to Front */
2365 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
2366 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2367 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2368 /* Enable all DACs */
2369 /* DAC DISABLE/MUTE 1? */
2370 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
2371 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
2372 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
2373 /* DAC DISABLE/MUTE 2? */
2374 /* some bit here disables the other DACs. Init=0x4900 */
2375 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
2376 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
2378 * This laptop has a stereo digital microphone. The mics are only 1cm apart
2379 * which makes the stereo useless. However, either the mic or the ALC889
2380 * makes the signal become a difference/sum signal instead of standard
2381 * stereo, which is annoying. So instead we flip this bit which makes the
2382 * codec replicate the sum signal to both channels, turning it into a
2385 /* DMIC_CONTROL? Init value = 0x0001 */
2386 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
2387 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
2391 static const struct hda_input_mux alc888_2_capture_sources[2] = {
2392 /* Front mic only available on one ADC */
2399 { "Front Mic", 0xb },
2412 static const struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
2413 /* Interal mic only available on one ADC */
2420 { "Input Mix", 0xa },
2421 { "Internal Mic", 0xb },
2430 { "Input Mix", 0xa },
2435 static const struct hda_input_mux alc889_capture_sources[3] = {
2436 /* Digital mic only available on first "ADC" */
2443 { "Front Mic", 0xb },
2444 { "Input Mix", 0xa },
2453 { "Input Mix", 0xa },
2462 { "Input Mix", 0xa },
2467 static const struct snd_kcontrol_new alc888_base_mixer[] = {
2468 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2469 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2470 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2471 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2472 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
2474 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2475 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2476 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2477 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2478 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2479 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2480 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2481 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2482 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2483 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2484 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
2485 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2489 static const struct snd_kcontrol_new alc888_acer_aspire_4930g_mixer[] = {
2490 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2491 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2492 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2493 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2494 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
2496 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2497 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2498 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2499 HDA_CODEC_VOLUME_MONO("Internal LFE Playback Volume", 0x0f, 1, 0x0, HDA_OUTPUT),
2500 HDA_BIND_MUTE_MONO("Internal LFE Playback Switch", 0x0f, 1, 2, HDA_INPUT),
2501 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2502 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2503 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2504 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2505 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2506 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
2507 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2511 static const struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = {
2512 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2513 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2514 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2515 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2516 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
2518 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2519 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2520 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2521 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2522 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2523 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2524 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
2525 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2530 static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
2532 struct alc_spec *spec = codec->spec;
2534 spec->autocfg.hp_pins[0] = 0x15;
2535 spec->autocfg.speaker_pins[0] = 0x14;
2536 spec->autocfg.speaker_pins[1] = 0x16;
2537 spec->autocfg.speaker_pins[2] = 0x17;
2539 spec->automute_mode = ALC_AUTOMUTE_AMP;
2542 static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
2544 struct alc_spec *spec = codec->spec;
2546 spec->autocfg.hp_pins[0] = 0x15;
2547 spec->autocfg.speaker_pins[0] = 0x14;
2548 spec->autocfg.speaker_pins[1] = 0x16;
2549 spec->autocfg.speaker_pins[2] = 0x17;
2551 spec->automute_mode = ALC_AUTOMUTE_AMP;
2554 static void alc888_acer_aspire_7730g_setup(struct hda_codec *codec)
2556 struct alc_spec *spec = codec->spec;
2558 spec->autocfg.hp_pins[0] = 0x15;
2559 spec->autocfg.speaker_pins[0] = 0x14;
2560 spec->autocfg.speaker_pins[1] = 0x16;
2561 spec->autocfg.speaker_pins[2] = 0x17;
2563 spec->automute_mode = ALC_AUTOMUTE_AMP;
2566 static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
2568 struct alc_spec *spec = codec->spec;
2570 spec->autocfg.hp_pins[0] = 0x15;
2571 spec->autocfg.speaker_pins[0] = 0x14;
2572 spec->autocfg.speaker_pins[1] = 0x16;
2573 spec->autocfg.speaker_pins[2] = 0x1b;
2575 spec->automute_mode = ALC_AUTOMUTE_AMP;
2579 * ALC880 3-stack model
2581 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
2582 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
2583 * F-Mic = 0x1b, HP = 0x19
2586 static const hda_nid_t alc880_dac_nids[4] = {
2587 /* front, rear, clfe, rear_surr */
2588 0x02, 0x05, 0x04, 0x03
2591 static const hda_nid_t alc880_adc_nids[3] = {
2596 /* The datasheet says the node 0x07 is connected from inputs,
2597 * but it shows zero connection in the real implementation on some devices.
2598 * Note: this is a 915GAV bug, fixed on 915GLV
2600 static const hda_nid_t alc880_adc_nids_alt[2] = {
2605 #define ALC880_DIGOUT_NID 0x06
2606 #define ALC880_DIGIN_NID 0x0a
2608 static const struct hda_input_mux alc880_capture_source = {
2612 { "Front Mic", 0x3 },
2618 /* channel source setting (2/6 channel selection for 3-stack) */
2620 static const struct hda_verb alc880_threestack_ch2_init[] = {
2621 /* set line-in to input, mute it */
2622 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2623 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2624 /* set mic-in to input vref 80%, mute it */
2625 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2626 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2631 static const struct hda_verb alc880_threestack_ch6_init[] = {
2632 /* set line-in to output, unmute it */
2633 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2634 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2635 /* set mic-in to output, unmute it */
2636 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2637 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2641 static const struct hda_channel_mode alc880_threestack_modes[2] = {
2642 { 2, alc880_threestack_ch2_init },
2643 { 6, alc880_threestack_ch6_init },
2646 static const struct snd_kcontrol_new alc880_three_stack_mixer[] = {
2647 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2648 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2649 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2650 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2651 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2652 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2653 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2654 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2655 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2656 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2657 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2658 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2659 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2660 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2661 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
2662 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
2663 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
2665 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2666 .name = "Channel Mode",
2667 .info = alc_ch_mode_info,
2668 .get = alc_ch_mode_get,
2669 .put = alc_ch_mode_put,
2674 /* capture mixer elements */
2675 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
2676 struct snd_ctl_elem_info *uinfo)
2678 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2679 struct alc_spec *spec = codec->spec;
2682 mutex_lock(&codec->control_mutex);
2683 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
2685 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
2686 mutex_unlock(&codec->control_mutex);
2690 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
2691 unsigned int size, unsigned int __user *tlv)
2693 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2694 struct alc_spec *spec = codec->spec;
2697 mutex_lock(&codec->control_mutex);
2698 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
2700 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
2701 mutex_unlock(&codec->control_mutex);
2705 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
2706 struct snd_ctl_elem_value *ucontrol);
2708 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
2709 struct snd_ctl_elem_value *ucontrol,
2710 getput_call_t func, bool check_adc_switch)
2712 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2713 struct alc_spec *spec = codec->spec;
2716 mutex_lock(&codec->control_mutex);
2717 if (check_adc_switch && spec->dual_adc_switch) {
2718 for (i = 0; i < spec->num_adc_nids; i++) {
2719 kcontrol->private_value =
2720 HDA_COMPOSE_AMP_VAL(spec->adc_nids[i],
2722 err = func(kcontrol, ucontrol);
2727 i = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
2728 kcontrol->private_value =
2729 HDA_COMPOSE_AMP_VAL(spec->adc_nids[i],
2731 err = func(kcontrol, ucontrol);
2734 mutex_unlock(&codec->control_mutex);
2738 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
2739 struct snd_ctl_elem_value *ucontrol)
2741 return alc_cap_getput_caller(kcontrol, ucontrol,
2742 snd_hda_mixer_amp_volume_get, false);
2745 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
2746 struct snd_ctl_elem_value *ucontrol)
2748 return alc_cap_getput_caller(kcontrol, ucontrol,
2749 snd_hda_mixer_amp_volume_put, true);
2752 /* capture mixer elements */
2753 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
2755 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
2756 struct snd_ctl_elem_value *ucontrol)
2758 return alc_cap_getput_caller(kcontrol, ucontrol,
2759 snd_hda_mixer_amp_switch_get, false);
2762 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
2763 struct snd_ctl_elem_value *ucontrol)
2765 return alc_cap_getput_caller(kcontrol, ucontrol,
2766 snd_hda_mixer_amp_switch_put, true);
2769 #define _DEFINE_CAPMIX(num) \
2771 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2772 .name = "Capture Switch", \
2773 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
2775 .info = alc_cap_sw_info, \
2776 .get = alc_cap_sw_get, \
2777 .put = alc_cap_sw_put, \
2780 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2781 .name = "Capture Volume", \
2782 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
2783 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
2784 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
2786 .info = alc_cap_vol_info, \
2787 .get = alc_cap_vol_get, \
2788 .put = alc_cap_vol_put, \
2789 .tlv = { .c = alc_cap_vol_tlv }, \
2792 #define _DEFINE_CAPSRC(num) \
2794 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2795 /* .name = "Capture Source", */ \
2796 .name = "Input Source", \
2798 .info = alc_mux_enum_info, \
2799 .get = alc_mux_enum_get, \
2800 .put = alc_mux_enum_put, \
2803 #define DEFINE_CAPMIX(num) \
2804 static const struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2805 _DEFINE_CAPMIX(num), \
2806 _DEFINE_CAPSRC(num), \
2810 #define DEFINE_CAPMIX_NOSRC(num) \
2811 static const struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2812 _DEFINE_CAPMIX(num), \
2816 /* up to three ADCs */
2820 DEFINE_CAPMIX_NOSRC(1);
2821 DEFINE_CAPMIX_NOSRC(2);
2822 DEFINE_CAPMIX_NOSRC(3);
2825 * ALC880 5-stack model
2827 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2829 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2830 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2833 /* additional mixers to alc880_three_stack_mixer */
2834 static const struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2835 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2836 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2840 /* channel source setting (6/8 channel selection for 5-stack) */
2842 static const struct hda_verb alc880_fivestack_ch6_init[] = {
2843 /* set line-in to input, mute it */
2844 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2845 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2850 static const struct hda_verb alc880_fivestack_ch8_init[] = {
2851 /* set line-in to output, unmute it */
2852 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2853 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2857 static const struct hda_channel_mode alc880_fivestack_modes[2] = {
2858 { 6, alc880_fivestack_ch6_init },
2859 { 8, alc880_fivestack_ch8_init },
2864 * ALC880 6-stack model
2866 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2867 * Side = 0x05 (0x0f)
2868 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2869 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2872 static const hda_nid_t alc880_6st_dac_nids[4] = {
2873 /* front, rear, clfe, rear_surr */
2874 0x02, 0x03, 0x04, 0x05
2877 static const struct hda_input_mux alc880_6stack_capture_source = {
2881 { "Front Mic", 0x1 },
2887 /* fixed 8-channels */
2888 static const struct hda_channel_mode alc880_sixstack_modes[1] = {
2892 static const struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2893 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2894 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2895 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2896 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2897 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2898 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2899 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2900 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2901 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2902 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2903 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2904 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2905 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2906 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2907 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2908 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2909 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2910 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2912 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2913 .name = "Channel Mode",
2914 .info = alc_ch_mode_info,
2915 .get = alc_ch_mode_get,
2916 .put = alc_ch_mode_put,
2925 * W810 has rear IO for:
2928 * Center/LFE (DAC 04)
2931 * The system also has a pair of internal speakers, and a headphone jack.
2932 * These are both connected to Line2 on the codec, hence to DAC 02.
2934 * There is a variable resistor to control the speaker or headphone
2935 * volume. This is a hardware-only device without a software API.
2937 * Plugging headphones in will disable the internal speakers. This is
2938 * implemented in hardware, not via the driver using jack sense. In
2939 * a similar fashion, plugging into the rear socket marked "front" will
2940 * disable both the speakers and headphones.
2942 * For input, there's a microphone jack, and an "audio in" jack.
2943 * These may not do anything useful with this driver yet, because I
2944 * haven't setup any initialization verbs for these yet...
2947 static const hda_nid_t alc880_w810_dac_nids[3] = {
2948 /* front, rear/surround, clfe */
2952 /* fixed 6 channels */
2953 static const struct hda_channel_mode alc880_w810_modes[1] = {
2957 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2958 static const struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2959 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2960 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2961 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2962 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2963 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2964 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2965 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2966 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2967 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2975 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2976 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2980 static const hda_nid_t alc880_z71v_dac_nids[1] = {
2983 #define ALC880_Z71V_HP_DAC 0x03
2985 /* fixed 2 channels */
2986 static const struct hda_channel_mode alc880_2_jack_modes[1] = {
2990 static const struct snd_kcontrol_new alc880_z71v_mixer[] = {
2991 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2992 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2993 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2994 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2995 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2996 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2997 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2998 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3004 * ALC880 F1734 model
3006 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
3007 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
3010 static const hda_nid_t alc880_f1734_dac_nids[1] = {
3013 #define ALC880_F1734_HP_DAC 0x02
3015 static const struct snd_kcontrol_new alc880_f1734_mixer[] = {
3016 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3017 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
3018 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3019 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
3020 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
3021 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
3022 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3023 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3027 static const struct hda_input_mux alc880_f1734_capture_source = {
3039 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
3040 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
3041 * Mic = 0x18, Line = 0x1a
3044 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
3045 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
3047 static const struct snd_kcontrol_new alc880_asus_mixer[] = {
3048 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3049 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3050 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3051 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3052 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3053 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3054 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3055 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3056 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
3057 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
3058 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3059 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3060 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3061 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3063 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3064 .name = "Channel Mode",
3065 .info = alc_ch_mode_info,
3066 .get = alc_ch_mode_get,
3067 .put = alc_ch_mode_put,
3073 * ALC880 ASUS W1V model
3075 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
3076 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
3077 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
3080 /* additional mixers to alc880_asus_mixer */
3081 static const struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
3082 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
3083 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
3088 static const struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
3089 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3090 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
3091 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
3092 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
3093 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
3094 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
3095 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
3096 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
3097 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
3102 static const struct snd_kcontrol_new alc880_uniwill_mixer[] = {
3103 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3104 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
3105 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3106 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
3107 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3108 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3109 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3110 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3111 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
3112 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
3113 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3114 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3115 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3116 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3117 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3118 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3120 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3121 .name = "Channel Mode",
3122 .info = alc_ch_mode_info,
3123 .get = alc_ch_mode_get,
3124 .put = alc_ch_mode_put,
3129 static const struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
3130 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3131 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
3132 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3133 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
3134 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
3135 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
3136 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3137 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3138 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3139 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3143 static const struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
3144 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3145 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
3146 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3147 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
3148 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3149 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3154 * virtual master controls
3158 * slave controls for virtual master
3160 static const char * const alc_slave_vols[] = {
3161 "Front Playback Volume",
3162 "Surround Playback Volume",
3163 "Center Playback Volume",
3164 "LFE Playback Volume",
3165 "Side Playback Volume",
3166 "Headphone Playback Volume",
3167 "Speaker Playback Volume",
3168 "Mono Playback Volume",
3169 "Line-Out Playback Volume",
3173 static const char * const alc_slave_sws[] = {
3174 "Front Playback Switch",
3175 "Surround Playback Switch",
3176 "Center Playback Switch",
3177 "LFE Playback Switch",
3178 "Side Playback Switch",
3179 "Headphone Playback Switch",
3180 "Speaker Playback Switch",
3181 "Mono Playback Switch",
3182 "IEC958 Playback Switch",
3183 "Line-Out Playback Switch",
3188 * build control elements
3191 #define NID_MAPPING (-1)
3193 #define SUBDEV_SPEAKER_ (0 << 6)
3194 #define SUBDEV_HP_ (1 << 6)
3195 #define SUBDEV_LINE_ (2 << 6)
3196 #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f))
3197 #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f))
3198 #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f))
3200 static void alc_free_kctls(struct hda_codec *codec);
3202 #ifdef CONFIG_SND_HDA_INPUT_BEEP
3203 /* additional beep mixers; the actual parameters are overwritten at build */
3204 static const struct snd_kcontrol_new alc_beep_mixer[] = {
3205 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
3206 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
3211 static int alc_build_controls(struct hda_codec *codec)
3213 struct alc_spec *spec = codec->spec;
3214 struct snd_kcontrol *kctl = NULL;
3215 const struct snd_kcontrol_new *knew;
3220 for (i = 0; i < spec->num_mixers; i++) {
3221 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
3225 if (spec->cap_mixer) {
3226 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
3230 if (spec->multiout.dig_out_nid) {
3231 err = snd_hda_create_spdif_out_ctls(codec,
3232 spec->multiout.dig_out_nid,
3233 spec->multiout.dig_out_nid);
3236 if (!spec->no_analog) {
3237 err = snd_hda_create_spdif_share_sw(codec,
3241 spec->multiout.share_spdif = 1;
3244 if (spec->dig_in_nid) {
3245 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
3250 #ifdef CONFIG_SND_HDA_INPUT_BEEP
3251 /* create beep controls if needed */
3252 if (spec->beep_amp) {
3253 const struct snd_kcontrol_new *knew;
3254 for (knew = alc_beep_mixer; knew->name; knew++) {
3255 struct snd_kcontrol *kctl;
3256 kctl = snd_ctl_new1(knew, codec);
3259 kctl->private_value = spec->beep_amp;
3260 err = snd_hda_ctl_add(codec, 0, kctl);
3267 /* if we have no master control, let's create it */
3268 if (!spec->no_analog &&
3269 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
3270 unsigned int vmaster_tlv[4];
3271 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
3272 HDA_OUTPUT, vmaster_tlv);
3273 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
3274 vmaster_tlv, alc_slave_vols);
3278 if (!spec->no_analog &&
3279 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
3280 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
3281 NULL, alc_slave_sws);
3286 /* assign Capture Source enums to NID */
3287 if (spec->capsrc_nids || spec->adc_nids) {
3288 kctl = snd_hda_find_mixer_ctl(codec, "Capture Source");
3290 kctl = snd_hda_find_mixer_ctl(codec, "Input Source");
3291 for (i = 0; kctl && i < kctl->count; i++) {
3292 const hda_nid_t *nids = spec->capsrc_nids;
3294 nids = spec->adc_nids;
3295 err = snd_hda_add_nid(codec, kctl, i, nids[i]);
3300 if (spec->cap_mixer) {
3301 const char *kname = kctl ? kctl->id.name : NULL;
3302 for (knew = spec->cap_mixer; knew->name; knew++) {
3303 if (kname && strcmp(knew->name, kname) == 0)
3305 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
3306 for (i = 0; kctl && i < kctl->count; i++) {
3307 err = snd_hda_add_nid(codec, kctl, i,
3315 /* other nid->control mapping */
3316 for (i = 0; i < spec->num_mixers; i++) {
3317 for (knew = spec->mixers[i]; knew->name; knew++) {
3318 if (knew->iface != NID_MAPPING)
3320 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
3323 u = knew->subdevice;
3324 for (j = 0; j < 4; j++, u >>= 8) {
3329 case SUBDEV_SPEAKER_:
3330 nid = spec->autocfg.speaker_pins[nid];
3333 nid = spec->autocfg.line_out_pins[nid];
3336 nid = spec->autocfg.hp_pins[nid];
3341 err = snd_hda_add_nid(codec, kctl, 0, nid);
3345 u = knew->private_value;
3346 for (j = 0; j < 4; j++, u >>= 8) {
3350 err = snd_hda_add_nid(codec, kctl, 0, nid);
3357 alc_free_kctls(codec); /* no longer needed */
3364 * initialize the codec volumes, etc
3368 * generic initialization of ADC, input mixers and output mixers
3370 static const struct hda_verb alc880_volume_init_verbs[] = {
3372 * Unmute ADC0-2 and set the default input to mic-in
3374 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3375 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3376 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3377 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3378 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3379 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3381 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
3383 * Note: PASD motherboards uses the Line In 2 as the input for front
3386 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
3387 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3388 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3389 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3390 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3391 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3392 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3393 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3396 * Set up output mixers (0x0c - 0x0f)
3398 /* set vol=0 to output mixers */
3399 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3400 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3401 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3402 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3403 /* set up input amps for analog loopback */
3404 /* Amp Indices: DAC = 0, mixer = 1 */
3405 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3406 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3407 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3408 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3409 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3410 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3411 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3412 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3418 * 3-stack pin configuration:
3419 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
3421 static const struct hda_verb alc880_pin_3stack_init_verbs[] = {
3423 * preset connection lists of input pins
3424 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
3426 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3427 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3428 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3431 * Set pin mode and muting
3433 /* set front pin widgets 0x14 for output */
3434 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3435 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3436 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3437 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3438 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3439 /* Mic2 (as headphone out) for HP output */
3440 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3441 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3442 /* Line In pin widget for input */
3443 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3444 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3445 /* Line2 (as front mic) pin widget for input and vref at 80% */
3446 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3447 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3448 /* CD pin widget for input */
3449 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3455 * 5-stack pin configuration:
3456 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
3457 * line-in/side = 0x1a, f-mic = 0x1b
3459 static const struct hda_verb alc880_pin_5stack_init_verbs[] = {
3461 * preset connection lists of input pins
3462 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
3464 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3465 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
3468 * Set pin mode and muting
3470 /* set pin widgets 0x14-0x17 for output */
3471 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3472 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3473 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3474 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3475 /* unmute pins for output (no gain on this amp) */
3476 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3477 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3478 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3479 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3481 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3482 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3483 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3484 /* Mic2 (as headphone out) for HP output */
3485 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3486 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3487 /* Line In pin widget for input */
3488 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3489 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3490 /* Line2 (as front mic) pin widget for input and vref at 80% */
3491 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3492 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3493 /* CD pin widget for input */
3494 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3500 * W810 pin configuration:
3501 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
3503 static const struct hda_verb alc880_pin_w810_init_verbs[] = {
3504 /* hphone/speaker input selector: front DAC */
3505 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
3507 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3508 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3509 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3510 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3511 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3512 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3514 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3515 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3521 * Z71V pin configuration:
3522 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
3524 static const struct hda_verb alc880_pin_z71v_init_verbs[] = {
3525 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3526 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3527 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3528 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3530 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3531 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3532 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3533 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3539 * 6-stack pin configuration:
3540 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
3541 * f-mic = 0x19, line = 0x1a, HP = 0x1b
3543 static const struct hda_verb alc880_pin_6stack_init_verbs[] = {
3544 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3546 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3547 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3548 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3549 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3550 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3551 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3552 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3553 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3555 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3556 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3557 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3558 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3559 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3560 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3561 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3562 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3563 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3569 * Uniwill pin configuration:
3570 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
3573 static const struct hda_verb alc880_uniwill_init_verbs[] = {
3574 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3576 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3577 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3578 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3579 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3580 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3581 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3582 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3583 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3584 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3585 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3586 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3587 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3588 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3589 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3591 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3592 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3593 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3594 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3595 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3596 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3597 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
3598 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
3599 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3601 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3602 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
3609 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
3611 static const struct hda_verb alc880_uniwill_p53_init_verbs[] = {
3612 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3614 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3615 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3616 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3617 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3618 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3619 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3620 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3621 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3622 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3623 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3624 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3625 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3627 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3628 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3629 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3630 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3631 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3632 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3634 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3635 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
3640 static const struct hda_verb alc880_beep_init_verbs[] = {
3641 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
3645 /* auto-toggle front mic */
3646 static void alc88x_simple_mic_automute(struct hda_codec *codec)
3648 unsigned int present;
3651 present = snd_hda_jack_detect(codec, 0x18);
3652 bits = present ? HDA_AMP_MUTE : 0;
3653 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
3656 static void alc880_uniwill_setup(struct hda_codec *codec)
3658 struct alc_spec *spec = codec->spec;
3660 spec->autocfg.hp_pins[0] = 0x14;
3661 spec->autocfg.speaker_pins[0] = 0x15;
3662 spec->autocfg.speaker_pins[0] = 0x16;
3664 spec->automute_mode = ALC_AUTOMUTE_AMP;
3667 static void alc880_uniwill_init_hook(struct hda_codec *codec)
3669 alc_hp_automute(codec);
3670 alc88x_simple_mic_automute(codec);
3673 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
3676 /* Looks like the unsol event is incompatible with the standard
3677 * definition. 4bit tag is placed at 28 bit!
3679 switch (res >> 28) {
3680 case ALC880_MIC_EVENT:
3681 alc88x_simple_mic_automute(codec);
3684 alc_sku_unsol_event(codec, res);
3689 static void alc880_uniwill_p53_setup(struct hda_codec *codec)
3691 struct alc_spec *spec = codec->spec;
3693 spec->autocfg.hp_pins[0] = 0x14;
3694 spec->autocfg.speaker_pins[0] = 0x15;
3696 spec->automute_mode = ALC_AUTOMUTE_AMP;
3699 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
3701 unsigned int present;
3703 present = snd_hda_codec_read(codec, 0x21, 0,
3704 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
3705 present &= HDA_AMP_VOLMASK;
3706 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
3707 HDA_AMP_VOLMASK, present);
3708 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
3709 HDA_AMP_VOLMASK, present);
3712 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
3715 /* Looks like the unsol event is incompatible with the standard
3716 * definition. 4bit tag is placed at 28 bit!
3718 if ((res >> 28) == ALC880_DCVOL_EVENT)
3719 alc880_uniwill_p53_dcvol_automute(codec);
3721 alc_sku_unsol_event(codec, res);
3725 * F1734 pin configuration:
3726 * HP = 0x14, speaker-out = 0x15, mic = 0x18
3728 static const struct hda_verb alc880_pin_f1734_init_verbs[] = {
3729 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
3730 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3731 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3732 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3733 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3735 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3736 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3737 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3738 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3740 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3741 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3742 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
3743 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3744 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3745 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3746 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3747 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3748 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3750 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
3751 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
3757 * ASUS pin configuration:
3758 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
3760 static const struct hda_verb alc880_pin_asus_init_verbs[] = {
3761 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3762 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3763 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3764 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3766 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3767 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3768 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3769 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3770 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3771 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3772 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3773 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3775 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3776 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3777 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3778 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3779 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3780 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3781 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3782 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3783 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3788 /* Enable GPIO mask and set output */
3789 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
3790 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
3791 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
3793 /* Clevo m520g init */
3794 static const struct hda_verb alc880_pin_clevo_init_verbs[] = {
3795 /* headphone output */
3796 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3798 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3799 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3801 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3802 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3804 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3805 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3806 /* Mic1 (rear panel) */
3807 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3808 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3809 /* Mic2 (front panel) */
3810 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3811 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3813 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3814 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3815 /* change to EAPD mode */
3816 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3817 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3822 static const struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
3823 /* change to EAPD mode */
3824 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3825 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3827 /* Headphone output */
3828 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3830 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3831 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
3833 /* Line In pin widget for input */
3834 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3835 /* CD pin widget for input */
3836 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3837 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3838 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3840 /* change to EAPD mode */
3841 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3842 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
3848 * LG m1 express dual
3851 * Rear Line-In/Out (blue): 0x14
3852 * Build-in Mic-In: 0x15
3854 * HP-Out (green): 0x1b
3855 * Mic-In/Out (red): 0x19
3859 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
3860 static const hda_nid_t alc880_lg_dac_nids[3] = {
3864 /* seems analog CD is not working */
3865 static const struct hda_input_mux alc880_lg_capture_source = {
3870 { "Internal Mic", 0x6 },
3874 /* 2,4,6 channel modes */
3875 static const struct hda_verb alc880_lg_ch2_init[] = {
3876 /* set line-in and mic-in to input */
3877 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
3878 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3882 static const struct hda_verb alc880_lg_ch4_init[] = {
3883 /* set line-in to out and mic-in to input */
3884 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3885 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3889 static const struct hda_verb alc880_lg_ch6_init[] = {
3890 /* set line-in and mic-in to output */
3891 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3892 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3896 static const struct hda_channel_mode alc880_lg_ch_modes[3] = {
3897 { 2, alc880_lg_ch2_init },
3898 { 4, alc880_lg_ch4_init },
3899 { 6, alc880_lg_ch6_init },
3902 static const struct snd_kcontrol_new alc880_lg_mixer[] = {
3903 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3904 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3905 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3906 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3907 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3908 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3909 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3910 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3911 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3912 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3913 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3914 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3915 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3916 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3918 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3919 .name = "Channel Mode",
3920 .info = alc_ch_mode_info,
3921 .get = alc_ch_mode_get,
3922 .put = alc_ch_mode_put,
3927 static const struct hda_verb alc880_lg_init_verbs[] = {
3928 /* set capture source to mic-in */
3929 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3930 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3931 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3932 /* mute all amp mixer inputs */
3933 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3934 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3935 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3936 /* line-in to input */
3937 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3938 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3940 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3941 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3943 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3944 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3945 /* mic-in to input */
3946 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3947 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3948 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3950 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3951 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3952 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3954 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3958 /* toggle speaker-output according to the hp-jack state */
3959 static void alc880_lg_setup(struct hda_codec *codec)
3961 struct alc_spec *spec = codec->spec;
3963 spec->autocfg.hp_pins[0] = 0x1b;
3964 spec->autocfg.speaker_pins[0] = 0x17;
3966 spec->automute_mode = ALC_AUTOMUTE_AMP;
3975 * Built-in Mic-In: 0x19
3981 static const struct hda_input_mux alc880_lg_lw_capture_source = {
3985 { "Internal Mic", 0x1 },
3990 #define alc880_lg_lw_modes alc880_threestack_modes
3992 static const struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3993 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3994 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3995 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3996 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3997 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3998 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3999 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
4000 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
4001 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
4002 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
4003 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
4004 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
4005 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
4006 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
4008 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4009 .name = "Channel Mode",
4010 .info = alc_ch_mode_info,
4011 .get = alc_ch_mode_get,
4012 .put = alc_ch_mode_put,
4017 static const struct hda_verb alc880_lg_lw_init_verbs[] = {
4018 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
4019 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
4020 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
4022 /* set capture source to mic-in */
4023 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4024 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4025 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4026 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
4028 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4029 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4031 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4032 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4033 /* mic-in to input */
4034 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4035 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4037 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4038 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4040 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4044 /* toggle speaker-output according to the hp-jack state */
4045 static void alc880_lg_lw_setup(struct hda_codec *codec)
4047 struct alc_spec *spec = codec->spec;
4049 spec->autocfg.hp_pins[0] = 0x1b;
4050 spec->autocfg.speaker_pins[0] = 0x14;
4052 spec->automute_mode = ALC_AUTOMUTE_AMP;
4055 static const struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
4056 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
4057 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
4058 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
4059 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
4060 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
4061 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
4065 static const struct hda_input_mux alc880_medion_rim_capture_source = {
4069 { "Internal Mic", 0x1 },
4073 static const struct hda_verb alc880_medion_rim_init_verbs[] = {
4074 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
4076 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4077 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4079 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4080 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4081 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4082 /* Mic2 (as headphone out) for HP output */
4083 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4084 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4085 /* Internal Speaker */
4086 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4087 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4089 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
4090 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
4092 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4096 /* toggle speaker-output according to the hp-jack state */
4097 static void alc880_medion_rim_automute(struct hda_codec *codec)
4099 struct alc_spec *spec = codec->spec;
4100 alc_hp_automute(codec);
4102 if (spec->jack_present)
4103 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
4105 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
4108 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
4111 /* Looks like the unsol event is incompatible with the standard
4112 * definition. 4bit tag is placed at 28 bit!
4114 if ((res >> 28) == ALC880_HP_EVENT)
4115 alc880_medion_rim_automute(codec);
4118 static void alc880_medion_rim_setup(struct hda_codec *codec)
4120 struct alc_spec *spec = codec->spec;
4122 spec->autocfg.hp_pins[0] = 0x14;
4123 spec->autocfg.speaker_pins[0] = 0x1b;
4125 spec->automute_mode = ALC_AUTOMUTE_AMP;
4128 #ifdef CONFIG_SND_HDA_POWER_SAVE
4129 static const struct hda_amp_list alc880_loopbacks[] = {
4130 { 0x0b, HDA_INPUT, 0 },
4131 { 0x0b, HDA_INPUT, 1 },
4132 { 0x0b, HDA_INPUT, 2 },
4133 { 0x0b, HDA_INPUT, 3 },
4134 { 0x0b, HDA_INPUT, 4 },
4138 static const struct hda_amp_list alc880_lg_loopbacks[] = {
4139 { 0x0b, HDA_INPUT, 1 },
4140 { 0x0b, HDA_INPUT, 6 },
4141 { 0x0b, HDA_INPUT, 7 },
4150 static void alc_init_special_input_src(struct hda_codec *codec);
4152 static int alc_init(struct hda_codec *codec)
4154 struct alc_spec *spec = codec->spec;
4158 alc_auto_init_amp(codec, spec->init_amp);
4160 for (i = 0; i < spec->num_init_verbs; i++)
4161 snd_hda_sequence_write(codec, spec->init_verbs[i]);
4162 alc_init_special_input_src(codec);
4164 if (spec->init_hook)
4165 spec->init_hook(codec);
4167 alc_apply_fixup(codec, ALC_FIXUP_ACT_INIT);
4169 hda_call_check_power_status(codec, 0x01);
4173 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
4175 struct alc_spec *spec = codec->spec;
4177 if (spec->unsol_event)
4178 spec->unsol_event(codec, res);
4181 #ifdef CONFIG_SND_HDA_POWER_SAVE
4182 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
4184 struct alc_spec *spec = codec->spec;
4185 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
4190 * Analog playback callbacks
4192 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
4193 struct hda_codec *codec,
4194 struct snd_pcm_substream *substream)
4196 struct alc_spec *spec = codec->spec;
4197 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
4201 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
4202 struct hda_codec *codec,
4203 unsigned int stream_tag,
4204 unsigned int format,
4205 struct snd_pcm_substream *substream)
4207 struct alc_spec *spec = codec->spec;
4208 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
4209 stream_tag, format, substream);
4212 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
4213 struct hda_codec *codec,
4214 struct snd_pcm_substream *substream)
4216 struct alc_spec *spec = codec->spec;
4217 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
4223 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
4224 struct hda_codec *codec,
4225 struct snd_pcm_substream *substream)
4227 struct alc_spec *spec = codec->spec;
4228 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
4231 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
4232 struct hda_codec *codec,
4233 unsigned int stream_tag,
4234 unsigned int format,
4235 struct snd_pcm_substream *substream)
4237 struct alc_spec *spec = codec->spec;
4238 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
4239 stream_tag, format, substream);
4242 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
4243 struct hda_codec *codec,
4244 struct snd_pcm_substream *substream)
4246 struct alc_spec *spec = codec->spec;
4247 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
4250 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
4251 struct hda_codec *codec,
4252 struct snd_pcm_substream *substream)
4254 struct alc_spec *spec = codec->spec;
4255 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
4261 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
4262 struct hda_codec *codec,
4263 unsigned int stream_tag,
4264 unsigned int format,
4265 struct snd_pcm_substream *substream)
4267 struct alc_spec *spec = codec->spec;
4269 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
4270 stream_tag, 0, format);
4274 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
4275 struct hda_codec *codec,
4276 struct snd_pcm_substream *substream)
4278 struct alc_spec *spec = codec->spec;
4280 snd_hda_codec_cleanup_stream(codec,
4281 spec->adc_nids[substream->number + 1]);
4285 /* analog capture with dynamic dual-adc changes */
4286 static int dualmic_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
4287 struct hda_codec *codec,
4288 unsigned int stream_tag,
4289 unsigned int format,
4290 struct snd_pcm_substream *substream)
4292 struct alc_spec *spec = codec->spec;
4293 spec->cur_adc = spec->adc_nids[spec->cur_adc_idx];
4294 spec->cur_adc_stream_tag = stream_tag;
4295 spec->cur_adc_format = format;
4296 snd_hda_codec_setup_stream(codec, spec->cur_adc, stream_tag, 0, format);
4300 static int dualmic_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
4301 struct hda_codec *codec,
4302 struct snd_pcm_substream *substream)
4304 struct alc_spec *spec = codec->spec;
4305 snd_hda_codec_cleanup_stream(codec, spec->cur_adc);
4310 static const struct hda_pcm_stream dualmic_pcm_analog_capture = {
4314 .nid = 0, /* fill later */
4316 .prepare = dualmic_capture_pcm_prepare,
4317 .cleanup = dualmic_capture_pcm_cleanup
4323 static const struct hda_pcm_stream alc880_pcm_analog_playback = {
4327 /* NID is set in alc_build_pcms */
4329 .open = alc880_playback_pcm_open,
4330 .prepare = alc880_playback_pcm_prepare,
4331 .cleanup = alc880_playback_pcm_cleanup
4335 static const struct hda_pcm_stream alc880_pcm_analog_capture = {
4339 /* NID is set in alc_build_pcms */
4342 static const struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
4346 /* NID is set in alc_build_pcms */
4349 static const struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
4350 .substreams = 2, /* can be overridden */
4353 /* NID is set in alc_build_pcms */
4355 .prepare = alc880_alt_capture_pcm_prepare,
4356 .cleanup = alc880_alt_capture_pcm_cleanup
4360 static const struct hda_pcm_stream alc880_pcm_digital_playback = {
4364 /* NID is set in alc_build_pcms */
4366 .open = alc880_dig_playback_pcm_open,
4367 .close = alc880_dig_playback_pcm_close,
4368 .prepare = alc880_dig_playback_pcm_prepare,
4369 .cleanup = alc880_dig_playback_pcm_cleanup
4373 static const struct hda_pcm_stream alc880_pcm_digital_capture = {
4377 /* NID is set in alc_build_pcms */
4380 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
4381 static const struct hda_pcm_stream alc_pcm_null_stream = {
4387 static int alc_build_pcms(struct hda_codec *codec)
4389 struct alc_spec *spec = codec->spec;
4390 struct hda_pcm *info = spec->pcm_rec;
4393 codec->num_pcms = 1;
4394 codec->pcm_info = info;
4396 if (spec->no_analog)
4399 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
4400 "%s Analog", codec->chip_name);
4401 info->name = spec->stream_name_analog;
4403 if (spec->stream_analog_playback) {
4404 if (snd_BUG_ON(!spec->multiout.dac_nids))
4406 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
4407 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
4409 if (spec->stream_analog_capture) {
4410 if (snd_BUG_ON(!spec->adc_nids))
4412 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
4413 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
4416 if (spec->channel_mode) {
4417 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
4418 for (i = 0; i < spec->num_channel_mode; i++) {
4419 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
4420 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
4426 /* SPDIF for stream index #1 */
4427 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
4428 snprintf(spec->stream_name_digital,
4429 sizeof(spec->stream_name_digital),
4430 "%s Digital", codec->chip_name);
4431 codec->num_pcms = 2;
4432 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
4433 info = spec->pcm_rec + 1;
4434 info->name = spec->stream_name_digital;
4435 if (spec->dig_out_type)
4436 info->pcm_type = spec->dig_out_type;
4438 info->pcm_type = HDA_PCM_TYPE_SPDIF;
4439 if (spec->multiout.dig_out_nid &&
4440 spec->stream_digital_playback) {
4441 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
4442 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
4444 if (spec->dig_in_nid &&
4445 spec->stream_digital_capture) {
4446 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
4447 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
4449 /* FIXME: do we need this for all Realtek codec models? */
4450 codec->spdif_status_reset = 1;
4453 if (spec->no_analog)
4456 /* If the use of more than one ADC is requested for the current
4457 * model, configure a second analog capture-only PCM.
4459 /* Additional Analaog capture for index #2 */
4460 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
4461 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
4462 codec->num_pcms = 3;
4463 info = spec->pcm_rec + 2;
4464 info->name = spec->stream_name_analog;
4465 if (spec->alt_dac_nid) {
4466 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
4467 *spec->stream_analog_alt_playback;
4468 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
4471 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
4472 alc_pcm_null_stream;
4473 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
4475 if (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture) {
4476 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
4477 *spec->stream_analog_alt_capture;
4478 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
4480 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
4481 spec->num_adc_nids - 1;
4483 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
4484 alc_pcm_null_stream;
4485 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
4492 static inline void alc_shutup(struct hda_codec *codec)
4494 struct alc_spec *spec = codec->spec;
4496 if (spec && spec->shutup)
4497 spec->shutup(codec);
4498 snd_hda_shutup_pins(codec);
4501 static void alc_free_kctls(struct hda_codec *codec)
4503 struct alc_spec *spec = codec->spec;
4505 if (spec->kctls.list) {
4506 struct snd_kcontrol_new *kctl = spec->kctls.list;
4508 for (i = 0; i < spec->kctls.used; i++)
4509 kfree(kctl[i].name);
4511 snd_array_free(&spec->kctls);
4514 static void alc_free(struct hda_codec *codec)
4516 struct alc_spec *spec = codec->spec;
4522 snd_hda_input_jack_free(codec);
4523 alc_free_kctls(codec);
4525 snd_hda_detach_beep_device(codec);
4528 #ifdef CONFIG_SND_HDA_POWER_SAVE
4529 static void alc_power_eapd(struct hda_codec *codec)
4531 alc_auto_setup_eapd(codec, false);
4534 static int alc_suspend(struct hda_codec *codec, pm_message_t state)
4536 struct alc_spec *spec = codec->spec;
4538 if (spec && spec->power_hook)
4539 spec->power_hook(codec);
4544 #ifdef SND_HDA_NEEDS_RESUME
4545 static int alc_resume(struct hda_codec *codec)
4547 msleep(150); /* to avoid pop noise */
4548 codec->patch_ops.init(codec);
4549 snd_hda_codec_resume_amp(codec);
4550 snd_hda_codec_resume_cache(codec);
4551 hda_call_check_power_status(codec, 0x01);
4558 static const struct hda_codec_ops alc_patch_ops = {
4559 .build_controls = alc_build_controls,
4560 .build_pcms = alc_build_pcms,
4563 .unsol_event = alc_unsol_event,
4564 #ifdef SND_HDA_NEEDS_RESUME
4565 .resume = alc_resume,
4567 #ifdef CONFIG_SND_HDA_POWER_SAVE
4568 .suspend = alc_suspend,
4569 .check_power_status = alc_check_power_status,
4571 .reboot_notify = alc_shutup,
4574 /* replace the codec chip_name with the given string */
4575 static int alc_codec_rename(struct hda_codec *codec, const char *name)
4577 kfree(codec->chip_name);
4578 codec->chip_name = kstrdup(name, GFP_KERNEL);
4579 if (!codec->chip_name) {
4587 * Test configuration for debugging
4589 * Almost all inputs/outputs are enabled. I/O pins can be configured via
4592 #ifdef CONFIG_SND_DEBUG
4593 static const hda_nid_t alc880_test_dac_nids[4] = {
4594 0x02, 0x03, 0x04, 0x05
4597 static const struct hda_input_mux alc880_test_capture_source = {
4606 { "Surround", 0x6 },
4610 static const struct hda_channel_mode alc880_test_modes[4] = {
4617 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
4618 struct snd_ctl_elem_info *uinfo)
4620 static const char * const texts[] = {
4621 "N/A", "Line Out", "HP Out",
4622 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
4624 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
4626 uinfo->value.enumerated.items = 8;
4627 if (uinfo->value.enumerated.item >= 8)
4628 uinfo->value.enumerated.item = 7;
4629 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
4633 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
4634 struct snd_ctl_elem_value *ucontrol)
4636 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4637 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4638 unsigned int pin_ctl, item = 0;
4640 pin_ctl = snd_hda_codec_read(codec, nid, 0,
4641 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
4642 if (pin_ctl & AC_PINCTL_OUT_EN) {
4643 if (pin_ctl & AC_PINCTL_HP_EN)
4647 } else if (pin_ctl & AC_PINCTL_IN_EN) {
4648 switch (pin_ctl & AC_PINCTL_VREFEN) {
4649 case AC_PINCTL_VREF_HIZ: item = 3; break;
4650 case AC_PINCTL_VREF_50: item = 4; break;
4651 case AC_PINCTL_VREF_GRD: item = 5; break;
4652 case AC_PINCTL_VREF_80: item = 6; break;
4653 case AC_PINCTL_VREF_100: item = 7; break;
4656 ucontrol->value.enumerated.item[0] = item;
4660 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
4661 struct snd_ctl_elem_value *ucontrol)
4663 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4664 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4665 static const unsigned int ctls[] = {
4666 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
4667 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
4668 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
4669 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
4670 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
4671 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
4673 unsigned int old_ctl, new_ctl;
4675 old_ctl = snd_hda_codec_read(codec, nid, 0,
4676 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
4677 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
4678 if (old_ctl != new_ctl) {
4680 snd_hda_codec_write_cache(codec, nid, 0,
4681 AC_VERB_SET_PIN_WIDGET_CONTROL,
4683 val = ucontrol->value.enumerated.item[0] >= 3 ?
4685 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
4692 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
4693 struct snd_ctl_elem_info *uinfo)
4695 static const char * const texts[] = {
4696 "Front", "Surround", "CLFE", "Side"
4698 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
4700 uinfo->value.enumerated.items = 4;
4701 if (uinfo->value.enumerated.item >= 4)
4702 uinfo->value.enumerated.item = 3;
4703 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
4707 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
4708 struct snd_ctl_elem_value *ucontrol)
4710 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4711 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4714 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
4715 ucontrol->value.enumerated.item[0] = sel & 3;
4719 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
4720 struct snd_ctl_elem_value *ucontrol)
4722 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4723 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4726 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
4727 if (ucontrol->value.enumerated.item[0] != sel) {
4728 sel = ucontrol->value.enumerated.item[0] & 3;
4729 snd_hda_codec_write_cache(codec, nid, 0,
4730 AC_VERB_SET_CONNECT_SEL, sel);
4736 #define PIN_CTL_TEST(xname,nid) { \
4737 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4739 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4740 .info = alc_test_pin_ctl_info, \
4741 .get = alc_test_pin_ctl_get, \
4742 .put = alc_test_pin_ctl_put, \
4743 .private_value = nid \
4746 #define PIN_SRC_TEST(xname,nid) { \
4747 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4749 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4750 .info = alc_test_pin_src_info, \
4751 .get = alc_test_pin_src_get, \
4752 .put = alc_test_pin_src_put, \
4753 .private_value = nid \
4756 static const struct snd_kcontrol_new alc880_test_mixer[] = {
4757 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
4758 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
4759 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
4760 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
4761 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
4762 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
4763 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
4764 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
4765 PIN_CTL_TEST("Front Pin Mode", 0x14),
4766 PIN_CTL_TEST("Surround Pin Mode", 0x15),
4767 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
4768 PIN_CTL_TEST("Side Pin Mode", 0x17),
4769 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
4770 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
4771 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
4772 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
4773 PIN_SRC_TEST("In-1 Pin Source", 0x18),
4774 PIN_SRC_TEST("In-2 Pin Source", 0x19),
4775 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
4776 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
4777 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
4778 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
4779 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
4780 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
4781 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
4782 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
4783 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
4784 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
4785 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
4786 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
4788 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4789 .name = "Channel Mode",
4790 .info = alc_ch_mode_info,
4791 .get = alc_ch_mode_get,
4792 .put = alc_ch_mode_put,
4797 static const struct hda_verb alc880_test_init_verbs[] = {
4798 /* Unmute inputs of 0x0c - 0x0f */
4799 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4800 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4801 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4802 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4803 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4804 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4805 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4806 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4807 /* Vol output for 0x0c-0x0f */
4808 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4809 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4810 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4811 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4812 /* Set output pins 0x14-0x17 */
4813 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4814 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4815 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4816 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4817 /* Unmute output pins 0x14-0x17 */
4818 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4819 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4820 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4821 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4822 /* Set input pins 0x18-0x1c */
4823 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4824 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4825 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4826 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4827 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4828 /* Mute input pins 0x18-0x1b */
4829 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4830 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4831 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4832 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4834 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4835 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
4836 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4837 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
4838 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4839 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
4840 /* Analog input/passthru */
4841 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4842 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4843 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4844 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4845 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4853 static const char * const alc880_models[ALC880_MODEL_LAST] = {
4854 [ALC880_3ST] = "3stack",
4855 [ALC880_TCL_S700] = "tcl",
4856 [ALC880_3ST_DIG] = "3stack-digout",
4857 [ALC880_CLEVO] = "clevo",
4858 [ALC880_5ST] = "5stack",
4859 [ALC880_5ST_DIG] = "5stack-digout",
4860 [ALC880_W810] = "w810",
4861 [ALC880_Z71V] = "z71v",
4862 [ALC880_6ST] = "6stack",
4863 [ALC880_6ST_DIG] = "6stack-digout",
4864 [ALC880_ASUS] = "asus",
4865 [ALC880_ASUS_W1V] = "asus-w1v",
4866 [ALC880_ASUS_DIG] = "asus-dig",
4867 [ALC880_ASUS_DIG2] = "asus-dig2",
4868 [ALC880_UNIWILL_DIG] = "uniwill",
4869 [ALC880_UNIWILL_P53] = "uniwill-p53",
4870 [ALC880_FUJITSU] = "fujitsu",
4871 [ALC880_F1734] = "F1734",
4873 [ALC880_LG_LW] = "lg-lw",
4874 [ALC880_MEDION_RIM] = "medion",
4875 #ifdef CONFIG_SND_DEBUG
4876 [ALC880_TEST] = "test",
4878 [ALC880_AUTO] = "auto",
4881 static const struct snd_pci_quirk alc880_cfg_tbl[] = {
4882 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
4883 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
4884 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
4885 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
4886 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
4887 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
4888 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
4889 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
4890 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
4891 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
4892 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
4893 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
4894 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
4895 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
4896 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
4897 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
4898 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
4899 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
4900 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
4901 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
4902 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
4903 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
4904 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
4905 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
4906 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
4907 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
4908 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
4909 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
4910 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
4911 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
4912 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
4913 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
4914 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
4915 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
4916 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
4917 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
4918 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
4919 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
4920 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
4921 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_F1734),
4922 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
4923 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
4924 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
4925 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
4926 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
4927 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
4928 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
4929 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
4930 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734),
4931 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
4932 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
4933 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
4934 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_LG),
4935 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
4936 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
4937 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
4938 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
4939 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
4940 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
4941 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
4942 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
4943 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
4944 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
4945 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
4946 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
4947 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
4948 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
4949 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
4951 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
4952 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
4953 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
4958 * ALC880 codec presets
4960 static const struct alc_config_preset alc880_presets[] = {
4962 .mixers = { alc880_three_stack_mixer },
4963 .init_verbs = { alc880_volume_init_verbs,
4964 alc880_pin_3stack_init_verbs },
4965 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4966 .dac_nids = alc880_dac_nids,
4967 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4968 .channel_mode = alc880_threestack_modes,
4970 .input_mux = &alc880_capture_source,
4972 [ALC880_3ST_DIG] = {
4973 .mixers = { alc880_three_stack_mixer },
4974 .init_verbs = { alc880_volume_init_verbs,
4975 alc880_pin_3stack_init_verbs },
4976 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4977 .dac_nids = alc880_dac_nids,
4978 .dig_out_nid = ALC880_DIGOUT_NID,
4979 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4980 .channel_mode = alc880_threestack_modes,
4982 .input_mux = &alc880_capture_source,
4984 [ALC880_TCL_S700] = {
4985 .mixers = { alc880_tcl_s700_mixer },
4986 .init_verbs = { alc880_volume_init_verbs,
4987 alc880_pin_tcl_S700_init_verbs,
4988 alc880_gpio2_init_verbs },
4989 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4990 .dac_nids = alc880_dac_nids,
4991 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4992 .num_adc_nids = 1, /* single ADC */
4994 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4995 .channel_mode = alc880_2_jack_modes,
4996 .input_mux = &alc880_capture_source,
4999 .mixers = { alc880_three_stack_mixer,
5000 alc880_five_stack_mixer},
5001 .init_verbs = { alc880_volume_init_verbs,
5002 alc880_pin_5stack_init_verbs },
5003 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
5004 .dac_nids = alc880_dac_nids,
5005 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
5006 .channel_mode = alc880_fivestack_modes,
5007 .input_mux = &alc880_capture_source,
5009 [ALC880_5ST_DIG] = {
5010 .mixers = { alc880_three_stack_mixer,
5011 alc880_five_stack_mixer },
5012 .init_verbs = { alc880_volume_init_verbs,
5013 alc880_pin_5stack_init_verbs },
5014 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
5015 .dac_nids = alc880_dac_nids,
5016 .dig_out_nid = ALC880_DIGOUT_NID,
5017 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
5018 .channel_mode = alc880_fivestack_modes,
5019 .input_mux = &alc880_capture_source,
5022 .mixers = { alc880_six_stack_mixer },
5023 .init_verbs = { alc880_volume_init_verbs,
5024 alc880_pin_6stack_init_verbs },
5025 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
5026 .dac_nids = alc880_6st_dac_nids,
5027 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
5028 .channel_mode = alc880_sixstack_modes,
5029 .input_mux = &alc880_6stack_capture_source,
5031 [ALC880_6ST_DIG] = {
5032 .mixers = { alc880_six_stack_mixer },
5033 .init_verbs = { alc880_volume_init_verbs,
5034 alc880_pin_6stack_init_verbs },
5035 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
5036 .dac_nids = alc880_6st_dac_nids,
5037 .dig_out_nid = ALC880_DIGOUT_NID,
5038 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
5039 .channel_mode = alc880_sixstack_modes,
5040 .input_mux = &alc880_6stack_capture_source,
5043 .mixers = { alc880_w810_base_mixer },
5044 .init_verbs = { alc880_volume_init_verbs,
5045 alc880_pin_w810_init_verbs,
5046 alc880_gpio2_init_verbs },
5047 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
5048 .dac_nids = alc880_w810_dac_nids,
5049 .dig_out_nid = ALC880_DIGOUT_NID,
5050 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
5051 .channel_mode = alc880_w810_modes,
5052 .input_mux = &alc880_capture_source,
5055 .mixers = { alc880_z71v_mixer },
5056 .init_verbs = { alc880_volume_init_verbs,
5057 alc880_pin_z71v_init_verbs },
5058 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
5059 .dac_nids = alc880_z71v_dac_nids,
5060 .dig_out_nid = ALC880_DIGOUT_NID,
5062 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
5063 .channel_mode = alc880_2_jack_modes,
5064 .input_mux = &alc880_capture_source,
5067 .mixers = { alc880_f1734_mixer },
5068 .init_verbs = { alc880_volume_init_verbs,
5069 alc880_pin_f1734_init_verbs },
5070 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
5071 .dac_nids = alc880_f1734_dac_nids,
5073 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
5074 .channel_mode = alc880_2_jack_modes,
5075 .input_mux = &alc880_f1734_capture_source,
5076 .unsol_event = alc880_uniwill_p53_unsol_event,
5077 .setup = alc880_uniwill_p53_setup,
5078 .init_hook = alc_hp_automute,
5081 .mixers = { alc880_asus_mixer },
5082 .init_verbs = { alc880_volume_init_verbs,
5083 alc880_pin_asus_init_verbs,
5084 alc880_gpio1_init_verbs },
5085 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
5086 .dac_nids = alc880_asus_dac_nids,
5087 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
5088 .channel_mode = alc880_asus_modes,
5090 .input_mux = &alc880_capture_source,
5092 [ALC880_ASUS_DIG] = {
5093 .mixers = { alc880_asus_mixer },
5094 .init_verbs = { alc880_volume_init_verbs,
5095 alc880_pin_asus_init_verbs,
5096 alc880_gpio1_init_verbs },
5097 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
5098 .dac_nids = alc880_asus_dac_nids,
5099 .dig_out_nid = ALC880_DIGOUT_NID,
5100 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
5101 .channel_mode = alc880_asus_modes,
5103 .input_mux = &alc880_capture_source,
5105 [ALC880_ASUS_DIG2] = {
5106 .mixers = { alc880_asus_mixer },
5107 .init_verbs = { alc880_volume_init_verbs,
5108 alc880_pin_asus_init_verbs,
5109 alc880_gpio2_init_verbs }, /* use GPIO2 */
5110 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
5111 .dac_nids = alc880_asus_dac_nids,
5112 .dig_out_nid = ALC880_DIGOUT_NID,
5113 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
5114 .channel_mode = alc880_asus_modes,
5116 .input_mux = &alc880_capture_source,
5118 [ALC880_ASUS_W1V] = {
5119 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
5120 .init_verbs = { alc880_volume_init_verbs,
5121 alc880_pin_asus_init_verbs,
5122 alc880_gpio1_init_verbs },
5123 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
5124 .dac_nids = alc880_asus_dac_nids,
5125 .dig_out_nid = ALC880_DIGOUT_NID,
5126 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
5127 .channel_mode = alc880_asus_modes,
5129 .input_mux = &alc880_capture_source,
5131 [ALC880_UNIWILL_DIG] = {
5132 .mixers = { alc880_asus_mixer },
5133 .init_verbs = { alc880_volume_init_verbs,
5134 alc880_pin_asus_init_verbs },
5135 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
5136 .dac_nids = alc880_asus_dac_nids,
5137 .dig_out_nid = ALC880_DIGOUT_NID,
5138 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
5139 .channel_mode = alc880_asus_modes,
5141 .input_mux = &alc880_capture_source,
5143 [ALC880_UNIWILL] = {
5144 .mixers = { alc880_uniwill_mixer },
5145 .init_verbs = { alc880_volume_init_verbs,
5146 alc880_uniwill_init_verbs },
5147 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
5148 .dac_nids = alc880_asus_dac_nids,
5149 .dig_out_nid = ALC880_DIGOUT_NID,
5150 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
5151 .channel_mode = alc880_threestack_modes,
5153 .input_mux = &alc880_capture_source,
5154 .unsol_event = alc880_uniwill_unsol_event,
5155 .setup = alc880_uniwill_setup,
5156 .init_hook = alc880_uniwill_init_hook,
5158 [ALC880_UNIWILL_P53] = {
5159 .mixers = { alc880_uniwill_p53_mixer },
5160 .init_verbs = { alc880_volume_init_verbs,
5161 alc880_uniwill_p53_init_verbs },
5162 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
5163 .dac_nids = alc880_asus_dac_nids,
5164 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
5165 .channel_mode = alc880_threestack_modes,
5166 .input_mux = &alc880_capture_source,
5167 .unsol_event = alc880_uniwill_p53_unsol_event,
5168 .setup = alc880_uniwill_p53_setup,
5169 .init_hook = alc_hp_automute,
5171 [ALC880_FUJITSU] = {
5172 .mixers = { alc880_fujitsu_mixer },
5173 .init_verbs = { alc880_volume_init_verbs,
5174 alc880_uniwill_p53_init_verbs,
5175 alc880_beep_init_verbs },
5176 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
5177 .dac_nids = alc880_dac_nids,
5178 .dig_out_nid = ALC880_DIGOUT_NID,
5179 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
5180 .channel_mode = alc880_2_jack_modes,
5181 .input_mux = &alc880_capture_source,
5182 .unsol_event = alc880_uniwill_p53_unsol_event,
5183 .setup = alc880_uniwill_p53_setup,
5184 .init_hook = alc_hp_automute,
5187 .mixers = { alc880_three_stack_mixer },
5188 .init_verbs = { alc880_volume_init_verbs,
5189 alc880_pin_clevo_init_verbs },
5190 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
5191 .dac_nids = alc880_dac_nids,
5193 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
5194 .channel_mode = alc880_threestack_modes,
5196 .input_mux = &alc880_capture_source,
5199 .mixers = { alc880_lg_mixer },
5200 .init_verbs = { alc880_volume_init_verbs,
5201 alc880_lg_init_verbs },
5202 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
5203 .dac_nids = alc880_lg_dac_nids,
5204 .dig_out_nid = ALC880_DIGOUT_NID,
5205 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
5206 .channel_mode = alc880_lg_ch_modes,
5208 .input_mux = &alc880_lg_capture_source,
5209 .unsol_event = alc_sku_unsol_event,
5210 .setup = alc880_lg_setup,
5211 .init_hook = alc_hp_automute,
5212 #ifdef CONFIG_SND_HDA_POWER_SAVE
5213 .loopbacks = alc880_lg_loopbacks,
5217 .mixers = { alc880_lg_lw_mixer },
5218 .init_verbs = { alc880_volume_init_verbs,
5219 alc880_lg_lw_init_verbs },
5220 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
5221 .dac_nids = alc880_dac_nids,
5222 .dig_out_nid = ALC880_DIGOUT_NID,
5223 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
5224 .channel_mode = alc880_lg_lw_modes,
5225 .input_mux = &alc880_lg_lw_capture_source,
5226 .unsol_event = alc_sku_unsol_event,
5227 .setup = alc880_lg_lw_setup,
5228 .init_hook = alc_hp_automute,
5230 [ALC880_MEDION_RIM] = {
5231 .mixers = { alc880_medion_rim_mixer },
5232 .init_verbs = { alc880_volume_init_verbs,
5233 alc880_medion_rim_init_verbs,
5234 alc_gpio2_init_verbs },
5235 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
5236 .dac_nids = alc880_dac_nids,
5237 .dig_out_nid = ALC880_DIGOUT_NID,
5238 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
5239 .channel_mode = alc880_2_jack_modes,
5240 .input_mux = &alc880_medion_rim_capture_source,
5241 .unsol_event = alc880_medion_rim_unsol_event,
5242 .setup = alc880_medion_rim_setup,
5243 .init_hook = alc880_medion_rim_automute,
5245 #ifdef CONFIG_SND_DEBUG
5247 .mixers = { alc880_test_mixer },
5248 .init_verbs = { alc880_test_init_verbs },
5249 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
5250 .dac_nids = alc880_test_dac_nids,
5251 .dig_out_nid = ALC880_DIGOUT_NID,
5252 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
5253 .channel_mode = alc880_test_modes,
5254 .input_mux = &alc880_test_capture_source,
5260 * Automatic parse of I/O pins from the BIOS configuration
5265 ALC_CTL_WIDGET_MUTE,
5268 static const struct snd_kcontrol_new alc880_control_templates[] = {
5269 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
5270 HDA_CODEC_MUTE(NULL, 0, 0, 0),
5271 HDA_BIND_MUTE(NULL, 0, 0, 0),
5274 static struct snd_kcontrol_new *alc_kcontrol_new(struct alc_spec *spec)
5276 snd_array_init(&spec->kctls, sizeof(struct snd_kcontrol_new), 32);
5277 return snd_array_new(&spec->kctls);
5280 /* add dynamic controls */
5281 static int add_control(struct alc_spec *spec, int type, const char *name,
5282 int cidx, unsigned long val)
5284 struct snd_kcontrol_new *knew;
5286 knew = alc_kcontrol_new(spec);
5289 *knew = alc880_control_templates[type];
5290 knew->name = kstrdup(name, GFP_KERNEL);
5294 if (get_amp_nid_(val))
5295 knew->subdevice = HDA_SUBDEV_AMP_FLAG;
5296 knew->private_value = val;
5300 static int add_control_with_pfx(struct alc_spec *spec, int type,
5301 const char *pfx, const char *dir,
5302 const char *sfx, int cidx, unsigned long val)
5305 snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx);
5306 return add_control(spec, type, name, cidx, val);
5309 #define add_pb_vol_ctrl(spec, type, pfx, val) \
5310 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", 0, val)
5311 #define add_pb_sw_ctrl(spec, type, pfx, val) \
5312 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", 0, val)
5313 #define __add_pb_vol_ctrl(spec, type, pfx, cidx, val) \
5314 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", cidx, val)
5315 #define __add_pb_sw_ctrl(spec, type, pfx, cidx, val) \
5316 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", cidx, val)
5318 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
5319 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
5320 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
5321 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
5322 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
5323 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
5324 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
5325 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
5326 #define ALC880_PIN_CD_NID 0x1c
5328 /* fill in the dac_nids table from the parsed pin configuration */
5329 static int alc880_auto_fill_dac_nids(struct hda_codec *codec)
5331 struct alc_spec *spec = codec->spec;
5332 const struct auto_pin_cfg *cfg = &spec->autocfg;
5337 memset(assigned, 0, sizeof(assigned));
5338 spec->multiout.dac_nids = spec->private_dac_nids;
5340 /* check the pins hardwired to audio widget */
5341 for (i = 0; i < cfg->line_outs; i++) {
5342 nid = cfg->line_out_pins[i];
5343 if (alc880_is_fixed_pin(nid)) {
5344 int idx = alc880_fixed_pin_idx(nid);
5345 spec->private_dac_nids[i] = alc880_idx_to_dac(idx);
5349 /* left pins can be connect to any audio widget */
5350 for (i = 0; i < cfg->line_outs; i++) {
5351 nid = cfg->line_out_pins[i];
5352 if (alc880_is_fixed_pin(nid))
5354 /* search for an empty channel */
5355 for (j = 0; j < cfg->line_outs; j++) {
5357 spec->private_dac_nids[i] =
5358 alc880_idx_to_dac(j);
5364 spec->multiout.num_dacs = cfg->line_outs;
5368 static const char *alc_get_line_out_pfx(struct alc_spec *spec, int ch,
5369 bool can_be_master, int *index)
5371 struct auto_pin_cfg *cfg = &spec->autocfg;
5372 static const char * const chname[4] = {
5373 "Front", "Surround", NULL /*CLFE*/, "Side"
5377 if (cfg->line_outs == 1 && !spec->multi_ios &&
5378 !cfg->hp_outs && !cfg->speaker_outs && can_be_master)
5381 switch (cfg->line_out_type) {
5382 case AUTO_PIN_SPEAKER_OUT:
5383 if (cfg->line_outs == 1)
5386 case AUTO_PIN_HP_OUT:
5387 /* for multi-io case, only the primary out */
5388 if (ch && spec->multi_ios)
5393 if (cfg->line_outs == 1 && !spec->multi_ios)
5400 /* add playback controls from the parsed DAC table */
5401 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
5402 const struct auto_pin_cfg *cfg)
5405 int i, err, noutputs;
5407 noutputs = cfg->line_outs;
5408 if (spec->multi_ios > 0)
5409 noutputs += spec->multi_ios;
5411 for (i = 0; i < noutputs; i++) {
5414 if (!spec->multiout.dac_nids[i])
5416 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
5417 name = alc_get_line_out_pfx(spec, i, false, &index);
5420 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
5422 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
5426 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
5428 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
5432 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
5434 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
5438 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
5440 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
5445 err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
5447 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
5451 err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
5453 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
5462 /* add playback controls for speaker and HP outputs */
5463 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
5472 if (alc880_is_fixed_pin(pin)) {
5473 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
5474 /* specify the DAC as the extra output */
5475 if (!spec->multiout.hp_nid)
5476 spec->multiout.hp_nid = nid;
5478 spec->multiout.extra_out_nid[0] = nid;
5479 /* control HP volume/switch on the output mixer amp */
5480 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
5481 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
5482 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
5485 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
5486 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
5489 } else if (alc880_is_multi_pin(pin)) {
5490 /* set manual connection */
5491 /* we have only a switch on HP-out PIN */
5492 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
5493 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
5500 /* create input playback/capture controls for the given pin */
5501 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
5502 const char *ctlname, int ctlidx,
5503 int idx, hda_nid_t mix_nid)
5507 err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, ctlidx,
5508 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
5511 err = __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, ctlidx,
5512 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
5518 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
5520 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
5521 return (pincap & AC_PINCAP_IN) != 0;
5524 /* create playback/capture controls for input pins */
5525 static int alc_auto_create_input_ctls(struct hda_codec *codec,
5526 const struct auto_pin_cfg *cfg,
5528 hda_nid_t cap1, hda_nid_t cap2)
5530 struct alc_spec *spec = codec->spec;
5531 struct hda_input_mux *imux = &spec->private_imux[0];
5532 int i, err, idx, type_idx = 0;
5533 const char *prev_label = NULL;
5535 for (i = 0; i < cfg->num_inputs; i++) {
5539 pin = cfg->inputs[i].pin;
5540 if (!alc_is_input_pin(codec, pin))
5543 label = hda_get_autocfg_input_label(codec, cfg, i);
5544 if (prev_label && !strcmp(label, prev_label))
5551 idx = get_connection_index(codec, mixer, pin);
5553 err = new_analog_input(spec, pin,
5563 idx = get_connection_index(codec, cap1, pin);
5564 if (idx < 0 && cap2)
5565 idx = get_connection_index(codec, cap2, pin);
5567 snd_hda_add_imux_item(imux, label, idx, NULL);
5572 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
5573 const struct auto_pin_cfg *cfg)
5575 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
5578 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
5579 unsigned int pin_type)
5581 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5584 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
5588 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
5589 hda_nid_t nid, int pin_type,
5592 alc_set_pin_output(codec, nid, pin_type);
5593 /* need the manual connection? */
5594 if (alc880_is_multi_pin(nid)) {
5595 struct alc_spec *spec = codec->spec;
5596 int idx = alc880_multi_pin_idx(nid);
5597 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
5598 AC_VERB_SET_CONNECT_SEL,
5599 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
5603 static int get_pin_type(int line_out_type)
5605 if (line_out_type == AUTO_PIN_HP_OUT)
5611 static void alc880_auto_init_dac(struct hda_codec *codec, hda_nid_t dac)
5617 mix = alc880_idx_to_mixer(alc880_dac_to_idx(dac));
5618 if (query_amp_caps(codec, dac, HDA_OUTPUT) & AC_AMPCAP_NUM_STEPS)
5620 else if (query_amp_caps(codec, mix, HDA_OUTPUT) & AC_AMPCAP_NUM_STEPS)
5625 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
5627 if (query_amp_caps(codec, mix, HDA_INPUT) & AC_AMPCAP_MUTE) {
5628 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
5630 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
5635 static void alc880_auto_init_multi_out(struct hda_codec *codec)
5637 struct alc_spec *spec = codec->spec;
5640 for (i = 0; i < spec->autocfg.line_outs; i++) {
5641 hda_nid_t nid = spec->autocfg.line_out_pins[i];
5642 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5643 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
5646 for (i = 0; i < spec->multiout.num_dacs; i++)
5647 alc880_auto_init_dac(codec, spec->multiout.dac_nids[i]);
5650 static void alc880_auto_init_extra_out(struct hda_codec *codec)
5652 struct alc_spec *spec = codec->spec;
5656 pin = spec->autocfg.speaker_pins[0];
5657 if (pin) /* connect to front */
5658 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
5659 pin = spec->autocfg.hp_pins[0];
5660 if (pin) /* connect to front */
5661 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
5663 alc880_auto_init_dac(codec, spec->multiout.hp_nid);
5664 for (i = 0; i < ARRAY_SIZE(spec->multiout.extra_out_nid); i++)
5665 alc880_auto_init_dac(codec, spec->multiout.extra_out_nid[i]);
5668 static void alc880_auto_init_analog_input(struct hda_codec *codec)
5670 struct alc_spec *spec = codec->spec;
5671 struct auto_pin_cfg *cfg = &spec->autocfg;
5674 for (i = 0; i < cfg->num_inputs; i++) {
5675 hda_nid_t nid = cfg->inputs[i].pin;
5676 if (alc_is_input_pin(codec, nid)) {
5677 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
5678 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
5679 snd_hda_codec_write(codec, nid, 0,
5680 AC_VERB_SET_AMP_GAIN_MUTE,
5685 /* mute all loopback inputs */
5686 if (spec->mixer_nid) {
5687 int nums = snd_hda_get_conn_list(codec, spec->mixer_nid, NULL);
5688 for (i = 0; i < nums; i++)
5689 snd_hda_codec_write(codec, spec->mixer_nid, 0,
5690 AC_VERB_SET_AMP_GAIN_MUTE,
5695 static void alc880_auto_init_input_src(struct hda_codec *codec)
5697 struct alc_spec *spec = codec->spec;
5700 for (c = 0; c < spec->num_adc_nids; c++) {
5701 unsigned int mux_idx;
5702 const struct hda_input_mux *imux;
5703 mux_idx = c >= spec->num_mux_defs ? 0 : c;
5704 imux = &spec->input_mux[mux_idx];
5705 if (!imux->num_items && mux_idx > 0)
5706 imux = &spec->input_mux[0];
5708 snd_hda_codec_write(codec, spec->adc_nids[c], 0,
5709 AC_VERB_SET_CONNECT_SEL,
5710 imux->items[0].index);
5711 snd_hda_codec_write(codec, spec->adc_nids[c], 0,
5712 AC_VERB_SET_AMP_GAIN_MUTE,
5717 static int alc_auto_add_multi_channel_mode(struct hda_codec *codec,
5718 int (*fill_dac)(struct hda_codec *));
5720 /* parse the BIOS configuration and set up the alc_spec */
5721 /* return 1 if successful, 0 if the proper config is not found,
5722 * or a negative error code
5724 static int alc880_parse_auto_config(struct hda_codec *codec)
5726 struct alc_spec *spec = codec->spec;
5728 static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
5730 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5734 if (!spec->autocfg.line_outs)
5735 return 0; /* can't find valid BIOS pin config */
5737 err = alc880_auto_fill_dac_nids(codec);
5740 err = alc_auto_add_multi_channel_mode(codec, alc880_auto_fill_dac_nids);
5743 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
5746 err = alc880_auto_create_extra_out(spec,
5747 spec->autocfg.speaker_pins[0],
5751 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
5755 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
5759 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
5761 alc_auto_parse_digital(codec);
5763 if (spec->kctls.list)
5764 add_mixer(spec, spec->kctls.list);
5766 spec->num_mux_defs = 1;
5767 spec->input_mux = &spec->private_imux[0];
5769 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
5774 /* additional initialization for auto-configuration model */
5775 static void alc880_auto_init(struct hda_codec *codec)
5777 struct alc_spec *spec = codec->spec;
5778 alc880_auto_init_multi_out(codec);
5779 alc880_auto_init_extra_out(codec);
5780 alc880_auto_init_analog_input(codec);
5781 alc880_auto_init_input_src(codec);
5782 alc_auto_init_digital(codec);
5783 if (spec->unsol_event)
5784 alc_inithook(codec);
5787 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
5788 * one of two digital mic pins, e.g. on ALC272
5790 static void fixup_automic_adc(struct hda_codec *codec)
5792 struct alc_spec *spec = codec->spec;
5795 for (i = 0; i < spec->num_adc_nids; i++) {
5796 hda_nid_t cap = spec->capsrc_nids ?
5797 spec->capsrc_nids[i] : spec->adc_nids[i];
5800 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
5803 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
5806 spec->int_mic.mux_idx = iidx;
5807 spec->ext_mic.mux_idx = eidx;
5808 if (spec->capsrc_nids)
5809 spec->capsrc_nids += i;
5810 spec->adc_nids += i;
5811 spec->num_adc_nids = 1;
5812 /* optional dock-mic */
5813 eidx = get_connection_index(codec, cap, spec->dock_mic.pin);
5815 spec->dock_mic.pin = 0;
5817 spec->dock_mic.mux_idx = eidx;
5820 snd_printd(KERN_INFO "hda_codec: %s: "
5821 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
5822 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
5823 spec->auto_mic = 0; /* disable auto-mic to be sure */
5826 /* select or unmute the given capsrc route */
5827 static void select_or_unmute_capsrc(struct hda_codec *codec, hda_nid_t cap,
5830 if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) {
5831 snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx,
5834 snd_hda_codec_write_cache(codec, cap, 0,
5835 AC_VERB_SET_CONNECT_SEL, idx);
5839 /* set the default connection to that pin */
5840 static int init_capsrc_for_pin(struct hda_codec *codec, hda_nid_t pin)
5842 struct alc_spec *spec = codec->spec;
5847 for (i = 0; i < spec->num_adc_nids; i++) {
5848 hda_nid_t cap = spec->capsrc_nids ?
5849 spec->capsrc_nids[i] : spec->adc_nids[i];
5852 idx = get_connection_index(codec, cap, pin);
5855 select_or_unmute_capsrc(codec, cap, idx);
5856 return i; /* return the found index */
5858 return -1; /* not found */
5861 /* choose the ADC/MUX containing the input pin and initialize the setup */
5862 static void fixup_single_adc(struct hda_codec *codec)
5864 struct alc_spec *spec = codec->spec;
5865 struct auto_pin_cfg *cfg = &spec->autocfg;
5868 /* search for the input pin; there must be only one */
5869 if (cfg->num_inputs != 1)
5871 i = init_capsrc_for_pin(codec, cfg->inputs[0].pin);
5873 /* use only this ADC */
5874 if (spec->capsrc_nids)
5875 spec->capsrc_nids += i;
5876 spec->adc_nids += i;
5877 spec->num_adc_nids = 1;
5878 spec->single_input_src = 1;
5882 /* initialize dual adcs */
5883 static void fixup_dual_adc_switch(struct hda_codec *codec)
5885 struct alc_spec *spec = codec->spec;
5886 init_capsrc_for_pin(codec, spec->ext_mic.pin);
5887 init_capsrc_for_pin(codec, spec->dock_mic.pin);
5888 init_capsrc_for_pin(codec, spec->int_mic.pin);
5891 /* initialize some special cases for input sources */
5892 static void alc_init_special_input_src(struct hda_codec *codec)
5894 struct alc_spec *spec = codec->spec;
5895 if (spec->dual_adc_switch)
5896 fixup_dual_adc_switch(codec);
5897 else if (spec->single_input_src)
5898 init_capsrc_for_pin(codec, spec->autocfg.inputs[0].pin);
5901 static void set_capture_mixer(struct hda_codec *codec)
5903 struct alc_spec *spec = codec->spec;
5904 static const struct snd_kcontrol_new *caps[2][3] = {
5905 { alc_capture_mixer_nosrc1,
5906 alc_capture_mixer_nosrc2,
5907 alc_capture_mixer_nosrc3 },
5908 { alc_capture_mixer1,
5910 alc_capture_mixer3 },
5912 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
5914 int num_adcs = spec->num_adc_nids;
5915 if (spec->dual_adc_switch)
5917 else if (spec->auto_mic)
5918 fixup_automic_adc(codec);
5919 else if (spec->input_mux) {
5920 if (spec->input_mux->num_items > 1)
5922 else if (spec->input_mux->num_items == 1)
5923 fixup_single_adc(codec);
5925 spec->cap_mixer = caps[mux][num_adcs - 1];
5929 /* fill adc_nids (and capsrc_nids) containing all active input pins */
5930 static void fillup_priv_adc_nids(struct hda_codec *codec, const hda_nid_t *nids,
5933 struct alc_spec *spec = codec->spec;
5934 struct auto_pin_cfg *cfg = &spec->autocfg;
5936 hda_nid_t fallback_adc = 0, fallback_cap = 0;
5938 for (n = 0; n < num_nids; n++) {
5940 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
5944 if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN)
5947 nconns = snd_hda_get_connections(codec, cap, conn,
5951 nconns = snd_hda_get_connections(codec, cap, conn,
5956 if (!fallback_adc) {
5960 for (i = 0; i < cfg->num_inputs; i++) {
5961 hda_nid_t nid = cfg->inputs[i].pin;
5962 for (j = 0; j < nconns; j++) {
5969 if (i >= cfg->num_inputs) {
5970 int num_adcs = spec->num_adc_nids;
5971 spec->private_adc_nids[num_adcs] = adc;
5972 spec->private_capsrc_nids[num_adcs] = cap;
5973 spec->num_adc_nids++;
5974 spec->adc_nids = spec->private_adc_nids;
5976 spec->capsrc_nids = spec->private_capsrc_nids;
5979 if (!spec->num_adc_nids) {
5980 printk(KERN_WARNING "hda_codec: %s: no valid ADC found;"
5981 " using fallback 0x%x\n",
5982 codec->chip_name, fallback_adc);
5983 spec->private_adc_nids[0] = fallback_adc;
5984 spec->adc_nids = spec->private_adc_nids;
5985 if (fallback_adc != fallback_cap) {
5986 spec->private_capsrc_nids[0] = fallback_cap;
5987 spec->capsrc_nids = spec->private_adc_nids;
5992 #ifdef CONFIG_SND_HDA_INPUT_BEEP
5993 #define set_beep_amp(spec, nid, idx, dir) \
5994 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
5996 static const struct snd_pci_quirk beep_white_list[] = {
5997 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
5998 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
5999 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
6000 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
6001 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
6005 static inline int has_cdefine_beep(struct hda_codec *codec)
6007 struct alc_spec *spec = codec->spec;
6008 const struct snd_pci_quirk *q;
6009 q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list);
6012 return spec->cdefine.enable_pcbeep;
6015 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
6016 #define has_cdefine_beep(codec) 0
6020 * OK, here we have finally the patch for ALC880
6023 static int patch_alc880(struct hda_codec *codec)
6025 struct alc_spec *spec;
6029 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6035 spec->mixer_nid = 0x0b;
6037 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
6040 if (board_config < 0) {
6041 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6043 board_config = ALC880_AUTO;
6046 if (board_config == ALC880_AUTO) {
6047 /* automatic parse from the BIOS config */
6048 err = alc880_parse_auto_config(codec);
6054 "hda_codec: Cannot set up configuration "
6055 "from BIOS. Using 3-stack mode...\n");
6056 board_config = ALC880_3ST;
6060 err = snd_hda_attach_beep_device(codec, 0x1);
6066 if (board_config != ALC880_AUTO)
6067 setup_preset(codec, &alc880_presets[board_config]);
6069 spec->stream_analog_playback = &alc880_pcm_analog_playback;
6070 spec->stream_analog_capture = &alc880_pcm_analog_capture;
6071 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
6073 spec->stream_digital_playback = &alc880_pcm_digital_playback;
6074 spec->stream_digital_capture = &alc880_pcm_digital_capture;
6076 if (!spec->adc_nids && spec->input_mux) {
6077 /* check whether NID 0x07 is valid */
6078 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
6080 wcap = get_wcaps_type(wcap);
6081 if (wcap != AC_WID_AUD_IN) {
6082 spec->adc_nids = alc880_adc_nids_alt;
6083 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
6085 spec->adc_nids = alc880_adc_nids;
6086 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
6089 set_capture_mixer(codec);
6090 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
6092 spec->vmaster_nid = 0x0c;
6094 codec->patch_ops = alc_patch_ops;
6095 if (board_config == ALC880_AUTO)
6096 spec->init_hook = alc880_auto_init;
6097 #ifdef CONFIG_SND_HDA_POWER_SAVE
6098 if (!spec->loopback.amplist)
6099 spec->loopback.amplist = alc880_loopbacks;
6110 static const hda_nid_t alc260_dac_nids[1] = {
6115 static const hda_nid_t alc260_adc_nids[1] = {
6120 static const hda_nid_t alc260_adc_nids_alt[1] = {
6125 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
6126 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
6128 static const hda_nid_t alc260_dual_adc_nids[2] = {
6133 #define ALC260_DIGOUT_NID 0x03
6134 #define ALC260_DIGIN_NID 0x06
6136 static const struct hda_input_mux alc260_capture_source = {
6140 { "Front Mic", 0x1 },
6146 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
6147 * headphone jack and the internal CD lines since these are the only pins at
6148 * which audio can appear. For flexibility, also allow the option of
6149 * recording the mixer output on the second ADC (ADC0 doesn't have a
6150 * connection to the mixer output).
6152 static const struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
6156 { "Mic/Line", 0x0 },
6158 { "Headphone", 0x2 },
6164 { "Mic/Line", 0x0 },
6166 { "Headphone", 0x2 },
6173 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
6174 * the Fujitsu S702x, but jacks are marked differently.
6176 static const struct hda_input_mux alc260_acer_capture_sources[2] = {
6183 { "Headphone", 0x5 },
6192 { "Headphone", 0x6 },
6198 /* Maxdata Favorit 100XS */
6199 static const struct hda_input_mux alc260_favorit100_capture_sources[2] = {
6203 { "Line/Mic", 0x0 },
6210 { "Line/Mic", 0x0 },
6218 * This is just place-holder, so there's something for alc_build_pcms to look
6219 * at when it calculates the maximum number of channels. ALC260 has no mixer
6220 * element which allows changing the channel mode, so the verb list is
6223 static const struct hda_channel_mode alc260_modes[1] = {
6228 /* Mixer combinations
6230 * basic: base_output + input + pc_beep + capture
6231 * HP: base_output + input + capture_alt
6232 * HP_3013: hp_3013 + input + capture
6233 * fujitsu: fujitsu + capture
6234 * acer: acer + capture
6237 static const struct snd_kcontrol_new alc260_base_output_mixer[] = {
6238 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6239 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
6240 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6241 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
6242 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
6243 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
6247 static const struct snd_kcontrol_new alc260_input_mixer[] = {
6248 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6249 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6250 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
6251 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
6252 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6253 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6254 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
6255 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
6259 /* update HP, line and mono out pins according to the master switch */
6260 static void alc260_hp_master_update(struct hda_codec *codec)
6262 update_speakers(codec);
6265 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
6266 struct snd_ctl_elem_value *ucontrol)
6268 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
6269 struct alc_spec *spec = codec->spec;
6270 *ucontrol->value.integer.value = !spec->master_mute;
6274 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
6275 struct snd_ctl_elem_value *ucontrol)
6277 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
6278 struct alc_spec *spec = codec->spec;
6279 int val = !*ucontrol->value.integer.value;
6281 if (val == spec->master_mute)
6283 spec->master_mute = val;
6284 alc260_hp_master_update(codec);
6288 static const struct snd_kcontrol_new alc260_hp_output_mixer[] = {
6290 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6291 .name = "Master Playback Switch",
6292 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
6293 .info = snd_ctl_boolean_mono_info,
6294 .get = alc260_hp_master_sw_get,
6295 .put = alc260_hp_master_sw_put,
6297 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6298 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
6299 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6300 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
6301 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
6303 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
6307 static const struct hda_verb alc260_hp_unsol_verbs[] = {
6308 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6312 static void alc260_hp_setup(struct hda_codec *codec)
6314 struct alc_spec *spec = codec->spec;
6316 spec->autocfg.hp_pins[0] = 0x0f;
6317 spec->autocfg.speaker_pins[0] = 0x10;
6318 spec->autocfg.speaker_pins[1] = 0x11;
6320 spec->automute_mode = ALC_AUTOMUTE_PIN;
6323 static const struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
6325 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6326 .name = "Master Playback Switch",
6327 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
6328 .info = snd_ctl_boolean_mono_info,
6329 .get = alc260_hp_master_sw_get,
6330 .put = alc260_hp_master_sw_put,
6332 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6333 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
6334 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
6335 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
6336 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6337 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6338 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
6339 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
6343 static void alc260_hp_3013_setup(struct hda_codec *codec)
6345 struct alc_spec *spec = codec->spec;
6347 spec->autocfg.hp_pins[0] = 0x15;
6348 spec->autocfg.speaker_pins[0] = 0x10;
6349 spec->autocfg.speaker_pins[1] = 0x11;
6351 spec->automute_mode = ALC_AUTOMUTE_PIN;
6354 static const struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
6355 .ops = &snd_hda_bind_vol,
6357 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
6358 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
6359 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
6364 static const struct hda_bind_ctls alc260_dc7600_bind_switch = {
6365 .ops = &snd_hda_bind_sw,
6367 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
6368 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
6373 static const struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
6374 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
6375 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
6376 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
6377 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
6381 static const struct hda_verb alc260_hp_3013_unsol_verbs[] = {
6382 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6386 static void alc260_hp_3012_setup(struct hda_codec *codec)
6388 struct alc_spec *spec = codec->spec;
6390 spec->autocfg.hp_pins[0] = 0x10;
6391 spec->autocfg.speaker_pins[0] = 0x0f;
6392 spec->autocfg.speaker_pins[1] = 0x11;
6393 spec->autocfg.speaker_pins[2] = 0x15;
6395 spec->automute_mode = ALC_AUTOMUTE_PIN;
6398 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
6399 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
6401 static const struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
6402 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6403 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
6404 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6405 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6406 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6407 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
6408 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
6409 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
6410 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6411 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
6415 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
6416 * versions of the ALC260 don't act on requests to enable mic bias from NID
6417 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
6418 * datasheet doesn't mention this restriction. At this stage it's not clear
6419 * whether this behaviour is intentional or is a hardware bug in chip
6420 * revisions available in early 2006. Therefore for now allow the
6421 * "Headphone Jack Mode" control to span all choices, but if it turns out
6422 * that the lack of mic bias for this NID is intentional we could change the
6423 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6425 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
6426 * don't appear to make the mic bias available from the "line" jack, even
6427 * though the NID used for this jack (0x14) can supply it. The theory is
6428 * that perhaps Acer have included blocking capacitors between the ALC260
6429 * and the output jack. If this turns out to be the case for all such
6430 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
6431 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
6433 * The C20x Tablet series have a mono internal speaker which is controlled
6434 * via the chip's Mono sum widget and pin complex, so include the necessary
6435 * controls for such models. On models without a "mono speaker" the control
6436 * won't do anything.
6438 static const struct snd_kcontrol_new alc260_acer_mixer[] = {
6439 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6440 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
6441 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
6442 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
6444 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
6446 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6447 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6448 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6449 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6450 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6451 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
6452 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
6453 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6457 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
6459 static const struct snd_kcontrol_new alc260_favorit100_mixer[] = {
6460 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6461 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
6462 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
6463 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6464 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6465 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6469 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
6470 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
6472 static const struct snd_kcontrol_new alc260_will_mixer[] = {
6473 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6474 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
6475 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6476 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6477 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6478 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
6479 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
6480 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6481 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6482 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6486 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
6487 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
6489 static const struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
6490 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6491 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
6492 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6493 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6494 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6495 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
6496 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
6497 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
6498 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
6499 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6504 * initialization verbs
6506 static const struct hda_verb alc260_init_verbs[] = {
6507 /* Line In pin widget for input */
6508 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6509 /* CD pin widget for input */
6510 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6511 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6512 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6513 /* Mic2 (front panel) pin widget for input and vref at 80% */
6514 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6515 /* LINE-2 is used for line-out in rear */
6516 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6517 /* select line-out */
6518 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
6520 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6522 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6524 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6525 /* mute capture amp left and right */
6526 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6527 /* set connection select to line in (default select for this ADC) */
6528 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
6529 /* mute capture amp left and right */
6530 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6531 /* set connection select to line in (default select for this ADC) */
6532 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
6533 /* set vol=0 Line-Out mixer amp left and right */
6534 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6535 /* unmute pin widget amp left and right (no gain on this amp) */
6536 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6537 /* set vol=0 HP mixer amp left and right */
6538 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6539 /* unmute pin widget amp left and right (no gain on this amp) */
6540 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6541 /* set vol=0 Mono mixer amp left and right */
6542 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6543 /* unmute pin widget amp left and right (no gain on this amp) */
6544 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6545 /* unmute LINE-2 out pin */
6546 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6547 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6550 /* mute analog inputs */
6551 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6552 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6553 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6554 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6555 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6556 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6557 /* mute Front out path */
6558 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6559 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6560 /* mute Headphone out path */
6561 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6562 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6563 /* mute Mono out path */
6564 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6565 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6569 #if 0 /* should be identical with alc260_init_verbs? */
6570 static const struct hda_verb alc260_hp_init_verbs[] = {
6571 /* Headphone and output */
6572 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
6574 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6575 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6576 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6577 /* Mic2 (front panel) pin widget for input and vref at 80% */
6578 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6579 /* Line In pin widget for input */
6580 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6581 /* Line-2 pin widget for output */
6582 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6583 /* CD pin widget for input */
6584 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6585 /* unmute amp left and right */
6586 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
6587 /* set connection select to line in (default select for this ADC) */
6588 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
6589 /* unmute Line-Out mixer amp left and right (volume = 0) */
6590 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6591 /* mute pin widget amp left and right (no gain on this amp) */
6592 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6593 /* unmute HP mixer amp left and right (volume = 0) */
6594 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6595 /* mute pin widget amp left and right (no gain on this amp) */
6596 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6597 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6600 /* mute analog inputs */
6601 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6602 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6603 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6604 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6605 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6606 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6607 /* Unmute Front out path */
6608 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6609 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6610 /* Unmute Headphone out path */
6611 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6612 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6613 /* Unmute Mono out path */
6614 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6615 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6620 static const struct hda_verb alc260_hp_3013_init_verbs[] = {
6621 /* Line out and output */
6622 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6624 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6625 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6626 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6627 /* Mic2 (front panel) pin widget for input and vref at 80% */
6628 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6629 /* Line In pin widget for input */
6630 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6631 /* Headphone pin widget for output */
6632 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
6633 /* CD pin widget for input */
6634 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6635 /* unmute amp left and right */
6636 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
6637 /* set connection select to line in (default select for this ADC) */
6638 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
6639 /* unmute Line-Out mixer amp left and right (volume = 0) */
6640 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6641 /* mute pin widget amp left and right (no gain on this amp) */
6642 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6643 /* unmute HP mixer amp left and right (volume = 0) */
6644 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6645 /* mute pin widget amp left and right (no gain on this amp) */
6646 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6647 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6650 /* mute analog inputs */
6651 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6652 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6653 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6654 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6655 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6656 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6657 /* Unmute Front out path */
6658 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6659 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6660 /* Unmute Headphone out path */
6661 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6662 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6663 /* Unmute Mono out path */
6664 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6665 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6669 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
6670 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
6671 * audio = 0x16, internal speaker = 0x10.
6673 static const struct hda_verb alc260_fujitsu_init_verbs[] = {
6674 /* Disable all GPIOs */
6675 {0x01, AC_VERB_SET_GPIO_MASK, 0},
6676 /* Internal speaker is connected to headphone pin */
6677 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6678 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
6679 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6680 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
6681 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6682 /* Ensure all other unused pins are disabled and muted. */
6683 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6684 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6685 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6686 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6687 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6688 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6689 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6690 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6692 /* Disable digital (SPDIF) pins */
6693 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6694 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6696 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
6697 * when acting as an output.
6699 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6701 /* Start with output sum widgets muted and their output gains at min */
6702 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6703 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6704 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6705 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6706 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6707 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6708 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6709 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6710 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6712 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
6713 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6714 /* Unmute Line1 pin widget output buffer since it starts as an output.
6715 * If the pin mode is changed by the user the pin mode control will
6716 * take care of enabling the pin's input/output buffers as needed.
6717 * Therefore there's no need to enable the input buffer at this
6720 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6721 /* Unmute input buffer of pin widget used for Line-in (no equiv
6724 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6726 /* Mute capture amp left and right */
6727 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6728 /* Set ADC connection select to match default mixer setting - line
6731 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6733 /* Do the same for the second ADC: mute capture input amp and
6734 * set ADC connection to line in (on mic1 pin)
6736 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6737 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6739 /* Mute all inputs to mixer widget (even unconnected ones) */
6740 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6741 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6742 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6743 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6744 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6745 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6746 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6747 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6752 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
6753 * similar laptops (adapted from Fujitsu init verbs).
6755 static const struct hda_verb alc260_acer_init_verbs[] = {
6756 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
6757 * the headphone jack. Turn this on and rely on the standard mute
6758 * methods whenever the user wants to turn these outputs off.
6760 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6761 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6762 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
6763 /* Internal speaker/Headphone jack is connected to Line-out pin */
6764 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6765 /* Internal microphone/Mic jack is connected to Mic1 pin */
6766 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
6767 /* Line In jack is connected to Line1 pin */
6768 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6769 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
6770 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6771 /* Ensure all other unused pins are disabled and muted. */
6772 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6773 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6774 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6775 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6776 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6777 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6778 /* Disable digital (SPDIF) pins */
6779 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6780 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6782 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6783 * bus when acting as outputs.
6785 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6786 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6788 /* Start with output sum widgets muted and their output gains at min */
6789 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6790 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6791 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6792 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6793 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6794 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6795 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6796 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6797 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6799 /* Unmute Line-out pin widget amp left and right
6800 * (no equiv mixer ctrl)
6802 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6803 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
6804 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6805 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6806 * inputs. If the pin mode is changed by the user the pin mode control
6807 * will take care of enabling the pin's input/output buffers as needed.
6808 * Therefore there's no need to enable the input buffer at this
6811 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6812 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6814 /* Mute capture amp left and right */
6815 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6816 /* Set ADC connection select to match default mixer setting - mic
6819 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6821 /* Do similar with the second ADC: mute capture input amp and
6822 * set ADC connection to mic to match ALSA's default state.
6824 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6825 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6827 /* Mute all inputs to mixer widget (even unconnected ones) */
6828 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6829 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6830 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6831 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6832 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6833 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6834 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6835 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6840 /* Initialisation sequence for Maxdata Favorit 100XS
6841 * (adapted from Acer init verbs).
6843 static const struct hda_verb alc260_favorit100_init_verbs[] = {
6844 /* GPIO 0 enables the output jack.
6845 * Turn this on and rely on the standard mute
6846 * methods whenever the user wants to turn these outputs off.
6848 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6849 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6850 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
6851 /* Line/Mic input jack is connected to Mic1 pin */
6852 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
6853 /* Ensure all other unused pins are disabled and muted. */
6854 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6855 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6856 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6857 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6858 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6859 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6860 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6861 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6862 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6863 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6864 /* Disable digital (SPDIF) pins */
6865 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6866 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6868 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6869 * bus when acting as outputs.
6871 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6872 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6874 /* Start with output sum widgets muted and their output gains at min */
6875 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6876 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6877 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6878 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6879 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6880 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6881 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6882 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6883 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6885 /* Unmute Line-out pin widget amp left and right
6886 * (no equiv mixer ctrl)
6888 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6889 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6890 * inputs. If the pin mode is changed by the user the pin mode control
6891 * will take care of enabling the pin's input/output buffers as needed.
6892 * Therefore there's no need to enable the input buffer at this
6895 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6897 /* Mute capture amp left and right */
6898 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6899 /* Set ADC connection select to match default mixer setting - mic
6902 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6904 /* Do similar with the second ADC: mute capture input amp and
6905 * set ADC connection to mic to match ALSA's default state.
6907 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6908 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6910 /* Mute all inputs to mixer widget (even unconnected ones) */
6911 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6912 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6913 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6914 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6915 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6916 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6917 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6918 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6923 static const struct hda_verb alc260_will_verbs[] = {
6924 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6925 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
6926 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
6927 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6928 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6929 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
6933 static const struct hda_verb alc260_replacer_672v_verbs[] = {
6934 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6935 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6936 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
6938 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6939 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6940 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6942 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6946 /* toggle speaker-output according to the hp-jack state */
6947 static void alc260_replacer_672v_automute(struct hda_codec *codec)
6949 unsigned int present;
6951 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
6952 present = snd_hda_jack_detect(codec, 0x0f);
6954 snd_hda_codec_write_cache(codec, 0x01, 0,
6955 AC_VERB_SET_GPIO_DATA, 1);
6956 snd_hda_codec_write_cache(codec, 0x0f, 0,
6957 AC_VERB_SET_PIN_WIDGET_CONTROL,
6960 snd_hda_codec_write_cache(codec, 0x01, 0,
6961 AC_VERB_SET_GPIO_DATA, 0);
6962 snd_hda_codec_write_cache(codec, 0x0f, 0,
6963 AC_VERB_SET_PIN_WIDGET_CONTROL,
6968 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
6971 if ((res >> 26) == ALC880_HP_EVENT)
6972 alc260_replacer_672v_automute(codec);
6975 static const struct hda_verb alc260_hp_dc7600_verbs[] = {
6976 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
6977 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6978 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6979 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6980 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6981 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6982 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6983 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6984 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6985 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6989 /* Test configuration for debugging, modelled after the ALC880 test
6992 #ifdef CONFIG_SND_DEBUG
6993 static const hda_nid_t alc260_test_dac_nids[1] = {
6996 static const hda_nid_t alc260_test_adc_nids[2] = {
6999 /* For testing the ALC260, each input MUX needs its own definition since
7000 * the signal assignments are different. This assumes that the first ADC
7003 static const struct hda_input_mux alc260_test_capture_sources[2] = {
7007 { "MIC1 pin", 0x0 },
7008 { "MIC2 pin", 0x1 },
7009 { "LINE1 pin", 0x2 },
7010 { "LINE2 pin", 0x3 },
7012 { "LINE-OUT pin", 0x5 },
7013 { "HP-OUT pin", 0x6 },
7019 { "MIC1 pin", 0x0 },
7020 { "MIC2 pin", 0x1 },
7021 { "LINE1 pin", 0x2 },
7022 { "LINE2 pin", 0x3 },
7025 { "LINE-OUT pin", 0x6 },
7026 { "HP-OUT pin", 0x7 },
7030 static const struct snd_kcontrol_new alc260_test_mixer[] = {
7031 /* Output driver widgets */
7032 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
7033 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
7034 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
7035 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
7036 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
7037 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
7039 /* Modes for retasking pin widgets
7040 * Note: the ALC260 doesn't seem to act on requests to enable mic
7041 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
7042 * mention this restriction. At this stage it's not clear whether
7043 * this behaviour is intentional or is a hardware bug in chip
7044 * revisions available at least up until early 2006. Therefore for
7045 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
7046 * choices, but if it turns out that the lack of mic bias for these
7047 * NIDs is intentional we could change their modes from
7048 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
7050 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
7051 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
7052 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
7053 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
7054 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
7055 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
7057 /* Loopback mixer controls */
7058 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
7059 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
7060 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
7061 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
7062 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
7063 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
7064 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
7065 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
7066 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
7067 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
7068 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
7069 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
7070 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
7071 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
7073 /* Controls for GPIO pins, assuming they are configured as outputs */
7074 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
7075 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
7076 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
7077 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
7079 /* Switches to allow the digital IO pins to be enabled. The datasheet
7080 * is ambigious as to which NID is which; testing on laptops which
7081 * make this output available should provide clarification.
7083 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
7084 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
7086 /* A switch allowing EAPD to be enabled. Some laptops seem to use
7087 * this output to turn on an external amplifier.
7089 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
7090 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
7094 static const struct hda_verb alc260_test_init_verbs[] = {
7095 /* Enable all GPIOs as outputs with an initial value of 0 */
7096 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
7097 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
7098 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
7100 /* Enable retasking pins as output, initially without power amp */
7101 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7102 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7103 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7104 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7105 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7106 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7108 /* Disable digital (SPDIF) pins initially, but users can enable
7109 * them via a mixer switch. In the case of SPDIF-out, this initverb
7110 * payload also sets the generation to 0, output to be in "consumer"
7111 * PCM format, copyright asserted, no pre-emphasis and no validity
7114 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
7115 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
7117 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
7118 * OUT1 sum bus when acting as an output.
7120 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
7121 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
7122 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
7123 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
7125 /* Start with output sum widgets muted and their output gains at min */
7126 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7127 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7128 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7129 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7130 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7131 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7132 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7133 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7134 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7136 /* Unmute retasking pin widget output buffers since the default
7137 * state appears to be output. As the pin mode is changed by the
7138 * user the pin mode control will take care of enabling the pin's
7139 * input/output buffers as needed.
7141 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7142 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7143 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7144 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7145 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7146 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7147 /* Also unmute the mono-out pin widget */
7148 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7150 /* Mute capture amp left and right */
7151 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7152 /* Set ADC connection select to match default mixer setting (mic1
7155 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
7157 /* Do the same for the second ADC: mute capture input amp and
7158 * set ADC connection to mic1 pin
7160 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7161 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
7163 /* Mute all inputs to mixer widget (even unconnected ones) */
7164 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
7165 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
7166 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
7167 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
7168 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
7169 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
7170 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
7171 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
7177 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
7178 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
7180 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
7181 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
7184 * for BIOS auto-configuration
7187 /* convert from pin to volume-mixer widget */
7188 static hda_nid_t alc260_pin_to_vol_mix(hda_nid_t nid)
7190 if (nid >= 0x0f && nid <= 0x11)
7192 else if (nid >= 0x12 && nid <= 0x15)
7198 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
7199 const char *pfx, int *vol_bits)
7202 unsigned long vol_val, sw_val;
7205 nid_vol = alc260_pin_to_vol_mix(nid);
7212 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, chs, 0, HDA_OUTPUT);
7213 sw_val = HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT);
7215 if (!(*vol_bits & (1 << nid_vol))) {
7216 /* first control for the volume widget */
7217 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val);
7220 *vol_bits |= (1 << nid_vol);
7222 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val);
7228 /* add playback controls from the parsed DAC table */
7229 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
7230 const struct auto_pin_cfg *cfg)
7236 spec->multiout.num_dacs = 1;
7237 spec->multiout.dac_nids = spec->private_dac_nids;
7238 spec->private_dac_nids[0] = 0x02;
7240 nid = cfg->line_out_pins[0];
7244 pfx = alc_get_line_out_pfx(spec, 0, true, &index);
7245 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
7250 nid = cfg->speaker_pins[0];
7252 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
7257 nid = cfg->hp_pins[0];
7259 err = alc260_add_playback_controls(spec, nid, "Headphone",
7267 /* create playback/capture controls for input pins */
7268 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
7269 const struct auto_pin_cfg *cfg)
7271 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
7274 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
7275 hda_nid_t nid, int pin_type,
7280 alc_set_pin_output(codec, nid, pin_type);
7281 /* need the manual connection? */
7283 int idx = nid - 0x12;
7284 snd_hda_codec_write(codec, idx + 0x0b, 0,
7285 AC_VERB_SET_CONNECT_SEL, sel_idx);
7288 mix = alc260_pin_to_vol_mix(nid);
7291 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
7293 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
7295 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
7299 static void alc260_auto_init_multi_out(struct hda_codec *codec)
7301 struct alc_spec *spec = codec->spec;
7304 nid = spec->autocfg.line_out_pins[0];
7306 int pin_type = get_pin_type(spec->autocfg.line_out_type);
7307 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
7310 nid = spec->autocfg.speaker_pins[0];
7312 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
7314 nid = spec->autocfg.hp_pins[0];
7316 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
7319 #define alc260_auto_init_analog_input alc880_auto_init_analog_input
7320 #define alc260_auto_init_input_src alc880_auto_init_input_src
7322 static int alc260_parse_auto_config(struct hda_codec *codec)
7324 struct alc_spec *spec = codec->spec;
7326 static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
7328 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
7332 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
7335 if (!spec->kctls.list)
7336 return 0; /* can't find valid BIOS pin config */
7337 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
7341 spec->multiout.max_channels = 2;
7343 if (spec->autocfg.dig_outs)
7344 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
7345 if (spec->kctls.list)
7346 add_mixer(spec, spec->kctls.list);
7348 spec->num_mux_defs = 1;
7349 spec->input_mux = &spec->private_imux[0];
7351 alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0);
7356 /* additional initialization for auto-configuration model */
7357 static void alc260_auto_init(struct hda_codec *codec)
7359 struct alc_spec *spec = codec->spec;
7360 alc260_auto_init_multi_out(codec);
7361 alc260_auto_init_analog_input(codec);
7362 alc260_auto_init_input_src(codec);
7363 alc_auto_init_digital(codec);
7364 if (spec->unsol_event)
7365 alc_inithook(codec);
7368 #ifdef CONFIG_SND_HDA_POWER_SAVE
7369 static const struct hda_amp_list alc260_loopbacks[] = {
7370 { 0x07, HDA_INPUT, 0 },
7371 { 0x07, HDA_INPUT, 1 },
7372 { 0x07, HDA_INPUT, 2 },
7373 { 0x07, HDA_INPUT, 3 },
7374 { 0x07, HDA_INPUT, 4 },
7386 static const struct alc_fixup alc260_fixups[] = {
7387 [PINFIX_HP_DC5750] = {
7388 .type = ALC_FIXUP_PINS,
7389 .v.pins = (const struct alc_pincfg[]) {
7390 { 0x11, 0x90130110 }, /* speaker */
7396 static const struct snd_pci_quirk alc260_fixup_tbl[] = {
7397 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", PINFIX_HP_DC5750),
7402 * ALC260 configurations
7404 static const char * const alc260_models[ALC260_MODEL_LAST] = {
7405 [ALC260_BASIC] = "basic",
7407 [ALC260_HP_3013] = "hp-3013",
7408 [ALC260_HP_DC7600] = "hp-dc7600",
7409 [ALC260_FUJITSU_S702X] = "fujitsu",
7410 [ALC260_ACER] = "acer",
7411 [ALC260_WILL] = "will",
7412 [ALC260_REPLACER_672V] = "replacer",
7413 [ALC260_FAVORIT100] = "favorit100",
7414 #ifdef CONFIG_SND_DEBUG
7415 [ALC260_TEST] = "test",
7417 [ALC260_AUTO] = "auto",
7420 static const struct snd_pci_quirk alc260_cfg_tbl[] = {
7421 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
7422 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
7423 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
7424 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
7425 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
7426 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */
7427 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
7428 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
7429 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
7430 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
7431 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
7432 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
7433 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
7434 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
7435 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
7436 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
7437 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
7438 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
7439 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
7440 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
7444 static const struct alc_config_preset alc260_presets[] = {
7446 .mixers = { alc260_base_output_mixer,
7447 alc260_input_mixer },
7448 .init_verbs = { alc260_init_verbs },
7449 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7450 .dac_nids = alc260_dac_nids,
7451 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7452 .adc_nids = alc260_dual_adc_nids,
7453 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7454 .channel_mode = alc260_modes,
7455 .input_mux = &alc260_capture_source,
7458 .mixers = { alc260_hp_output_mixer,
7459 alc260_input_mixer },
7460 .init_verbs = { alc260_init_verbs,
7461 alc260_hp_unsol_verbs },
7462 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7463 .dac_nids = alc260_dac_nids,
7464 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
7465 .adc_nids = alc260_adc_nids_alt,
7466 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7467 .channel_mode = alc260_modes,
7468 .input_mux = &alc260_capture_source,
7469 .unsol_event = alc_sku_unsol_event,
7470 .setup = alc260_hp_setup,
7471 .init_hook = alc_inithook,
7473 [ALC260_HP_DC7600] = {
7474 .mixers = { alc260_hp_dc7600_mixer,
7475 alc260_input_mixer },
7476 .init_verbs = { alc260_init_verbs,
7477 alc260_hp_dc7600_verbs },
7478 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7479 .dac_nids = alc260_dac_nids,
7480 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
7481 .adc_nids = alc260_adc_nids_alt,
7482 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7483 .channel_mode = alc260_modes,
7484 .input_mux = &alc260_capture_source,
7485 .unsol_event = alc_sku_unsol_event,
7486 .setup = alc260_hp_3012_setup,
7487 .init_hook = alc_inithook,
7489 [ALC260_HP_3013] = {
7490 .mixers = { alc260_hp_3013_mixer,
7491 alc260_input_mixer },
7492 .init_verbs = { alc260_hp_3013_init_verbs,
7493 alc260_hp_3013_unsol_verbs },
7494 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7495 .dac_nids = alc260_dac_nids,
7496 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
7497 .adc_nids = alc260_adc_nids_alt,
7498 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7499 .channel_mode = alc260_modes,
7500 .input_mux = &alc260_capture_source,
7501 .unsol_event = alc_sku_unsol_event,
7502 .setup = alc260_hp_3013_setup,
7503 .init_hook = alc_inithook,
7505 [ALC260_FUJITSU_S702X] = {
7506 .mixers = { alc260_fujitsu_mixer },
7507 .init_verbs = { alc260_fujitsu_init_verbs },
7508 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7509 .dac_nids = alc260_dac_nids,
7510 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7511 .adc_nids = alc260_dual_adc_nids,
7512 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7513 .channel_mode = alc260_modes,
7514 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
7515 .input_mux = alc260_fujitsu_capture_sources,
7518 .mixers = { alc260_acer_mixer },
7519 .init_verbs = { alc260_acer_init_verbs },
7520 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7521 .dac_nids = alc260_dac_nids,
7522 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7523 .adc_nids = alc260_dual_adc_nids,
7524 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7525 .channel_mode = alc260_modes,
7526 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
7527 .input_mux = alc260_acer_capture_sources,
7529 [ALC260_FAVORIT100] = {
7530 .mixers = { alc260_favorit100_mixer },
7531 .init_verbs = { alc260_favorit100_init_verbs },
7532 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7533 .dac_nids = alc260_dac_nids,
7534 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7535 .adc_nids = alc260_dual_adc_nids,
7536 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7537 .channel_mode = alc260_modes,
7538 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
7539 .input_mux = alc260_favorit100_capture_sources,
7542 .mixers = { alc260_will_mixer },
7543 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
7544 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7545 .dac_nids = alc260_dac_nids,
7546 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
7547 .adc_nids = alc260_adc_nids,
7548 .dig_out_nid = ALC260_DIGOUT_NID,
7549 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7550 .channel_mode = alc260_modes,
7551 .input_mux = &alc260_capture_source,
7553 [ALC260_REPLACER_672V] = {
7554 .mixers = { alc260_replacer_672v_mixer },
7555 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
7556 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7557 .dac_nids = alc260_dac_nids,
7558 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
7559 .adc_nids = alc260_adc_nids,
7560 .dig_out_nid = ALC260_DIGOUT_NID,
7561 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7562 .channel_mode = alc260_modes,
7563 .input_mux = &alc260_capture_source,
7564 .unsol_event = alc260_replacer_672v_unsol_event,
7565 .init_hook = alc260_replacer_672v_automute,
7567 #ifdef CONFIG_SND_DEBUG
7569 .mixers = { alc260_test_mixer },
7570 .init_verbs = { alc260_test_init_verbs },
7571 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
7572 .dac_nids = alc260_test_dac_nids,
7573 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
7574 .adc_nids = alc260_test_adc_nids,
7575 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7576 .channel_mode = alc260_modes,
7577 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
7578 .input_mux = alc260_test_capture_sources,
7583 static int patch_alc260(struct hda_codec *codec)
7585 struct alc_spec *spec;
7586 int err, board_config;
7588 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
7594 spec->mixer_nid = 0x07;
7596 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
7599 if (board_config < 0) {
7600 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
7602 board_config = ALC260_AUTO;
7605 if (board_config == ALC260_AUTO) {
7606 alc_pick_fixup(codec, NULL, alc260_fixup_tbl, alc260_fixups);
7607 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
7610 if (board_config == ALC260_AUTO) {
7611 /* automatic parse from the BIOS config */
7612 err = alc260_parse_auto_config(codec);
7618 "hda_codec: Cannot set up configuration "
7619 "from BIOS. Using base mode...\n");
7620 board_config = ALC260_BASIC;
7624 err = snd_hda_attach_beep_device(codec, 0x1);
7630 if (board_config != ALC260_AUTO)
7631 setup_preset(codec, &alc260_presets[board_config]);
7633 spec->stream_analog_playback = &alc260_pcm_analog_playback;
7634 spec->stream_analog_capture = &alc260_pcm_analog_capture;
7635 spec->stream_analog_alt_capture = &alc260_pcm_analog_capture;
7637 spec->stream_digital_playback = &alc260_pcm_digital_playback;
7638 spec->stream_digital_capture = &alc260_pcm_digital_capture;
7640 if (!spec->adc_nids && spec->input_mux) {
7641 /* check whether NID 0x04 is valid */
7642 unsigned int wcap = get_wcaps(codec, 0x04);
7643 wcap = get_wcaps_type(wcap);
7645 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
7646 spec->adc_nids = alc260_adc_nids_alt;
7647 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
7649 spec->adc_nids = alc260_adc_nids;
7650 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
7653 set_capture_mixer(codec);
7654 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
7656 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
7658 spec->vmaster_nid = 0x08;
7660 codec->patch_ops = alc_patch_ops;
7661 if (board_config == ALC260_AUTO)
7662 spec->init_hook = alc260_auto_init;
7663 spec->shutup = alc_eapd_shutup;
7664 #ifdef CONFIG_SND_HDA_POWER_SAVE
7665 if (!spec->loopback.amplist)
7666 spec->loopback.amplist = alc260_loopbacks;
7674 * ALC882/883/885/888/889 support
7676 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
7677 * configuration. Each pin widget can choose any input DACs and a mixer.
7678 * Each ADC is connected from a mixer of all inputs. This makes possible
7679 * 6-channel independent captures.
7681 * In addition, an independent DAC for the multi-playback (not used in this
7684 #define ALC882_DIGOUT_NID 0x06
7685 #define ALC882_DIGIN_NID 0x0a
7686 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
7687 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
7688 #define ALC1200_DIGOUT_NID 0x10
7691 static const struct hda_channel_mode alc882_ch_modes[1] = {
7696 static const hda_nid_t alc882_dac_nids[4] = {
7697 /* front, rear, clfe, rear_surr */
7698 0x02, 0x03, 0x04, 0x05
7700 #define alc883_dac_nids alc882_dac_nids
7703 #define alc882_adc_nids alc880_adc_nids
7704 #define alc882_adc_nids_alt alc880_adc_nids_alt
7705 #define alc883_adc_nids alc882_adc_nids_alt
7706 static const hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
7707 static const hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
7708 #define alc889_adc_nids alc880_adc_nids
7710 static const hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
7711 static const hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
7712 #define alc883_capsrc_nids alc882_capsrc_nids_alt
7713 static const hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
7714 #define alc889_capsrc_nids alc882_capsrc_nids
7717 /* FIXME: should be a matrix-type input source selection */
7719 static const struct hda_input_mux alc882_capture_source = {
7723 { "Front Mic", 0x1 },
7729 #define alc883_capture_source alc882_capture_source
7731 static const struct hda_input_mux alc889_capture_source = {
7734 { "Front Mic", 0x0 },
7740 static const struct hda_input_mux mb5_capture_source = {
7749 static const struct hda_input_mux macmini3_capture_source = {
7757 static const struct hda_input_mux alc883_3stack_6ch_intel = {
7761 { "Front Mic", 0x0 },
7767 static const struct hda_input_mux alc883_lenovo_101e_capture_source = {
7775 static const struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
7779 { "Internal Mic", 0x1 },
7785 static const struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
7789 { "Internal Mic", 0x1 },
7793 static const struct hda_input_mux alc883_lenovo_sky_capture_source = {
7797 { "Front Mic", 0x1 },
7802 static const struct hda_input_mux alc883_asus_eee1601_capture_source = {
7810 static const struct hda_input_mux alc889A_mb31_capture_source = {
7814 /* Front Mic (0x01) unused */
7816 /* Line 2 (0x03) unused */
7817 /* CD (0x04) unused? */
7821 static const struct hda_input_mux alc889A_imac91_capture_source = {
7825 { "Line", 0x2 }, /* Not sure! */
7832 static const struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
7839 static const struct hda_verb alc882_3ST_ch2_init[] = {
7840 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7841 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7842 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7843 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7850 static const struct hda_verb alc882_3ST_ch4_init[] = {
7851 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7852 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7853 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7854 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7855 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7862 static const struct hda_verb alc882_3ST_ch6_init[] = {
7863 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7864 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7865 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7866 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7867 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7868 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7872 static const struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
7873 { 2, alc882_3ST_ch2_init },
7874 { 4, alc882_3ST_ch4_init },
7875 { 6, alc882_3ST_ch6_init },
7878 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
7883 static const struct hda_verb alc883_3ST_ch2_clevo_init[] = {
7884 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
7885 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7886 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7887 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7888 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7895 static const struct hda_verb alc883_3ST_ch4_clevo_init[] = {
7896 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7897 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7898 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7899 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7900 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7901 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7908 static const struct hda_verb alc883_3ST_ch6_clevo_init[] = {
7909 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7910 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7911 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7912 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7913 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7914 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7915 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7919 static const struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
7920 { 2, alc883_3ST_ch2_clevo_init },
7921 { 4, alc883_3ST_ch4_clevo_init },
7922 { 6, alc883_3ST_ch6_clevo_init },
7929 static const struct hda_verb alc882_sixstack_ch6_init[] = {
7930 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7931 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7932 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7933 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7940 static const struct hda_verb alc882_sixstack_ch8_init[] = {
7941 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7942 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7943 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7944 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7948 static const struct hda_channel_mode alc882_sixstack_modes[2] = {
7949 { 6, alc882_sixstack_ch6_init },
7950 { 8, alc882_sixstack_ch8_init },
7954 /* Macbook Air 2,1 */
7956 static const struct hda_channel_mode alc885_mba21_ch_modes[1] = {
7961 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
7967 static const struct hda_verb alc885_mbp_ch2_init[] = {
7968 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7969 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7970 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7977 static const struct hda_verb alc885_mbp_ch4_init[] = {
7978 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7979 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7980 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7981 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7982 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7986 static const struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
7987 { 2, alc885_mbp_ch2_init },
7988 { 4, alc885_mbp_ch4_init },
7993 * Speakers/Woofer/HP = Front
7996 static const struct hda_verb alc885_mb5_ch2_init[] = {
7997 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7998 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8004 * Speakers/HP = Front
8008 static const struct hda_verb alc885_mb5_ch6_init[] = {
8009 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8010 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8011 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8015 static const struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
8016 { 2, alc885_mb5_ch2_init },
8017 { 6, alc885_mb5_ch6_init },
8020 #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes
8025 static const struct hda_verb alc883_4ST_ch2_init[] = {
8026 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8027 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8028 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8029 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8030 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8031 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8038 static const struct hda_verb alc883_4ST_ch4_init[] = {
8039 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8040 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8041 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8042 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8043 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8044 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8045 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
8052 static const struct hda_verb alc883_4ST_ch6_init[] = {
8053 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8054 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8055 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8056 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8057 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8058 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8059 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8060 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
8067 static const struct hda_verb alc883_4ST_ch8_init[] = {
8068 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8069 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8070 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
8071 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8072 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8073 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8074 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8075 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8076 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
8080 static const struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
8081 { 2, alc883_4ST_ch2_init },
8082 { 4, alc883_4ST_ch4_init },
8083 { 6, alc883_4ST_ch6_init },
8084 { 8, alc883_4ST_ch8_init },
8091 static const struct hda_verb alc883_3ST_ch2_intel_init[] = {
8092 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8093 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8094 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8095 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8102 static const struct hda_verb alc883_3ST_ch4_intel_init[] = {
8103 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8104 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8105 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8106 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8107 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
8114 static const struct hda_verb alc883_3ST_ch6_intel_init[] = {
8115 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8116 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8117 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
8118 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8119 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8120 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
8124 static const struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
8125 { 2, alc883_3ST_ch2_intel_init },
8126 { 4, alc883_3ST_ch4_intel_init },
8127 { 6, alc883_3ST_ch6_intel_init },
8133 static const struct hda_verb alc889_ch2_intel_init[] = {
8134 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
8135 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
8136 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
8137 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
8138 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8139 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8146 static const struct hda_verb alc889_ch6_intel_init[] = {
8147 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
8148 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
8149 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
8150 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
8151 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8152 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8159 static const struct hda_verb alc889_ch8_intel_init[] = {
8160 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
8161 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
8162 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
8163 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
8164 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
8165 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8166 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8170 static const struct hda_channel_mode alc889_8ch_intel_modes[3] = {
8171 { 2, alc889_ch2_intel_init },
8172 { 6, alc889_ch6_intel_init },
8173 { 8, alc889_ch8_intel_init },
8179 static const struct hda_verb alc883_sixstack_ch6_init[] = {
8180 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
8181 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8182 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8183 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8190 static const struct hda_verb alc883_sixstack_ch8_init[] = {
8191 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8192 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8193 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8194 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8198 static const struct hda_channel_mode alc883_sixstack_modes[2] = {
8199 { 6, alc883_sixstack_ch6_init },
8200 { 8, alc883_sixstack_ch8_init },
8204 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
8205 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
8207 static const struct snd_kcontrol_new alc882_base_mixer[] = {
8208 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8209 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8210 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8211 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8212 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8213 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8214 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8215 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8216 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8217 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8218 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8219 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8220 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8221 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8222 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8223 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8224 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8225 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8226 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8227 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
8228 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8232 /* Macbook Air 2,1 same control for HP and internal Speaker */
8234 static const struct snd_kcontrol_new alc885_mba21_mixer[] = {
8235 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8236 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT),
8241 static const struct snd_kcontrol_new alc885_mbp3_mixer[] = {
8242 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8243 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
8244 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
8245 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
8246 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8247 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8248 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8249 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8250 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8251 HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT),
8252 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT),
8256 static const struct snd_kcontrol_new alc885_mb5_mixer[] = {
8257 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8258 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8259 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8260 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8261 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
8262 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
8263 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
8264 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
8265 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
8266 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
8267 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8268 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8269 HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT),
8270 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0x00, HDA_INPUT),
8274 static const struct snd_kcontrol_new alc885_macmini3_mixer[] = {
8275 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8276 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8277 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8278 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8279 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
8280 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
8281 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
8282 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
8283 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
8284 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
8285 HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT),
8289 static const struct snd_kcontrol_new alc885_imac91_mixer[] = {
8290 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8291 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
8296 static const struct snd_kcontrol_new alc882_w2jc_mixer[] = {
8297 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8298 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8299 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8300 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8301 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8302 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8303 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8304 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8305 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8309 static const struct snd_kcontrol_new alc882_targa_mixer[] = {
8310 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8311 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8312 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8313 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8314 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8315 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8316 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8317 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8318 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8319 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8320 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8321 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8322 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
8326 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
8327 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
8329 static const struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
8330 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8331 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8332 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8333 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
8334 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8335 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8336 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8337 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8338 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
8339 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
8340 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8341 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8342 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8346 static const struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
8347 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8348 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8349 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8350 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8351 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8352 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8353 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8354 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8355 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8356 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8360 static const struct snd_kcontrol_new alc882_chmode_mixer[] = {
8362 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8363 .name = "Channel Mode",
8364 .info = alc_ch_mode_info,
8365 .get = alc_ch_mode_get,
8366 .put = alc_ch_mode_put,
8371 static const struct hda_verb alc882_base_init_verbs[] = {
8372 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8373 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8374 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8376 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8377 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8379 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8380 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8382 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8383 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8385 /* Front Pin: output 0 (0x0c) */
8386 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8387 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8388 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8389 /* Rear Pin: output 1 (0x0d) */
8390 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8391 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8392 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8393 /* CLFE Pin: output 2 (0x0e) */
8394 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8395 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8396 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
8397 /* Side Pin: output 3 (0x0f) */
8398 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8399 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8400 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8401 /* Mic (rear) pin: input vref at 80% */
8402 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8403 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8404 /* Front Mic pin: input vref at 80% */
8405 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8406 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8407 /* Line In pin: input */
8408 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8409 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8410 /* Line-2 In: Headphone output (output 0 - 0x0c) */
8411 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8412 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8413 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8414 /* CD pin widget for input */
8415 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8417 /* FIXME: use matrix-type input source selection */
8418 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8420 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8422 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8423 /* ADC2: mute amp left and right */
8424 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8425 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8426 /* ADC3: mute amp left and right */
8427 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8428 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8433 static const struct hda_verb alc882_adc1_init_verbs[] = {
8434 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8435 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8436 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8437 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8438 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8439 /* ADC1: mute amp left and right */
8440 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8441 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8445 static const struct hda_verb alc882_eapd_verbs[] = {
8446 /* change to EAPD mode */
8447 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8448 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
8452 static const struct hda_verb alc889_eapd_verbs[] = {
8453 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
8454 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
8458 static const struct hda_verb alc_hp15_unsol_verbs[] = {
8459 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8460 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8464 static const struct hda_verb alc885_init_verbs[] = {
8465 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8466 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8467 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8469 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8470 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8472 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8473 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8475 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8476 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8478 /* Front HP Pin: output 0 (0x0c) */
8479 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8480 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8481 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8482 /* Front Pin: output 0 (0x0c) */
8483 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8484 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8485 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8486 /* Rear Pin: output 1 (0x0d) */
8487 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8488 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8489 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
8490 /* CLFE Pin: output 2 (0x0e) */
8491 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8492 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8493 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
8494 /* Side Pin: output 3 (0x0f) */
8495 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8496 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8497 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8498 /* Mic (rear) pin: input vref at 80% */
8499 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8500 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8501 /* Front Mic pin: input vref at 80% */
8502 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8503 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8504 /* Line In pin: input */
8505 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8506 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8508 /* Mixer elements: 0x18, , 0x1a, 0x1b */
8510 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8512 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8514 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8515 /* ADC2: mute amp left and right */
8516 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8517 /* ADC3: mute amp left and right */
8518 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8523 static const struct hda_verb alc885_init_input_verbs[] = {
8524 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8525 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8526 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
8531 /* Unmute Selector 24h and set the default input to front mic */
8532 static const struct hda_verb alc889_init_input_verbs[] = {
8533 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
8534 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8539 #define alc883_init_verbs alc882_base_init_verbs
8542 static const struct snd_kcontrol_new alc882_macpro_mixer[] = {
8543 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8544 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8545 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
8546 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
8547 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
8548 /* FIXME: this looks suspicious...
8549 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
8550 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
8555 static const struct hda_verb alc882_macpro_init_verbs[] = {
8556 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8557 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8558 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8559 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8560 /* Front Pin: output 0 (0x0c) */
8561 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8562 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8563 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8564 /* Front Mic pin: input vref at 80% */
8565 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8566 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8567 /* Speaker: output */
8568 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8569 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8570 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
8571 /* Headphone output (output 0 - 0x0c) */
8572 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8573 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8574 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8576 /* FIXME: use matrix-type input source selection */
8577 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8578 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8579 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8580 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8581 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8582 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8584 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8585 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8586 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8587 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8589 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8590 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8591 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8592 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8593 /* ADC1: mute amp left and right */
8594 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8595 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8596 /* ADC2: mute amp left and right */
8597 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8598 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8599 /* ADC3: mute amp left and right */
8600 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8601 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8607 static const struct hda_verb alc885_mb5_init_verbs[] = {
8609 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8610 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8611 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8612 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8614 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8615 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8616 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8617 /* Surround mixer */
8618 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8619 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8620 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8622 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8623 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8624 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8626 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8627 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8628 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8629 /* Front Pin (0x0c) */
8630 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8631 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8632 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8633 /* LFE Pin (0x0e) */
8634 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8635 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8636 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
8638 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8639 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8640 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
8641 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8642 /* Front Mic pin: input vref at 80% */
8643 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8644 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8646 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8647 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8649 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)},
8650 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)},
8651 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)},
8656 static const struct hda_verb alc885_macmini3_init_verbs[] = {
8658 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8659 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8660 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8661 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8663 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8664 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8665 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8666 /* Surround mixer */
8667 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8668 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8669 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8671 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8672 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8673 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8675 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8676 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8677 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8678 /* Front Pin (0x0c) */
8679 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8680 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8681 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8682 /* LFE Pin (0x0e) */
8683 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8684 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8685 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
8687 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8688 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8689 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
8690 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8692 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8693 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8695 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8696 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8697 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8698 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8703 static const struct hda_verb alc885_mba21_init_verbs[] = {
8704 /*Internal and HP Speaker Mixer*/
8705 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8706 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8707 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8708 /*Internal Speaker Pin (0x0c)*/
8709 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8710 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8711 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8712 /* HP Pin: output 0 (0x0e) */
8713 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
8714 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8715 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8716 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
8717 /* Line in (is hp when jack connected)*/
8718 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
8719 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8725 /* Macbook Pro rev3 */
8726 static const struct hda_verb alc885_mbp3_init_verbs[] = {
8727 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8728 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8729 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8730 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8732 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8733 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8734 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8736 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8737 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8738 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8739 /* Front Pin: output 0 (0x0c) */
8740 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8741 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8742 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8743 /* HP Pin: output 0 (0x0e) */
8744 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
8745 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8746 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
8747 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8748 /* Mic (rear) pin: input vref at 80% */
8749 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8750 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8751 /* Front Mic pin: input vref at 80% */
8752 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8753 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8754 /* Line In pin: use output 1 when in LineOut mode */
8755 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8756 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8757 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8759 /* FIXME: use matrix-type input source selection */
8760 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8761 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8762 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8763 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8764 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8765 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8767 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8768 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8769 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8770 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8772 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8773 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8774 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8775 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8776 /* ADC1: mute amp left and right */
8777 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8778 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8779 /* ADC2: mute amp left and right */
8780 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8781 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8782 /* ADC3: mute amp left and right */
8783 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8784 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8790 static const struct hda_verb alc885_imac91_init_verbs[] = {
8791 /* Internal Speaker Pin (0x0c) */
8792 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8793 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8794 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8795 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8796 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8797 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8799 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8800 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8801 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8802 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
8804 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
8805 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8806 /* Front Mic pin: input vref at 80% */
8807 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8808 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8810 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8811 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8812 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8813 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
8814 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8815 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8816 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8817 /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8818 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8819 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8820 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8821 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8822 /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8823 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8824 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8825 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8826 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8827 /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8828 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8829 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8830 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8831 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8832 /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8833 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8834 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8835 /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8836 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8837 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8838 /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8839 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8840 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8844 /* iMac 24 mixer. */
8845 static const struct snd_kcontrol_new alc885_imac24_mixer[] = {
8846 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8847 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
8851 /* iMac 24 init verbs. */
8852 static const struct hda_verb alc885_imac24_init_verbs[] = {
8853 /* Internal speakers: output 0 (0x0c) */
8854 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8855 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8856 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8857 /* Internal speakers: output 0 (0x0c) */
8858 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8859 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8860 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8861 /* Headphone: output 0 (0x0c) */
8862 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8863 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8864 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8865 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8866 /* Front Mic: input vref at 80% */
8867 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8868 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8872 /* Toggle speaker-output according to the hp-jack state */
8873 static void alc885_imac24_setup(struct hda_codec *codec)
8875 struct alc_spec *spec = codec->spec;
8877 spec->autocfg.hp_pins[0] = 0x14;
8878 spec->autocfg.speaker_pins[0] = 0x18;
8879 spec->autocfg.speaker_pins[1] = 0x1a;
8881 spec->automute_mode = ALC_AUTOMUTE_AMP;
8884 #define alc885_mb5_setup alc885_imac24_setup
8885 #define alc885_macmini3_setup alc885_imac24_setup
8887 /* Macbook Air 2,1 */
8888 static void alc885_mba21_setup(struct hda_codec *codec)
8890 struct alc_spec *spec = codec->spec;
8892 spec->autocfg.hp_pins[0] = 0x14;
8893 spec->autocfg.speaker_pins[0] = 0x18;
8895 spec->automute_mode = ALC_AUTOMUTE_AMP;
8900 static void alc885_mbp3_setup(struct hda_codec *codec)
8902 struct alc_spec *spec = codec->spec;
8904 spec->autocfg.hp_pins[0] = 0x15;
8905 spec->autocfg.speaker_pins[0] = 0x14;
8907 spec->automute_mode = ALC_AUTOMUTE_AMP;
8910 static void alc885_imac91_setup(struct hda_codec *codec)
8912 struct alc_spec *spec = codec->spec;
8914 spec->autocfg.hp_pins[0] = 0x14;
8915 spec->autocfg.speaker_pins[0] = 0x18;
8916 spec->autocfg.speaker_pins[1] = 0x1a;
8918 spec->automute_mode = ALC_AUTOMUTE_AMP;
8921 static const struct hda_verb alc882_targa_verbs[] = {
8922 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8923 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8925 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8926 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8928 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8929 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8930 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8932 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8936 /* toggle speaker-output according to the hp-jack state */
8937 static void alc882_targa_automute(struct hda_codec *codec)
8939 struct alc_spec *spec = codec->spec;
8940 alc_hp_automute(codec);
8941 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
8942 spec->jack_present ? 1 : 3);
8945 static void alc882_targa_setup(struct hda_codec *codec)
8947 struct alc_spec *spec = codec->spec;
8949 spec->autocfg.hp_pins[0] = 0x14;
8950 spec->autocfg.speaker_pins[0] = 0x1b;
8952 spec->automute_mode = ALC_AUTOMUTE_AMP;
8955 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
8957 if ((res >> 26) == ALC880_HP_EVENT)
8958 alc882_targa_automute(codec);
8961 static const struct hda_verb alc882_asus_a7j_verbs[] = {
8962 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8963 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8965 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8966 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8967 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8969 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8970 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8971 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8973 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8974 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8975 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8979 static const struct hda_verb alc882_asus_a7m_verbs[] = {
8980 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8981 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8983 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8984 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8985 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8987 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8988 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8989 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8991 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8992 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8993 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8997 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
8999 unsigned int gpiostate, gpiomask, gpiodir;
9001 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
9002 AC_VERB_GET_GPIO_DATA, 0);
9005 gpiostate |= (1 << pin);
9007 gpiostate &= ~(1 << pin);
9009 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
9010 AC_VERB_GET_GPIO_MASK, 0);
9011 gpiomask |= (1 << pin);
9013 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
9014 AC_VERB_GET_GPIO_DIRECTION, 0);
9015 gpiodir |= (1 << pin);
9018 snd_hda_codec_write(codec, codec->afg, 0,
9019 AC_VERB_SET_GPIO_MASK, gpiomask);
9020 snd_hda_codec_write(codec, codec->afg, 0,
9021 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
9025 snd_hda_codec_write(codec, codec->afg, 0,
9026 AC_VERB_SET_GPIO_DATA, gpiostate);
9029 /* set up GPIO at initialization */
9030 static void alc885_macpro_init_hook(struct hda_codec *codec)
9032 alc882_gpio_mute(codec, 0, 0);
9033 alc882_gpio_mute(codec, 1, 0);
9036 /* set up GPIO and update auto-muting at initialization */
9037 static void alc885_imac24_init_hook(struct hda_codec *codec)
9039 alc885_macpro_init_hook(codec);
9040 alc_hp_automute(codec);
9043 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
9044 static const struct hda_verb alc889A_mb31_ch2_init[] = {
9045 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
9046 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
9047 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
9048 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
9052 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
9053 static const struct hda_verb alc889A_mb31_ch4_init[] = {
9054 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
9055 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
9056 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
9057 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
9061 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
9062 static const struct hda_verb alc889A_mb31_ch5_init[] = {
9063 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
9064 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
9065 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
9066 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
9070 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
9071 static const struct hda_verb alc889A_mb31_ch6_init[] = {
9072 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
9073 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
9074 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
9075 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
9079 static const struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
9080 { 2, alc889A_mb31_ch2_init },
9081 { 4, alc889A_mb31_ch4_init },
9082 { 5, alc889A_mb31_ch5_init },
9083 { 6, alc889A_mb31_ch6_init },
9086 static const struct hda_verb alc883_medion_eapd_verbs[] = {
9087 /* eanable EAPD on medion laptop */
9088 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9089 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
9093 #define alc883_base_mixer alc882_base_mixer
9095 static const struct snd_kcontrol_new alc883_mitac_mixer[] = {
9096 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9097 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9098 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
9099 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9100 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
9101 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
9102 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9103 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9104 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9105 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9106 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9107 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
9108 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9112 static const struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
9113 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9114 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
9115 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9116 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
9117 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9118 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9119 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9120 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9121 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
9122 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9126 static const struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
9127 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9128 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
9129 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9130 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
9131 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9132 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9133 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9134 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9135 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
9136 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9140 static const struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
9141 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9142 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9143 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9144 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9145 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9146 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9147 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9148 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9149 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9150 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9151 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9152 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
9153 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9157 static const struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
9158 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9159 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9160 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9161 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
9162 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
9163 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9164 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
9165 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
9166 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9167 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9168 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9169 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9170 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9171 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9172 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9173 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9174 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9175 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
9176 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9180 static const struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
9181 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9182 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9183 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9184 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
9185 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
9187 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9188 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
9189 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
9190 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9191 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9192 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9193 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9194 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9195 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9196 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT),
9197 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9198 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9199 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT),
9200 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9204 static const struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
9205 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9206 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9207 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9208 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
9209 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
9211 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9212 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
9213 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
9214 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
9215 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
9216 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9217 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9218 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9219 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
9220 HDA_CODEC_VOLUME("Mic Boost Volume", 0x1b, 0, HDA_INPUT),
9221 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
9222 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9223 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT),
9224 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9228 static const struct snd_kcontrol_new alc883_fivestack_mixer[] = {
9229 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9230 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9231 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9232 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
9233 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
9234 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9235 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
9236 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
9237 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9238 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9239 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9240 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9241 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9242 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9243 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9244 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9245 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9246 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
9247 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9251 static const struct snd_kcontrol_new alc883_targa_mixer[] = {
9252 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9253 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9254 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9255 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9256 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9257 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
9258 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
9259 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9260 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
9261 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
9262 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9263 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9264 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9265 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9266 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9267 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9268 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9272 static const struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
9273 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9274 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9275 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9276 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9277 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9278 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9279 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9280 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9281 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9282 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9283 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
9284 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9288 static const struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
9289 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
9290 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
9291 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9292 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
9293 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9297 static const struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
9298 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9299 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9300 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9301 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
9302 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9303 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9304 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9305 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9309 static const struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
9310 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9311 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
9312 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9313 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9314 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9315 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9316 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9317 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9318 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9322 static const struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = {
9323 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9324 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9325 HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9326 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
9327 HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT),
9328 HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT),
9332 static const struct hda_verb alc883_medion_wim2160_verbs[] = {
9333 /* Unmute front mixer */
9334 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9335 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9337 /* Set speaker pin to front mixer */
9338 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9340 /* Init headphone pin */
9341 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9342 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9343 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
9344 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9349 /* toggle speaker-output according to the hp-jack state */
9350 static void alc883_medion_wim2160_setup(struct hda_codec *codec)
9352 struct alc_spec *spec = codec->spec;
9354 spec->autocfg.hp_pins[0] = 0x1a;
9355 spec->autocfg.speaker_pins[0] = 0x15;
9357 spec->automute_mode = ALC_AUTOMUTE_AMP;
9360 static const struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
9361 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9362 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9363 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9364 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9365 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9366 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9367 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9368 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9372 static const struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
9373 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9374 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
9375 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9376 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9377 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9378 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9379 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9380 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9381 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9385 static const struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
9386 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9387 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9388 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
9389 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
9390 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
9391 0x0d, 1, 0x0, HDA_OUTPUT),
9392 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
9393 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
9394 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
9395 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
9396 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
9397 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9398 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9399 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9400 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9401 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9402 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9403 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9404 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9405 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
9406 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9410 static const struct snd_kcontrol_new alc889A_mb31_mixer[] = {
9412 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
9413 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
9414 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
9415 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
9416 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
9418 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
9419 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
9420 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
9421 /* Output switches */
9422 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
9423 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
9424 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
9426 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT),
9427 HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT),
9429 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
9430 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
9431 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9432 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9436 static const struct snd_kcontrol_new alc883_vaiott_mixer[] = {
9437 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9438 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9439 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9440 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9441 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT),
9442 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9446 static const struct hda_bind_ctls alc883_bind_cap_vol = {
9447 .ops = &snd_hda_bind_vol,
9449 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
9450 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
9455 static const struct hda_bind_ctls alc883_bind_cap_switch = {
9456 .ops = &snd_hda_bind_sw,
9458 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
9459 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
9464 static const struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
9465 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9466 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9467 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9468 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9469 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9470 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9471 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9472 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9476 static const struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
9477 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
9478 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
9480 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9481 /* .name = "Capture Source", */
9482 .name = "Input Source",
9484 .info = alc_mux_enum_info,
9485 .get = alc_mux_enum_get,
9486 .put = alc_mux_enum_put,
9491 static const struct snd_kcontrol_new alc883_chmode_mixer[] = {
9493 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9494 .name = "Channel Mode",
9495 .info = alc_ch_mode_info,
9496 .get = alc_ch_mode_get,
9497 .put = alc_ch_mode_put,
9502 /* toggle speaker-output according to the hp-jack state */
9503 static void alc883_mitac_setup(struct hda_codec *codec)
9505 struct alc_spec *spec = codec->spec;
9507 spec->autocfg.hp_pins[0] = 0x15;
9508 spec->autocfg.speaker_pins[0] = 0x14;
9509 spec->autocfg.speaker_pins[1] = 0x17;
9511 spec->automute_mode = ALC_AUTOMUTE_AMP;
9514 static const struct hda_verb alc883_mitac_verbs[] = {
9516 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9517 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9519 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
9520 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9522 /* enable unsolicited event */
9523 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9524 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
9529 static const struct hda_verb alc883_clevo_m540r_verbs[] = {
9531 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9532 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9534 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
9536 /* enable unsolicited event */
9538 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9539 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9545 static const struct hda_verb alc883_clevo_m720_verbs[] = {
9547 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9548 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9550 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
9551 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9553 /* enable unsolicited event */
9554 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9555 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9560 static const struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
9562 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9563 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9565 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9566 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9568 /* enable unsolicited event */
9569 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9574 static const struct hda_verb alc883_targa_verbs[] = {
9575 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9576 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9578 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9579 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9581 /* Connect Line-Out side jack (SPDIF) to Side */
9582 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9583 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9584 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
9585 /* Connect Mic jack to CLFE */
9586 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9587 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9588 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
9589 /* Connect Line-in jack to Surround */
9590 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9591 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9592 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
9593 /* Connect HP out jack to Front */
9594 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9595 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9596 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9598 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9603 static const struct hda_verb alc883_lenovo_101e_verbs[] = {
9604 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9605 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
9606 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
9610 static const struct hda_verb alc883_lenovo_nb0763_verbs[] = {
9611 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9612 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9613 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9614 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9618 static const struct hda_verb alc888_lenovo_ms7195_verbs[] = {
9619 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9620 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9621 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9622 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
9623 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9627 static const struct hda_verb alc883_haier_w66_verbs[] = {
9628 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9629 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9631 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9633 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9634 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9635 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9636 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9640 static const struct hda_verb alc888_lenovo_sky_verbs[] = {
9641 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9642 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9643 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9644 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9645 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9646 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9647 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
9648 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9652 static const struct hda_verb alc888_6st_dell_verbs[] = {
9653 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9657 static const struct hda_verb alc883_vaiott_verbs[] = {
9659 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9660 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9662 /* enable unsolicited event */
9663 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9668 static void alc888_3st_hp_setup(struct hda_codec *codec)
9670 struct alc_spec *spec = codec->spec;
9672 spec->autocfg.hp_pins[0] = 0x1b;
9673 spec->autocfg.speaker_pins[0] = 0x14;
9674 spec->autocfg.speaker_pins[1] = 0x16;
9675 spec->autocfg.speaker_pins[2] = 0x18;
9677 spec->automute_mode = ALC_AUTOMUTE_AMP;
9680 static const struct hda_verb alc888_3st_hp_verbs[] = {
9681 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
9682 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
9683 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
9684 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9691 static const struct hda_verb alc888_3st_hp_2ch_init[] = {
9692 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
9693 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9694 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
9695 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9702 static const struct hda_verb alc888_3st_hp_4ch_init[] = {
9703 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
9704 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9705 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9706 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9707 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
9714 static const struct hda_verb alc888_3st_hp_6ch_init[] = {
9715 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9716 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9717 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
9718 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9719 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9720 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
9724 static const struct hda_channel_mode alc888_3st_hp_modes[3] = {
9725 { 2, alc888_3st_hp_2ch_init },
9726 { 4, alc888_3st_hp_4ch_init },
9727 { 6, alc888_3st_hp_6ch_init },
9730 static void alc888_lenovo_ms7195_setup(struct hda_codec *codec)
9732 struct alc_spec *spec = codec->spec;
9734 spec->autocfg.hp_pins[0] = 0x1b;
9735 spec->autocfg.line_out_pins[0] = 0x14;
9736 spec->autocfg.speaker_pins[0] = 0x15;
9738 spec->automute_mode = ALC_AUTOMUTE_AMP;
9741 /* toggle speaker-output according to the hp-jack state */
9742 static void alc883_lenovo_nb0763_setup(struct hda_codec *codec)
9744 struct alc_spec *spec = codec->spec;
9746 spec->autocfg.hp_pins[0] = 0x14;
9747 spec->autocfg.speaker_pins[0] = 0x15;
9749 spec->automute_mode = ALC_AUTOMUTE_AMP;
9752 /* toggle speaker-output according to the hp-jack state */
9753 #define alc883_targa_init_hook alc882_targa_init_hook
9754 #define alc883_targa_unsol_event alc882_targa_unsol_event
9756 static void alc883_clevo_m720_setup(struct hda_codec *codec)
9758 struct alc_spec *spec = codec->spec;
9760 spec->autocfg.hp_pins[0] = 0x15;
9761 spec->autocfg.speaker_pins[0] = 0x14;
9763 spec->automute_mode = ALC_AUTOMUTE_AMP;
9766 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
9768 alc_hp_automute(codec);
9769 alc88x_simple_mic_automute(codec);
9772 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
9775 switch (res >> 26) {
9776 case ALC880_MIC_EVENT:
9777 alc88x_simple_mic_automute(codec);
9780 alc_sku_unsol_event(codec, res);
9785 /* toggle speaker-output according to the hp-jack state */
9786 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
9788 struct alc_spec *spec = codec->spec;
9790 spec->autocfg.hp_pins[0] = 0x14;
9791 spec->autocfg.speaker_pins[0] = 0x15;
9793 spec->automute_mode = ALC_AUTOMUTE_AMP;
9796 static void alc883_haier_w66_setup(struct hda_codec *codec)
9798 struct alc_spec *spec = codec->spec;
9800 spec->autocfg.hp_pins[0] = 0x1b;
9801 spec->autocfg.speaker_pins[0] = 0x14;
9803 spec->automute_mode = ALC_AUTOMUTE_AMP;
9806 static void alc883_lenovo_101e_setup(struct hda_codec *codec)
9808 struct alc_spec *spec = codec->spec;
9810 spec->autocfg.hp_pins[0] = 0x1b;
9811 spec->autocfg.line_out_pins[0] = 0x14;
9812 spec->autocfg.speaker_pins[0] = 0x15;
9814 spec->detect_line = 1;
9815 spec->automute_lines = 1;
9816 spec->automute_mode = ALC_AUTOMUTE_AMP;
9819 /* toggle speaker-output according to the hp-jack state */
9820 static void alc883_acer_aspire_setup(struct hda_codec *codec)
9822 struct alc_spec *spec = codec->spec;
9824 spec->autocfg.hp_pins[0] = 0x14;
9825 spec->autocfg.speaker_pins[0] = 0x15;
9826 spec->autocfg.speaker_pins[1] = 0x16;
9828 spec->automute_mode = ALC_AUTOMUTE_AMP;
9831 static const struct hda_verb alc883_acer_eapd_verbs[] = {
9832 /* HP Pin: output 0 (0x0c) */
9833 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9834 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9835 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9836 /* Front Pin: output 0 (0x0c) */
9837 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9838 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9839 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9840 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
9841 /* eanable EAPD on medion laptop */
9842 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9843 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
9844 /* enable unsolicited event */
9845 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9849 static void alc888_6st_dell_setup(struct hda_codec *codec)
9851 struct alc_spec *spec = codec->spec;
9853 spec->autocfg.hp_pins[0] = 0x1b;
9854 spec->autocfg.speaker_pins[0] = 0x14;
9855 spec->autocfg.speaker_pins[1] = 0x15;
9856 spec->autocfg.speaker_pins[2] = 0x16;
9857 spec->autocfg.speaker_pins[3] = 0x17;
9859 spec->automute_mode = ALC_AUTOMUTE_AMP;
9862 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
9864 struct alc_spec *spec = codec->spec;
9866 spec->autocfg.hp_pins[0] = 0x1b;
9867 spec->autocfg.speaker_pins[0] = 0x14;
9868 spec->autocfg.speaker_pins[1] = 0x15;
9869 spec->autocfg.speaker_pins[2] = 0x16;
9870 spec->autocfg.speaker_pins[3] = 0x17;
9871 spec->autocfg.speaker_pins[4] = 0x1a;
9873 spec->automute_mode = ALC_AUTOMUTE_AMP;
9876 static void alc883_vaiott_setup(struct hda_codec *codec)
9878 struct alc_spec *spec = codec->spec;
9880 spec->autocfg.hp_pins[0] = 0x15;
9881 spec->autocfg.speaker_pins[0] = 0x14;
9882 spec->autocfg.speaker_pins[1] = 0x17;
9884 spec->automute_mode = ALC_AUTOMUTE_AMP;
9887 static const struct hda_verb alc888_asus_m90v_verbs[] = {
9888 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9889 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9890 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9891 /* enable unsolicited event */
9892 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9893 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9897 static void alc883_mode2_setup(struct hda_codec *codec)
9899 struct alc_spec *spec = codec->spec;
9901 spec->autocfg.hp_pins[0] = 0x1b;
9902 spec->autocfg.speaker_pins[0] = 0x14;
9903 spec->autocfg.speaker_pins[1] = 0x15;
9904 spec->autocfg.speaker_pins[2] = 0x16;
9905 spec->ext_mic.pin = 0x18;
9906 spec->int_mic.pin = 0x19;
9907 spec->ext_mic.mux_idx = 0;
9908 spec->int_mic.mux_idx = 1;
9911 spec->automute_mode = ALC_AUTOMUTE_AMP;
9914 static const struct hda_verb alc888_asus_eee1601_verbs[] = {
9915 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9916 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9917 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9918 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9919 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9920 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
9921 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
9922 /* enable unsolicited event */
9923 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9927 static void alc883_eee1601_inithook(struct hda_codec *codec)
9929 struct alc_spec *spec = codec->spec;
9931 spec->autocfg.hp_pins[0] = 0x14;
9932 spec->autocfg.speaker_pins[0] = 0x1b;
9933 alc_hp_automute(codec);
9936 static const struct hda_verb alc889A_mb31_verbs[] = {
9937 /* Init rear pin (used as headphone output) */
9938 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
9939 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
9940 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9941 /* Init line pin (used as output in 4ch and 6ch mode) */
9942 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
9943 /* Init line 2 pin (used as headphone out by default) */
9944 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
9945 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
9949 /* Mute speakers according to the headphone jack state */
9950 static void alc889A_mb31_automute(struct hda_codec *codec)
9952 unsigned int present;
9954 /* Mute only in 2ch or 4ch mode */
9955 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
9957 present = snd_hda_jack_detect(codec, 0x15);
9958 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9959 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9960 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9961 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9965 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
9967 if ((res >> 26) == ALC880_HP_EVENT)
9968 alc889A_mb31_automute(codec);
9972 #ifdef CONFIG_SND_HDA_POWER_SAVE
9973 #define alc882_loopbacks alc880_loopbacks
9976 /* pcm configuration: identical with ALC880 */
9977 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
9978 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
9979 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
9980 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
9982 static const hda_nid_t alc883_slave_dig_outs[] = {
9983 ALC1200_DIGOUT_NID, 0,
9986 static const hda_nid_t alc1200_slave_dig_outs[] = {
9987 ALC883_DIGOUT_NID, 0,
9991 * configuration and preset
9993 static const char * const alc882_models[ALC882_MODEL_LAST] = {
9994 [ALC882_3ST_DIG] = "3stack-dig",
9995 [ALC882_6ST_DIG] = "6stack-dig",
9996 [ALC882_ARIMA] = "arima",
9997 [ALC882_W2JC] = "w2jc",
9998 [ALC882_TARGA] = "targa",
9999 [ALC882_ASUS_A7J] = "asus-a7j",
10000 [ALC882_ASUS_A7M] = "asus-a7m",
10001 [ALC885_MACPRO] = "macpro",
10002 [ALC885_MB5] = "mb5",
10003 [ALC885_MACMINI3] = "macmini3",
10004 [ALC885_MBA21] = "mba21",
10005 [ALC885_MBP3] = "mbp3",
10006 [ALC885_IMAC24] = "imac24",
10007 [ALC885_IMAC91] = "imac91",
10008 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
10009 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
10010 [ALC883_3ST_6ch] = "3stack-6ch",
10011 [ALC883_6ST_DIG] = "alc883-6stack-dig",
10012 [ALC883_TARGA_DIG] = "targa-dig",
10013 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
10014 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
10015 [ALC883_ACER] = "acer",
10016 [ALC883_ACER_ASPIRE] = "acer-aspire",
10017 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
10018 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
10019 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
10020 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
10021 [ALC883_MEDION] = "medion",
10022 [ALC883_MEDION_WIM2160] = "medion-wim2160",
10023 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
10024 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
10025 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
10026 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
10027 [ALC888_LENOVO_SKY] = "lenovo-sky",
10028 [ALC883_HAIER_W66] = "haier-w66",
10029 [ALC888_3ST_HP] = "3stack-hp",
10030 [ALC888_6ST_DELL] = "6stack-dell",
10031 [ALC883_MITAC] = "mitac",
10032 [ALC883_CLEVO_M540R] = "clevo-m540r",
10033 [ALC883_CLEVO_M720] = "clevo-m720",
10034 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
10035 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
10036 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
10037 [ALC889A_INTEL] = "intel-alc889a",
10038 [ALC889_INTEL] = "intel-x58",
10039 [ALC1200_ASUS_P5Q] = "asus-p5q",
10040 [ALC889A_MB31] = "mb31",
10041 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
10042 [ALC882_AUTO] = "auto",
10045 static const struct snd_pci_quirk alc882_cfg_tbl[] = {
10046 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
10048 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
10049 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
10050 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
10051 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
10052 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
10053 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
10054 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
10055 ALC888_ACER_ASPIRE_4930G),
10056 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
10057 ALC888_ACER_ASPIRE_4930G),
10058 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
10059 ALC888_ACER_ASPIRE_8930G),
10060 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
10061 ALC888_ACER_ASPIRE_8930G),
10062 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
10063 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
10064 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
10065 ALC888_ACER_ASPIRE_6530G),
10066 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
10067 ALC888_ACER_ASPIRE_6530G),
10068 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
10069 ALC888_ACER_ASPIRE_7730G),
10070 /* default Acer -- disabled as it causes more problems.
10071 * model=auto should work fine now
10073 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
10075 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
10077 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavilion", ALC883_6ST_DIG),
10078 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
10079 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
10080 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
10081 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
10082 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
10084 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
10085 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
10086 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
10087 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
10088 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
10089 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
10090 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
10091 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
10092 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
10093 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
10094 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
10096 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
10097 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
10098 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
10099 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
10100 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
10101 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
10102 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
10103 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
10104 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
10106 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
10107 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
10108 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
10109 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
10110 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
10111 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
10112 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
10113 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
10114 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
10115 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
10116 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
10117 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
10118 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
10119 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
10120 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
10121 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
10122 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
10123 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
10124 SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG),
10125 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
10126 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
10127 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
10128 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
10129 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
10130 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
10131 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
10132 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
10133 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
10134 SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG),
10135 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
10136 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
10138 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
10139 SND_PCI_QUIRK(0x1558, 0x0571, "Clevo laptop M570U", ALC883_3ST_6ch_DIG),
10140 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
10141 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
10142 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
10143 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
10144 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
10145 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
10146 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
10147 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
10148 ALC883_FUJITSU_PI2515),
10149 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
10150 ALC888_FUJITSU_XA3530),
10151 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
10152 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
10153 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
10154 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
10155 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
10156 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
10157 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
10158 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
10160 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
10161 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
10162 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
10163 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
10164 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
10165 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
10166 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG),
10171 /* codec SSID table for Intel Mac */
10172 static const struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
10173 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
10174 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
10175 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
10176 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
10177 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
10178 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
10179 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
10180 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31),
10181 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_ASUS_A7M),
10182 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3),
10183 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21),
10184 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
10185 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
10186 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
10187 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
10188 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
10189 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5),
10190 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
10191 * so apparently no perfect solution yet
10193 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
10194 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
10195 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3),
10196 {} /* terminator */
10199 static const struct alc_config_preset alc882_presets[] = {
10200 [ALC882_3ST_DIG] = {
10201 .mixers = { alc882_base_mixer },
10202 .init_verbs = { alc882_base_init_verbs,
10203 alc882_adc1_init_verbs },
10204 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10205 .dac_nids = alc882_dac_nids,
10206 .dig_out_nid = ALC882_DIGOUT_NID,
10207 .dig_in_nid = ALC882_DIGIN_NID,
10208 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
10209 .channel_mode = alc882_ch_modes,
10211 .input_mux = &alc882_capture_source,
10213 [ALC882_6ST_DIG] = {
10214 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
10215 .init_verbs = { alc882_base_init_verbs,
10216 alc882_adc1_init_verbs },
10217 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10218 .dac_nids = alc882_dac_nids,
10219 .dig_out_nid = ALC882_DIGOUT_NID,
10220 .dig_in_nid = ALC882_DIGIN_NID,
10221 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
10222 .channel_mode = alc882_sixstack_modes,
10223 .input_mux = &alc882_capture_source,
10226 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
10227 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10228 alc882_eapd_verbs },
10229 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10230 .dac_nids = alc882_dac_nids,
10231 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
10232 .channel_mode = alc882_sixstack_modes,
10233 .input_mux = &alc882_capture_source,
10236 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
10237 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10238 alc882_eapd_verbs, alc880_gpio1_init_verbs },
10239 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10240 .dac_nids = alc882_dac_nids,
10241 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
10242 .channel_mode = alc880_threestack_modes,
10244 .input_mux = &alc882_capture_source,
10245 .dig_out_nid = ALC882_DIGOUT_NID,
10248 .mixers = { alc885_mba21_mixer },
10249 .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs },
10251 .dac_nids = alc882_dac_nids,
10252 .channel_mode = alc885_mba21_ch_modes,
10253 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
10254 .input_mux = &alc882_capture_source,
10255 .unsol_event = alc_sku_unsol_event,
10256 .setup = alc885_mba21_setup,
10257 .init_hook = alc_hp_automute,
10260 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
10261 .init_verbs = { alc885_mbp3_init_verbs,
10262 alc880_gpio1_init_verbs },
10264 .dac_nids = alc882_dac_nids,
10266 .channel_mode = alc885_mbp_4ch_modes,
10267 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
10268 .input_mux = &alc882_capture_source,
10269 .dig_out_nid = ALC882_DIGOUT_NID,
10270 .dig_in_nid = ALC882_DIGIN_NID,
10271 .unsol_event = alc_sku_unsol_event,
10272 .setup = alc885_mbp3_setup,
10273 .init_hook = alc_hp_automute,
10276 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
10277 .init_verbs = { alc885_mb5_init_verbs,
10278 alc880_gpio1_init_verbs },
10279 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10280 .dac_nids = alc882_dac_nids,
10281 .channel_mode = alc885_mb5_6ch_modes,
10282 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
10283 .input_mux = &mb5_capture_source,
10284 .dig_out_nid = ALC882_DIGOUT_NID,
10285 .dig_in_nid = ALC882_DIGIN_NID,
10286 .unsol_event = alc_sku_unsol_event,
10287 .setup = alc885_mb5_setup,
10288 .init_hook = alc_hp_automute,
10290 [ALC885_MACMINI3] = {
10291 .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer },
10292 .init_verbs = { alc885_macmini3_init_verbs,
10293 alc880_gpio1_init_verbs },
10294 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10295 .dac_nids = alc882_dac_nids,
10296 .channel_mode = alc885_macmini3_6ch_modes,
10297 .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes),
10298 .input_mux = &macmini3_capture_source,
10299 .dig_out_nid = ALC882_DIGOUT_NID,
10300 .dig_in_nid = ALC882_DIGIN_NID,
10301 .unsol_event = alc_sku_unsol_event,
10302 .setup = alc885_macmini3_setup,
10303 .init_hook = alc_hp_automute,
10305 [ALC885_MACPRO] = {
10306 .mixers = { alc882_macpro_mixer },
10307 .init_verbs = { alc882_macpro_init_verbs },
10308 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10309 .dac_nids = alc882_dac_nids,
10310 .dig_out_nid = ALC882_DIGOUT_NID,
10311 .dig_in_nid = ALC882_DIGIN_NID,
10312 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
10313 .channel_mode = alc882_ch_modes,
10314 .input_mux = &alc882_capture_source,
10315 .init_hook = alc885_macpro_init_hook,
10317 [ALC885_IMAC24] = {
10318 .mixers = { alc885_imac24_mixer },
10319 .init_verbs = { alc885_imac24_init_verbs },
10320 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10321 .dac_nids = alc882_dac_nids,
10322 .dig_out_nid = ALC882_DIGOUT_NID,
10323 .dig_in_nid = ALC882_DIGIN_NID,
10324 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
10325 .channel_mode = alc882_ch_modes,
10326 .input_mux = &alc882_capture_source,
10327 .unsol_event = alc_sku_unsol_event,
10328 .setup = alc885_imac24_setup,
10329 .init_hook = alc885_imac24_init_hook,
10331 [ALC885_IMAC91] = {
10332 .mixers = {alc885_imac91_mixer},
10333 .init_verbs = { alc885_imac91_init_verbs,
10334 alc880_gpio1_init_verbs },
10335 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10336 .dac_nids = alc882_dac_nids,
10337 .channel_mode = alc885_mba21_ch_modes,
10338 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
10339 .input_mux = &alc889A_imac91_capture_source,
10340 .dig_out_nid = ALC882_DIGOUT_NID,
10341 .dig_in_nid = ALC882_DIGIN_NID,
10342 .unsol_event = alc_sku_unsol_event,
10343 .setup = alc885_imac91_setup,
10344 .init_hook = alc_hp_automute,
10347 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
10348 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10349 alc880_gpio3_init_verbs, alc882_targa_verbs},
10350 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10351 .dac_nids = alc882_dac_nids,
10352 .dig_out_nid = ALC882_DIGOUT_NID,
10353 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
10354 .adc_nids = alc882_adc_nids,
10355 .capsrc_nids = alc882_capsrc_nids,
10356 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
10357 .channel_mode = alc882_3ST_6ch_modes,
10359 .input_mux = &alc882_capture_source,
10360 .unsol_event = alc_sku_unsol_event,
10361 .setup = alc882_targa_setup,
10362 .init_hook = alc882_targa_automute,
10364 [ALC882_ASUS_A7J] = {
10365 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
10366 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10367 alc882_asus_a7j_verbs},
10368 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10369 .dac_nids = alc882_dac_nids,
10370 .dig_out_nid = ALC882_DIGOUT_NID,
10371 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
10372 .adc_nids = alc882_adc_nids,
10373 .capsrc_nids = alc882_capsrc_nids,
10374 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
10375 .channel_mode = alc882_3ST_6ch_modes,
10377 .input_mux = &alc882_capture_source,
10379 [ALC882_ASUS_A7M] = {
10380 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
10381 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10382 alc882_eapd_verbs, alc880_gpio1_init_verbs,
10383 alc882_asus_a7m_verbs },
10384 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10385 .dac_nids = alc882_dac_nids,
10386 .dig_out_nid = ALC882_DIGOUT_NID,
10387 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
10388 .channel_mode = alc880_threestack_modes,
10390 .input_mux = &alc882_capture_source,
10392 [ALC883_3ST_2ch_DIG] = {
10393 .mixers = { alc883_3ST_2ch_mixer },
10394 .init_verbs = { alc883_init_verbs },
10395 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10396 .dac_nids = alc883_dac_nids,
10397 .dig_out_nid = ALC883_DIGOUT_NID,
10398 .dig_in_nid = ALC883_DIGIN_NID,
10399 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10400 .channel_mode = alc883_3ST_2ch_modes,
10401 .input_mux = &alc883_capture_source,
10403 [ALC883_3ST_6ch_DIG] = {
10404 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10405 .init_verbs = { alc883_init_verbs },
10406 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10407 .dac_nids = alc883_dac_nids,
10408 .dig_out_nid = ALC883_DIGOUT_NID,
10409 .dig_in_nid = ALC883_DIGIN_NID,
10410 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10411 .channel_mode = alc883_3ST_6ch_modes,
10413 .input_mux = &alc883_capture_source,
10415 [ALC883_3ST_6ch] = {
10416 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10417 .init_verbs = { alc883_init_verbs },
10418 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10419 .dac_nids = alc883_dac_nids,
10420 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10421 .channel_mode = alc883_3ST_6ch_modes,
10423 .input_mux = &alc883_capture_source,
10425 [ALC883_3ST_6ch_INTEL] = {
10426 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
10427 .init_verbs = { alc883_init_verbs },
10428 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10429 .dac_nids = alc883_dac_nids,
10430 .dig_out_nid = ALC883_DIGOUT_NID,
10431 .dig_in_nid = ALC883_DIGIN_NID,
10432 .slave_dig_outs = alc883_slave_dig_outs,
10433 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
10434 .channel_mode = alc883_3ST_6ch_intel_modes,
10436 .input_mux = &alc883_3stack_6ch_intel,
10438 [ALC889A_INTEL] = {
10439 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
10440 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
10441 alc_hp15_unsol_verbs },
10442 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10443 .dac_nids = alc883_dac_nids,
10444 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10445 .adc_nids = alc889_adc_nids,
10446 .dig_out_nid = ALC883_DIGOUT_NID,
10447 .dig_in_nid = ALC883_DIGIN_NID,
10448 .slave_dig_outs = alc883_slave_dig_outs,
10449 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
10450 .channel_mode = alc889_8ch_intel_modes,
10451 .capsrc_nids = alc889_capsrc_nids,
10452 .input_mux = &alc889_capture_source,
10453 .setup = alc889_automute_setup,
10454 .init_hook = alc_hp_automute,
10455 .unsol_event = alc_sku_unsol_event,
10459 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
10460 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
10461 alc889_eapd_verbs, alc_hp15_unsol_verbs},
10462 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10463 .dac_nids = alc883_dac_nids,
10464 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10465 .adc_nids = alc889_adc_nids,
10466 .dig_out_nid = ALC883_DIGOUT_NID,
10467 .dig_in_nid = ALC883_DIGIN_NID,
10468 .slave_dig_outs = alc883_slave_dig_outs,
10469 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
10470 .channel_mode = alc889_8ch_intel_modes,
10471 .capsrc_nids = alc889_capsrc_nids,
10472 .input_mux = &alc889_capture_source,
10473 .setup = alc889_automute_setup,
10474 .init_hook = alc889_intel_init_hook,
10475 .unsol_event = alc_sku_unsol_event,
10478 [ALC883_6ST_DIG] = {
10479 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10480 .init_verbs = { alc883_init_verbs },
10481 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10482 .dac_nids = alc883_dac_nids,
10483 .dig_out_nid = ALC883_DIGOUT_NID,
10484 .dig_in_nid = ALC883_DIGIN_NID,
10485 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10486 .channel_mode = alc883_sixstack_modes,
10487 .input_mux = &alc883_capture_source,
10489 [ALC883_TARGA_DIG] = {
10490 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
10491 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10492 alc883_targa_verbs},
10493 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10494 .dac_nids = alc883_dac_nids,
10495 .dig_out_nid = ALC883_DIGOUT_NID,
10496 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10497 .channel_mode = alc883_3ST_6ch_modes,
10499 .input_mux = &alc883_capture_source,
10500 .unsol_event = alc883_targa_unsol_event,
10501 .setup = alc882_targa_setup,
10502 .init_hook = alc882_targa_automute,
10504 [ALC883_TARGA_2ch_DIG] = {
10505 .mixers = { alc883_targa_2ch_mixer},
10506 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10507 alc883_targa_verbs},
10508 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10509 .dac_nids = alc883_dac_nids,
10510 .adc_nids = alc883_adc_nids_alt,
10511 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10512 .capsrc_nids = alc883_capsrc_nids,
10513 .dig_out_nid = ALC883_DIGOUT_NID,
10514 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10515 .channel_mode = alc883_3ST_2ch_modes,
10516 .input_mux = &alc883_capture_source,
10517 .unsol_event = alc883_targa_unsol_event,
10518 .setup = alc882_targa_setup,
10519 .init_hook = alc882_targa_automute,
10521 [ALC883_TARGA_8ch_DIG] = {
10522 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
10523 alc883_chmode_mixer },
10524 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10525 alc883_targa_verbs },
10526 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10527 .dac_nids = alc883_dac_nids,
10528 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10529 .adc_nids = alc883_adc_nids_rev,
10530 .capsrc_nids = alc883_capsrc_nids_rev,
10531 .dig_out_nid = ALC883_DIGOUT_NID,
10532 .dig_in_nid = ALC883_DIGIN_NID,
10533 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
10534 .channel_mode = alc883_4ST_8ch_modes,
10536 .input_mux = &alc883_capture_source,
10537 .unsol_event = alc883_targa_unsol_event,
10538 .setup = alc882_targa_setup,
10539 .init_hook = alc882_targa_automute,
10542 .mixers = { alc883_base_mixer },
10543 /* On TravelMate laptops, GPIO 0 enables the internal speaker
10544 * and the headphone jack. Turn this on and rely on the
10545 * standard mute methods whenever the user wants to turn
10546 * these outputs off.
10548 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
10549 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10550 .dac_nids = alc883_dac_nids,
10551 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10552 .channel_mode = alc883_3ST_2ch_modes,
10553 .input_mux = &alc883_capture_source,
10555 [ALC883_ACER_ASPIRE] = {
10556 .mixers = { alc883_acer_aspire_mixer },
10557 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
10558 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10559 .dac_nids = alc883_dac_nids,
10560 .dig_out_nid = ALC883_DIGOUT_NID,
10561 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10562 .channel_mode = alc883_3ST_2ch_modes,
10563 .input_mux = &alc883_capture_source,
10564 .unsol_event = alc_sku_unsol_event,
10565 .setup = alc883_acer_aspire_setup,
10566 .init_hook = alc_hp_automute,
10568 [ALC888_ACER_ASPIRE_4930G] = {
10569 .mixers = { alc888_acer_aspire_4930g_mixer,
10570 alc883_chmode_mixer },
10571 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10572 alc888_acer_aspire_4930g_verbs },
10573 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10574 .dac_nids = alc883_dac_nids,
10575 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10576 .adc_nids = alc883_adc_nids_rev,
10577 .capsrc_nids = alc883_capsrc_nids_rev,
10578 .dig_out_nid = ALC883_DIGOUT_NID,
10579 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10580 .channel_mode = alc883_3ST_6ch_modes,
10582 .const_channel_count = 6,
10584 ARRAY_SIZE(alc888_2_capture_sources),
10585 .input_mux = alc888_2_capture_sources,
10586 .unsol_event = alc_sku_unsol_event,
10587 .setup = alc888_acer_aspire_4930g_setup,
10588 .init_hook = alc_hp_automute,
10590 [ALC888_ACER_ASPIRE_6530G] = {
10591 .mixers = { alc888_acer_aspire_6530_mixer },
10592 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10593 alc888_acer_aspire_6530g_verbs },
10594 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10595 .dac_nids = alc883_dac_nids,
10596 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10597 .adc_nids = alc883_adc_nids_rev,
10598 .capsrc_nids = alc883_capsrc_nids_rev,
10599 .dig_out_nid = ALC883_DIGOUT_NID,
10600 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10601 .channel_mode = alc883_3ST_2ch_modes,
10603 ARRAY_SIZE(alc888_2_capture_sources),
10604 .input_mux = alc888_acer_aspire_6530_sources,
10605 .unsol_event = alc_sku_unsol_event,
10606 .setup = alc888_acer_aspire_6530g_setup,
10607 .init_hook = alc_hp_automute,
10609 [ALC888_ACER_ASPIRE_8930G] = {
10610 .mixers = { alc889_acer_aspire_8930g_mixer,
10611 alc883_chmode_mixer },
10612 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10613 alc889_acer_aspire_8930g_verbs,
10614 alc889_eapd_verbs},
10615 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10616 .dac_nids = alc883_dac_nids,
10617 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10618 .adc_nids = alc889_adc_nids,
10619 .capsrc_nids = alc889_capsrc_nids,
10620 .dig_out_nid = ALC883_DIGOUT_NID,
10621 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10622 .channel_mode = alc883_3ST_6ch_modes,
10624 .const_channel_count = 6,
10626 ARRAY_SIZE(alc889_capture_sources),
10627 .input_mux = alc889_capture_sources,
10628 .unsol_event = alc_sku_unsol_event,
10629 .setup = alc889_acer_aspire_8930g_setup,
10630 .init_hook = alc_hp_automute,
10631 #ifdef CONFIG_SND_HDA_POWER_SAVE
10632 .power_hook = alc_power_eapd,
10635 [ALC888_ACER_ASPIRE_7730G] = {
10636 .mixers = { alc883_3ST_6ch_mixer,
10637 alc883_chmode_mixer },
10638 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10639 alc888_acer_aspire_7730G_verbs },
10640 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10641 .dac_nids = alc883_dac_nids,
10642 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10643 .adc_nids = alc883_adc_nids_rev,
10644 .capsrc_nids = alc883_capsrc_nids_rev,
10645 .dig_out_nid = ALC883_DIGOUT_NID,
10646 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10647 .channel_mode = alc883_3ST_6ch_modes,
10649 .const_channel_count = 6,
10650 .input_mux = &alc883_capture_source,
10651 .unsol_event = alc_sku_unsol_event,
10652 .setup = alc888_acer_aspire_7730g_setup,
10653 .init_hook = alc_hp_automute,
10655 [ALC883_MEDION] = {
10656 .mixers = { alc883_fivestack_mixer,
10657 alc883_chmode_mixer },
10658 .init_verbs = { alc883_init_verbs,
10659 alc883_medion_eapd_verbs },
10660 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10661 .dac_nids = alc883_dac_nids,
10662 .adc_nids = alc883_adc_nids_alt,
10663 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10664 .capsrc_nids = alc883_capsrc_nids,
10665 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10666 .channel_mode = alc883_sixstack_modes,
10667 .input_mux = &alc883_capture_source,
10669 [ALC883_MEDION_WIM2160] = {
10670 .mixers = { alc883_medion_wim2160_mixer },
10671 .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs },
10672 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10673 .dac_nids = alc883_dac_nids,
10674 .dig_out_nid = ALC883_DIGOUT_NID,
10675 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10676 .adc_nids = alc883_adc_nids,
10677 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10678 .channel_mode = alc883_3ST_2ch_modes,
10679 .input_mux = &alc883_capture_source,
10680 .unsol_event = alc_sku_unsol_event,
10681 .setup = alc883_medion_wim2160_setup,
10682 .init_hook = alc_hp_automute,
10684 [ALC883_LAPTOP_EAPD] = {
10685 .mixers = { alc883_base_mixer },
10686 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
10687 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10688 .dac_nids = alc883_dac_nids,
10689 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10690 .channel_mode = alc883_3ST_2ch_modes,
10691 .input_mux = &alc883_capture_source,
10693 [ALC883_CLEVO_M540R] = {
10694 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10695 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
10696 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10697 .dac_nids = alc883_dac_nids,
10698 .dig_out_nid = ALC883_DIGOUT_NID,
10699 .dig_in_nid = ALC883_DIGIN_NID,
10700 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
10701 .channel_mode = alc883_3ST_6ch_clevo_modes,
10703 .input_mux = &alc883_capture_source,
10704 /* This machine has the hardware HP auto-muting, thus
10705 * we need no software mute via unsol event
10708 [ALC883_CLEVO_M720] = {
10709 .mixers = { alc883_clevo_m720_mixer },
10710 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
10711 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10712 .dac_nids = alc883_dac_nids,
10713 .dig_out_nid = ALC883_DIGOUT_NID,
10714 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10715 .channel_mode = alc883_3ST_2ch_modes,
10716 .input_mux = &alc883_capture_source,
10717 .unsol_event = alc883_clevo_m720_unsol_event,
10718 .setup = alc883_clevo_m720_setup,
10719 .init_hook = alc883_clevo_m720_init_hook,
10721 [ALC883_LENOVO_101E_2ch] = {
10722 .mixers = { alc883_lenovo_101e_2ch_mixer},
10723 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
10724 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10725 .dac_nids = alc883_dac_nids,
10726 .adc_nids = alc883_adc_nids_alt,
10727 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10728 .capsrc_nids = alc883_capsrc_nids,
10729 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10730 .channel_mode = alc883_3ST_2ch_modes,
10731 .input_mux = &alc883_lenovo_101e_capture_source,
10732 .setup = alc883_lenovo_101e_setup,
10733 .unsol_event = alc_sku_unsol_event,
10734 .init_hook = alc_inithook,
10736 [ALC883_LENOVO_NB0763] = {
10737 .mixers = { alc883_lenovo_nb0763_mixer },
10738 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
10739 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10740 .dac_nids = alc883_dac_nids,
10741 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10742 .channel_mode = alc883_3ST_2ch_modes,
10744 .input_mux = &alc883_lenovo_nb0763_capture_source,
10745 .unsol_event = alc_sku_unsol_event,
10746 .setup = alc883_lenovo_nb0763_setup,
10747 .init_hook = alc_hp_automute,
10749 [ALC888_LENOVO_MS7195_DIG] = {
10750 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10751 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
10752 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10753 .dac_nids = alc883_dac_nids,
10754 .dig_out_nid = ALC883_DIGOUT_NID,
10755 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10756 .channel_mode = alc883_3ST_6ch_modes,
10758 .input_mux = &alc883_capture_source,
10759 .unsol_event = alc_sku_unsol_event,
10760 .setup = alc888_lenovo_ms7195_setup,
10761 .init_hook = alc_inithook,
10763 [ALC883_HAIER_W66] = {
10764 .mixers = { alc883_targa_2ch_mixer},
10765 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
10766 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10767 .dac_nids = alc883_dac_nids,
10768 .dig_out_nid = ALC883_DIGOUT_NID,
10769 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10770 .channel_mode = alc883_3ST_2ch_modes,
10771 .input_mux = &alc883_capture_source,
10772 .unsol_event = alc_sku_unsol_event,
10773 .setup = alc883_haier_w66_setup,
10774 .init_hook = alc_hp_automute,
10776 [ALC888_3ST_HP] = {
10777 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10778 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
10779 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10780 .dac_nids = alc883_dac_nids,
10781 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
10782 .channel_mode = alc888_3st_hp_modes,
10784 .input_mux = &alc883_capture_source,
10785 .unsol_event = alc_sku_unsol_event,
10786 .setup = alc888_3st_hp_setup,
10787 .init_hook = alc_hp_automute,
10789 [ALC888_6ST_DELL] = {
10790 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10791 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
10792 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10793 .dac_nids = alc883_dac_nids,
10794 .dig_out_nid = ALC883_DIGOUT_NID,
10795 .dig_in_nid = ALC883_DIGIN_NID,
10796 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10797 .channel_mode = alc883_sixstack_modes,
10798 .input_mux = &alc883_capture_source,
10799 .unsol_event = alc_sku_unsol_event,
10800 .setup = alc888_6st_dell_setup,
10801 .init_hook = alc_hp_automute,
10804 .mixers = { alc883_mitac_mixer },
10805 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
10806 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10807 .dac_nids = alc883_dac_nids,
10808 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10809 .channel_mode = alc883_3ST_2ch_modes,
10810 .input_mux = &alc883_capture_source,
10811 .unsol_event = alc_sku_unsol_event,
10812 .setup = alc883_mitac_setup,
10813 .init_hook = alc_hp_automute,
10815 [ALC883_FUJITSU_PI2515] = {
10816 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
10817 .init_verbs = { alc883_init_verbs,
10818 alc883_2ch_fujitsu_pi2515_verbs},
10819 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10820 .dac_nids = alc883_dac_nids,
10821 .dig_out_nid = ALC883_DIGOUT_NID,
10822 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10823 .channel_mode = alc883_3ST_2ch_modes,
10824 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10825 .unsol_event = alc_sku_unsol_event,
10826 .setup = alc883_2ch_fujitsu_pi2515_setup,
10827 .init_hook = alc_hp_automute,
10829 [ALC888_FUJITSU_XA3530] = {
10830 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
10831 .init_verbs = { alc883_init_verbs,
10832 alc888_fujitsu_xa3530_verbs },
10833 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10834 .dac_nids = alc883_dac_nids,
10835 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10836 .adc_nids = alc883_adc_nids_rev,
10837 .capsrc_nids = alc883_capsrc_nids_rev,
10838 .dig_out_nid = ALC883_DIGOUT_NID,
10839 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
10840 .channel_mode = alc888_4ST_8ch_intel_modes,
10842 ARRAY_SIZE(alc888_2_capture_sources),
10843 .input_mux = alc888_2_capture_sources,
10844 .unsol_event = alc_sku_unsol_event,
10845 .setup = alc888_fujitsu_xa3530_setup,
10846 .init_hook = alc_hp_automute,
10848 [ALC888_LENOVO_SKY] = {
10849 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
10850 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
10851 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10852 .dac_nids = alc883_dac_nids,
10853 .dig_out_nid = ALC883_DIGOUT_NID,
10854 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10855 .channel_mode = alc883_sixstack_modes,
10857 .input_mux = &alc883_lenovo_sky_capture_source,
10858 .unsol_event = alc_sku_unsol_event,
10859 .setup = alc888_lenovo_sky_setup,
10860 .init_hook = alc_hp_automute,
10862 [ALC888_ASUS_M90V] = {
10863 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10864 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
10865 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10866 .dac_nids = alc883_dac_nids,
10867 .dig_out_nid = ALC883_DIGOUT_NID,
10868 .dig_in_nid = ALC883_DIGIN_NID,
10869 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10870 .channel_mode = alc883_3ST_6ch_modes,
10872 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10873 .unsol_event = alc_sku_unsol_event,
10874 .setup = alc883_mode2_setup,
10875 .init_hook = alc_inithook,
10877 [ALC888_ASUS_EEE1601] = {
10878 .mixers = { alc883_asus_eee1601_mixer },
10879 .cap_mixer = alc883_asus_eee1601_cap_mixer,
10880 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
10881 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10882 .dac_nids = alc883_dac_nids,
10883 .dig_out_nid = ALC883_DIGOUT_NID,
10884 .dig_in_nid = ALC883_DIGIN_NID,
10885 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10886 .channel_mode = alc883_3ST_2ch_modes,
10888 .input_mux = &alc883_asus_eee1601_capture_source,
10889 .unsol_event = alc_sku_unsol_event,
10890 .init_hook = alc883_eee1601_inithook,
10892 [ALC1200_ASUS_P5Q] = {
10893 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10894 .init_verbs = { alc883_init_verbs },
10895 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10896 .dac_nids = alc883_dac_nids,
10897 .dig_out_nid = ALC1200_DIGOUT_NID,
10898 .dig_in_nid = ALC883_DIGIN_NID,
10899 .slave_dig_outs = alc1200_slave_dig_outs,
10900 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10901 .channel_mode = alc883_sixstack_modes,
10902 .input_mux = &alc883_capture_source,
10905 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
10906 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
10907 alc880_gpio1_init_verbs },
10908 .adc_nids = alc883_adc_nids,
10909 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10910 .capsrc_nids = alc883_capsrc_nids,
10911 .dac_nids = alc883_dac_nids,
10912 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10913 .channel_mode = alc889A_mb31_6ch_modes,
10914 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
10915 .input_mux = &alc889A_mb31_capture_source,
10916 .dig_out_nid = ALC883_DIGOUT_NID,
10917 .unsol_event = alc889A_mb31_unsol_event,
10918 .init_hook = alc889A_mb31_automute,
10920 [ALC883_SONY_VAIO_TT] = {
10921 .mixers = { alc883_vaiott_mixer },
10922 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
10923 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10924 .dac_nids = alc883_dac_nids,
10925 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10926 .channel_mode = alc883_3ST_2ch_modes,
10927 .input_mux = &alc883_capture_source,
10928 .unsol_event = alc_sku_unsol_event,
10929 .setup = alc883_vaiott_setup,
10930 .init_hook = alc_hp_automute,
10939 PINFIX_ABIT_AW9D_MAX,
10940 PINFIX_LENOVO_Y530,
10942 PINFIX_ACER_ASPIRE_7736,
10945 static const struct alc_fixup alc882_fixups[] = {
10946 [PINFIX_ABIT_AW9D_MAX] = {
10947 .type = ALC_FIXUP_PINS,
10948 .v.pins = (const struct alc_pincfg[]) {
10949 { 0x15, 0x01080104 }, /* side */
10950 { 0x16, 0x01011012 }, /* rear */
10951 { 0x17, 0x01016011 }, /* clfe */
10955 [PINFIX_LENOVO_Y530] = {
10956 .type = ALC_FIXUP_PINS,
10957 .v.pins = (const struct alc_pincfg[]) {
10958 { 0x15, 0x99130112 }, /* rear int speakers */
10959 { 0x16, 0x99130111 }, /* subwoofer */
10963 [PINFIX_PB_M5210] = {
10964 .type = ALC_FIXUP_VERBS,
10965 .v.verbs = (const struct hda_verb[]) {
10966 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 },
10970 [PINFIX_ACER_ASPIRE_7736] = {
10971 .type = ALC_FIXUP_SKU,
10972 .v.sku = ALC_FIXUP_SKU_IGNORE,
10976 static const struct snd_pci_quirk alc882_fixup_tbl[] = {
10977 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210),
10978 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", PINFIX_LENOVO_Y530),
10979 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
10980 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", PINFIX_ACER_ASPIRE_7736),
10985 * BIOS auto configuration
10987 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
10988 const struct auto_pin_cfg *cfg)
10990 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
10993 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
10994 hda_nid_t nid, int pin_type,
10999 /* set as output */
11000 alc_set_pin_output(codec, nid, pin_type);
11002 if (snd_hda_get_conn_list(codec, nid, NULL) < 2)
11007 else if (dac >= 0x02 && dac <= 0x05)
11011 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
11014 #define alc882_auto_init_dac alc880_auto_init_dac
11016 static void alc882_auto_init_multi_out(struct hda_codec *codec)
11018 struct alc_spec *spec = codec->spec;
11021 for (i = 0; i <= HDA_SIDE; i++) {
11022 hda_nid_t nid = spec->autocfg.line_out_pins[i];
11023 int pin_type = get_pin_type(spec->autocfg.line_out_type);
11025 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
11026 spec->multiout.dac_nids[i]);
11029 for (i = 0; i < spec->multiout.num_dacs; i++)
11030 alc882_auto_init_dac(codec, spec->multiout.dac_nids[i]);
11033 static void alc882_auto_init_hp_out(struct hda_codec *codec)
11035 struct alc_spec *spec = codec->spec;
11036 hda_nid_t pin, dac;
11039 if (spec->autocfg.line_out_type != AUTO_PIN_HP_OUT) {
11040 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
11041 pin = spec->autocfg.hp_pins[i];
11044 dac = spec->multiout.hp_nid;
11046 dac = spec->multiout.dac_nids[0]; /* to front */
11047 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac);
11051 if (spec->autocfg.line_out_type != AUTO_PIN_SPEAKER_OUT) {
11052 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
11053 pin = spec->autocfg.speaker_pins[i];
11056 dac = spec->multiout.extra_out_nid[0];
11058 dac = spec->multiout.dac_nids[0]; /* to front */
11059 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac);
11064 alc882_auto_init_dac(codec, spec->multiout.hp_nid);
11065 for (i = 0; i < ARRAY_SIZE(spec->multiout.extra_out_nid); i++)
11066 alc882_auto_init_dac(codec, spec->multiout.extra_out_nid[i]);
11069 #define alc882_auto_init_analog_input alc880_auto_init_analog_input
11071 static void alc882_auto_init_input_src(struct hda_codec *codec)
11073 struct alc_spec *spec = codec->spec;
11076 for (c = 0; c < spec->num_adc_nids; c++) {
11077 hda_nid_t nid = spec->capsrc_nids[c];
11078 unsigned int mux_idx;
11079 const struct hda_input_mux *imux;
11080 int conns, mute, idx, item;
11081 unsigned int wid_type;
11084 if (query_amp_caps(codec, spec->adc_nids[c], HDA_INPUT) &
11086 snd_hda_codec_write(codec, spec->adc_nids[c], 0,
11087 AC_VERB_SET_AMP_GAIN_MUTE,
11089 else if (query_amp_caps(codec, nid, HDA_OUTPUT) &
11091 snd_hda_codec_write(codec, nid, 0,
11092 AC_VERB_SET_AMP_GAIN_MUTE,
11095 conns = snd_hda_get_conn_list(codec, nid, NULL);
11098 mux_idx = c >= spec->num_mux_defs ? 0 : c;
11099 imux = &spec->input_mux[mux_idx];
11100 if (!imux->num_items && mux_idx > 0)
11101 imux = &spec->input_mux[0];
11102 wid_type = get_wcaps_type(get_wcaps(codec, nid));
11103 for (idx = 0; idx < conns; idx++) {
11104 /* if the current connection is the selected one,
11105 * unmute it as default - otherwise mute it
11107 mute = AMP_IN_MUTE(idx);
11108 for (item = 0; item < imux->num_items; item++) {
11109 if (imux->items[item].index == idx) {
11110 if (spec->cur_mux[c] == item)
11111 mute = AMP_IN_UNMUTE(idx);
11115 /* initialize the mute status if mute-amp is present */
11116 if (query_amp_caps(codec, nid, HDA_INPUT) & AC_AMPCAP_MUTE)
11117 snd_hda_codec_write(codec, nid, 0,
11118 AC_VERB_SET_AMP_GAIN_MUTE,
11120 if (wid_type == AC_WID_AUD_SEL &&
11121 mute != AMP_IN_MUTE(idx))
11122 snd_hda_codec_write(codec, nid, 0,
11123 AC_VERB_SET_CONNECT_SEL,
11129 /* add mic boosts if needed */
11130 static int alc_auto_add_mic_boost(struct hda_codec *codec)
11132 struct alc_spec *spec = codec->spec;
11133 struct auto_pin_cfg *cfg = &spec->autocfg;
11137 const char *prev_label = NULL;
11139 for (i = 0; i < cfg->num_inputs; i++) {
11140 if (cfg->inputs[i].type > AUTO_PIN_MIC)
11142 nid = cfg->inputs[i].pin;
11143 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) {
11145 char boost_label[32];
11147 label = hda_get_autocfg_input_label(codec, cfg, i);
11148 if (prev_label && !strcmp(label, prev_label))
11152 prev_label = label;
11154 snprintf(boost_label, sizeof(boost_label),
11155 "%s Boost Volume", label);
11156 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11157 boost_label, type_idx,
11158 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
11166 /* almost identical with ALC880 parser... */
11167 static int alc882_parse_auto_config(struct hda_codec *codec)
11169 struct alc_spec *spec = codec->spec;
11170 static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
11173 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11177 if (!spec->autocfg.line_outs)
11178 return 0; /* can't find valid BIOS pin config */
11180 err = alc880_auto_fill_dac_nids(codec);
11183 err = alc_auto_add_multi_channel_mode(codec, alc880_auto_fill_dac_nids);
11186 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
11189 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
11193 err = alc880_auto_create_extra_out(spec,
11194 spec->autocfg.speaker_pins[0],
11198 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
11202 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11204 alc_auto_parse_digital(codec);
11206 if (spec->kctls.list)
11207 add_mixer(spec, spec->kctls.list);
11209 /* if ADC 0x07 is available, initialize it, too */
11210 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
11211 add_verb(spec, alc882_adc1_init_verbs);
11213 spec->num_mux_defs = 1;
11214 spec->input_mux = &spec->private_imux[0];
11216 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
11218 err = alc_auto_add_mic_boost(codec);
11222 return 1; /* config found */
11225 /* additional initialization for auto-configuration model */
11226 static void alc882_auto_init(struct hda_codec *codec)
11228 struct alc_spec *spec = codec->spec;
11229 alc882_auto_init_multi_out(codec);
11230 alc882_auto_init_hp_out(codec);
11231 alc882_auto_init_analog_input(codec);
11232 alc882_auto_init_input_src(codec);
11233 alc_auto_init_digital(codec);
11234 if (spec->unsol_event)
11235 alc_inithook(codec);
11238 static int patch_alc882(struct hda_codec *codec)
11240 struct alc_spec *spec;
11241 int err, board_config;
11243 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11247 codec->spec = spec;
11249 spec->mixer_nid = 0x0b;
11251 switch (codec->vendor_id) {
11256 /* ALC883 and variants */
11257 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11261 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
11265 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
11266 board_config = snd_hda_check_board_codec_sid_config(codec,
11267 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
11269 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
11270 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
11272 board_config = ALC882_AUTO;
11275 if (board_config == ALC882_AUTO) {
11276 alc_pick_fixup(codec, NULL, alc882_fixup_tbl, alc882_fixups);
11277 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
11280 alc_auto_parse_customize_define(codec);
11282 if (board_config == ALC882_AUTO) {
11283 /* automatic parse from the BIOS config */
11284 err = alc882_parse_auto_config(codec);
11290 "hda_codec: Cannot set up configuration "
11291 "from BIOS. Using base mode...\n");
11292 board_config = ALC882_3ST_DIG;
11296 if (has_cdefine_beep(codec)) {
11297 err = snd_hda_attach_beep_device(codec, 0x1);
11304 if (board_config != ALC882_AUTO)
11305 setup_preset(codec, &alc882_presets[board_config]);
11307 spec->stream_analog_playback = &alc882_pcm_analog_playback;
11308 spec->stream_analog_capture = &alc882_pcm_analog_capture;
11309 /* FIXME: setup DAC5 */
11310 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
11311 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
11313 spec->stream_digital_playback = &alc882_pcm_digital_playback;
11314 spec->stream_digital_capture = &alc882_pcm_digital_capture;
11316 if (!spec->adc_nids && spec->input_mux) {
11318 spec->num_adc_nids = 0;
11319 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
11320 const struct hda_input_mux *imux = spec->input_mux;
11322 hda_nid_t nid = alc882_adc_nids[i];
11323 unsigned int wcap = get_wcaps(codec, nid);
11325 wcap = get_wcaps_type(wcap);
11326 if (wcap != AC_WID_AUD_IN)
11328 spec->private_adc_nids[spec->num_adc_nids] = nid;
11329 err = snd_hda_get_connections(codec, nid, &cap, 1);
11332 err = snd_hda_get_conn_list(codec, cap, NULL);
11335 for (j = 0; j < imux->num_items; j++)
11336 if (imux->items[j].index >= err)
11338 if (j < imux->num_items)
11340 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
11341 spec->num_adc_nids++;
11343 spec->adc_nids = spec->private_adc_nids;
11344 spec->capsrc_nids = spec->private_capsrc_nids;
11347 set_capture_mixer(codec);
11349 if (has_cdefine_beep(codec))
11350 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11352 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
11354 spec->vmaster_nid = 0x0c;
11356 codec->patch_ops = alc_patch_ops;
11357 if (board_config == ALC882_AUTO)
11358 spec->init_hook = alc882_auto_init;
11360 alc_init_jacks(codec);
11361 #ifdef CONFIG_SND_HDA_POWER_SAVE
11362 if (!spec->loopback.amplist)
11363 spec->loopback.amplist = alc882_loopbacks;
11374 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
11375 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
11377 #define alc262_dac_nids alc260_dac_nids
11378 #define alc262_adc_nids alc882_adc_nids
11379 #define alc262_adc_nids_alt alc882_adc_nids_alt
11380 #define alc262_capsrc_nids alc882_capsrc_nids
11381 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
11383 #define alc262_modes alc260_modes
11384 #define alc262_capture_source alc882_capture_source
11386 static const hda_nid_t alc262_dmic_adc_nids[1] = {
11391 static const hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
11393 static const struct snd_kcontrol_new alc262_base_mixer[] = {
11394 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11395 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11396 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11397 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11398 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11399 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11400 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11401 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11402 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11403 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11404 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11405 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11406 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
11407 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11408 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
11409 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
11413 /* update HP, line and mono-out pins according to the master switch */
11414 #define alc262_hp_master_update alc260_hp_master_update
11416 static void alc262_hp_bpc_setup(struct hda_codec *codec)
11418 struct alc_spec *spec = codec->spec;
11420 spec->autocfg.hp_pins[0] = 0x1b;
11421 spec->autocfg.speaker_pins[0] = 0x16;
11422 spec->automute = 1;
11423 spec->automute_mode = ALC_AUTOMUTE_PIN;
11426 static void alc262_hp_wildwest_setup(struct hda_codec *codec)
11428 struct alc_spec *spec = codec->spec;
11430 spec->autocfg.hp_pins[0] = 0x15;
11431 spec->autocfg.speaker_pins[0] = 0x16;
11432 spec->automute = 1;
11433 spec->automute_mode = ALC_AUTOMUTE_PIN;
11436 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
11437 #define alc262_hp_master_sw_put alc260_hp_master_sw_put
11439 #define ALC262_HP_MASTER_SWITCH \
11441 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
11442 .name = "Master Playback Switch", \
11443 .info = snd_ctl_boolean_mono_info, \
11444 .get = alc262_hp_master_sw_get, \
11445 .put = alc262_hp_master_sw_put, \
11448 .iface = NID_MAPPING, \
11449 .name = "Master Playback Switch", \
11450 .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \
11454 static const struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
11455 ALC262_HP_MASTER_SWITCH,
11456 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11457 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11458 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11459 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
11461 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
11463 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11464 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11465 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11466 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11467 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11468 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11469 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11470 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11471 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11472 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11473 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
11474 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
11478 static const struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
11479 ALC262_HP_MASTER_SWITCH,
11480 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11481 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11482 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11483 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11484 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
11486 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
11488 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
11489 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
11490 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x1a, 0, HDA_INPUT),
11491 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
11492 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
11493 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11494 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11498 static const struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
11499 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11500 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11501 HDA_CODEC_VOLUME("Rear Mic Boost Volume", 0x18, 0, HDA_INPUT),
11505 /* mute/unmute internal speaker according to the hp jack and mute state */
11506 static void alc262_hp_t5735_setup(struct hda_codec *codec)
11508 struct alc_spec *spec = codec->spec;
11510 spec->autocfg.hp_pins[0] = 0x15;
11511 spec->autocfg.speaker_pins[0] = 0x14;
11512 spec->automute = 1;
11513 spec->automute_mode = ALC_AUTOMUTE_PIN;
11516 static const struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
11517 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11518 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11519 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11520 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11521 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11522 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11523 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11527 static const struct hda_verb alc262_hp_t5735_verbs[] = {
11528 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11529 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11531 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11535 static const struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
11536 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11537 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11538 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
11539 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
11540 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
11541 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
11545 static const struct hda_verb alc262_hp_rp5700_verbs[] = {
11546 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11547 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11548 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11549 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11550 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11551 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11552 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11553 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11554 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
11555 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
11559 static const struct hda_input_mux alc262_hp_rp5700_capture_source = {
11566 /* bind hp and internal speaker mute (with plug check) as master switch */
11567 #define alc262_hippo_master_update alc262_hp_master_update
11568 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
11569 #define alc262_hippo_master_sw_put alc262_hp_master_sw_put
11571 #define ALC262_HIPPO_MASTER_SWITCH \
11573 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
11574 .name = "Master Playback Switch", \
11575 .info = snd_ctl_boolean_mono_info, \
11576 .get = alc262_hippo_master_sw_get, \
11577 .put = alc262_hippo_master_sw_put, \
11580 .iface = NID_MAPPING, \
11581 .name = "Master Playback Switch", \
11582 .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \
11583 (SUBDEV_SPEAKER(0) << 16), \
11586 static const struct snd_kcontrol_new alc262_hippo_mixer[] = {
11587 ALC262_HIPPO_MASTER_SWITCH,
11588 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11589 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11590 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11591 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11592 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11593 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11594 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11595 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11596 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11597 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11598 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11599 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11603 static const struct snd_kcontrol_new alc262_hippo1_mixer[] = {
11604 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11605 ALC262_HIPPO_MASTER_SWITCH,
11606 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11607 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11608 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11609 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11610 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11611 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11612 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11613 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11614 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11615 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11619 /* mute/unmute internal speaker according to the hp jack and mute state */
11620 static void alc262_hippo_setup(struct hda_codec *codec)
11622 struct alc_spec *spec = codec->spec;
11624 spec->autocfg.hp_pins[0] = 0x15;
11625 spec->autocfg.speaker_pins[0] = 0x14;
11626 spec->automute = 1;
11627 spec->automute_mode = ALC_AUTOMUTE_AMP;
11630 static void alc262_hippo1_setup(struct hda_codec *codec)
11632 struct alc_spec *spec = codec->spec;
11634 spec->autocfg.hp_pins[0] = 0x1b;
11635 spec->autocfg.speaker_pins[0] = 0x14;
11636 spec->automute = 1;
11637 spec->automute_mode = ALC_AUTOMUTE_AMP;
11641 static const struct snd_kcontrol_new alc262_sony_mixer[] = {
11642 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11643 ALC262_HIPPO_MASTER_SWITCH,
11644 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11645 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11646 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11647 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11651 static const struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
11652 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11653 ALC262_HIPPO_MASTER_SWITCH,
11654 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11655 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11656 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11657 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11658 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11662 static const struct snd_kcontrol_new alc262_tyan_mixer[] = {
11663 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11664 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11665 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
11666 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
11667 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11668 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11669 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11670 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11671 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11672 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11673 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11674 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11678 static const struct hda_verb alc262_tyan_verbs[] = {
11679 /* Headphone automute */
11680 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11681 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11682 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11684 /* P11 AUX_IN, white 4-pin connector */
11685 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11686 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
11687 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
11688 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
11693 /* unsolicited event for HP jack sensing */
11694 static void alc262_tyan_setup(struct hda_codec *codec)
11696 struct alc_spec *spec = codec->spec;
11698 spec->autocfg.hp_pins[0] = 0x1b;
11699 spec->autocfg.speaker_pins[0] = 0x15;
11700 spec->automute = 1;
11701 spec->automute_mode = ALC_AUTOMUTE_AMP;
11705 #define alc262_capture_mixer alc882_capture_mixer
11706 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
11709 * generic initialization of ADC, input mixers and output mixers
11711 static const struct hda_verb alc262_init_verbs[] = {
11713 * Unmute ADC0-2 and set the default input to mic-in
11715 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11716 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11717 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11718 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11719 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11720 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11722 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11724 * Note: PASD motherboards uses the Line In 2 as the input for
11725 * front panel mic (mic 2)
11727 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11728 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11729 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11730 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11731 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11732 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11735 * Set up output mixers (0x0c - 0x0e)
11737 /* set vol=0 to output mixers */
11738 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11739 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11740 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11741 /* set up input amps for analog loopback */
11742 /* Amp Indices: DAC = 0, mixer = 1 */
11743 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11744 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11745 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11746 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11747 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11748 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11750 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11751 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11752 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11753 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11754 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11755 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11757 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11758 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11759 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11760 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11761 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11763 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11764 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11766 /* FIXME: use matrix-type input source selection */
11767 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11768 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11769 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11770 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11771 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11772 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11774 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11775 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11776 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11777 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11779 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11780 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11781 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11782 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11787 static const struct hda_verb alc262_eapd_verbs[] = {
11788 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11789 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11793 static const struct hda_verb alc262_hippo1_unsol_verbs[] = {
11794 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11795 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11796 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11798 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11799 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11803 static const struct hda_verb alc262_sony_unsol_verbs[] = {
11804 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11805 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11806 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
11808 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11809 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11813 static const struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
11814 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11815 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11816 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11817 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11818 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11822 static const struct hda_verb alc262_toshiba_s06_verbs[] = {
11823 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11824 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11825 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11826 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11827 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
11828 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11829 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11830 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11834 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
11836 struct alc_spec *spec = codec->spec;
11838 spec->autocfg.hp_pins[0] = 0x15;
11839 spec->autocfg.speaker_pins[0] = 0x14;
11840 spec->ext_mic.pin = 0x18;
11841 spec->ext_mic.mux_idx = 0;
11842 spec->int_mic.pin = 0x12;
11843 spec->int_mic.mux_idx = 9;
11844 spec->auto_mic = 1;
11845 spec->automute = 1;
11846 spec->automute_mode = ALC_AUTOMUTE_PIN;
11852 * 0x16 = internal speaker
11853 * 0x18 = external mic
11856 static const struct snd_kcontrol_new alc262_nec_mixer[] = {
11857 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
11858 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
11860 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11861 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11862 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11864 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11865 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11869 static const struct hda_verb alc262_nec_verbs[] = {
11870 /* Unmute Speaker */
11871 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11874 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11875 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11877 /* External mic to headphone */
11878 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11879 /* External mic to speaker */
11880 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11886 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
11887 * 0x1b = port replicator headphone out
11890 #define ALC_HP_EVENT ALC880_HP_EVENT
11892 static const struct hda_verb alc262_fujitsu_unsol_verbs[] = {
11893 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11894 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11895 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11896 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11900 static const struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
11901 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11902 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11906 static const struct hda_verb alc262_lenovo_3000_init_verbs[] = {
11907 /* Front Mic pin: input vref at 50% */
11908 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
11909 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11913 static const struct hda_input_mux alc262_fujitsu_capture_source = {
11917 { "Internal Mic", 0x1 },
11922 static const struct hda_input_mux alc262_HP_capture_source = {
11926 { "Front Mic", 0x1 },
11933 static const struct hda_input_mux alc262_HP_D7000_capture_source = {
11937 { "Front Mic", 0x2 },
11943 static void alc262_fujitsu_setup(struct hda_codec *codec)
11945 struct alc_spec *spec = codec->spec;
11947 spec->autocfg.hp_pins[0] = 0x14;
11948 spec->autocfg.hp_pins[1] = 0x1b;
11949 spec->autocfg.speaker_pins[0] = 0x15;
11950 spec->automute = 1;
11951 spec->automute_mode = ALC_AUTOMUTE_AMP;
11954 /* bind volumes of both NID 0x0c and 0x0d */
11955 static const struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
11956 .ops = &snd_hda_bind_vol,
11958 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
11959 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
11964 static const struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
11965 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11967 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11968 .name = "Master Playback Switch",
11969 .subdevice = HDA_SUBDEV_NID_FLAG | 0x14,
11970 .info = snd_ctl_boolean_mono_info,
11971 .get = alc262_hp_master_sw_get,
11972 .put = alc262_hp_master_sw_put,
11975 .iface = NID_MAPPING,
11976 .name = "Master Playback Switch",
11977 .private_value = 0x1b,
11979 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11980 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11981 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11982 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11983 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11984 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
11985 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11986 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11990 static void alc262_lenovo_3000_setup(struct hda_codec *codec)
11992 struct alc_spec *spec = codec->spec;
11994 spec->autocfg.hp_pins[0] = 0x1b;
11995 spec->autocfg.speaker_pins[0] = 0x14;
11996 spec->autocfg.speaker_pins[1] = 0x16;
11997 spec->automute = 1;
11998 spec->automute_mode = ALC_AUTOMUTE_AMP;
12001 static const struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
12002 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
12004 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12005 .name = "Master Playback Switch",
12006 .subdevice = HDA_SUBDEV_NID_FLAG | 0x1b,
12007 .info = snd_ctl_boolean_mono_info,
12008 .get = alc262_hp_master_sw_get,
12009 .put = alc262_hp_master_sw_put,
12011 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12012 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
12013 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
12014 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12015 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12016 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
12017 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12018 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12022 static const struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
12023 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
12024 ALC262_HIPPO_MASTER_SWITCH,
12025 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12026 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12027 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
12028 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12029 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12030 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
12034 /* additional init verbs for Benq laptops */
12035 static const struct hda_verb alc262_EAPD_verbs[] = {
12036 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
12037 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
12041 static const struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
12042 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12043 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12045 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
12046 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
12050 /* Samsung Q1 Ultra Vista model setup */
12051 static const struct snd_kcontrol_new alc262_ultra_mixer[] = {
12052 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
12053 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
12054 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12055 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12056 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT),
12057 HDA_CODEC_VOLUME("Headphone Mic Boost Volume", 0x15, 0, HDA_INPUT),
12061 static const struct hda_verb alc262_ultra_verbs[] = {
12063 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12064 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12065 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12067 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12068 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12069 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12070 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12072 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12073 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12074 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12075 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12076 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12078 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12079 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12080 /* ADC, choose mic */
12081 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12082 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12083 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12084 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12085 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12086 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12087 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12088 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
12089 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
12090 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
12094 /* mute/unmute internal speaker according to the hp jack and mute state */
12095 static void alc262_ultra_automute(struct hda_codec *codec)
12097 struct alc_spec *spec = codec->spec;
12101 /* auto-mute only when HP is used as HP */
12102 if (!spec->cur_mux[0]) {
12103 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
12104 if (spec->jack_present)
12105 mute = HDA_AMP_MUTE;
12107 /* mute/unmute internal speaker */
12108 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
12109 HDA_AMP_MUTE, mute);
12110 /* mute/unmute HP */
12111 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12112 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
12115 /* unsolicited event for HP jack sensing */
12116 static void alc262_ultra_unsol_event(struct hda_codec *codec,
12119 if ((res >> 26) != ALC880_HP_EVENT)
12121 alc262_ultra_automute(codec);
12124 static const struct hda_input_mux alc262_ultra_capture_source = {
12128 { "Headphone", 0x7 },
12132 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
12133 struct snd_ctl_elem_value *ucontrol)
12135 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12136 struct alc_spec *spec = codec->spec;
12139 ret = alc_mux_enum_put(kcontrol, ucontrol);
12142 /* reprogram the HP pin as mic or HP according to the input source */
12143 snd_hda_codec_write_cache(codec, 0x15, 0,
12144 AC_VERB_SET_PIN_WIDGET_CONTROL,
12145 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
12146 alc262_ultra_automute(codec); /* mute/unmute HP */
12150 static const struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
12151 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
12152 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
12154 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12155 .name = "Capture Source",
12156 .info = alc_mux_enum_info,
12157 .get = alc_mux_enum_get,
12158 .put = alc262_ultra_mux_enum_put,
12161 .iface = NID_MAPPING,
12162 .name = "Capture Source",
12163 .private_value = 0x15,
12168 /* We use two mixers depending on the output pin; 0x16 is a mono output
12169 * and thus it's bound with a different mixer.
12170 * This function returns which mixer amp should be used.
12172 static int alc262_check_volbit(hda_nid_t nid)
12176 else if (nid == 0x16)
12182 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
12183 const char *pfx, int *vbits, int idx)
12188 vbit = alc262_check_volbit(nid);
12191 if (*vbits & vbit) /* a volume control for this mixer already there */
12195 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
12197 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
12198 return __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, idx, val);
12201 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
12202 const char *pfx, int idx)
12209 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
12211 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
12212 return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, idx, val);
12215 /* add playback controls from the parsed DAC table */
12216 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
12217 const struct auto_pin_cfg *cfg)
12223 spec->multiout.num_dacs = 1; /* only use one dac */
12224 spec->multiout.dac_nids = spec->private_dac_nids;
12225 spec->private_dac_nids[0] = 2;
12227 for (i = 0; i < 2; i++) {
12228 pfx = alc_get_line_out_pfx(spec, i, true, &index);
12231 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[i], pfx,
12235 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) {
12236 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[i],
12241 if (cfg->line_out_type != AUTO_PIN_HP_OUT) {
12242 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[i],
12249 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
12250 alc262_check_volbit(cfg->speaker_pins[0]) |
12251 alc262_check_volbit(cfg->hp_pins[0]);
12253 for (i = 0; i < 2; i++) {
12254 pfx = alc_get_line_out_pfx(spec, i, true, &index);
12257 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[i], pfx,
12261 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) {
12262 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[i],
12263 "Speaker", &vbits, i);
12267 if (cfg->line_out_type != AUTO_PIN_HP_OUT) {
12268 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[i],
12269 "Headphone", &vbits, i);
12277 #define alc262_auto_create_input_ctls \
12278 alc882_auto_create_input_ctls
12280 static const struct hda_verb alc262_HP_BPC_init_verbs[] = {
12282 * Unmute ADC0-2 and set the default input to mic-in
12284 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12285 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12286 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12287 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12288 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12289 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12291 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12293 * Note: PASD motherboards uses the Line In 2 as the input for
12294 * front panel mic (mic 2)
12296 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12297 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12298 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12299 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12300 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12301 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12302 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12303 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
12306 * Set up output mixers (0x0c - 0x0e)
12308 /* set vol=0 to output mixers */
12309 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12310 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12311 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12313 /* set up input amps for analog loopback */
12314 /* Amp Indices: DAC = 0, mixer = 1 */
12315 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12316 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12317 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12318 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12319 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12320 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12322 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12323 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12324 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12326 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12327 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12329 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12330 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12332 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12333 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12334 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12335 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12336 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12338 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12339 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12340 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12341 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12342 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12343 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12346 /* FIXME: use matrix-type input source selection */
12347 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
12348 /* Input mixer1: only unmute Mic */
12349 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12350 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12351 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12352 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12353 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12354 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12355 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12356 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12357 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12359 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12360 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12361 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12362 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12363 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12364 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12365 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12366 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12367 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12369 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12370 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12371 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12372 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12373 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12374 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12375 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12376 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12377 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12379 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12384 static const struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
12386 * Unmute ADC0-2 and set the default input to mic-in
12388 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12389 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12390 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12391 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12392 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12393 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12395 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12397 * Note: PASD motherboards uses the Line In 2 as the input for front
12398 * panel mic (mic 2)
12400 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12401 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12402 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12403 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12404 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12405 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12406 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12407 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
12408 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
12410 * Set up output mixers (0x0c - 0x0e)
12412 /* set vol=0 to output mixers */
12413 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12414 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12415 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12417 /* set up input amps for analog loopback */
12418 /* Amp Indices: DAC = 0, mixer = 1 */
12419 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12420 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12421 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12422 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12423 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12424 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12427 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
12428 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
12429 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
12430 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
12431 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
12432 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
12433 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
12435 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12436 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12438 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12439 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12441 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
12442 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12443 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12444 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
12445 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12446 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12448 /* FIXME: use matrix-type input source selection */
12449 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12450 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12451 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
12452 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
12453 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
12454 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
12455 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
12456 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12457 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
12459 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12460 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
12461 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
12462 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
12463 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
12464 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12465 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
12467 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12468 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
12469 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
12470 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
12471 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
12472 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12473 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
12475 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12480 static const struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
12482 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
12483 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12484 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
12486 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
12487 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
12488 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
12489 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
12491 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
12492 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12493 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12505 static const struct alc_fixup alc262_fixups[] = {
12506 [PINFIX_FSC_H270] = {
12507 .type = ALC_FIXUP_PINS,
12508 .v.pins = (const struct alc_pincfg[]) {
12509 { 0x14, 0x99130110 }, /* speaker */
12510 { 0x15, 0x0221142f }, /* front HP */
12511 { 0x1b, 0x0121141f }, /* rear HP */
12515 [PINFIX_HP_Z200] = {
12516 .type = ALC_FIXUP_PINS,
12517 .v.pins = (const struct alc_pincfg[]) {
12518 { 0x16, 0x99130120 }, /* internal speaker */
12524 static const struct snd_pci_quirk alc262_fixup_tbl[] = {
12525 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", PINFIX_HP_Z200),
12526 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", PINFIX_FSC_H270),
12531 #ifdef CONFIG_SND_HDA_POWER_SAVE
12532 #define alc262_loopbacks alc880_loopbacks
12535 /* pcm configuration: identical with ALC880 */
12536 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
12537 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
12538 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
12539 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
12542 * BIOS auto configuration
12544 static int alc262_parse_auto_config(struct hda_codec *codec)
12546 struct alc_spec *spec = codec->spec;
12548 static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
12550 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12554 if (!spec->autocfg.line_outs) {
12555 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12556 spec->multiout.max_channels = 2;
12557 spec->no_analog = 1;
12560 return 0; /* can't find valid BIOS pin config */
12562 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
12565 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
12569 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12572 alc_auto_parse_digital(codec);
12574 if (spec->kctls.list)
12575 add_mixer(spec, spec->kctls.list);
12577 spec->num_mux_defs = 1;
12578 spec->input_mux = &spec->private_imux[0];
12580 err = alc_auto_add_mic_boost(codec);
12584 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
12589 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
12590 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
12591 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
12592 #define alc262_auto_init_input_src alc882_auto_init_input_src
12595 /* init callback for auto-configuration model -- overriding the default init */
12596 static void alc262_auto_init(struct hda_codec *codec)
12598 struct alc_spec *spec = codec->spec;
12599 alc262_auto_init_multi_out(codec);
12600 alc262_auto_init_hp_out(codec);
12601 alc262_auto_init_analog_input(codec);
12602 alc262_auto_init_input_src(codec);
12603 alc_auto_init_digital(codec);
12604 if (spec->unsol_event)
12605 alc_inithook(codec);
12609 * configuration and preset
12611 static const char * const alc262_models[ALC262_MODEL_LAST] = {
12612 [ALC262_BASIC] = "basic",
12613 [ALC262_HIPPO] = "hippo",
12614 [ALC262_HIPPO_1] = "hippo_1",
12615 [ALC262_FUJITSU] = "fujitsu",
12616 [ALC262_HP_BPC] = "hp-bpc",
12617 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
12618 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
12619 [ALC262_HP_RP5700] = "hp-rp5700",
12620 [ALC262_BENQ_ED8] = "benq",
12621 [ALC262_BENQ_T31] = "benq-t31",
12622 [ALC262_SONY_ASSAMD] = "sony-assamd",
12623 [ALC262_TOSHIBA_S06] = "toshiba-s06",
12624 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
12625 [ALC262_ULTRA] = "ultra",
12626 [ALC262_LENOVO_3000] = "lenovo-3000",
12627 [ALC262_NEC] = "nec",
12628 [ALC262_TYAN] = "tyan",
12629 [ALC262_AUTO] = "auto",
12632 static const struct snd_pci_quirk alc262_cfg_tbl[] = {
12633 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
12634 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
12635 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
12637 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
12639 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1500, "HP z series",
12641 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200",
12643 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
12645 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
12646 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
12647 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
12648 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
12649 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
12650 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
12651 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
12652 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
12653 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
12654 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
12655 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
12656 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
12657 ALC262_HP_TC_T5735),
12658 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
12659 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12660 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
12661 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12662 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
12663 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
12664 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
12665 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
12666 #if 0 /* disable the quirk since model=auto works better in recent versions */
12667 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
12668 ALC262_SONY_ASSAMD),
12670 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
12671 ALC262_TOSHIBA_RX1),
12672 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
12673 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
12674 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
12675 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
12676 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
12678 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
12679 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
12680 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
12681 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
12682 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
12686 static const struct alc_config_preset alc262_presets[] = {
12688 .mixers = { alc262_base_mixer },
12689 .init_verbs = { alc262_init_verbs },
12690 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12691 .dac_nids = alc262_dac_nids,
12693 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12694 .channel_mode = alc262_modes,
12695 .input_mux = &alc262_capture_source,
12698 .mixers = { alc262_hippo_mixer },
12699 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
12700 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12701 .dac_nids = alc262_dac_nids,
12703 .dig_out_nid = ALC262_DIGOUT_NID,
12704 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12705 .channel_mode = alc262_modes,
12706 .input_mux = &alc262_capture_source,
12707 .unsol_event = alc_sku_unsol_event,
12708 .setup = alc262_hippo_setup,
12709 .init_hook = alc_inithook,
12711 [ALC262_HIPPO_1] = {
12712 .mixers = { alc262_hippo1_mixer },
12713 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
12714 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12715 .dac_nids = alc262_dac_nids,
12717 .dig_out_nid = ALC262_DIGOUT_NID,
12718 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12719 .channel_mode = alc262_modes,
12720 .input_mux = &alc262_capture_source,
12721 .unsol_event = alc_sku_unsol_event,
12722 .setup = alc262_hippo1_setup,
12723 .init_hook = alc_inithook,
12725 [ALC262_FUJITSU] = {
12726 .mixers = { alc262_fujitsu_mixer },
12727 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12728 alc262_fujitsu_unsol_verbs },
12729 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12730 .dac_nids = alc262_dac_nids,
12732 .dig_out_nid = ALC262_DIGOUT_NID,
12733 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12734 .channel_mode = alc262_modes,
12735 .input_mux = &alc262_fujitsu_capture_source,
12736 .unsol_event = alc_sku_unsol_event,
12737 .setup = alc262_fujitsu_setup,
12738 .init_hook = alc_inithook,
12740 [ALC262_HP_BPC] = {
12741 .mixers = { alc262_HP_BPC_mixer },
12742 .init_verbs = { alc262_HP_BPC_init_verbs },
12743 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12744 .dac_nids = alc262_dac_nids,
12746 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12747 .channel_mode = alc262_modes,
12748 .input_mux = &alc262_HP_capture_source,
12749 .unsol_event = alc_sku_unsol_event,
12750 .setup = alc262_hp_bpc_setup,
12751 .init_hook = alc_inithook,
12753 [ALC262_HP_BPC_D7000_WF] = {
12754 .mixers = { alc262_HP_BPC_WildWest_mixer },
12755 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12756 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12757 .dac_nids = alc262_dac_nids,
12759 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12760 .channel_mode = alc262_modes,
12761 .input_mux = &alc262_HP_D7000_capture_source,
12762 .unsol_event = alc_sku_unsol_event,
12763 .setup = alc262_hp_wildwest_setup,
12764 .init_hook = alc_inithook,
12766 [ALC262_HP_BPC_D7000_WL] = {
12767 .mixers = { alc262_HP_BPC_WildWest_mixer,
12768 alc262_HP_BPC_WildWest_option_mixer },
12769 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12770 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12771 .dac_nids = alc262_dac_nids,
12773 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12774 .channel_mode = alc262_modes,
12775 .input_mux = &alc262_HP_D7000_capture_source,
12776 .unsol_event = alc_sku_unsol_event,
12777 .setup = alc262_hp_wildwest_setup,
12778 .init_hook = alc_inithook,
12780 [ALC262_HP_TC_T5735] = {
12781 .mixers = { alc262_hp_t5735_mixer },
12782 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
12783 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12784 .dac_nids = alc262_dac_nids,
12786 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12787 .channel_mode = alc262_modes,
12788 .input_mux = &alc262_capture_source,
12789 .unsol_event = alc_sku_unsol_event,
12790 .setup = alc262_hp_t5735_setup,
12791 .init_hook = alc_inithook,
12793 [ALC262_HP_RP5700] = {
12794 .mixers = { alc262_hp_rp5700_mixer },
12795 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
12796 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12797 .dac_nids = alc262_dac_nids,
12798 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12799 .channel_mode = alc262_modes,
12800 .input_mux = &alc262_hp_rp5700_capture_source,
12802 [ALC262_BENQ_ED8] = {
12803 .mixers = { alc262_base_mixer },
12804 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
12805 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12806 .dac_nids = alc262_dac_nids,
12808 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12809 .channel_mode = alc262_modes,
12810 .input_mux = &alc262_capture_source,
12812 [ALC262_SONY_ASSAMD] = {
12813 .mixers = { alc262_sony_mixer },
12814 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
12815 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12816 .dac_nids = alc262_dac_nids,
12818 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12819 .channel_mode = alc262_modes,
12820 .input_mux = &alc262_capture_source,
12821 .unsol_event = alc_sku_unsol_event,
12822 .setup = alc262_hippo_setup,
12823 .init_hook = alc_inithook,
12825 [ALC262_BENQ_T31] = {
12826 .mixers = { alc262_benq_t31_mixer },
12827 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
12828 alc_hp15_unsol_verbs },
12829 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12830 .dac_nids = alc262_dac_nids,
12832 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12833 .channel_mode = alc262_modes,
12834 .input_mux = &alc262_capture_source,
12835 .unsol_event = alc_sku_unsol_event,
12836 .setup = alc262_hippo_setup,
12837 .init_hook = alc_inithook,
12840 .mixers = { alc262_ultra_mixer },
12841 .cap_mixer = alc262_ultra_capture_mixer,
12842 .init_verbs = { alc262_ultra_verbs },
12843 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12844 .dac_nids = alc262_dac_nids,
12845 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12846 .channel_mode = alc262_modes,
12847 .input_mux = &alc262_ultra_capture_source,
12848 .adc_nids = alc262_adc_nids, /* ADC0 */
12849 .capsrc_nids = alc262_capsrc_nids,
12850 .num_adc_nids = 1, /* single ADC */
12851 .unsol_event = alc262_ultra_unsol_event,
12852 .init_hook = alc262_ultra_automute,
12854 [ALC262_LENOVO_3000] = {
12855 .mixers = { alc262_lenovo_3000_mixer },
12856 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12857 alc262_lenovo_3000_unsol_verbs,
12858 alc262_lenovo_3000_init_verbs },
12859 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12860 .dac_nids = alc262_dac_nids,
12862 .dig_out_nid = ALC262_DIGOUT_NID,
12863 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12864 .channel_mode = alc262_modes,
12865 .input_mux = &alc262_fujitsu_capture_source,
12866 .unsol_event = alc_sku_unsol_event,
12867 .setup = alc262_lenovo_3000_setup,
12868 .init_hook = alc_inithook,
12871 .mixers = { alc262_nec_mixer },
12872 .init_verbs = { alc262_nec_verbs },
12873 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12874 .dac_nids = alc262_dac_nids,
12876 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12877 .channel_mode = alc262_modes,
12878 .input_mux = &alc262_capture_source,
12880 [ALC262_TOSHIBA_S06] = {
12881 .mixers = { alc262_toshiba_s06_mixer },
12882 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
12883 alc262_eapd_verbs },
12884 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12885 .capsrc_nids = alc262_dmic_capsrc_nids,
12886 .dac_nids = alc262_dac_nids,
12887 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
12888 .num_adc_nids = 1, /* single ADC */
12889 .dig_out_nid = ALC262_DIGOUT_NID,
12890 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12891 .channel_mode = alc262_modes,
12892 .unsol_event = alc_sku_unsol_event,
12893 .setup = alc262_toshiba_s06_setup,
12894 .init_hook = alc_inithook,
12896 [ALC262_TOSHIBA_RX1] = {
12897 .mixers = { alc262_toshiba_rx1_mixer },
12898 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
12899 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12900 .dac_nids = alc262_dac_nids,
12902 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12903 .channel_mode = alc262_modes,
12904 .input_mux = &alc262_capture_source,
12905 .unsol_event = alc_sku_unsol_event,
12906 .setup = alc262_hippo_setup,
12907 .init_hook = alc_inithook,
12910 .mixers = { alc262_tyan_mixer },
12911 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
12912 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12913 .dac_nids = alc262_dac_nids,
12915 .dig_out_nid = ALC262_DIGOUT_NID,
12916 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12917 .channel_mode = alc262_modes,
12918 .input_mux = &alc262_capture_source,
12919 .unsol_event = alc_sku_unsol_event,
12920 .setup = alc262_tyan_setup,
12921 .init_hook = alc_hp_automute,
12925 static int patch_alc262(struct hda_codec *codec)
12927 struct alc_spec *spec;
12931 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12935 codec->spec = spec;
12937 spec->mixer_nid = 0x0b;
12940 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
12945 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12946 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
12947 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12948 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
12951 alc_auto_parse_customize_define(codec);
12953 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
12955 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
12959 if (board_config < 0) {
12960 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12962 board_config = ALC262_AUTO;
12965 if (board_config == ALC262_AUTO) {
12966 alc_pick_fixup(codec, NULL, alc262_fixup_tbl, alc262_fixups);
12967 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
12970 if (board_config == ALC262_AUTO) {
12971 /* automatic parse from the BIOS config */
12972 err = alc262_parse_auto_config(codec);
12978 "hda_codec: Cannot set up configuration "
12979 "from BIOS. Using base mode...\n");
12980 board_config = ALC262_BASIC;
12984 if (!spec->no_analog && has_cdefine_beep(codec)) {
12985 err = snd_hda_attach_beep_device(codec, 0x1);
12992 if (board_config != ALC262_AUTO)
12993 setup_preset(codec, &alc262_presets[board_config]);
12995 spec->stream_analog_playback = &alc262_pcm_analog_playback;
12996 spec->stream_analog_capture = &alc262_pcm_analog_capture;
12998 spec->stream_digital_playback = &alc262_pcm_digital_playback;
12999 spec->stream_digital_capture = &alc262_pcm_digital_capture;
13001 if (!spec->adc_nids && spec->input_mux) {
13003 /* check whether the digital-mic has to be supported */
13004 for (i = 0; i < spec->input_mux->num_items; i++) {
13005 if (spec->input_mux->items[i].index >= 9)
13008 if (i < spec->input_mux->num_items) {
13009 /* use only ADC0 */
13010 spec->adc_nids = alc262_dmic_adc_nids;
13011 spec->num_adc_nids = 1;
13012 spec->capsrc_nids = alc262_dmic_capsrc_nids;
13014 /* all analog inputs */
13015 /* check whether NID 0x07 is valid */
13016 unsigned int wcap = get_wcaps(codec, 0x07);
13019 wcap = get_wcaps_type(wcap);
13020 if (wcap != AC_WID_AUD_IN) {
13021 spec->adc_nids = alc262_adc_nids_alt;
13022 spec->num_adc_nids =
13023 ARRAY_SIZE(alc262_adc_nids_alt);
13024 spec->capsrc_nids = alc262_capsrc_nids_alt;
13026 spec->adc_nids = alc262_adc_nids;
13027 spec->num_adc_nids =
13028 ARRAY_SIZE(alc262_adc_nids);
13029 spec->capsrc_nids = alc262_capsrc_nids;
13033 if (!spec->cap_mixer && !spec->no_analog)
13034 set_capture_mixer(codec);
13035 if (!spec->no_analog && has_cdefine_beep(codec))
13036 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
13038 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
13040 spec->vmaster_nid = 0x0c;
13042 codec->patch_ops = alc_patch_ops;
13043 if (board_config == ALC262_AUTO)
13044 spec->init_hook = alc262_auto_init;
13045 spec->shutup = alc_eapd_shutup;
13047 alc_init_jacks(codec);
13048 #ifdef CONFIG_SND_HDA_POWER_SAVE
13049 if (!spec->loopback.amplist)
13050 spec->loopback.amplist = alc262_loopbacks;
13057 * ALC268 channel source setting (2 channel)
13059 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
13060 #define alc268_modes alc260_modes
13062 static const hda_nid_t alc268_dac_nids[2] = {
13067 static const hda_nid_t alc268_adc_nids[2] = {
13072 static const hda_nid_t alc268_adc_nids_alt[1] = {
13077 static const hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
13079 static const struct snd_kcontrol_new alc268_base_mixer[] = {
13080 /* output mixer control */
13081 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13082 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13083 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13084 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13085 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13086 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
13087 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
13091 static const struct snd_kcontrol_new alc268_toshiba_mixer[] = {
13092 /* output mixer control */
13093 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13094 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13095 ALC262_HIPPO_MASTER_SWITCH,
13096 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13097 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
13098 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
13102 /* bind Beep switches of both NID 0x0f and 0x10 */
13103 static const struct hda_bind_ctls alc268_bind_beep_sw = {
13104 .ops = &snd_hda_bind_sw,
13106 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
13107 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
13112 static const struct snd_kcontrol_new alc268_beep_mixer[] = {
13113 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
13114 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
13118 static const struct hda_verb alc268_eapd_verbs[] = {
13119 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13120 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13124 /* Toshiba specific */
13125 static const struct hda_verb alc268_toshiba_verbs[] = {
13126 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13130 /* Acer specific */
13131 /* bind volumes of both NID 0x02 and 0x03 */
13132 static const struct hda_bind_ctls alc268_acer_bind_master_vol = {
13133 .ops = &snd_hda_bind_vol,
13135 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
13136 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
13141 static void alc268_acer_setup(struct hda_codec *codec)
13143 struct alc_spec *spec = codec->spec;
13145 spec->autocfg.hp_pins[0] = 0x14;
13146 spec->autocfg.speaker_pins[0] = 0x15;
13147 spec->automute = 1;
13148 spec->automute_mode = ALC_AUTOMUTE_AMP;
13151 #define alc268_acer_master_sw_get alc262_hp_master_sw_get
13152 #define alc268_acer_master_sw_put alc262_hp_master_sw_put
13154 static const struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
13155 /* output mixer control */
13156 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13158 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13159 .name = "Master Playback Switch",
13160 .subdevice = HDA_SUBDEV_NID_FLAG | 0x15,
13161 .info = snd_ctl_boolean_mono_info,
13162 .get = alc268_acer_master_sw_get,
13163 .put = alc268_acer_master_sw_put,
13165 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
13169 static const struct snd_kcontrol_new alc268_acer_mixer[] = {
13170 /* output mixer control */
13171 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13173 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13174 .name = "Master Playback Switch",
13175 .subdevice = HDA_SUBDEV_NID_FLAG | 0x14,
13176 .info = snd_ctl_boolean_mono_info,
13177 .get = alc268_acer_master_sw_get,
13178 .put = alc268_acer_master_sw_put,
13180 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13181 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
13182 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
13186 static const struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
13187 /* output mixer control */
13188 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13190 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13191 .name = "Master Playback Switch",
13192 .subdevice = HDA_SUBDEV_NID_FLAG | 0x14,
13193 .info = snd_ctl_boolean_mono_info,
13194 .get = alc268_acer_master_sw_get,
13195 .put = alc268_acer_master_sw_put,
13197 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13198 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
13202 static const struct hda_verb alc268_acer_aspire_one_verbs[] = {
13203 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13204 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13205 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13206 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13207 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
13208 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
13212 static const struct hda_verb alc268_acer_verbs[] = {
13213 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
13214 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13215 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13216 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13217 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13218 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13219 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13223 /* unsolicited event for HP jack sensing */
13224 #define alc268_toshiba_setup alc262_hippo_setup
13226 static void alc268_acer_lc_setup(struct hda_codec *codec)
13228 struct alc_spec *spec = codec->spec;
13229 spec->autocfg.hp_pins[0] = 0x15;
13230 spec->autocfg.speaker_pins[0] = 0x14;
13231 spec->automute = 1;
13232 spec->automute_mode = ALC_AUTOMUTE_AMP;
13233 spec->ext_mic.pin = 0x18;
13234 spec->ext_mic.mux_idx = 0;
13235 spec->int_mic.pin = 0x12;
13236 spec->int_mic.mux_idx = 6;
13237 spec->auto_mic = 1;
13240 static const struct snd_kcontrol_new alc268_dell_mixer[] = {
13241 /* output mixer control */
13242 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13243 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13244 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13245 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13246 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13247 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
13251 static const struct hda_verb alc268_dell_verbs[] = {
13252 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13253 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13254 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13255 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
13259 /* mute/unmute internal speaker according to the hp jack and mute state */
13260 static void alc268_dell_setup(struct hda_codec *codec)
13262 struct alc_spec *spec = codec->spec;
13264 spec->autocfg.hp_pins[0] = 0x15;
13265 spec->autocfg.speaker_pins[0] = 0x14;
13266 spec->ext_mic.pin = 0x18;
13267 spec->ext_mic.mux_idx = 0;
13268 spec->int_mic.pin = 0x19;
13269 spec->int_mic.mux_idx = 1;
13270 spec->auto_mic = 1;
13271 spec->automute = 1;
13272 spec->automute_mode = ALC_AUTOMUTE_PIN;
13275 static const struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
13276 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13277 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13278 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13279 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13280 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13281 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
13282 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13283 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
13287 static const struct hda_verb alc267_quanta_il1_verbs[] = {
13288 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13289 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
13293 static void alc267_quanta_il1_setup(struct hda_codec *codec)
13295 struct alc_spec *spec = codec->spec;
13296 spec->autocfg.hp_pins[0] = 0x15;
13297 spec->autocfg.speaker_pins[0] = 0x14;
13298 spec->ext_mic.pin = 0x18;
13299 spec->ext_mic.mux_idx = 0;
13300 spec->int_mic.pin = 0x19;
13301 spec->int_mic.mux_idx = 1;
13302 spec->auto_mic = 1;
13303 spec->automute = 1;
13304 spec->automute_mode = ALC_AUTOMUTE_PIN;
13308 * generic initialization of ADC, input mixers and output mixers
13310 static const struct hda_verb alc268_base_init_verbs[] = {
13311 /* Unmute DAC0-1 and set vol = 0 */
13312 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13313 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13316 * Set up output mixers (0x0c - 0x0e)
13318 /* set vol=0 to output mixers */
13319 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13320 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
13322 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13323 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13325 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
13326 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
13327 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
13328 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13329 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13330 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13331 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13332 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13334 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13335 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13336 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13337 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13338 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13340 /* set PCBEEP vol = 0, mute connections */
13341 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13342 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13343 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13345 /* Unmute Selector 23h,24h and set the default input to mic-in */
13347 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
13348 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13349 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
13350 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13355 /* only for model=test */
13356 #ifdef CONFIG_SND_DEBUG
13358 * generic initialization of ADC, input mixers and output mixers
13360 static const struct hda_verb alc268_volume_init_verbs[] = {
13361 /* set output DAC */
13362 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13363 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13365 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13366 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13367 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13368 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13369 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13371 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13372 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13373 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13375 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13376 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13379 #endif /* CONFIG_SND_DEBUG */
13381 /* set PCBEEP vol = 0, mute connections */
13382 static const struct hda_verb alc268_beep_init_verbs[] = {
13383 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13384 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13385 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13389 static const struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
13390 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13391 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13395 static const struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
13396 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13397 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13402 static const struct snd_kcontrol_new alc268_capture_mixer[] = {
13403 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13404 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13405 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
13406 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
13411 static const struct hda_input_mux alc268_capture_source = {
13415 { "Front Mic", 0x1 },
13421 static const struct hda_input_mux alc268_acer_capture_source = {
13425 { "Internal Mic", 0x1 },
13430 static const struct hda_input_mux alc268_acer_dmic_capture_source = {
13434 { "Internal Mic", 0x6 },
13439 #ifdef CONFIG_SND_DEBUG
13440 static const struct snd_kcontrol_new alc268_test_mixer[] = {
13441 /* Volume widgets */
13442 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13443 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13444 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
13445 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
13446 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
13447 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
13448 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
13449 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
13450 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
13451 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
13452 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
13453 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
13454 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
13455 /* The below appears problematic on some hardwares */
13456 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
13457 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13458 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
13459 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
13460 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
13462 /* Modes for retasking pin widgets */
13463 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
13464 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
13465 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
13466 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
13468 /* Controls for GPIO pins, assuming they are configured as outputs */
13469 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
13470 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
13471 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
13472 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
13474 /* Switches to allow the digital SPDIF output pin to be enabled.
13475 * The ALC268 does not have an SPDIF input.
13477 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
13479 /* A switch allowing EAPD to be enabled. Some laptops seem to use
13480 * this output to turn on an external amplifier.
13482 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
13483 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
13489 /* create input playback/capture controls for the given pin */
13490 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
13491 const char *ctlname, int idx)
13502 case 0x1a: /* ALC259/269 only */
13503 case 0x1b: /* ALC259/269 only */
13504 case 0x21: /* ALC269vb has this pin, too */
13508 snd_printd(KERN_WARNING "hda_codec: "
13509 "ignoring pin 0x%x as unknown\n", nid);
13512 if (spec->multiout.dac_nids[0] != dac &&
13513 spec->multiout.dac_nids[1] != dac) {
13514 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
13515 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
13519 spec->private_dac_nids[spec->multiout.num_dacs++] = dac;
13523 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
13524 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
13526 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
13527 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
13533 /* add playback controls from the parsed DAC table */
13534 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
13535 const struct auto_pin_cfg *cfg)
13540 spec->multiout.dac_nids = spec->private_dac_nids;
13542 nid = cfg->line_out_pins[0];
13546 name = alc_get_line_out_pfx(spec, 0, true, &index);
13547 err = alc268_new_analog_output(spec, nid, name, 0);
13552 nid = cfg->speaker_pins[0];
13554 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
13555 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
13559 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
13563 nid = cfg->hp_pins[0];
13565 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
13570 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
13572 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
13573 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
13580 /* create playback/capture controls for input pins */
13581 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
13582 const struct auto_pin_cfg *cfg)
13584 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
13587 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
13588 hda_nid_t nid, int pin_type)
13592 alc_set_pin_output(codec, nid, pin_type);
13593 if (snd_hda_get_conn_list(codec, nid, NULL) <= 1)
13595 if (nid == 0x14 || nid == 0x16)
13599 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
13602 static void alc268_auto_init_dac(struct hda_codec *codec, hda_nid_t nid)
13606 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13610 static void alc268_auto_init_multi_out(struct hda_codec *codec)
13612 struct alc_spec *spec = codec->spec;
13615 for (i = 0; i < spec->autocfg.line_outs; i++) {
13616 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13617 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13618 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
13621 for (i = 0; i < spec->multiout.num_dacs; i++)
13622 alc268_auto_init_dac(codec, spec->multiout.dac_nids[i]);
13625 static void alc268_auto_init_hp_out(struct hda_codec *codec)
13627 struct alc_spec *spec = codec->spec;
13631 for (i = 0; i < spec->autocfg.hp_outs; i++) {
13632 pin = spec->autocfg.hp_pins[i];
13633 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
13635 for (i = 0; i < spec->autocfg.speaker_outs; i++) {
13636 pin = spec->autocfg.speaker_pins[i];
13637 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
13639 if (spec->autocfg.mono_out_pin)
13640 snd_hda_codec_write(codec, spec->autocfg.mono_out_pin, 0,
13641 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
13643 alc268_auto_init_dac(codec, spec->multiout.hp_nid);
13644 for (i = 0; i < ARRAY_SIZE(spec->multiout.extra_out_nid); i++)
13645 alc268_auto_init_dac(codec, spec->multiout.extra_out_nid[i]);
13648 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
13650 struct alc_spec *spec = codec->spec;
13651 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
13652 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
13653 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
13654 unsigned int dac_vol1, dac_vol2;
13656 if (line_nid == 0x1d || speaker_nid == 0x1d) {
13657 snd_hda_codec_write(codec, speaker_nid, 0,
13658 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
13659 /* mute mixer inputs from 0x1d */
13660 snd_hda_codec_write(codec, 0x0f, 0,
13661 AC_VERB_SET_AMP_GAIN_MUTE,
13663 snd_hda_codec_write(codec, 0x10, 0,
13664 AC_VERB_SET_AMP_GAIN_MUTE,
13667 /* unmute mixer inputs from 0x1d */
13668 snd_hda_codec_write(codec, 0x0f, 0,
13669 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13670 snd_hda_codec_write(codec, 0x10, 0,
13671 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13674 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
13675 if (line_nid == 0x14)
13676 dac_vol2 = AMP_OUT_ZERO;
13677 else if (line_nid == 0x15)
13678 dac_vol1 = AMP_OUT_ZERO;
13679 if (hp_nid == 0x14)
13680 dac_vol2 = AMP_OUT_ZERO;
13681 else if (hp_nid == 0x15)
13682 dac_vol1 = AMP_OUT_ZERO;
13683 if (line_nid != 0x16 || hp_nid != 0x16 ||
13684 spec->autocfg.line_out_pins[1] != 0x16 ||
13685 spec->autocfg.line_out_pins[2] != 0x16)
13686 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
13688 snd_hda_codec_write(codec, 0x02, 0,
13689 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
13690 snd_hda_codec_write(codec, 0x03, 0,
13691 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
13694 /* pcm configuration: identical with ALC880 */
13695 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
13696 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
13697 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
13698 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
13701 * BIOS auto configuration
13703 static int alc268_parse_auto_config(struct hda_codec *codec)
13705 struct alc_spec *spec = codec->spec;
13707 static const hda_nid_t alc268_ignore[] = { 0 };
13709 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13713 if (!spec->autocfg.line_outs) {
13714 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
13715 spec->multiout.max_channels = 2;
13716 spec->no_analog = 1;
13719 return 0; /* can't find valid BIOS pin config */
13721 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
13724 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
13728 spec->multiout.max_channels = 2;
13731 /* digital only support output */
13732 alc_auto_parse_digital(codec);
13733 if (spec->kctls.list)
13734 add_mixer(spec, spec->kctls.list);
13736 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) {
13737 add_mixer(spec, alc268_beep_mixer);
13738 add_verb(spec, alc268_beep_init_verbs);
13741 spec->num_mux_defs = 2;
13742 spec->input_mux = &spec->private_imux[0];
13744 err = alc_auto_add_mic_boost(codec);
13748 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
13753 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
13754 #define alc268_auto_init_input_src alc882_auto_init_input_src
13756 /* init callback for auto-configuration model -- overriding the default init */
13757 static void alc268_auto_init(struct hda_codec *codec)
13759 struct alc_spec *spec = codec->spec;
13760 alc268_auto_init_multi_out(codec);
13761 alc268_auto_init_hp_out(codec);
13762 alc268_auto_init_mono_speaker_out(codec);
13763 alc268_auto_init_analog_input(codec);
13764 alc268_auto_init_input_src(codec);
13765 alc_auto_init_digital(codec);
13766 if (spec->unsol_event)
13767 alc_inithook(codec);
13771 * configuration and preset
13773 static const char * const alc268_models[ALC268_MODEL_LAST] = {
13774 [ALC267_QUANTA_IL1] = "quanta-il1",
13775 [ALC268_3ST] = "3stack",
13776 [ALC268_TOSHIBA] = "toshiba",
13777 [ALC268_ACER] = "acer",
13778 [ALC268_ACER_DMIC] = "acer-dmic",
13779 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
13780 [ALC268_DELL] = "dell",
13781 [ALC268_ZEPTO] = "zepto",
13782 #ifdef CONFIG_SND_DEBUG
13783 [ALC268_TEST] = "test",
13785 [ALC268_AUTO] = "auto",
13788 static const struct snd_pci_quirk alc268_cfg_tbl[] = {
13789 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
13790 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
13791 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
13792 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
13793 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
13794 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
13795 ALC268_ACER_ASPIRE_ONE),
13796 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
13797 SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron 910", ALC268_AUTO),
13798 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
13799 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
13800 /* almost compatible with toshiba but with optional digital outs;
13801 * auto-probing seems working fine
13803 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
13805 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
13806 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
13807 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
13808 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
13812 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
13813 static const struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
13814 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
13815 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
13816 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
13821 static const struct alc_config_preset alc268_presets[] = {
13822 [ALC267_QUANTA_IL1] = {
13823 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
13824 alc268_capture_nosrc_mixer },
13825 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13826 alc267_quanta_il1_verbs },
13827 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13828 .dac_nids = alc268_dac_nids,
13829 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13830 .adc_nids = alc268_adc_nids_alt,
13832 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13833 .channel_mode = alc268_modes,
13834 .unsol_event = alc_sku_unsol_event,
13835 .setup = alc267_quanta_il1_setup,
13836 .init_hook = alc_inithook,
13839 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13840 alc268_beep_mixer },
13841 .init_verbs = { alc268_base_init_verbs },
13842 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13843 .dac_nids = alc268_dac_nids,
13844 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13845 .adc_nids = alc268_adc_nids_alt,
13846 .capsrc_nids = alc268_capsrc_nids,
13848 .dig_out_nid = ALC268_DIGOUT_NID,
13849 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13850 .channel_mode = alc268_modes,
13851 .input_mux = &alc268_capture_source,
13853 [ALC268_TOSHIBA] = {
13854 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
13855 alc268_beep_mixer },
13856 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13857 alc268_toshiba_verbs },
13858 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13859 .dac_nids = alc268_dac_nids,
13860 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13861 .adc_nids = alc268_adc_nids_alt,
13862 .capsrc_nids = alc268_capsrc_nids,
13864 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13865 .channel_mode = alc268_modes,
13866 .input_mux = &alc268_capture_source,
13867 .unsol_event = alc_sku_unsol_event,
13868 .setup = alc268_toshiba_setup,
13869 .init_hook = alc_inithook,
13872 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
13873 alc268_beep_mixer },
13874 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13875 alc268_acer_verbs },
13876 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13877 .dac_nids = alc268_dac_nids,
13878 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13879 .adc_nids = alc268_adc_nids_alt,
13880 .capsrc_nids = alc268_capsrc_nids,
13882 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13883 .channel_mode = alc268_modes,
13884 .input_mux = &alc268_acer_capture_source,
13885 .unsol_event = alc_sku_unsol_event,
13886 .setup = alc268_acer_setup,
13887 .init_hook = alc_inithook,
13889 [ALC268_ACER_DMIC] = {
13890 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
13891 alc268_beep_mixer },
13892 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13893 alc268_acer_verbs },
13894 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13895 .dac_nids = alc268_dac_nids,
13896 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13897 .adc_nids = alc268_adc_nids_alt,
13898 .capsrc_nids = alc268_capsrc_nids,
13900 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13901 .channel_mode = alc268_modes,
13902 .input_mux = &alc268_acer_dmic_capture_source,
13903 .unsol_event = alc_sku_unsol_event,
13904 .setup = alc268_acer_setup,
13905 .init_hook = alc_inithook,
13907 [ALC268_ACER_ASPIRE_ONE] = {
13908 .mixers = { alc268_acer_aspire_one_mixer,
13910 alc268_capture_nosrc_mixer },
13911 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13912 alc268_acer_aspire_one_verbs },
13913 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13914 .dac_nids = alc268_dac_nids,
13915 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13916 .adc_nids = alc268_adc_nids_alt,
13917 .capsrc_nids = alc268_capsrc_nids,
13919 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13920 .channel_mode = alc268_modes,
13921 .unsol_event = alc_sku_unsol_event,
13922 .setup = alc268_acer_lc_setup,
13923 .init_hook = alc_inithook,
13926 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
13927 alc268_capture_nosrc_mixer },
13928 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13929 alc268_dell_verbs },
13930 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13931 .dac_nids = alc268_dac_nids,
13932 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13933 .adc_nids = alc268_adc_nids_alt,
13934 .capsrc_nids = alc268_capsrc_nids,
13936 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13937 .channel_mode = alc268_modes,
13938 .unsol_event = alc_sku_unsol_event,
13939 .setup = alc268_dell_setup,
13940 .init_hook = alc_inithook,
13943 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13944 alc268_beep_mixer },
13945 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13946 alc268_toshiba_verbs },
13947 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13948 .dac_nids = alc268_dac_nids,
13949 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13950 .adc_nids = alc268_adc_nids_alt,
13951 .capsrc_nids = alc268_capsrc_nids,
13953 .dig_out_nid = ALC268_DIGOUT_NID,
13954 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13955 .channel_mode = alc268_modes,
13956 .input_mux = &alc268_capture_source,
13957 .unsol_event = alc_sku_unsol_event,
13958 .setup = alc268_toshiba_setup,
13959 .init_hook = alc_inithook,
13961 #ifdef CONFIG_SND_DEBUG
13963 .mixers = { alc268_test_mixer, alc268_capture_mixer },
13964 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13965 alc268_volume_init_verbs,
13966 alc268_beep_init_verbs },
13967 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13968 .dac_nids = alc268_dac_nids,
13969 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13970 .adc_nids = alc268_adc_nids_alt,
13971 .capsrc_nids = alc268_capsrc_nids,
13973 .dig_out_nid = ALC268_DIGOUT_NID,
13974 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13975 .channel_mode = alc268_modes,
13976 .input_mux = &alc268_capture_source,
13981 static int patch_alc268(struct hda_codec *codec)
13983 struct alc_spec *spec;
13985 int i, has_beep, err;
13987 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13991 codec->spec = spec;
13993 /* ALC268 has no aa-loopback mixer */
13995 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
13999 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
14000 board_config = snd_hda_check_board_codec_sid_config(codec,
14001 ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
14003 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
14004 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14006 board_config = ALC268_AUTO;
14009 if (board_config == ALC268_AUTO) {
14010 /* automatic parse from the BIOS config */
14011 err = alc268_parse_auto_config(codec);
14017 "hda_codec: Cannot set up configuration "
14018 "from BIOS. Using base mode...\n");
14019 board_config = ALC268_3ST;
14023 if (board_config != ALC268_AUTO)
14024 setup_preset(codec, &alc268_presets[board_config]);
14026 spec->stream_analog_playback = &alc268_pcm_analog_playback;
14027 spec->stream_analog_capture = &alc268_pcm_analog_capture;
14028 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
14030 spec->stream_digital_playback = &alc268_pcm_digital_playback;
14033 for (i = 0; i < spec->num_mixers; i++) {
14034 if (spec->mixers[i] == alc268_beep_mixer) {
14041 err = snd_hda_attach_beep_device(codec, 0x1);
14046 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
14047 /* override the amp caps for beep generator */
14048 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
14049 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
14050 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
14051 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
14052 (0 << AC_AMPCAP_MUTE_SHIFT));
14055 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
14056 /* check whether NID 0x07 is valid */
14057 unsigned int wcap = get_wcaps(codec, 0x07);
14059 spec->capsrc_nids = alc268_capsrc_nids;
14061 wcap = get_wcaps_type(wcap);
14062 if (spec->auto_mic ||
14063 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
14064 spec->adc_nids = alc268_adc_nids_alt;
14065 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
14066 if (spec->auto_mic)
14067 fixup_automic_adc(codec);
14068 if (spec->auto_mic || spec->input_mux->num_items == 1)
14069 add_mixer(spec, alc268_capture_nosrc_mixer);
14071 add_mixer(spec, alc268_capture_alt_mixer);
14073 spec->adc_nids = alc268_adc_nids;
14074 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
14075 add_mixer(spec, alc268_capture_mixer);
14079 spec->vmaster_nid = 0x02;
14081 codec->patch_ops = alc_patch_ops;
14082 if (board_config == ALC268_AUTO)
14083 spec->init_hook = alc268_auto_init;
14084 spec->shutup = alc_eapd_shutup;
14086 alc_init_jacks(codec);
14092 * ALC269 channel source setting (2 channel)
14094 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
14096 #define alc269_dac_nids alc260_dac_nids
14098 static const hda_nid_t alc269_adc_nids[1] = {
14103 static const hda_nid_t alc269_capsrc_nids[1] = {
14107 static const hda_nid_t alc269vb_adc_nids[1] = {
14112 static const hda_nid_t alc269vb_capsrc_nids[1] = {
14116 static const hda_nid_t alc269_adc_candidates[] = {
14117 0x08, 0x09, 0x07, 0x11,
14120 #define alc269_modes alc260_modes
14121 #define alc269_capture_source alc880_lg_lw_capture_source
14123 static const struct snd_kcontrol_new alc269_base_mixer[] = {
14124 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14125 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14126 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14127 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14128 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14129 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14130 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14131 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
14132 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
14133 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
14134 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14135 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
14139 static const struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
14140 /* output mixer control */
14141 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
14143 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14144 .name = "Master Playback Switch",
14145 .subdevice = HDA_SUBDEV_AMP_FLAG,
14146 .info = snd_hda_mixer_amp_switch_info,
14147 .get = snd_hda_mixer_amp_switch_get,
14148 .put = alc268_acer_master_sw_put,
14149 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14151 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14152 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14153 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14154 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
14155 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
14156 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
14160 static const struct snd_kcontrol_new alc269_lifebook_mixer[] = {
14161 /* output mixer control */
14162 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
14164 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14165 .name = "Master Playback Switch",
14166 .subdevice = HDA_SUBDEV_AMP_FLAG,
14167 .info = snd_hda_mixer_amp_switch_info,
14168 .get = snd_hda_mixer_amp_switch_get,
14169 .put = alc268_acer_master_sw_put,
14170 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14172 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14173 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14174 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14175 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
14176 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
14177 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
14178 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
14179 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
14180 HDA_CODEC_VOLUME("Dock Mic Boost Volume", 0x1b, 0, HDA_INPUT),
14184 static const struct snd_kcontrol_new alc269_laptop_mixer[] = {
14185 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14186 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14187 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14188 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14192 static const struct snd_kcontrol_new alc269vb_laptop_mixer[] = {
14193 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14194 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14195 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
14196 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14200 static const struct snd_kcontrol_new alc269_asus_mixer[] = {
14201 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14202 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x0, HDA_INPUT),
14206 /* capture mixer elements */
14207 static const struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = {
14208 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
14209 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
14210 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14211 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
14215 static const struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = {
14216 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
14217 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
14218 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14222 static const struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = {
14223 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
14224 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
14225 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14226 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
14230 static const struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = {
14231 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
14232 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
14233 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14238 #define alc269_fujitsu_mixer alc269_laptop_mixer
14240 static const struct hda_verb alc269_quanta_fl1_verbs[] = {
14241 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14242 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14243 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14244 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
14245 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14246 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14250 static const struct hda_verb alc269_lifebook_verbs[] = {
14251 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14252 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
14253 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14254 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14255 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
14256 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14257 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14258 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
14259 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14260 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14264 /* toggle speaker-output according to the hp-jack state */
14265 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
14267 alc_hp_automute(codec);
14269 snd_hda_codec_write(codec, 0x20, 0,
14270 AC_VERB_SET_COEF_INDEX, 0x0c);
14271 snd_hda_codec_write(codec, 0x20, 0,
14272 AC_VERB_SET_PROC_COEF, 0x680);
14274 snd_hda_codec_write(codec, 0x20, 0,
14275 AC_VERB_SET_COEF_INDEX, 0x0c);
14276 snd_hda_codec_write(codec, 0x20, 0,
14277 AC_VERB_SET_PROC_COEF, 0x480);
14280 #define alc269_lifebook_speaker_automute \
14281 alc269_quanta_fl1_speaker_automute
14283 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
14285 unsigned int present_laptop;
14286 unsigned int present_dock;
14288 present_laptop = snd_hda_jack_detect(codec, 0x18);
14289 present_dock = snd_hda_jack_detect(codec, 0x1b);
14291 /* Laptop mic port overrides dock mic port, design decision */
14293 snd_hda_codec_write(codec, 0x23, 0,
14294 AC_VERB_SET_CONNECT_SEL, 0x3);
14295 if (present_laptop)
14296 snd_hda_codec_write(codec, 0x23, 0,
14297 AC_VERB_SET_CONNECT_SEL, 0x0);
14298 if (!present_dock && !present_laptop)
14299 snd_hda_codec_write(codec, 0x23, 0,
14300 AC_VERB_SET_CONNECT_SEL, 0x1);
14303 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
14306 switch (res >> 26) {
14307 case ALC880_HP_EVENT:
14308 alc269_quanta_fl1_speaker_automute(codec);
14310 case ALC880_MIC_EVENT:
14311 alc_mic_automute(codec);
14316 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
14319 if ((res >> 26) == ALC880_HP_EVENT)
14320 alc269_lifebook_speaker_automute(codec);
14321 if ((res >> 26) == ALC880_MIC_EVENT)
14322 alc269_lifebook_mic_autoswitch(codec);
14325 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
14327 struct alc_spec *spec = codec->spec;
14328 spec->autocfg.hp_pins[0] = 0x15;
14329 spec->autocfg.speaker_pins[0] = 0x14;
14330 spec->automute_mixer_nid[0] = 0x0c;
14331 spec->automute = 1;
14332 spec->automute_mode = ALC_AUTOMUTE_MIXER;
14333 spec->ext_mic.pin = 0x18;
14334 spec->ext_mic.mux_idx = 0;
14335 spec->int_mic.pin = 0x19;
14336 spec->int_mic.mux_idx = 1;
14337 spec->auto_mic = 1;
14340 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
14342 alc269_quanta_fl1_speaker_automute(codec);
14343 alc_mic_automute(codec);
14346 static void alc269_lifebook_setup(struct hda_codec *codec)
14348 struct alc_spec *spec = codec->spec;
14349 spec->autocfg.hp_pins[0] = 0x15;
14350 spec->autocfg.hp_pins[1] = 0x1a;
14351 spec->autocfg.speaker_pins[0] = 0x14;
14352 spec->automute_mixer_nid[0] = 0x0c;
14353 spec->automute = 1;
14354 spec->automute_mode = ALC_AUTOMUTE_MIXER;
14357 static void alc269_lifebook_init_hook(struct hda_codec *codec)
14359 alc269_lifebook_speaker_automute(codec);
14360 alc269_lifebook_mic_autoswitch(codec);
14363 static const struct hda_verb alc269_laptop_dmic_init_verbs[] = {
14364 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14365 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
14366 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14367 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14368 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14369 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14370 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14374 static const struct hda_verb alc269_laptop_amic_init_verbs[] = {
14375 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14376 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
14377 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14378 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
14379 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14380 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14384 static const struct hda_verb alc269vb_laptop_dmic_init_verbs[] = {
14385 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
14386 {0x22, AC_VERB_SET_CONNECT_SEL, 0x06},
14387 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14388 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14389 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14390 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14391 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14395 static const struct hda_verb alc269vb_laptop_amic_init_verbs[] = {
14396 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
14397 {0x22, AC_VERB_SET_CONNECT_SEL, 0x01},
14398 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14399 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14400 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14401 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14402 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14406 static const struct hda_verb alc271_acer_dmic_verbs[] = {
14407 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
14408 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
14409 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14410 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14411 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14412 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14413 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00},
14414 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14415 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14416 {0x22, AC_VERB_SET_CONNECT_SEL, 6},
14420 static void alc269_laptop_amic_setup(struct hda_codec *codec)
14422 struct alc_spec *spec = codec->spec;
14423 spec->autocfg.hp_pins[0] = 0x15;
14424 spec->autocfg.speaker_pins[0] = 0x14;
14425 spec->automute_mixer_nid[0] = 0x0c;
14426 spec->automute = 1;
14427 spec->automute_mode = ALC_AUTOMUTE_MIXER;
14428 spec->ext_mic.pin = 0x18;
14429 spec->ext_mic.mux_idx = 0;
14430 spec->int_mic.pin = 0x19;
14431 spec->int_mic.mux_idx = 1;
14432 spec->auto_mic = 1;
14435 static void alc269_laptop_dmic_setup(struct hda_codec *codec)
14437 struct alc_spec *spec = codec->spec;
14438 spec->autocfg.hp_pins[0] = 0x15;
14439 spec->autocfg.speaker_pins[0] = 0x14;
14440 spec->automute_mixer_nid[0] = 0x0c;
14441 spec->automute = 1;
14442 spec->automute_mode = ALC_AUTOMUTE_MIXER;
14443 spec->ext_mic.pin = 0x18;
14444 spec->ext_mic.mux_idx = 0;
14445 spec->int_mic.pin = 0x12;
14446 spec->int_mic.mux_idx = 5;
14447 spec->auto_mic = 1;
14450 static void alc269vb_laptop_amic_setup(struct hda_codec *codec)
14452 struct alc_spec *spec = codec->spec;
14453 spec->autocfg.hp_pins[0] = 0x21;
14454 spec->autocfg.speaker_pins[0] = 0x14;
14455 spec->automute_mixer_nid[0] = 0x0c;
14456 spec->automute = 1;
14457 spec->automute_mode = ALC_AUTOMUTE_MIXER;
14458 spec->ext_mic.pin = 0x18;
14459 spec->ext_mic.mux_idx = 0;
14460 spec->int_mic.pin = 0x19;
14461 spec->int_mic.mux_idx = 1;
14462 spec->auto_mic = 1;
14465 static void alc269vb_laptop_dmic_setup(struct hda_codec *codec)
14467 struct alc_spec *spec = codec->spec;
14468 spec->autocfg.hp_pins[0] = 0x21;
14469 spec->autocfg.speaker_pins[0] = 0x14;
14470 spec->automute_mixer_nid[0] = 0x0c;
14471 spec->automute = 1;
14472 spec->automute_mode = ALC_AUTOMUTE_MIXER;
14473 spec->ext_mic.pin = 0x18;
14474 spec->ext_mic.mux_idx = 0;
14475 spec->int_mic.pin = 0x12;
14476 spec->int_mic.mux_idx = 6;
14477 spec->auto_mic = 1;
14481 * generic initialization of ADC, input mixers and output mixers
14483 static const struct hda_verb alc269_init_verbs[] = {
14485 * Unmute ADC0 and set the default input to mic-in
14487 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14490 * Set up output mixers (0x02 - 0x03)
14492 /* set vol=0 to output mixers */
14493 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14494 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14496 /* set up input amps for analog loopback */
14497 /* Amp Indices: DAC = 0, mixer = 1 */
14498 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14499 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14500 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14501 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14502 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14503 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14505 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14506 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14507 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14508 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14509 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14510 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14511 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14513 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14514 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14516 /* FIXME: use Mux-type input source selection */
14517 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14518 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14519 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
14522 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14526 static const struct hda_verb alc269vb_init_verbs[] = {
14528 * Unmute ADC0 and set the default input to mic-in
14530 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14533 * Set up output mixers (0x02 - 0x03)
14535 /* set vol=0 to output mixers */
14536 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14537 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14539 /* set up input amps for analog loopback */
14540 /* Amp Indices: DAC = 0, mixer = 1 */
14541 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14542 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14543 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14544 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14545 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14546 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14548 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14549 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14550 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14551 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14552 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14553 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14554 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14556 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14557 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14559 /* FIXME: use Mux-type input source selection */
14560 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14561 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14562 {0x22, AC_VERB_SET_CONNECT_SEL, 0x00},
14565 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14569 #define alc269_auto_create_multi_out_ctls \
14570 alc268_auto_create_multi_out_ctls
14571 #define alc269_auto_create_input_ctls \
14572 alc268_auto_create_input_ctls
14574 #ifdef CONFIG_SND_HDA_POWER_SAVE
14575 #define alc269_loopbacks alc880_loopbacks
14578 /* pcm configuration: identical with ALC880 */
14579 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
14580 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
14581 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
14582 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
14584 static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
14588 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14589 /* NID is set in alc_build_pcms */
14591 .open = alc880_playback_pcm_open,
14592 .prepare = alc880_playback_pcm_prepare,
14593 .cleanup = alc880_playback_pcm_cleanup
14597 static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
14601 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14602 /* NID is set in alc_build_pcms */
14605 #ifdef CONFIG_SND_HDA_POWER_SAVE
14606 static int alc269_mic2_for_mute_led(struct hda_codec *codec)
14608 switch (codec->subsystem_id) {
14615 static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid)
14617 /* update mute-LED according to the speaker mute state */
14618 if (nid == 0x01 || nid == 0x14) {
14620 if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) &
14625 /* mic2 vref pin is used for mute LED control */
14626 snd_hda_codec_update_cache(codec, 0x19, 0,
14627 AC_VERB_SET_PIN_WIDGET_CONTROL,
14630 return alc_check_power_status(codec, nid);
14632 #endif /* CONFIG_SND_HDA_POWER_SAVE */
14634 static int alc275_setup_dual_adc(struct hda_codec *codec)
14636 struct alc_spec *spec = codec->spec;
14638 if (codec->vendor_id != 0x10ec0275 || !spec->auto_mic)
14640 if ((spec->ext_mic.pin >= 0x18 && spec->int_mic.pin <= 0x13) ||
14641 (spec->ext_mic.pin <= 0x12 && spec->int_mic.pin >= 0x18)) {
14642 if (spec->ext_mic.pin <= 0x12) {
14643 spec->private_adc_nids[0] = 0x08;
14644 spec->private_adc_nids[1] = 0x11;
14645 spec->private_capsrc_nids[0] = 0x23;
14646 spec->private_capsrc_nids[1] = 0x22;
14648 spec->private_adc_nids[0] = 0x11;
14649 spec->private_adc_nids[1] = 0x08;
14650 spec->private_capsrc_nids[0] = 0x22;
14651 spec->private_capsrc_nids[1] = 0x23;
14653 spec->adc_nids = spec->private_adc_nids;
14654 spec->capsrc_nids = spec->private_capsrc_nids;
14655 spec->num_adc_nids = 2;
14656 spec->dual_adc_switch = 1;
14657 snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n",
14658 spec->adc_nids[0], spec->adc_nids[1]);
14664 /* different alc269-variants */
14666 ALC269_TYPE_ALC269VA,
14667 ALC269_TYPE_ALC269VB,
14668 ALC269_TYPE_ALC269VC,
14672 * BIOS auto configuration
14674 static int alc269_parse_auto_config(struct hda_codec *codec)
14676 struct alc_spec *spec = codec->spec;
14678 static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
14680 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14685 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
14688 if (spec->codec_variant == ALC269_TYPE_ALC269VA)
14689 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
14691 err = alc_auto_create_input_ctls(codec, &spec->autocfg, 0,
14696 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14698 alc_auto_parse_digital(codec);
14700 if (spec->kctls.list)
14701 add_mixer(spec, spec->kctls.list);
14703 if (spec->codec_variant != ALC269_TYPE_ALC269VA)
14704 alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21);
14706 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
14708 spec->num_mux_defs = 1;
14709 spec->input_mux = &spec->private_imux[0];
14711 if (!alc275_setup_dual_adc(codec))
14712 fillup_priv_adc_nids(codec, alc269_adc_candidates,
14713 sizeof(alc269_adc_candidates));
14715 err = alc_auto_add_mic_boost(codec);
14719 if (!spec->cap_mixer && !spec->no_analog)
14720 set_capture_mixer(codec);
14725 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
14726 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
14727 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
14728 #define alc269_auto_init_input_src alc882_auto_init_input_src
14731 /* init callback for auto-configuration model -- overriding the default init */
14732 static void alc269_auto_init(struct hda_codec *codec)
14734 struct alc_spec *spec = codec->spec;
14735 alc269_auto_init_multi_out(codec);
14736 alc269_auto_init_hp_out(codec);
14737 alc269_auto_init_analog_input(codec);
14738 if (!spec->dual_adc_switch)
14739 alc269_auto_init_input_src(codec);
14740 alc_auto_init_digital(codec);
14741 if (spec->unsol_event)
14742 alc_inithook(codec);
14745 static void alc269_toggle_power_output(struct hda_codec *codec, int power_up)
14747 int val = alc_read_coef_idx(codec, 0x04);
14752 alc_write_coef_idx(codec, 0x04, val);
14755 static void alc269_shutup(struct hda_codec *codec)
14757 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017)
14758 alc269_toggle_power_output(codec, 0);
14759 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
14760 alc269_toggle_power_output(codec, 0);
14765 #ifdef SND_HDA_NEEDS_RESUME
14766 static int alc269_resume(struct hda_codec *codec)
14768 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
14769 alc269_toggle_power_output(codec, 0);
14773 codec->patch_ops.init(codec);
14775 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) {
14776 alc269_toggle_power_output(codec, 1);
14780 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018)
14781 alc269_toggle_power_output(codec, 1);
14783 snd_hda_codec_resume_amp(codec);
14784 snd_hda_codec_resume_cache(codec);
14785 hda_call_check_power_status(codec, 0x01);
14788 #endif /* SND_HDA_NEEDS_RESUME */
14790 static void alc269_fixup_hweq(struct hda_codec *codec,
14791 const struct alc_fixup *fix, int action)
14795 if (action != ALC_FIXUP_ACT_INIT)
14797 coef = alc_read_coef_idx(codec, 0x1e);
14798 alc_write_coef_idx(codec, 0x1e, coef | 0x80);
14801 static void alc271_fixup_dmic(struct hda_codec *codec,
14802 const struct alc_fixup *fix, int action)
14804 static const struct hda_verb verbs[] = {
14805 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
14806 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
14811 if (strcmp(codec->chip_name, "ALC271X"))
14813 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
14814 if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
14815 snd_hda_sequence_write(codec, verbs);
14819 ALC269_FIXUP_SONY_VAIO,
14820 ALC275_FIXUP_SONY_VAIO_GPIO2,
14821 ALC269_FIXUP_DELL_M101Z,
14822 ALC269_FIXUP_SKU_IGNORE,
14823 ALC269_FIXUP_ASUS_G73JW,
14824 ALC269_FIXUP_LENOVO_EAPD,
14825 ALC275_FIXUP_SONY_HWEQ,
14829 static const struct alc_fixup alc269_fixups[] = {
14830 [ALC269_FIXUP_SONY_VAIO] = {
14831 .type = ALC_FIXUP_VERBS,
14832 .v.verbs = (const struct hda_verb[]) {
14833 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD},
14837 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
14838 .type = ALC_FIXUP_VERBS,
14839 .v.verbs = (const struct hda_verb[]) {
14840 {0x01, AC_VERB_SET_GPIO_MASK, 0x04},
14841 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04},
14842 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
14846 .chain_id = ALC269_FIXUP_SONY_VAIO
14848 [ALC269_FIXUP_DELL_M101Z] = {
14849 .type = ALC_FIXUP_VERBS,
14850 .v.verbs = (const struct hda_verb[]) {
14851 /* Enables internal speaker */
14852 {0x20, AC_VERB_SET_COEF_INDEX, 13},
14853 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
14857 [ALC269_FIXUP_SKU_IGNORE] = {
14858 .type = ALC_FIXUP_SKU,
14859 .v.sku = ALC_FIXUP_SKU_IGNORE,
14861 [ALC269_FIXUP_ASUS_G73JW] = {
14862 .type = ALC_FIXUP_PINS,
14863 .v.pins = (const struct alc_pincfg[]) {
14864 { 0x17, 0x99130111 }, /* subwoofer */
14868 [ALC269_FIXUP_LENOVO_EAPD] = {
14869 .type = ALC_FIXUP_VERBS,
14870 .v.verbs = (const struct hda_verb[]) {
14871 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
14875 [ALC275_FIXUP_SONY_HWEQ] = {
14876 .type = ALC_FIXUP_FUNC,
14877 .v.func = alc269_fixup_hweq,
14879 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
14881 [ALC271_FIXUP_DMIC] = {
14882 .type = ALC_FIXUP_FUNC,
14883 .v.func = alc271_fixup_dmic,
14887 static const struct snd_pci_quirk alc269_fixup_tbl[] = {
14888 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
14889 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
14890 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
14891 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
14892 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
14893 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
14894 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
14895 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
14896 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
14897 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
14898 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
14899 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
14900 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
14906 * configuration and preset
14908 static const char * const alc269_models[ALC269_MODEL_LAST] = {
14909 [ALC269_BASIC] = "basic",
14910 [ALC269_QUANTA_FL1] = "quanta",
14911 [ALC269_AMIC] = "laptop-amic",
14912 [ALC269_DMIC] = "laptop-dmic",
14913 [ALC269_FUJITSU] = "fujitsu",
14914 [ALC269_LIFEBOOK] = "lifebook",
14915 [ALC269_AUTO] = "auto",
14918 static const struct snd_pci_quirk alc269_cfg_tbl[] = {
14919 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
14920 SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER),
14921 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
14923 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC),
14924 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC),
14925 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC),
14926 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC),
14927 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC),
14928 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC),
14929 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC),
14930 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC),
14931 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC),
14932 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269VB_AMIC),
14933 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC),
14934 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC),
14935 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC),
14936 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC),
14937 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC),
14938 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC),
14939 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC),
14940 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC),
14941 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC),
14942 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC),
14943 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC),
14944 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC),
14945 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC),
14946 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC),
14947 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC),
14948 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC),
14949 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC),
14950 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC),
14951 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC),
14952 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC),
14953 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC),
14954 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC),
14955 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC),
14956 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC),
14957 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC),
14958 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC),
14959 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
14961 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
14963 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC),
14964 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC),
14965 SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO),
14966 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
14967 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC),
14968 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
14969 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC),
14970 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC),
14971 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC),
14972 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC),
14976 static const struct alc_config_preset alc269_presets[] = {
14978 .mixers = { alc269_base_mixer },
14979 .init_verbs = { alc269_init_verbs },
14980 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14981 .dac_nids = alc269_dac_nids,
14983 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14984 .channel_mode = alc269_modes,
14985 .input_mux = &alc269_capture_source,
14987 [ALC269_QUANTA_FL1] = {
14988 .mixers = { alc269_quanta_fl1_mixer },
14989 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
14990 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14991 .dac_nids = alc269_dac_nids,
14993 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14994 .channel_mode = alc269_modes,
14995 .input_mux = &alc269_capture_source,
14996 .unsol_event = alc269_quanta_fl1_unsol_event,
14997 .setup = alc269_quanta_fl1_setup,
14998 .init_hook = alc269_quanta_fl1_init_hook,
15001 .mixers = { alc269_laptop_mixer },
15002 .cap_mixer = alc269_laptop_analog_capture_mixer,
15003 .init_verbs = { alc269_init_verbs,
15004 alc269_laptop_amic_init_verbs },
15005 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15006 .dac_nids = alc269_dac_nids,
15008 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15009 .channel_mode = alc269_modes,
15010 .unsol_event = alc_sku_unsol_event,
15011 .setup = alc269_laptop_amic_setup,
15012 .init_hook = alc_inithook,
15015 .mixers = { alc269_laptop_mixer },
15016 .cap_mixer = alc269_laptop_digital_capture_mixer,
15017 .init_verbs = { alc269_init_verbs,
15018 alc269_laptop_dmic_init_verbs },
15019 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15020 .dac_nids = alc269_dac_nids,
15022 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15023 .channel_mode = alc269_modes,
15024 .unsol_event = alc_sku_unsol_event,
15025 .setup = alc269_laptop_dmic_setup,
15026 .init_hook = alc_inithook,
15028 [ALC269VB_AMIC] = {
15029 .mixers = { alc269vb_laptop_mixer },
15030 .cap_mixer = alc269vb_laptop_analog_capture_mixer,
15031 .init_verbs = { alc269vb_init_verbs,
15032 alc269vb_laptop_amic_init_verbs },
15033 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15034 .dac_nids = alc269_dac_nids,
15036 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15037 .channel_mode = alc269_modes,
15038 .unsol_event = alc_sku_unsol_event,
15039 .setup = alc269vb_laptop_amic_setup,
15040 .init_hook = alc_inithook,
15042 [ALC269VB_DMIC] = {
15043 .mixers = { alc269vb_laptop_mixer },
15044 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
15045 .init_verbs = { alc269vb_init_verbs,
15046 alc269vb_laptop_dmic_init_verbs },
15047 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15048 .dac_nids = alc269_dac_nids,
15050 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15051 .channel_mode = alc269_modes,
15052 .unsol_event = alc_sku_unsol_event,
15053 .setup = alc269vb_laptop_dmic_setup,
15054 .init_hook = alc_inithook,
15056 [ALC269_FUJITSU] = {
15057 .mixers = { alc269_fujitsu_mixer },
15058 .cap_mixer = alc269_laptop_digital_capture_mixer,
15059 .init_verbs = { alc269_init_verbs,
15060 alc269_laptop_dmic_init_verbs },
15061 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15062 .dac_nids = alc269_dac_nids,
15064 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15065 .channel_mode = alc269_modes,
15066 .unsol_event = alc_sku_unsol_event,
15067 .setup = alc269_laptop_dmic_setup,
15068 .init_hook = alc_inithook,
15070 [ALC269_LIFEBOOK] = {
15071 .mixers = { alc269_lifebook_mixer },
15072 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
15073 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15074 .dac_nids = alc269_dac_nids,
15076 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15077 .channel_mode = alc269_modes,
15078 .input_mux = &alc269_capture_source,
15079 .unsol_event = alc269_lifebook_unsol_event,
15080 .setup = alc269_lifebook_setup,
15081 .init_hook = alc269_lifebook_init_hook,
15084 .mixers = { alc269_asus_mixer },
15085 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
15086 .init_verbs = { alc269_init_verbs, alc271_acer_dmic_verbs },
15087 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15088 .dac_nids = alc269_dac_nids,
15089 .adc_nids = alc262_dmic_adc_nids,
15090 .num_adc_nids = ARRAY_SIZE(alc262_dmic_adc_nids),
15091 .capsrc_nids = alc262_dmic_capsrc_nids,
15092 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15093 .channel_mode = alc269_modes,
15094 .input_mux = &alc269_capture_source,
15095 .dig_out_nid = ALC880_DIGOUT_NID,
15096 .unsol_event = alc_sku_unsol_event,
15097 .setup = alc269vb_laptop_dmic_setup,
15098 .init_hook = alc_inithook,
15102 static int alc269_fill_coef(struct hda_codec *codec)
15106 if ((alc_read_coef_idx(codec, 0) & 0x00ff) < 0x015) {
15107 alc_write_coef_idx(codec, 0xf, 0x960b);
15108 alc_write_coef_idx(codec, 0xe, 0x8817);
15111 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x016) {
15112 alc_write_coef_idx(codec, 0xf, 0x960b);
15113 alc_write_coef_idx(codec, 0xe, 0x8814);
15116 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) {
15117 val = alc_read_coef_idx(codec, 0x04);
15118 /* Power up output pin */
15119 alc_write_coef_idx(codec, 0x04, val | (1<<11));
15122 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
15123 val = alc_read_coef_idx(codec, 0xd);
15124 if ((val & 0x0c00) >> 10 != 0x1) {
15125 /* Capless ramp up clock control */
15126 alc_write_coef_idx(codec, 0xd, val | (1<<10));
15128 val = alc_read_coef_idx(codec, 0x17);
15129 if ((val & 0x01c0) >> 6 != 0x4) {
15130 /* Class D power on reset */
15131 alc_write_coef_idx(codec, 0x17, val | (1<<7));
15135 val = alc_read_coef_idx(codec, 0xd); /* Class D */
15136 alc_write_coef_idx(codec, 0xd, val | (1<<14));
15138 val = alc_read_coef_idx(codec, 0x4); /* HP */
15139 alc_write_coef_idx(codec, 0x4, val | (1<<11));
15144 static int patch_alc269(struct hda_codec *codec)
15146 struct alc_spec *spec;
15147 int board_config, coef;
15150 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15154 codec->spec = spec;
15156 spec->mixer_nid = 0x0b;
15158 alc_auto_parse_customize_define(codec);
15160 if (codec->vendor_id == 0x10ec0269) {
15161 spec->codec_variant = ALC269_TYPE_ALC269VA;
15162 coef = alc_read_coef_idx(codec, 0);
15163 if ((coef & 0x00f0) == 0x0010) {
15164 if (codec->bus->pci->subsystem_vendor == 0x1025 &&
15165 spec->cdefine.platform_type == 1) {
15166 alc_codec_rename(codec, "ALC271X");
15167 } else if ((coef & 0xf000) == 0x2000) {
15168 alc_codec_rename(codec, "ALC259");
15169 } else if ((coef & 0xf000) == 0x3000) {
15170 alc_codec_rename(codec, "ALC258");
15171 } else if ((coef & 0xfff0) == 0x3010) {
15172 alc_codec_rename(codec, "ALC277");
15174 alc_codec_rename(codec, "ALC269VB");
15176 spec->codec_variant = ALC269_TYPE_ALC269VB;
15177 } else if ((coef & 0x00f0) == 0x0020) {
15178 if (coef == 0xa023)
15179 alc_codec_rename(codec, "ALC259");
15180 else if (coef == 0x6023)
15181 alc_codec_rename(codec, "ALC281X");
15182 else if (codec->bus->pci->subsystem_vendor == 0x17aa &&
15183 codec->bus->pci->subsystem_device == 0x21f3)
15184 alc_codec_rename(codec, "ALC3202");
15186 alc_codec_rename(codec, "ALC269VC");
15187 spec->codec_variant = ALC269_TYPE_ALC269VC;
15189 alc_fix_pll_init(codec, 0x20, 0x04, 15);
15190 alc269_fill_coef(codec);
15193 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
15197 if (board_config < 0) {
15198 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15200 board_config = ALC269_AUTO;
15203 if (board_config == ALC269_AUTO) {
15204 alc_pick_fixup(codec, NULL, alc269_fixup_tbl, alc269_fixups);
15205 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
15208 if (board_config == ALC269_AUTO) {
15209 /* automatic parse from the BIOS config */
15210 err = alc269_parse_auto_config(codec);
15216 "hda_codec: Cannot set up configuration "
15217 "from BIOS. Using base mode...\n");
15218 board_config = ALC269_BASIC;
15222 if (has_cdefine_beep(codec)) {
15223 err = snd_hda_attach_beep_device(codec, 0x1);
15230 if (board_config != ALC269_AUTO)
15231 setup_preset(codec, &alc269_presets[board_config]);
15233 if (board_config == ALC269_QUANTA_FL1) {
15234 /* Due to a hardware problem on Lenovo Ideadpad, we need to
15235 * fix the sample rate of analog I/O to 44.1kHz
15237 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
15238 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
15239 } else if (spec->dual_adc_switch) {
15240 spec->stream_analog_playback = &alc269_pcm_analog_playback;
15241 /* switch ADC dynamically */
15242 spec->stream_analog_capture = &dualmic_pcm_analog_capture;
15244 spec->stream_analog_playback = &alc269_pcm_analog_playback;
15245 spec->stream_analog_capture = &alc269_pcm_analog_capture;
15247 spec->stream_digital_playback = &alc269_pcm_digital_playback;
15248 spec->stream_digital_capture = &alc269_pcm_digital_capture;
15250 if (!spec->adc_nids) { /* wasn't filled automatically? use default */
15251 if (spec->codec_variant == ALC269_TYPE_ALC269VA) {
15252 spec->adc_nids = alc269_adc_nids;
15253 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
15254 spec->capsrc_nids = alc269_capsrc_nids;
15256 spec->adc_nids = alc269vb_adc_nids;
15257 spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids);
15258 spec->capsrc_nids = alc269vb_capsrc_nids;
15262 if (!spec->cap_mixer)
15263 set_capture_mixer(codec);
15264 if (has_cdefine_beep(codec))
15265 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
15267 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
15269 spec->vmaster_nid = 0x02;
15271 codec->patch_ops = alc_patch_ops;
15272 #ifdef SND_HDA_NEEDS_RESUME
15273 codec->patch_ops.resume = alc269_resume;
15275 if (board_config == ALC269_AUTO)
15276 spec->init_hook = alc269_auto_init;
15277 spec->shutup = alc269_shutup;
15279 alc_init_jacks(codec);
15280 #ifdef CONFIG_SND_HDA_POWER_SAVE
15281 if (!spec->loopback.amplist)
15282 spec->loopback.amplist = alc269_loopbacks;
15283 if (alc269_mic2_for_mute_led(codec))
15284 codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps;
15291 * ALC861 channel source setting (2/6 channel selection for 3-stack)
15295 * set the path ways for 2 channel output
15296 * need to set the codec line out and mic 1 pin widgets to inputs
15298 static const struct hda_verb alc861_threestack_ch2_init[] = {
15299 /* set pin widget 1Ah (line in) for input */
15300 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15301 /* set pin widget 18h (mic1/2) for input, for mic also enable
15304 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15306 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
15308 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15309 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
15315 * need to set the codec line out and mic 1 pin widgets to outputs
15317 static const struct hda_verb alc861_threestack_ch6_init[] = {
15318 /* set pin widget 1Ah (line in) for output (Back Surround)*/
15319 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15320 /* set pin widget 18h (mic1) for output (CLFE)*/
15321 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15323 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
15324 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
15326 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
15328 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15329 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
15334 static const struct hda_channel_mode alc861_threestack_modes[2] = {
15335 { 2, alc861_threestack_ch2_init },
15336 { 6, alc861_threestack_ch6_init },
15338 /* Set mic1 as input and unmute the mixer */
15339 static const struct hda_verb alc861_uniwill_m31_ch2_init[] = {
15340 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15341 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15344 /* Set mic1 as output and mute mixer */
15345 static const struct hda_verb alc861_uniwill_m31_ch4_init[] = {
15346 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15347 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15351 static const struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
15352 { 2, alc861_uniwill_m31_ch2_init },
15353 { 4, alc861_uniwill_m31_ch4_init },
15356 /* Set mic1 and line-in as input and unmute the mixer */
15357 static const struct hda_verb alc861_asus_ch2_init[] = {
15358 /* set pin widget 1Ah (line in) for input */
15359 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15360 /* set pin widget 18h (mic1/2) for input, for mic also enable
15363 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15365 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
15367 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15368 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
15372 /* Set mic1 nad line-in as output and mute mixer */
15373 static const struct hda_verb alc861_asus_ch6_init[] = {
15374 /* set pin widget 1Ah (line in) for output (Back Surround)*/
15375 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15376 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
15377 /* set pin widget 18h (mic1) for output (CLFE)*/
15378 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15379 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
15380 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
15381 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
15383 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
15385 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15386 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
15391 static const struct hda_channel_mode alc861_asus_modes[2] = {
15392 { 2, alc861_asus_ch2_init },
15393 { 6, alc861_asus_ch6_init },
15398 static const struct snd_kcontrol_new alc861_base_mixer[] = {
15399 /* output mixer control */
15400 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15401 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15402 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15403 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15404 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
15406 /*Input mixer control */
15407 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15408 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15409 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15410 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15411 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15412 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15413 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15414 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15415 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15416 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
15421 static const struct snd_kcontrol_new alc861_3ST_mixer[] = {
15422 /* output mixer control */
15423 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15424 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15425 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15426 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15427 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
15429 /* Input mixer control */
15430 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15431 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15432 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15433 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15434 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15435 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15436 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15437 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15438 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15439 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
15442 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15443 .name = "Channel Mode",
15444 .info = alc_ch_mode_info,
15445 .get = alc_ch_mode_get,
15446 .put = alc_ch_mode_put,
15447 .private_value = ARRAY_SIZE(alc861_threestack_modes),
15452 static const struct snd_kcontrol_new alc861_toshiba_mixer[] = {
15453 /* output mixer control */
15454 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15455 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15456 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15461 static const struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
15462 /* output mixer control */
15463 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15464 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15465 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15466 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15467 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
15469 /* Input mixer control */
15470 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15471 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15472 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15473 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15474 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15475 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15476 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15477 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15478 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15479 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
15482 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15483 .name = "Channel Mode",
15484 .info = alc_ch_mode_info,
15485 .get = alc_ch_mode_get,
15486 .put = alc_ch_mode_put,
15487 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
15492 static const struct snd_kcontrol_new alc861_asus_mixer[] = {
15493 /* output mixer control */
15494 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15495 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15496 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15497 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15498 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
15500 /* Input mixer control */
15501 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15502 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15503 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15504 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15505 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15506 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15507 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15508 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15509 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15510 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
15513 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15514 .name = "Channel Mode",
15515 .info = alc_ch_mode_info,
15516 .get = alc_ch_mode_get,
15517 .put = alc_ch_mode_put,
15518 .private_value = ARRAY_SIZE(alc861_asus_modes),
15523 /* additional mixer */
15524 static const struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
15525 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15526 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15531 * generic initialization of ADC, input mixers and output mixers
15533 static const struct hda_verb alc861_base_init_verbs[] = {
15535 * Unmute ADC0 and set the default input to mic-in
15537 /* port-A for surround (rear panel) */
15538 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15539 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
15540 /* port-B for mic-in (rear panel) with vref */
15541 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15542 /* port-C for line-in (rear panel) */
15543 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15544 /* port-D for Front */
15545 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15546 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15547 /* port-E for HP out (front panel) */
15548 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
15549 /* route front PCM to HP */
15550 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15551 /* port-F for mic-in (front panel) with vref */
15552 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15553 /* port-G for CLFE (rear panel) */
15554 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15555 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15556 /* port-H for side (rear panel) */
15557 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15558 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
15560 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15561 /* route front mic to ADC1*/
15562 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15563 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15565 /* Unmute DAC0~3 & spdif out*/
15566 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15567 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15568 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15569 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15570 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15572 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15573 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15574 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15575 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15576 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15578 /* Unmute Stereo Mixer 15 */
15579 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15580 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15581 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15582 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15584 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15585 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15586 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15587 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15588 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15589 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15590 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15591 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15592 /* hp used DAC 3 (Front) */
15593 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15594 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15599 static const struct hda_verb alc861_threestack_init_verbs[] = {
15601 * Unmute ADC0 and set the default input to mic-in
15603 /* port-A for surround (rear panel) */
15604 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15605 /* port-B for mic-in (rear panel) with vref */
15606 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15607 /* port-C for line-in (rear panel) */
15608 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15609 /* port-D for Front */
15610 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15611 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15612 /* port-E for HP out (front panel) */
15613 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
15614 /* route front PCM to HP */
15615 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15616 /* port-F for mic-in (front panel) with vref */
15617 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15618 /* port-G for CLFE (rear panel) */
15619 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15620 /* port-H for side (rear panel) */
15621 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15623 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15624 /* route front mic to ADC1*/
15625 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15626 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15627 /* Unmute DAC0~3 & spdif out*/
15628 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15629 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15630 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15631 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15632 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15634 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15635 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15636 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15637 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15638 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15640 /* Unmute Stereo Mixer 15 */
15641 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15642 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15643 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15644 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15646 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15647 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15648 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15649 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15650 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15651 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15652 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15653 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15654 /* hp used DAC 3 (Front) */
15655 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15656 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15660 static const struct hda_verb alc861_uniwill_m31_init_verbs[] = {
15662 * Unmute ADC0 and set the default input to mic-in
15664 /* port-A for surround (rear panel) */
15665 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15666 /* port-B for mic-in (rear panel) with vref */
15667 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15668 /* port-C for line-in (rear panel) */
15669 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15670 /* port-D for Front */
15671 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15672 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15673 /* port-E for HP out (front panel) */
15674 /* this has to be set to VREF80 */
15675 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15676 /* route front PCM to HP */
15677 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15678 /* port-F for mic-in (front panel) with vref */
15679 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15680 /* port-G for CLFE (rear panel) */
15681 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15682 /* port-H for side (rear panel) */
15683 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15685 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15686 /* route front mic to ADC1*/
15687 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15688 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15689 /* Unmute DAC0~3 & spdif out*/
15690 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15691 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15692 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15693 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15694 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15696 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15697 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15698 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15699 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15700 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15702 /* Unmute Stereo Mixer 15 */
15703 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15704 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15705 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15706 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15708 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15709 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15710 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15711 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15712 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15713 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15714 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15715 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15716 /* hp used DAC 3 (Front) */
15717 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15718 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15722 static const struct hda_verb alc861_asus_init_verbs[] = {
15724 * Unmute ADC0 and set the default input to mic-in
15726 /* port-A for surround (rear panel)
15727 * according to codec#0 this is the HP jack
15729 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
15730 /* route front PCM to HP */
15731 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
15732 /* port-B for mic-in (rear panel) with vref */
15733 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15734 /* port-C for line-in (rear panel) */
15735 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15736 /* port-D for Front */
15737 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15738 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15739 /* port-E for HP out (front panel) */
15740 /* this has to be set to VREF80 */
15741 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15742 /* route front PCM to HP */
15743 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15744 /* port-F for mic-in (front panel) with vref */
15745 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15746 /* port-G for CLFE (rear panel) */
15747 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15748 /* port-H for side (rear panel) */
15749 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15751 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15752 /* route front mic to ADC1*/
15753 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15754 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15755 /* Unmute DAC0~3 & spdif out*/
15756 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15757 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15758 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15759 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15760 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15761 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15762 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15763 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15764 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15765 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15767 /* Unmute Stereo Mixer 15 */
15768 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15769 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15770 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15771 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15773 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15774 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15775 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15776 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15777 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15778 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15779 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15780 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15781 /* hp used DAC 3 (Front) */
15782 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15783 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15787 /* additional init verbs for ASUS laptops */
15788 static const struct hda_verb alc861_asus_laptop_init_verbs[] = {
15789 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
15790 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
15794 static const struct hda_verb alc861_toshiba_init_verbs[] = {
15795 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15800 /* toggle speaker-output according to the hp-jack state */
15801 static void alc861_toshiba_automute(struct hda_codec *codec)
15803 unsigned int present = snd_hda_jack_detect(codec, 0x0f);
15805 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
15806 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
15807 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
15808 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
15811 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
15814 if ((res >> 26) == ALC880_HP_EVENT)
15815 alc861_toshiba_automute(codec);
15818 /* pcm configuration: identical with ALC880 */
15819 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
15820 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
15821 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
15822 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
15825 #define ALC861_DIGOUT_NID 0x07
15827 static const struct hda_channel_mode alc861_8ch_modes[1] = {
15831 static const hda_nid_t alc861_dac_nids[4] = {
15832 /* front, surround, clfe, side */
15833 0x03, 0x06, 0x05, 0x04
15836 static const hda_nid_t alc660_dac_nids[3] = {
15837 /* front, clfe, surround */
15841 static const hda_nid_t alc861_adc_nids[1] = {
15846 static const struct hda_input_mux alc861_capture_source = {
15850 { "Front Mic", 0x3 },
15857 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
15859 struct alc_spec *spec = codec->spec;
15860 hda_nid_t mix, srcs[5];
15863 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
15865 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
15868 for (i = 0; i < num; i++) {
15870 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
15871 if (type != AC_WID_AUD_OUT)
15873 if (!found_in_nid_list(srcs[i], spec->multiout.dac_nids,
15874 spec->multiout.num_dacs))
15880 /* fill in the dac_nids table from the parsed pin configuration */
15881 static int alc861_auto_fill_dac_nids(struct hda_codec *codec)
15883 struct alc_spec *spec = codec->spec;
15884 const struct auto_pin_cfg *cfg = &spec->autocfg;
15886 hda_nid_t nid, dac;
15888 spec->multiout.dac_nids = spec->private_dac_nids;
15889 for (i = 0; i < cfg->line_outs; i++) {
15890 nid = cfg->line_out_pins[i];
15891 dac = alc861_look_for_dac(codec, nid);
15894 spec->private_dac_nids[spec->multiout.num_dacs++] = dac;
15899 static int __alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
15900 hda_nid_t nid, int idx, unsigned int chs)
15902 return __add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx, idx,
15903 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
15906 #define alc861_create_out_sw(codec, pfx, nid, chs) \
15907 __alc861_create_out_sw(codec, pfx, nid, 0, chs)
15909 /* add playback controls from the parsed DAC table */
15910 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
15911 const struct auto_pin_cfg *cfg)
15913 struct alc_spec *spec = codec->spec;
15915 int i, err, noutputs;
15917 noutputs = cfg->line_outs;
15918 if (spec->multi_ios > 0)
15919 noutputs += spec->multi_ios;
15921 for (i = 0; i < noutputs; i++) {
15924 nid = spec->multiout.dac_nids[i];
15927 name = alc_get_line_out_pfx(spec, i, true, &index);
15930 err = alc861_create_out_sw(codec, "Center", nid, 1);
15933 err = alc861_create_out_sw(codec, "LFE", nid, 2);
15937 err = __alc861_create_out_sw(codec, name, nid, index, 3);
15945 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
15947 struct alc_spec *spec = codec->spec;
15954 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
15955 nid = alc861_look_for_dac(codec, pin);
15957 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
15960 spec->multiout.hp_nid = nid;
15966 /* create playback/capture controls for input pins */
15967 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
15968 const struct auto_pin_cfg *cfg)
15970 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
15973 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
15975 int pin_type, hda_nid_t dac)
15977 hda_nid_t mix, srcs[5];
15980 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
15982 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15984 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
15986 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
15989 for (i = 0; i < num; i++) {
15991 if (srcs[i] == dac || srcs[i] == 0x15)
15992 mute = AMP_IN_UNMUTE(i);
15994 mute = AMP_IN_MUTE(i);
15995 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16000 static void alc861_auto_init_multi_out(struct hda_codec *codec)
16002 struct alc_spec *spec = codec->spec;
16005 for (i = 0; i < spec->autocfg.line_outs + spec->multi_ios; i++) {
16006 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16007 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16009 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
16010 spec->multiout.dac_nids[i]);
16014 static void alc861_auto_init_hp_out(struct hda_codec *codec)
16016 struct alc_spec *spec = codec->spec;
16018 if (spec->autocfg.hp_outs)
16019 alc861_auto_set_output_and_unmute(codec,
16020 spec->autocfg.hp_pins[0],
16022 spec->multiout.hp_nid);
16023 if (spec->autocfg.speaker_outs)
16024 alc861_auto_set_output_and_unmute(codec,
16025 spec->autocfg.speaker_pins[0],
16027 spec->multiout.dac_nids[0]);
16030 #define alc861_auto_init_analog_input alc880_auto_init_analog_input
16032 /* parse the BIOS configuration and set up the alc_spec */
16033 /* return 1 if successful, 0 if the proper config is not found,
16034 * or a negative error code
16036 static int alc861_parse_auto_config(struct hda_codec *codec)
16038 struct alc_spec *spec = codec->spec;
16040 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
16042 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16046 if (!spec->autocfg.line_outs)
16047 return 0; /* can't find valid BIOS pin config */
16049 err = alc861_auto_fill_dac_nids(codec);
16052 err = alc_auto_add_multi_channel_mode(codec, alc861_auto_fill_dac_nids);
16055 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
16058 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
16061 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
16065 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16067 alc_auto_parse_digital(codec);
16069 if (spec->kctls.list)
16070 add_mixer(spec, spec->kctls.list);
16072 spec->num_mux_defs = 1;
16073 spec->input_mux = &spec->private_imux[0];
16075 spec->adc_nids = alc861_adc_nids;
16076 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
16077 set_capture_mixer(codec);
16079 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0);
16084 /* additional initialization for auto-configuration model */
16085 static void alc861_auto_init(struct hda_codec *codec)
16087 struct alc_spec *spec = codec->spec;
16088 alc861_auto_init_multi_out(codec);
16089 alc861_auto_init_hp_out(codec);
16090 alc861_auto_init_analog_input(codec);
16091 alc_auto_init_digital(codec);
16092 if (spec->unsol_event)
16093 alc_inithook(codec);
16096 #ifdef CONFIG_SND_HDA_POWER_SAVE
16097 static const struct hda_amp_list alc861_loopbacks[] = {
16098 { 0x15, HDA_INPUT, 0 },
16099 { 0x15, HDA_INPUT, 1 },
16100 { 0x15, HDA_INPUT, 2 },
16101 { 0x15, HDA_INPUT, 3 },
16108 * configuration and preset
16110 static const char * const alc861_models[ALC861_MODEL_LAST] = {
16111 [ALC861_3ST] = "3stack",
16112 [ALC660_3ST] = "3stack-660",
16113 [ALC861_3ST_DIG] = "3stack-dig",
16114 [ALC861_6ST_DIG] = "6stack-dig",
16115 [ALC861_UNIWILL_M31] = "uniwill-m31",
16116 [ALC861_TOSHIBA] = "toshiba",
16117 [ALC861_ASUS] = "asus",
16118 [ALC861_ASUS_LAPTOP] = "asus-laptop",
16119 [ALC861_AUTO] = "auto",
16122 static const struct snd_pci_quirk alc861_cfg_tbl[] = {
16123 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
16124 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
16125 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
16126 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
16127 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
16128 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
16129 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
16130 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
16131 * Any other models that need this preset?
16133 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
16134 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
16135 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
16136 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
16137 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
16138 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
16139 /* FIXME: the below seems conflict */
16140 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
16141 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
16142 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
16146 static const struct alc_config_preset alc861_presets[] = {
16148 .mixers = { alc861_3ST_mixer },
16149 .init_verbs = { alc861_threestack_init_verbs },
16150 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16151 .dac_nids = alc861_dac_nids,
16152 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
16153 .channel_mode = alc861_threestack_modes,
16155 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16156 .adc_nids = alc861_adc_nids,
16157 .input_mux = &alc861_capture_source,
16159 [ALC861_3ST_DIG] = {
16160 .mixers = { alc861_base_mixer },
16161 .init_verbs = { alc861_threestack_init_verbs },
16162 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16163 .dac_nids = alc861_dac_nids,
16164 .dig_out_nid = ALC861_DIGOUT_NID,
16165 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
16166 .channel_mode = alc861_threestack_modes,
16168 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16169 .adc_nids = alc861_adc_nids,
16170 .input_mux = &alc861_capture_source,
16172 [ALC861_6ST_DIG] = {
16173 .mixers = { alc861_base_mixer },
16174 .init_verbs = { alc861_base_init_verbs },
16175 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16176 .dac_nids = alc861_dac_nids,
16177 .dig_out_nid = ALC861_DIGOUT_NID,
16178 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
16179 .channel_mode = alc861_8ch_modes,
16180 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16181 .adc_nids = alc861_adc_nids,
16182 .input_mux = &alc861_capture_source,
16185 .mixers = { alc861_3ST_mixer },
16186 .init_verbs = { alc861_threestack_init_verbs },
16187 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
16188 .dac_nids = alc660_dac_nids,
16189 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
16190 .channel_mode = alc861_threestack_modes,
16192 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16193 .adc_nids = alc861_adc_nids,
16194 .input_mux = &alc861_capture_source,
16196 [ALC861_UNIWILL_M31] = {
16197 .mixers = { alc861_uniwill_m31_mixer },
16198 .init_verbs = { alc861_uniwill_m31_init_verbs },
16199 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16200 .dac_nids = alc861_dac_nids,
16201 .dig_out_nid = ALC861_DIGOUT_NID,
16202 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
16203 .channel_mode = alc861_uniwill_m31_modes,
16205 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16206 .adc_nids = alc861_adc_nids,
16207 .input_mux = &alc861_capture_source,
16209 [ALC861_TOSHIBA] = {
16210 .mixers = { alc861_toshiba_mixer },
16211 .init_verbs = { alc861_base_init_verbs,
16212 alc861_toshiba_init_verbs },
16213 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16214 .dac_nids = alc861_dac_nids,
16215 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
16216 .channel_mode = alc883_3ST_2ch_modes,
16217 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16218 .adc_nids = alc861_adc_nids,
16219 .input_mux = &alc861_capture_source,
16220 .unsol_event = alc861_toshiba_unsol_event,
16221 .init_hook = alc861_toshiba_automute,
16224 .mixers = { alc861_asus_mixer },
16225 .init_verbs = { alc861_asus_init_verbs },
16226 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16227 .dac_nids = alc861_dac_nids,
16228 .dig_out_nid = ALC861_DIGOUT_NID,
16229 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
16230 .channel_mode = alc861_asus_modes,
16233 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16234 .adc_nids = alc861_adc_nids,
16235 .input_mux = &alc861_capture_source,
16237 [ALC861_ASUS_LAPTOP] = {
16238 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
16239 .init_verbs = { alc861_asus_init_verbs,
16240 alc861_asus_laptop_init_verbs },
16241 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16242 .dac_nids = alc861_dac_nids,
16243 .dig_out_nid = ALC861_DIGOUT_NID,
16244 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
16245 .channel_mode = alc883_3ST_2ch_modes,
16247 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16248 .adc_nids = alc861_adc_nids,
16249 .input_mux = &alc861_capture_source,
16253 /* Pin config fixes */
16255 PINFIX_FSC_AMILO_PI1505,
16258 static const struct alc_fixup alc861_fixups[] = {
16259 [PINFIX_FSC_AMILO_PI1505] = {
16260 .type = ALC_FIXUP_PINS,
16261 .v.pins = (const struct alc_pincfg[]) {
16262 { 0x0b, 0x0221101f }, /* HP */
16263 { 0x0f, 0x90170310 }, /* speaker */
16269 static const struct snd_pci_quirk alc861_fixup_tbl[] = {
16270 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
16274 static int patch_alc861(struct hda_codec *codec)
16276 struct alc_spec *spec;
16280 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16284 codec->spec = spec;
16286 spec->mixer_nid = 0x15;
16288 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
16292 if (board_config < 0) {
16293 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
16295 board_config = ALC861_AUTO;
16298 if (board_config == ALC861_AUTO) {
16299 alc_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
16300 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
16303 if (board_config == ALC861_AUTO) {
16304 /* automatic parse from the BIOS config */
16305 err = alc861_parse_auto_config(codec);
16311 "hda_codec: Cannot set up configuration "
16312 "from BIOS. Using base mode...\n");
16313 board_config = ALC861_3ST_DIG;
16317 err = snd_hda_attach_beep_device(codec, 0x23);
16323 if (board_config != ALC861_AUTO)
16324 setup_preset(codec, &alc861_presets[board_config]);
16326 spec->stream_analog_playback = &alc861_pcm_analog_playback;
16327 spec->stream_analog_capture = &alc861_pcm_analog_capture;
16329 spec->stream_digital_playback = &alc861_pcm_digital_playback;
16330 spec->stream_digital_capture = &alc861_pcm_digital_capture;
16332 if (!spec->cap_mixer)
16333 set_capture_mixer(codec);
16334 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
16336 spec->vmaster_nid = 0x03;
16338 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
16340 codec->patch_ops = alc_patch_ops;
16341 if (board_config == ALC861_AUTO) {
16342 spec->init_hook = alc861_auto_init;
16343 #ifdef CONFIG_SND_HDA_POWER_SAVE
16344 spec->power_hook = alc_power_eapd;
16347 #ifdef CONFIG_SND_HDA_POWER_SAVE
16348 if (!spec->loopback.amplist)
16349 spec->loopback.amplist = alc861_loopbacks;
16356 * ALC861-VD support
16360 * In addition, an independent DAC
16362 #define ALC861VD_DIGOUT_NID 0x06
16364 static const hda_nid_t alc861vd_dac_nids[4] = {
16365 /* front, surr, clfe, side surr */
16366 0x02, 0x03, 0x04, 0x05
16369 /* dac_nids for ALC660vd are in a different order - according to
16370 * Realtek's driver.
16371 * This should probably result in a different mixer for 6stack models
16372 * of ALC660vd codecs, but for now there is only 3stack mixer
16373 * - and it is the same as in 861vd.
16374 * adc_nids in ALC660vd are (is) the same as in 861vd
16376 static const hda_nid_t alc660vd_dac_nids[3] = {
16377 /* front, rear, clfe, rear_surr */
16381 static const hda_nid_t alc861vd_adc_nids[1] = {
16386 static const hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
16389 /* FIXME: should be a matrix-type input source selection */
16390 static const struct hda_input_mux alc861vd_capture_source = {
16394 { "Front Mic", 0x1 },
16400 static const struct hda_input_mux alc861vd_dallas_capture_source = {
16404 { "Internal Mic", 0x1 },
16408 static const struct hda_input_mux alc861vd_hp_capture_source = {
16411 { "Front Mic", 0x0 },
16412 { "ATAPI Mic", 0x1 },
16419 static const struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
16426 static const struct hda_verb alc861vd_6stack_ch6_init[] = {
16427 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16428 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16429 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16430 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16437 static const struct hda_verb alc861vd_6stack_ch8_init[] = {
16438 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16439 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16440 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16441 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16445 static const struct hda_channel_mode alc861vd_6stack_modes[2] = {
16446 { 6, alc861vd_6stack_ch6_init },
16447 { 8, alc861vd_6stack_ch8_init },
16450 static const struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
16452 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16453 .name = "Channel Mode",
16454 .info = alc_ch_mode_info,
16455 .get = alc_ch_mode_get,
16456 .put = alc_ch_mode_put,
16461 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16462 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16464 static const struct snd_kcontrol_new alc861vd_6st_mixer[] = {
16465 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16466 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16468 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16469 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
16471 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
16473 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
16475 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
16476 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
16478 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
16479 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
16481 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16483 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
16484 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16485 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16487 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
16488 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16489 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16491 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16492 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16494 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16495 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16500 static const struct snd_kcontrol_new alc861vd_3st_mixer[] = {
16501 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16502 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16504 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16506 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
16507 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16508 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16510 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
16511 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16512 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16514 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16515 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16517 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16518 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16523 static const struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
16524 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16525 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
16526 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16528 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16530 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
16531 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16532 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16534 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
16535 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16536 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16538 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16539 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16544 /* Pin assignment: Speaker=0x14, HP = 0x15,
16545 * Mic=0x18, Internal Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
16547 static const struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
16548 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16549 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
16550 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16551 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
16552 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
16553 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16554 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16555 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
16556 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16557 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16561 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
16562 * Front Mic=0x18, ATAPI Mic = 0x19,
16564 static const struct snd_kcontrol_new alc861vd_hp_mixer[] = {
16565 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16566 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16567 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16568 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
16569 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16570 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16571 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16572 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16578 * generic initialization of ADC, input mixers and output mixers
16580 static const struct hda_verb alc861vd_volume_init_verbs[] = {
16582 * Unmute ADC0 and set the default input to mic-in
16584 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16585 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16587 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
16588 * the analog-loopback mixer widget
16590 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16591 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16592 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16593 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16594 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16595 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16597 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
16598 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16599 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16600 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
16601 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
16604 * Set up output mixers (0x02 - 0x05)
16606 /* set vol=0 to output mixers */
16607 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16608 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16609 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16610 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16612 /* set up input amps for analog loopback */
16613 /* Amp Indices: DAC = 0, mixer = 1 */
16614 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16615 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16616 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16617 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16618 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16619 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16620 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16621 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16627 * 3-stack pin configuration:
16628 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
16630 static const struct hda_verb alc861vd_3stack_init_verbs[] = {
16632 * Set pin mode and muting
16634 /* set front pin widgets 0x14 for output */
16635 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16636 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16637 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
16639 /* Mic (rear) pin: input vref at 80% */
16640 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16641 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16642 /* Front Mic pin: input vref at 80% */
16643 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16644 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16645 /* Line In pin: input */
16646 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16647 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16648 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16649 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16650 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16651 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16652 /* CD pin widget for input */
16653 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16659 * 6-stack pin configuration:
16661 static const struct hda_verb alc861vd_6stack_init_verbs[] = {
16663 * Set pin mode and muting
16665 /* set front pin widgets 0x14 for output */
16666 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16667 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16668 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
16670 /* Rear Pin: output 1 (0x0d) */
16671 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16672 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16673 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
16674 /* CLFE Pin: output 2 (0x0e) */
16675 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16676 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16677 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
16678 /* Side Pin: output 3 (0x0f) */
16679 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16680 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16681 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
16683 /* Mic (rear) pin: input vref at 80% */
16684 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16685 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16686 /* Front Mic pin: input vref at 80% */
16687 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16688 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16689 /* Line In pin: input */
16690 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16691 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16692 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16693 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16694 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16695 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16696 /* CD pin widget for input */
16697 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16702 static const struct hda_verb alc861vd_eapd_verbs[] = {
16703 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16707 static const struct hda_verb alc660vd_eapd_verbs[] = {
16708 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16709 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16713 static const struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
16714 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16715 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16716 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
16717 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16718 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16722 static void alc861vd_lenovo_setup(struct hda_codec *codec)
16724 struct alc_spec *spec = codec->spec;
16725 spec->autocfg.hp_pins[0] = 0x1b;
16726 spec->autocfg.speaker_pins[0] = 0x14;
16727 spec->automute = 1;
16728 spec->automute_mode = ALC_AUTOMUTE_AMP;
16731 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
16733 alc_hp_automute(codec);
16734 alc88x_simple_mic_automute(codec);
16737 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
16740 switch (res >> 26) {
16741 case ALC880_MIC_EVENT:
16742 alc88x_simple_mic_automute(codec);
16745 alc_sku_unsol_event(codec, res);
16750 static const struct hda_verb alc861vd_dallas_verbs[] = {
16751 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16752 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16753 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16754 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16756 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16757 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16758 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16759 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16760 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16761 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16762 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16763 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16765 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16766 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16767 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16768 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16769 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16770 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16771 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16772 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16774 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
16775 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16776 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
16777 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16778 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16779 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16780 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16781 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16783 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16784 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16785 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16786 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16788 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16789 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16790 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16795 /* toggle speaker-output according to the hp-jack state */
16796 static void alc861vd_dallas_setup(struct hda_codec *codec)
16798 struct alc_spec *spec = codec->spec;
16800 spec->autocfg.hp_pins[0] = 0x15;
16801 spec->autocfg.speaker_pins[0] = 0x14;
16802 spec->automute = 1;
16803 spec->automute_mode = ALC_AUTOMUTE_AMP;
16806 #ifdef CONFIG_SND_HDA_POWER_SAVE
16807 #define alc861vd_loopbacks alc880_loopbacks
16810 /* pcm configuration: identical with ALC880 */
16811 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
16812 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
16813 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
16814 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
16817 * configuration and preset
16819 static const char * const alc861vd_models[ALC861VD_MODEL_LAST] = {
16820 [ALC660VD_3ST] = "3stack-660",
16821 [ALC660VD_3ST_DIG] = "3stack-660-digout",
16822 [ALC660VD_ASUS_V1S] = "asus-v1s",
16823 [ALC861VD_3ST] = "3stack",
16824 [ALC861VD_3ST_DIG] = "3stack-digout",
16825 [ALC861VD_6ST_DIG] = "6stack-digout",
16826 [ALC861VD_LENOVO] = "lenovo",
16827 [ALC861VD_DALLAS] = "dallas",
16828 [ALC861VD_HP] = "hp",
16829 [ALC861VD_AUTO] = "auto",
16832 static const struct snd_pci_quirk alc861vd_cfg_tbl[] = {
16833 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
16834 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
16835 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
16836 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
16837 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
16838 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
16839 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
16840 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
16841 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
16842 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
16843 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
16844 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
16845 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
16846 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
16847 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
16851 static const struct alc_config_preset alc861vd_presets[] = {
16853 .mixers = { alc861vd_3st_mixer },
16854 .init_verbs = { alc861vd_volume_init_verbs,
16855 alc861vd_3stack_init_verbs },
16856 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16857 .dac_nids = alc660vd_dac_nids,
16858 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16859 .channel_mode = alc861vd_3stack_2ch_modes,
16860 .input_mux = &alc861vd_capture_source,
16862 [ALC660VD_3ST_DIG] = {
16863 .mixers = { alc861vd_3st_mixer },
16864 .init_verbs = { alc861vd_volume_init_verbs,
16865 alc861vd_3stack_init_verbs },
16866 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16867 .dac_nids = alc660vd_dac_nids,
16868 .dig_out_nid = ALC861VD_DIGOUT_NID,
16869 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16870 .channel_mode = alc861vd_3stack_2ch_modes,
16871 .input_mux = &alc861vd_capture_source,
16874 .mixers = { alc861vd_3st_mixer },
16875 .init_verbs = { alc861vd_volume_init_verbs,
16876 alc861vd_3stack_init_verbs },
16877 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16878 .dac_nids = alc861vd_dac_nids,
16879 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16880 .channel_mode = alc861vd_3stack_2ch_modes,
16881 .input_mux = &alc861vd_capture_source,
16883 [ALC861VD_3ST_DIG] = {
16884 .mixers = { alc861vd_3st_mixer },
16885 .init_verbs = { alc861vd_volume_init_verbs,
16886 alc861vd_3stack_init_verbs },
16887 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16888 .dac_nids = alc861vd_dac_nids,
16889 .dig_out_nid = ALC861VD_DIGOUT_NID,
16890 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16891 .channel_mode = alc861vd_3stack_2ch_modes,
16892 .input_mux = &alc861vd_capture_source,
16894 [ALC861VD_6ST_DIG] = {
16895 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
16896 .init_verbs = { alc861vd_volume_init_verbs,
16897 alc861vd_6stack_init_verbs },
16898 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16899 .dac_nids = alc861vd_dac_nids,
16900 .dig_out_nid = ALC861VD_DIGOUT_NID,
16901 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
16902 .channel_mode = alc861vd_6stack_modes,
16903 .input_mux = &alc861vd_capture_source,
16905 [ALC861VD_LENOVO] = {
16906 .mixers = { alc861vd_lenovo_mixer },
16907 .init_verbs = { alc861vd_volume_init_verbs,
16908 alc861vd_3stack_init_verbs,
16909 alc861vd_eapd_verbs,
16910 alc861vd_lenovo_unsol_verbs },
16911 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16912 .dac_nids = alc660vd_dac_nids,
16913 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16914 .channel_mode = alc861vd_3stack_2ch_modes,
16915 .input_mux = &alc861vd_capture_source,
16916 .unsol_event = alc861vd_lenovo_unsol_event,
16917 .setup = alc861vd_lenovo_setup,
16918 .init_hook = alc861vd_lenovo_init_hook,
16920 [ALC861VD_DALLAS] = {
16921 .mixers = { alc861vd_dallas_mixer },
16922 .init_verbs = { alc861vd_dallas_verbs },
16923 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16924 .dac_nids = alc861vd_dac_nids,
16925 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16926 .channel_mode = alc861vd_3stack_2ch_modes,
16927 .input_mux = &alc861vd_dallas_capture_source,
16928 .unsol_event = alc_sku_unsol_event,
16929 .setup = alc861vd_dallas_setup,
16930 .init_hook = alc_hp_automute,
16933 .mixers = { alc861vd_hp_mixer },
16934 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
16935 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16936 .dac_nids = alc861vd_dac_nids,
16937 .dig_out_nid = ALC861VD_DIGOUT_NID,
16938 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16939 .channel_mode = alc861vd_3stack_2ch_modes,
16940 .input_mux = &alc861vd_hp_capture_source,
16941 .unsol_event = alc_sku_unsol_event,
16942 .setup = alc861vd_dallas_setup,
16943 .init_hook = alc_hp_automute,
16945 [ALC660VD_ASUS_V1S] = {
16946 .mixers = { alc861vd_lenovo_mixer },
16947 .init_verbs = { alc861vd_volume_init_verbs,
16948 alc861vd_3stack_init_verbs,
16949 alc861vd_eapd_verbs,
16950 alc861vd_lenovo_unsol_verbs },
16951 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16952 .dac_nids = alc660vd_dac_nids,
16953 .dig_out_nid = ALC861VD_DIGOUT_NID,
16954 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16955 .channel_mode = alc861vd_3stack_2ch_modes,
16956 .input_mux = &alc861vd_capture_source,
16957 .unsol_event = alc861vd_lenovo_unsol_event,
16958 .setup = alc861vd_lenovo_setup,
16959 .init_hook = alc861vd_lenovo_init_hook,
16964 * BIOS auto configuration
16966 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
16967 const struct auto_pin_cfg *cfg)
16969 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x22, 0);
16973 #define alc861vd_auto_init_multi_out alc882_auto_init_multi_out
16974 #define alc861vd_auto_init_hp_out alc882_auto_init_hp_out
16975 #define alc861vd_auto_init_analog_input alc882_auto_init_analog_input
16976 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
16978 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
16979 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
16981 /* add playback controls from the parsed DAC table */
16982 /* Based on ALC880 version. But ALC861VD has separate,
16983 * different NIDs for mute/unmute switch and volume control */
16984 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
16985 const struct auto_pin_cfg *cfg)
16987 hda_nid_t nid_v, nid_s;
16988 int i, err, noutputs;
16990 noutputs = cfg->line_outs;
16991 if (spec->multi_ios > 0)
16992 noutputs += spec->multi_ios;
16994 for (i = 0; i < noutputs; i++) {
16997 if (!spec->multiout.dac_nids[i])
16999 nid_v = alc861vd_idx_to_mixer_vol(
17001 spec->multiout.dac_nids[i]));
17002 nid_s = alc861vd_idx_to_mixer_switch(
17004 spec->multiout.dac_nids[i]));
17006 name = alc_get_line_out_pfx(spec, i, true, &index);
17009 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
17011 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
17015 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
17017 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
17021 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
17023 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
17027 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
17029 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
17034 err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
17036 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
17040 err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
17042 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
17051 /* add playback controls for speaker and HP outputs */
17052 /* Based on ALC880 version. But ALC861VD has separate,
17053 * different NIDs for mute/unmute switch and volume control */
17054 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
17055 hda_nid_t pin, const char *pfx)
17057 hda_nid_t nid_v, nid_s;
17063 if (alc880_is_fixed_pin(pin)) {
17064 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
17065 /* specify the DAC as the extra output */
17066 if (!spec->multiout.hp_nid)
17067 spec->multiout.hp_nid = nid_v;
17069 spec->multiout.extra_out_nid[0] = nid_v;
17070 /* control HP volume/switch on the output mixer amp */
17071 nid_v = alc861vd_idx_to_mixer_vol(
17072 alc880_fixed_pin_idx(pin));
17073 nid_s = alc861vd_idx_to_mixer_switch(
17074 alc880_fixed_pin_idx(pin));
17076 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
17077 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
17080 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
17081 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
17084 } else if (alc880_is_multi_pin(pin)) {
17085 /* set manual connection */
17086 /* we have only a switch on HP-out PIN */
17087 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17088 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17095 /* parse the BIOS configuration and set up the alc_spec
17096 * return 1 if successful, 0 if the proper config is not found,
17097 * or a negative error code
17098 * Based on ALC880 version - had to change it to override
17099 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
17100 static int alc861vd_parse_auto_config(struct hda_codec *codec)
17102 struct alc_spec *spec = codec->spec;
17104 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
17106 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17110 if (!spec->autocfg.line_outs)
17111 return 0; /* can't find valid BIOS pin config */
17113 err = alc880_auto_fill_dac_nids(codec);
17116 err = alc_auto_add_multi_channel_mode(codec, alc880_auto_fill_dac_nids);
17119 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
17122 err = alc861vd_auto_create_extra_out(spec,
17123 spec->autocfg.speaker_pins[0],
17127 err = alc861vd_auto_create_extra_out(spec,
17128 spec->autocfg.hp_pins[0],
17132 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
17136 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
17138 alc_auto_parse_digital(codec);
17140 if (spec->kctls.list)
17141 add_mixer(spec, spec->kctls.list);
17143 spec->num_mux_defs = 1;
17144 spec->input_mux = &spec->private_imux[0];
17146 err = alc_auto_add_mic_boost(codec);
17150 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
17155 /* additional initialization for auto-configuration model */
17156 static void alc861vd_auto_init(struct hda_codec *codec)
17158 struct alc_spec *spec = codec->spec;
17159 alc861vd_auto_init_multi_out(codec);
17160 alc861vd_auto_init_hp_out(codec);
17161 alc861vd_auto_init_analog_input(codec);
17162 alc861vd_auto_init_input_src(codec);
17163 alc_auto_init_digital(codec);
17164 if (spec->unsol_event)
17165 alc_inithook(codec);
17169 ALC660VD_FIX_ASUS_GPIO1
17173 static const struct alc_fixup alc861vd_fixups[] = {
17174 [ALC660VD_FIX_ASUS_GPIO1] = {
17175 .type = ALC_FIXUP_VERBS,
17176 .v.verbs = (const struct hda_verb[]) {
17177 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
17178 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
17179 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
17185 static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
17186 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
17190 static int patch_alc861vd(struct hda_codec *codec)
17192 struct alc_spec *spec;
17193 int err, board_config;
17195 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
17199 codec->spec = spec;
17201 spec->mixer_nid = 0x0b;
17203 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
17207 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
17208 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
17210 board_config = ALC861VD_AUTO;
17213 if (board_config == ALC861VD_AUTO) {
17214 alc_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
17215 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
17218 if (board_config == ALC861VD_AUTO) {
17219 /* automatic parse from the BIOS config */
17220 err = alc861vd_parse_auto_config(codec);
17226 "hda_codec: Cannot set up configuration "
17227 "from BIOS. Using base mode...\n");
17228 board_config = ALC861VD_3ST;
17232 err = snd_hda_attach_beep_device(codec, 0x23);
17238 if (board_config != ALC861VD_AUTO)
17239 setup_preset(codec, &alc861vd_presets[board_config]);
17241 if (codec->vendor_id == 0x10ec0660) {
17242 /* always turn on EAPD */
17243 add_verb(spec, alc660vd_eapd_verbs);
17246 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
17247 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
17249 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
17250 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
17252 if (!spec->adc_nids) {
17253 spec->adc_nids = alc861vd_adc_nids;
17254 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
17256 if (!spec->capsrc_nids)
17257 spec->capsrc_nids = alc861vd_capsrc_nids;
17259 set_capture_mixer(codec);
17260 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
17262 spec->vmaster_nid = 0x02;
17264 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
17266 codec->patch_ops = alc_patch_ops;
17268 if (board_config == ALC861VD_AUTO)
17269 spec->init_hook = alc861vd_auto_init;
17270 spec->shutup = alc_eapd_shutup;
17271 #ifdef CONFIG_SND_HDA_POWER_SAVE
17272 if (!spec->loopback.amplist)
17273 spec->loopback.amplist = alc861vd_loopbacks;
17282 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
17283 * configuration. Each pin widget can choose any input DACs and a mixer.
17284 * Each ADC is connected from a mixer of all inputs. This makes possible
17285 * 6-channel independent captures.
17287 * In addition, an independent DAC for the multi-playback (not used in this
17290 #define ALC662_DIGOUT_NID 0x06
17291 #define ALC662_DIGIN_NID 0x0a
17293 static const hda_nid_t alc662_dac_nids[3] = {
17294 /* front, rear, clfe */
17298 static const hda_nid_t alc272_dac_nids[2] = {
17302 static const hda_nid_t alc662_adc_nids[2] = {
17307 static const hda_nid_t alc272_adc_nids[1] = {
17312 static const hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
17313 static const hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
17317 /* FIXME: should be a matrix-type input source selection */
17318 static const struct hda_input_mux alc662_capture_source = {
17322 { "Front Mic", 0x1 },
17328 static const struct hda_input_mux alc662_lenovo_101e_capture_source = {
17336 static const struct hda_input_mux alc663_capture_source = {
17340 { "Front Mic", 0x1 },
17345 #if 0 /* set to 1 for testing other input sources below */
17346 static const struct hda_input_mux alc272_nc10_capture_source = {
17349 { "Autoselect Mic", 0x0 },
17350 { "Internal Mic", 0x1 },
17351 { "In-0x02", 0x2 },
17352 { "In-0x03", 0x3 },
17353 { "In-0x04", 0x4 },
17354 { "In-0x05", 0x5 },
17355 { "In-0x06", 0x6 },
17356 { "In-0x07", 0x7 },
17357 { "In-0x08", 0x8 },
17358 { "In-0x09", 0x9 },
17359 { "In-0x0a", 0x0a },
17360 { "In-0x0b", 0x0b },
17361 { "In-0x0c", 0x0c },
17362 { "In-0x0d", 0x0d },
17363 { "In-0x0e", 0x0e },
17364 { "In-0x0f", 0x0f },
17372 static const struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
17379 static const struct hda_verb alc662_3ST_ch2_init[] = {
17380 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
17381 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
17382 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
17383 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
17390 static const struct hda_verb alc662_3ST_ch6_init[] = {
17391 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17392 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
17393 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
17394 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17395 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
17396 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
17400 static const struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
17401 { 2, alc662_3ST_ch2_init },
17402 { 6, alc662_3ST_ch6_init },
17408 static const struct hda_verb alc662_sixstack_ch6_init[] = {
17409 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
17410 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
17411 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17418 static const struct hda_verb alc662_sixstack_ch8_init[] = {
17419 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17420 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17421 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17425 static const struct hda_channel_mode alc662_5stack_modes[2] = {
17426 { 2, alc662_sixstack_ch6_init },
17427 { 6, alc662_sixstack_ch8_init },
17430 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
17431 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
17434 static const struct snd_kcontrol_new alc662_base_mixer[] = {
17435 /* output mixer control */
17436 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
17437 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17438 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
17439 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
17440 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17441 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17442 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
17443 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
17444 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17446 /*Input mixer control */
17447 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
17448 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
17449 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
17450 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
17451 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
17452 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
17453 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
17454 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
17458 static const struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
17459 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17460 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17461 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17462 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
17463 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
17464 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17465 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17466 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17467 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17468 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17469 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17473 static const struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
17474 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17475 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17476 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17477 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
17478 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17479 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17480 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
17481 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
17482 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17483 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
17484 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
17485 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17486 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17487 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17488 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17489 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17490 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17494 static const struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
17495 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17496 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
17497 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17498 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
17499 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17500 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17501 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17502 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17503 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17507 static const struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
17508 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17509 ALC262_HIPPO_MASTER_SWITCH,
17511 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
17512 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17513 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17515 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
17516 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17517 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17521 static const struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
17522 ALC262_HIPPO_MASTER_SWITCH,
17523 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17524 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17525 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17526 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17527 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
17528 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17529 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17530 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17531 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17535 static const struct hda_bind_ctls alc663_asus_bind_master_vol = {
17536 .ops = &snd_hda_bind_vol,
17538 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
17539 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
17544 static const struct hda_bind_ctls alc663_asus_one_bind_switch = {
17545 .ops = &snd_hda_bind_sw,
17547 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17548 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17553 static const struct snd_kcontrol_new alc663_m51va_mixer[] = {
17554 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17555 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
17556 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17557 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17561 static const struct hda_bind_ctls alc663_asus_tree_bind_switch = {
17562 .ops = &snd_hda_bind_sw,
17564 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17565 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17566 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17571 static const struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
17572 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17573 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
17574 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17575 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17576 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17577 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17582 static const struct hda_bind_ctls alc663_asus_four_bind_switch = {
17583 .ops = &snd_hda_bind_sw,
17585 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17586 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17587 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
17592 static const struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
17593 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17594 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
17595 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17596 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17597 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17598 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17602 static const struct snd_kcontrol_new alc662_1bjd_mixer[] = {
17603 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17604 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17605 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17606 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17607 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17608 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17609 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17613 static const struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
17614 .ops = &snd_hda_bind_vol,
17616 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
17617 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
17622 static const struct hda_bind_ctls alc663_asus_two_bind_switch = {
17623 .ops = &snd_hda_bind_sw,
17625 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17626 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
17631 static const struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
17632 HDA_BIND_VOL("Master Playback Volume",
17633 &alc663_asus_two_bind_master_vol),
17634 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
17635 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17636 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17637 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17638 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17642 static const struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
17643 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17644 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
17645 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17646 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17647 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17648 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17652 static const struct snd_kcontrol_new alc663_g71v_mixer[] = {
17653 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17654 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17655 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17656 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17657 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17659 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17660 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17661 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17662 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17666 static const struct snd_kcontrol_new alc663_g50v_mixer[] = {
17667 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17668 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17669 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17671 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17672 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17673 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17674 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17675 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17676 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17680 static const struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
17681 .ops = &snd_hda_bind_sw,
17683 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17684 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17685 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
17686 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
17687 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17692 static const struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
17693 .ops = &snd_hda_bind_sw,
17695 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17696 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
17701 static const struct snd_kcontrol_new alc663_mode7_mixer[] = {
17702 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17703 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17704 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
17705 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17706 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17707 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17708 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17709 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17710 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17714 static const struct snd_kcontrol_new alc663_mode8_mixer[] = {
17715 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17716 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17717 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
17718 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17719 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17720 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17721 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17726 static const struct snd_kcontrol_new alc662_chmode_mixer[] = {
17728 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
17729 .name = "Channel Mode",
17730 .info = alc_ch_mode_info,
17731 .get = alc_ch_mode_get,
17732 .put = alc_ch_mode_put,
17737 static const struct hda_verb alc662_init_verbs[] = {
17738 /* ADC: mute amp left and right */
17739 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17740 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
17742 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17743 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17744 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17745 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17746 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17747 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17749 /* Front Pin: output 0 (0x0c) */
17750 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17751 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17753 /* Rear Pin: output 1 (0x0d) */
17754 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17755 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17757 /* CLFE Pin: output 2 (0x0e) */
17758 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17759 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17761 /* Mic (rear) pin: input vref at 80% */
17762 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
17763 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17764 /* Front Mic pin: input vref at 80% */
17765 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
17766 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17767 /* Line In pin: input */
17768 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17769 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17770 /* Line-2 In: Headphone output (output 0 - 0x0c) */
17771 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17772 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17773 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
17774 /* CD pin widget for input */
17775 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17777 /* FIXME: use matrix-type input source selection */
17778 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
17780 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17781 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17786 static const struct hda_verb alc662_eapd_init_verbs[] = {
17787 /* always trun on EAPD */
17788 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
17789 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
17793 static const struct hda_verb alc662_sue_init_verbs[] = {
17794 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
17795 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
17799 static const struct hda_verb alc662_eeepc_sue_init_verbs[] = {
17800 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17801 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17805 /* Set Unsolicited Event*/
17806 static const struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
17807 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17808 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17812 static const struct hda_verb alc663_m51va_init_verbs[] = {
17813 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17814 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17815 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17816 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17817 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17818 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17819 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17820 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17821 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17825 static const struct hda_verb alc663_21jd_amic_init_verbs[] = {
17826 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17827 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17828 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17829 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17830 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17831 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17832 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17836 static const struct hda_verb alc662_1bjd_amic_init_verbs[] = {
17837 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17838 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17839 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17840 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17841 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17842 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17843 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17844 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17848 static const struct hda_verb alc663_15jd_amic_init_verbs[] = {
17849 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17850 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17851 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17852 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17853 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17854 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17855 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17859 static const struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
17860 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17861 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17862 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17863 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
17864 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17865 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17866 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
17867 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17868 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17869 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17870 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17871 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17875 static const struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
17876 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17877 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17878 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17879 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17880 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17881 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17882 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17883 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17884 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17885 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17886 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17887 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17891 static const struct hda_verb alc663_g71v_init_verbs[] = {
17892 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17893 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
17894 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
17896 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17897 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17898 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17900 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
17901 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
17902 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
17906 static const struct hda_verb alc663_g50v_init_verbs[] = {
17907 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17908 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17909 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17911 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17912 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17916 static const struct hda_verb alc662_ecs_init_verbs[] = {
17917 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
17918 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17919 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17920 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17924 static const struct hda_verb alc272_dell_zm1_init_verbs[] = {
17925 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17926 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17927 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17928 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17929 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17930 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17931 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17932 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17933 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17934 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17935 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17939 static const struct hda_verb alc272_dell_init_verbs[] = {
17940 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17941 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17942 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17943 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17944 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17945 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17946 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17947 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17948 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17949 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17950 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17954 static const struct hda_verb alc663_mode7_init_verbs[] = {
17955 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17956 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17957 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17958 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17959 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17960 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17961 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
17962 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17963 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17964 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17965 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17966 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17967 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17968 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17969 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17973 static const struct hda_verb alc663_mode8_init_verbs[] = {
17974 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17975 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17976 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17977 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
17978 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17979 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17980 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17981 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17982 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17983 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17984 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17985 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17986 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17987 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17988 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17989 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17993 static const struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
17994 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
17995 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
17999 static const struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
18000 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
18001 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
18005 static void alc662_lenovo_101e_setup(struct hda_codec *codec)
18007 struct alc_spec *spec = codec->spec;
18009 spec->autocfg.hp_pins[0] = 0x1b;
18010 spec->autocfg.line_out_pins[0] = 0x14;
18011 spec->autocfg.speaker_pins[0] = 0x15;
18012 spec->automute = 1;
18013 spec->detect_line = 1;
18014 spec->automute_lines = 1;
18015 spec->automute_mode = ALC_AUTOMUTE_AMP;
18018 static void alc662_eeepc_setup(struct hda_codec *codec)
18020 struct alc_spec *spec = codec->spec;
18022 alc262_hippo1_setup(codec);
18023 spec->ext_mic.pin = 0x18;
18024 spec->ext_mic.mux_idx = 0;
18025 spec->int_mic.pin = 0x19;
18026 spec->int_mic.mux_idx = 1;
18027 spec->auto_mic = 1;
18030 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
18032 struct alc_spec *spec = codec->spec;
18034 spec->autocfg.hp_pins[0] = 0x14;
18035 spec->autocfg.speaker_pins[0] = 0x1b;
18036 spec->automute = 1;
18037 spec->automute_mode = ALC_AUTOMUTE_AMP;
18040 static void alc663_m51va_setup(struct hda_codec *codec)
18042 struct alc_spec *spec = codec->spec;
18043 spec->autocfg.hp_pins[0] = 0x21;
18044 spec->autocfg.speaker_pins[0] = 0x14;
18045 spec->automute_mixer_nid[0] = 0x0c;
18046 spec->automute = 1;
18047 spec->automute_mode = ALC_AUTOMUTE_MIXER;
18048 spec->ext_mic.pin = 0x18;
18049 spec->ext_mic.mux_idx = 0;
18050 spec->int_mic.pin = 0x12;
18051 spec->int_mic.mux_idx = 9;
18052 spec->auto_mic = 1;
18055 /* ***************** Mode1 ******************************/
18056 static void alc663_mode1_setup(struct hda_codec *codec)
18058 struct alc_spec *spec = codec->spec;
18059 spec->autocfg.hp_pins[0] = 0x21;
18060 spec->autocfg.speaker_pins[0] = 0x14;
18061 spec->automute_mixer_nid[0] = 0x0c;
18062 spec->automute = 1;
18063 spec->automute_mode = ALC_AUTOMUTE_MIXER;
18064 spec->ext_mic.pin = 0x18;
18065 spec->ext_mic.mux_idx = 0;
18066 spec->int_mic.pin = 0x19;
18067 spec->int_mic.mux_idx = 1;
18068 spec->auto_mic = 1;
18071 /* ***************** Mode2 ******************************/
18072 static void alc662_mode2_setup(struct hda_codec *codec)
18074 struct alc_spec *spec = codec->spec;
18075 spec->autocfg.hp_pins[0] = 0x1b;
18076 spec->autocfg.speaker_pins[0] = 0x14;
18077 spec->automute = 1;
18078 spec->automute_mode = ALC_AUTOMUTE_PIN;
18079 spec->ext_mic.pin = 0x18;
18080 spec->ext_mic.mux_idx = 0;
18081 spec->int_mic.pin = 0x19;
18082 spec->int_mic.mux_idx = 1;
18083 spec->auto_mic = 1;
18086 /* ***************** Mode3 ******************************/
18087 static void alc663_mode3_setup(struct hda_codec *codec)
18089 struct alc_spec *spec = codec->spec;
18090 spec->autocfg.hp_pins[0] = 0x21;
18091 spec->autocfg.hp_pins[0] = 0x15;
18092 spec->autocfg.speaker_pins[0] = 0x14;
18093 spec->automute = 1;
18094 spec->automute_mode = ALC_AUTOMUTE_PIN;
18095 spec->ext_mic.pin = 0x18;
18096 spec->ext_mic.mux_idx = 0;
18097 spec->int_mic.pin = 0x19;
18098 spec->int_mic.mux_idx = 1;
18099 spec->auto_mic = 1;
18102 /* ***************** Mode4 ******************************/
18103 static void alc663_mode4_setup(struct hda_codec *codec)
18105 struct alc_spec *spec = codec->spec;
18106 spec->autocfg.hp_pins[0] = 0x21;
18107 spec->autocfg.speaker_pins[0] = 0x14;
18108 spec->autocfg.speaker_pins[1] = 0x16;
18109 spec->automute_mixer_nid[0] = 0x0c;
18110 spec->automute_mixer_nid[1] = 0x0e;
18111 spec->automute = 1;
18112 spec->automute_mode = ALC_AUTOMUTE_MIXER;
18113 spec->ext_mic.pin = 0x18;
18114 spec->ext_mic.mux_idx = 0;
18115 spec->int_mic.pin = 0x19;
18116 spec->int_mic.mux_idx = 1;
18117 spec->auto_mic = 1;
18120 /* ***************** Mode5 ******************************/
18121 static void alc663_mode5_setup(struct hda_codec *codec)
18123 struct alc_spec *spec = codec->spec;
18124 spec->autocfg.hp_pins[0] = 0x15;
18125 spec->autocfg.speaker_pins[0] = 0x14;
18126 spec->autocfg.speaker_pins[1] = 0x16;
18127 spec->automute_mixer_nid[0] = 0x0c;
18128 spec->automute_mixer_nid[1] = 0x0e;
18129 spec->automute = 1;
18130 spec->automute_mode = ALC_AUTOMUTE_MIXER;
18131 spec->ext_mic.pin = 0x18;
18132 spec->ext_mic.mux_idx = 0;
18133 spec->int_mic.pin = 0x19;
18134 spec->int_mic.mux_idx = 1;
18135 spec->auto_mic = 1;
18138 /* ***************** Mode6 ******************************/
18139 static void alc663_mode6_setup(struct hda_codec *codec)
18141 struct alc_spec *spec = codec->spec;
18142 spec->autocfg.hp_pins[0] = 0x1b;
18143 spec->autocfg.hp_pins[0] = 0x15;
18144 spec->autocfg.speaker_pins[0] = 0x14;
18145 spec->automute_mixer_nid[0] = 0x0c;
18146 spec->automute = 1;
18147 spec->automute_mode = ALC_AUTOMUTE_MIXER;
18148 spec->ext_mic.pin = 0x18;
18149 spec->ext_mic.mux_idx = 0;
18150 spec->int_mic.pin = 0x19;
18151 spec->int_mic.mux_idx = 1;
18152 spec->auto_mic = 1;
18155 /* ***************** Mode7 ******************************/
18156 static void alc663_mode7_setup(struct hda_codec *codec)
18158 struct alc_spec *spec = codec->spec;
18159 spec->autocfg.hp_pins[0] = 0x1b;
18160 spec->autocfg.hp_pins[0] = 0x21;
18161 spec->autocfg.speaker_pins[0] = 0x14;
18162 spec->autocfg.speaker_pins[0] = 0x17;
18163 spec->automute = 1;
18164 spec->automute_mode = ALC_AUTOMUTE_PIN;
18165 spec->ext_mic.pin = 0x18;
18166 spec->ext_mic.mux_idx = 0;
18167 spec->int_mic.pin = 0x19;
18168 spec->int_mic.mux_idx = 1;
18169 spec->auto_mic = 1;
18172 /* ***************** Mode8 ******************************/
18173 static void alc663_mode8_setup(struct hda_codec *codec)
18175 struct alc_spec *spec = codec->spec;
18176 spec->autocfg.hp_pins[0] = 0x21;
18177 spec->autocfg.hp_pins[1] = 0x15;
18178 spec->autocfg.speaker_pins[0] = 0x14;
18179 spec->autocfg.speaker_pins[0] = 0x17;
18180 spec->automute = 1;
18181 spec->automute_mode = ALC_AUTOMUTE_PIN;
18182 spec->ext_mic.pin = 0x18;
18183 spec->ext_mic.mux_idx = 0;
18184 spec->int_mic.pin = 0x12;
18185 spec->int_mic.mux_idx = 9;
18186 spec->auto_mic = 1;
18189 static void alc663_g71v_setup(struct hda_codec *codec)
18191 struct alc_spec *spec = codec->spec;
18192 spec->autocfg.hp_pins[0] = 0x21;
18193 spec->autocfg.line_out_pins[0] = 0x15;
18194 spec->autocfg.speaker_pins[0] = 0x14;
18195 spec->automute = 1;
18196 spec->automute_mode = ALC_AUTOMUTE_AMP;
18197 spec->detect_line = 1;
18198 spec->automute_lines = 1;
18199 spec->ext_mic.pin = 0x18;
18200 spec->ext_mic.mux_idx = 0;
18201 spec->int_mic.pin = 0x12;
18202 spec->int_mic.mux_idx = 9;
18203 spec->auto_mic = 1;
18206 #define alc663_g50v_setup alc663_m51va_setup
18208 static const struct snd_kcontrol_new alc662_ecs_mixer[] = {
18209 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
18210 ALC262_HIPPO_MASTER_SWITCH,
18212 HDA_CODEC_VOLUME("Mic/LineIn Boost Volume", 0x18, 0, HDA_INPUT),
18213 HDA_CODEC_VOLUME("Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
18214 HDA_CODEC_MUTE("Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
18216 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
18217 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
18218 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
18222 static const struct snd_kcontrol_new alc272_nc10_mixer[] = {
18223 /* Master Playback automatically created from Speaker and Headphone */
18224 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
18225 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
18226 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
18227 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
18229 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
18230 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
18231 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
18233 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
18234 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
18235 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
18239 #ifdef CONFIG_SND_HDA_POWER_SAVE
18240 #define alc662_loopbacks alc880_loopbacks
18244 /* pcm configuration: identical with ALC880 */
18245 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
18246 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
18247 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
18248 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
18251 * configuration and preset
18253 static const char * const alc662_models[ALC662_MODEL_LAST] = {
18254 [ALC662_3ST_2ch_DIG] = "3stack-dig",
18255 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
18256 [ALC662_3ST_6ch] = "3stack-6ch",
18257 [ALC662_5ST_DIG] = "5stack-dig",
18258 [ALC662_LENOVO_101E] = "lenovo-101e",
18259 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
18260 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
18261 [ALC662_ECS] = "ecs",
18262 [ALC663_ASUS_M51VA] = "m51va",
18263 [ALC663_ASUS_G71V] = "g71v",
18264 [ALC663_ASUS_H13] = "h13",
18265 [ALC663_ASUS_G50V] = "g50v",
18266 [ALC663_ASUS_MODE1] = "asus-mode1",
18267 [ALC662_ASUS_MODE2] = "asus-mode2",
18268 [ALC663_ASUS_MODE3] = "asus-mode3",
18269 [ALC663_ASUS_MODE4] = "asus-mode4",
18270 [ALC663_ASUS_MODE5] = "asus-mode5",
18271 [ALC663_ASUS_MODE6] = "asus-mode6",
18272 [ALC663_ASUS_MODE7] = "asus-mode7",
18273 [ALC663_ASUS_MODE8] = "asus-mode8",
18274 [ALC272_DELL] = "dell",
18275 [ALC272_DELL_ZM1] = "dell-zm1",
18276 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
18277 [ALC662_AUTO] = "auto",
18280 static const struct snd_pci_quirk alc662_cfg_tbl[] = {
18281 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
18282 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
18283 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
18284 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
18285 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
18286 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1),
18287 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
18288 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
18289 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
18290 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
18291 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
18292 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
18293 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
18294 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
18295 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
18296 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
18297 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
18298 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
18299 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
18300 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
18301 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
18302 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
18303 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
18304 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
18305 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
18306 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
18307 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
18308 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
18309 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
18310 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
18311 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
18312 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
18313 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
18314 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
18315 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
18316 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
18317 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
18318 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
18319 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
18320 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
18321 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
18322 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1),
18323 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
18324 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
18325 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
18326 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
18327 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
18328 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
18329 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
18330 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
18331 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
18332 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
18333 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
18334 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
18335 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
18336 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
18337 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
18338 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
18339 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
18340 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
18341 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
18342 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
18343 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
18344 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
18345 ALC662_3ST_6ch_DIG),
18346 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO),
18347 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
18348 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
18349 ALC662_3ST_6ch_DIG),
18350 SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13),
18351 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
18352 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
18353 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
18354 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
18355 ALC662_3ST_6ch_DIG),
18356 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
18358 SND_PCI_QUIRK(0x1991, 0x5628, "Ordissimo EVE", ALC662_LENOVO_101E),
18362 static const struct alc_config_preset alc662_presets[] = {
18363 [ALC662_3ST_2ch_DIG] = {
18364 .mixers = { alc662_3ST_2ch_mixer },
18365 .init_verbs = { alc662_init_verbs, alc662_eapd_init_verbs },
18366 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18367 .dac_nids = alc662_dac_nids,
18368 .dig_out_nid = ALC662_DIGOUT_NID,
18369 .dig_in_nid = ALC662_DIGIN_NID,
18370 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18371 .channel_mode = alc662_3ST_2ch_modes,
18372 .input_mux = &alc662_capture_source,
18374 [ALC662_3ST_6ch_DIG] = {
18375 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18376 .init_verbs = { alc662_init_verbs, alc662_eapd_init_verbs },
18377 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18378 .dac_nids = alc662_dac_nids,
18379 .dig_out_nid = ALC662_DIGOUT_NID,
18380 .dig_in_nid = ALC662_DIGIN_NID,
18381 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18382 .channel_mode = alc662_3ST_6ch_modes,
18384 .input_mux = &alc662_capture_source,
18386 [ALC662_3ST_6ch] = {
18387 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18388 .init_verbs = { alc662_init_verbs, alc662_eapd_init_verbs },
18389 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18390 .dac_nids = alc662_dac_nids,
18391 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18392 .channel_mode = alc662_3ST_6ch_modes,
18394 .input_mux = &alc662_capture_source,
18396 [ALC662_5ST_DIG] = {
18397 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
18398 .init_verbs = { alc662_init_verbs, alc662_eapd_init_verbs },
18399 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18400 .dac_nids = alc662_dac_nids,
18401 .dig_out_nid = ALC662_DIGOUT_NID,
18402 .dig_in_nid = ALC662_DIGIN_NID,
18403 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
18404 .channel_mode = alc662_5stack_modes,
18405 .input_mux = &alc662_capture_source,
18407 [ALC662_LENOVO_101E] = {
18408 .mixers = { alc662_lenovo_101e_mixer },
18409 .init_verbs = { alc662_init_verbs,
18410 alc662_eapd_init_verbs,
18411 alc662_sue_init_verbs },
18412 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18413 .dac_nids = alc662_dac_nids,
18414 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18415 .channel_mode = alc662_3ST_2ch_modes,
18416 .input_mux = &alc662_lenovo_101e_capture_source,
18417 .unsol_event = alc_sku_unsol_event,
18418 .setup = alc662_lenovo_101e_setup,
18419 .init_hook = alc_inithook,
18421 [ALC662_ASUS_EEEPC_P701] = {
18422 .mixers = { alc662_eeepc_p701_mixer },
18423 .init_verbs = { alc662_init_verbs,
18424 alc662_eapd_init_verbs,
18425 alc662_eeepc_sue_init_verbs },
18426 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18427 .dac_nids = alc662_dac_nids,
18428 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18429 .channel_mode = alc662_3ST_2ch_modes,
18430 .unsol_event = alc_sku_unsol_event,
18431 .setup = alc662_eeepc_setup,
18432 .init_hook = alc_inithook,
18434 [ALC662_ASUS_EEEPC_EP20] = {
18435 .mixers = { alc662_eeepc_ep20_mixer,
18436 alc662_chmode_mixer },
18437 .init_verbs = { alc662_init_verbs,
18438 alc662_eapd_init_verbs,
18439 alc662_eeepc_ep20_sue_init_verbs },
18440 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18441 .dac_nids = alc662_dac_nids,
18442 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18443 .channel_mode = alc662_3ST_6ch_modes,
18444 .input_mux = &alc662_lenovo_101e_capture_source,
18445 .unsol_event = alc_sku_unsol_event,
18446 .setup = alc662_eeepc_ep20_setup,
18447 .init_hook = alc_inithook,
18450 .mixers = { alc662_ecs_mixer },
18451 .init_verbs = { alc662_init_verbs,
18452 alc662_eapd_init_verbs,
18453 alc662_ecs_init_verbs },
18454 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18455 .dac_nids = alc662_dac_nids,
18456 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18457 .channel_mode = alc662_3ST_2ch_modes,
18458 .unsol_event = alc_sku_unsol_event,
18459 .setup = alc662_eeepc_setup,
18460 .init_hook = alc_inithook,
18462 [ALC663_ASUS_M51VA] = {
18463 .mixers = { alc663_m51va_mixer },
18464 .init_verbs = { alc662_init_verbs,
18465 alc662_eapd_init_verbs,
18466 alc663_m51va_init_verbs },
18467 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18468 .dac_nids = alc662_dac_nids,
18469 .dig_out_nid = ALC662_DIGOUT_NID,
18470 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18471 .channel_mode = alc662_3ST_2ch_modes,
18472 .unsol_event = alc_sku_unsol_event,
18473 .setup = alc663_m51va_setup,
18474 .init_hook = alc_inithook,
18476 [ALC663_ASUS_G71V] = {
18477 .mixers = { alc663_g71v_mixer },
18478 .init_verbs = { alc662_init_verbs,
18479 alc662_eapd_init_verbs,
18480 alc663_g71v_init_verbs },
18481 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18482 .dac_nids = alc662_dac_nids,
18483 .dig_out_nid = ALC662_DIGOUT_NID,
18484 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18485 .channel_mode = alc662_3ST_2ch_modes,
18486 .unsol_event = alc_sku_unsol_event,
18487 .setup = alc663_g71v_setup,
18488 .init_hook = alc_inithook,
18490 [ALC663_ASUS_H13] = {
18491 .mixers = { alc663_m51va_mixer },
18492 .init_verbs = { alc662_init_verbs,
18493 alc662_eapd_init_verbs,
18494 alc663_m51va_init_verbs },
18495 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18496 .dac_nids = alc662_dac_nids,
18497 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18498 .channel_mode = alc662_3ST_2ch_modes,
18499 .setup = alc663_m51va_setup,
18500 .unsol_event = alc_sku_unsol_event,
18501 .init_hook = alc_inithook,
18503 [ALC663_ASUS_G50V] = {
18504 .mixers = { alc663_g50v_mixer },
18505 .init_verbs = { alc662_init_verbs,
18506 alc662_eapd_init_verbs,
18507 alc663_g50v_init_verbs },
18508 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18509 .dac_nids = alc662_dac_nids,
18510 .dig_out_nid = ALC662_DIGOUT_NID,
18511 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18512 .channel_mode = alc662_3ST_6ch_modes,
18513 .input_mux = &alc663_capture_source,
18514 .unsol_event = alc_sku_unsol_event,
18515 .setup = alc663_g50v_setup,
18516 .init_hook = alc_inithook,
18518 [ALC663_ASUS_MODE1] = {
18519 .mixers = { alc663_m51va_mixer },
18520 .cap_mixer = alc662_auto_capture_mixer,
18521 .init_verbs = { alc662_init_verbs,
18522 alc662_eapd_init_verbs,
18523 alc663_21jd_amic_init_verbs },
18524 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18526 .dac_nids = alc662_dac_nids,
18527 .dig_out_nid = ALC662_DIGOUT_NID,
18528 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18529 .channel_mode = alc662_3ST_2ch_modes,
18530 .unsol_event = alc_sku_unsol_event,
18531 .setup = alc663_mode1_setup,
18532 .init_hook = alc_inithook,
18534 [ALC662_ASUS_MODE2] = {
18535 .mixers = { alc662_1bjd_mixer },
18536 .cap_mixer = alc662_auto_capture_mixer,
18537 .init_verbs = { alc662_init_verbs,
18538 alc662_eapd_init_verbs,
18539 alc662_1bjd_amic_init_verbs },
18540 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18541 .dac_nids = alc662_dac_nids,
18542 .dig_out_nid = ALC662_DIGOUT_NID,
18543 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18544 .channel_mode = alc662_3ST_2ch_modes,
18545 .unsol_event = alc_sku_unsol_event,
18546 .setup = alc662_mode2_setup,
18547 .init_hook = alc_inithook,
18549 [ALC663_ASUS_MODE3] = {
18550 .mixers = { alc663_two_hp_m1_mixer },
18551 .cap_mixer = alc662_auto_capture_mixer,
18552 .init_verbs = { alc662_init_verbs,
18553 alc662_eapd_init_verbs,
18554 alc663_two_hp_amic_m1_init_verbs },
18555 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18557 .dac_nids = alc662_dac_nids,
18558 .dig_out_nid = ALC662_DIGOUT_NID,
18559 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18560 .channel_mode = alc662_3ST_2ch_modes,
18561 .unsol_event = alc_sku_unsol_event,
18562 .setup = alc663_mode3_setup,
18563 .init_hook = alc_inithook,
18565 [ALC663_ASUS_MODE4] = {
18566 .mixers = { alc663_asus_21jd_clfe_mixer },
18567 .cap_mixer = alc662_auto_capture_mixer,
18568 .init_verbs = { alc662_init_verbs,
18569 alc662_eapd_init_verbs,
18570 alc663_21jd_amic_init_verbs},
18571 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18573 .dac_nids = alc662_dac_nids,
18574 .dig_out_nid = ALC662_DIGOUT_NID,
18575 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18576 .channel_mode = alc662_3ST_2ch_modes,
18577 .unsol_event = alc_sku_unsol_event,
18578 .setup = alc663_mode4_setup,
18579 .init_hook = alc_inithook,
18581 [ALC663_ASUS_MODE5] = {
18582 .mixers = { alc663_asus_15jd_clfe_mixer },
18583 .cap_mixer = alc662_auto_capture_mixer,
18584 .init_verbs = { alc662_init_verbs,
18585 alc662_eapd_init_verbs,
18586 alc663_15jd_amic_init_verbs },
18587 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18589 .dac_nids = alc662_dac_nids,
18590 .dig_out_nid = ALC662_DIGOUT_NID,
18591 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18592 .channel_mode = alc662_3ST_2ch_modes,
18593 .unsol_event = alc_sku_unsol_event,
18594 .setup = alc663_mode5_setup,
18595 .init_hook = alc_inithook,
18597 [ALC663_ASUS_MODE6] = {
18598 .mixers = { alc663_two_hp_m2_mixer },
18599 .cap_mixer = alc662_auto_capture_mixer,
18600 .init_verbs = { alc662_init_verbs,
18601 alc662_eapd_init_verbs,
18602 alc663_two_hp_amic_m2_init_verbs },
18603 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18605 .dac_nids = alc662_dac_nids,
18606 .dig_out_nid = ALC662_DIGOUT_NID,
18607 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18608 .channel_mode = alc662_3ST_2ch_modes,
18609 .unsol_event = alc_sku_unsol_event,
18610 .setup = alc663_mode6_setup,
18611 .init_hook = alc_inithook,
18613 [ALC663_ASUS_MODE7] = {
18614 .mixers = { alc663_mode7_mixer },
18615 .cap_mixer = alc662_auto_capture_mixer,
18616 .init_verbs = { alc662_init_verbs,
18617 alc662_eapd_init_verbs,
18618 alc663_mode7_init_verbs },
18619 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18621 .dac_nids = alc662_dac_nids,
18622 .dig_out_nid = ALC662_DIGOUT_NID,
18623 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18624 .channel_mode = alc662_3ST_2ch_modes,
18625 .unsol_event = alc_sku_unsol_event,
18626 .setup = alc663_mode7_setup,
18627 .init_hook = alc_inithook,
18629 [ALC663_ASUS_MODE8] = {
18630 .mixers = { alc663_mode8_mixer },
18631 .cap_mixer = alc662_auto_capture_mixer,
18632 .init_verbs = { alc662_init_verbs,
18633 alc662_eapd_init_verbs,
18634 alc663_mode8_init_verbs },
18635 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18637 .dac_nids = alc662_dac_nids,
18638 .dig_out_nid = ALC662_DIGOUT_NID,
18639 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18640 .channel_mode = alc662_3ST_2ch_modes,
18641 .unsol_event = alc_sku_unsol_event,
18642 .setup = alc663_mode8_setup,
18643 .init_hook = alc_inithook,
18646 .mixers = { alc663_m51va_mixer },
18647 .cap_mixer = alc272_auto_capture_mixer,
18648 .init_verbs = { alc662_init_verbs,
18649 alc662_eapd_init_verbs,
18650 alc272_dell_init_verbs },
18651 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18652 .dac_nids = alc272_dac_nids,
18653 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18654 .adc_nids = alc272_adc_nids,
18655 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
18656 .capsrc_nids = alc272_capsrc_nids,
18657 .channel_mode = alc662_3ST_2ch_modes,
18658 .unsol_event = alc_sku_unsol_event,
18659 .setup = alc663_m51va_setup,
18660 .init_hook = alc_inithook,
18662 [ALC272_DELL_ZM1] = {
18663 .mixers = { alc663_m51va_mixer },
18664 .cap_mixer = alc662_auto_capture_mixer,
18665 .init_verbs = { alc662_init_verbs,
18666 alc662_eapd_init_verbs,
18667 alc272_dell_zm1_init_verbs },
18668 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18669 .dac_nids = alc272_dac_nids,
18670 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18671 .adc_nids = alc662_adc_nids,
18673 .capsrc_nids = alc662_capsrc_nids,
18674 .channel_mode = alc662_3ST_2ch_modes,
18675 .unsol_event = alc_sku_unsol_event,
18676 .setup = alc663_m51va_setup,
18677 .init_hook = alc_inithook,
18679 [ALC272_SAMSUNG_NC10] = {
18680 .mixers = { alc272_nc10_mixer },
18681 .init_verbs = { alc662_init_verbs,
18682 alc662_eapd_init_verbs,
18683 alc663_21jd_amic_init_verbs },
18684 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18685 .dac_nids = alc272_dac_nids,
18686 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18687 .channel_mode = alc662_3ST_2ch_modes,
18688 /*.input_mux = &alc272_nc10_capture_source,*/
18689 .unsol_event = alc_sku_unsol_event,
18690 .setup = alc663_mode4_setup,
18691 .init_hook = alc_inithook,
18697 * BIOS auto configuration
18700 /* convert from MIX nid to DAC */
18701 static hda_nid_t alc_auto_mix_to_dac(struct hda_codec *codec, hda_nid_t nid)
18706 num = snd_hda_get_connections(codec, nid, list, ARRAY_SIZE(list));
18707 for (i = 0; i < num; i++) {
18708 if (get_wcaps_type(get_wcaps(codec, list[i])) == AC_WID_AUD_OUT)
18714 /* go down to the selector widget before the mixer */
18715 static hda_nid_t alc_go_down_to_selector(struct hda_codec *codec, hda_nid_t pin)
18718 int num = snd_hda_get_connections(codec, pin, srcs,
18721 get_wcaps_type(get_wcaps(codec, srcs[0])) != AC_WID_AUD_SEL)
18726 /* get MIX nid connected to the given pin targeted to DAC */
18727 static hda_nid_t alc_auto_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
18733 pin = alc_go_down_to_selector(codec, pin);
18734 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
18735 for (i = 0; i < num; i++) {
18736 if (alc_auto_mix_to_dac(codec, mix[i]) == dac)
18742 /* select the connection from pin to DAC if needed */
18743 static int alc_auto_select_dac(struct hda_codec *codec, hda_nid_t pin,
18749 pin = alc_go_down_to_selector(codec, pin);
18750 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
18753 for (i = 0; i < num; i++) {
18754 if (alc_auto_mix_to_dac(codec, mix[i]) == dac) {
18755 snd_hda_codec_update_cache(codec, pin, 0,
18756 AC_VERB_SET_CONNECT_SEL, i);
18763 /* look for an empty DAC slot */
18764 static hda_nid_t alc_auto_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
18766 struct alc_spec *spec = codec->spec;
18770 pin = alc_go_down_to_selector(codec, pin);
18771 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
18772 for (i = 0; i < num; i++) {
18773 hda_nid_t nid = alc_auto_mix_to_dac(codec, srcs[i]);
18776 if (found_in_nid_list(nid, spec->multiout.dac_nids,
18777 spec->multiout.num_dacs))
18779 if (spec->multiout.hp_nid == nid)
18781 if (found_in_nid_list(nid, spec->multiout.extra_out_nid,
18782 ARRAY_SIZE(spec->multiout.extra_out_nid)))
18789 static hda_nid_t get_dac_if_single(struct hda_codec *codec, hda_nid_t pin)
18791 hda_nid_t sel = alc_go_down_to_selector(codec, pin);
18792 if (snd_hda_get_conn_list(codec, sel, NULL) == 1)
18793 return alc_auto_look_for_dac(codec, pin);
18797 /* fill in the dac_nids table from the parsed pin configuration */
18798 static int alc662_auto_fill_dac_nids(struct hda_codec *codec)
18800 struct alc_spec *spec = codec->spec;
18801 const struct auto_pin_cfg *cfg = &spec->autocfg;
18802 bool redone = false;
18806 spec->multiout.num_dacs = 0;
18807 spec->multiout.hp_nid = 0;
18808 spec->multiout.extra_out_nid[0] = 0;
18809 memset(spec->private_dac_nids, 0, sizeof(spec->private_dac_nids));
18810 spec->multiout.dac_nids = spec->private_dac_nids;
18812 /* fill hard-wired DACs first */
18814 for (i = 0; i < cfg->line_outs; i++)
18815 spec->private_dac_nids[i] =
18816 get_dac_if_single(codec, cfg->line_out_pins[i]);
18818 spec->multiout.hp_nid =
18819 get_dac_if_single(codec, cfg->hp_pins[0]);
18820 if (cfg->speaker_outs)
18821 spec->multiout.extra_out_nid[0] =
18822 get_dac_if_single(codec, cfg->speaker_pins[0]);
18825 for (i = 0; i < cfg->line_outs; i++) {
18826 hda_nid_t pin = cfg->line_out_pins[i];
18827 if (spec->private_dac_nids[i])
18829 spec->private_dac_nids[i] = alc_auto_look_for_dac(codec, pin);
18830 if (!spec->private_dac_nids[i] && !redone) {
18831 /* if we can't find primary DACs, re-probe without
18832 * checking the hard-wired DACs
18839 for (i = 0; i < cfg->line_outs; i++) {
18840 if (spec->private_dac_nids[i])
18841 spec->multiout.num_dacs++;
18843 memmove(spec->private_dac_nids + i,
18844 spec->private_dac_nids + i + 1,
18845 sizeof(hda_nid_t) * (cfg->line_outs - i - 1));
18848 if (cfg->hp_outs && !spec->multiout.hp_nid)
18849 spec->multiout.hp_nid =
18850 alc_auto_look_for_dac(codec, cfg->hp_pins[0]);
18851 if (cfg->speaker_outs && !spec->multiout.extra_out_nid[0])
18852 spec->multiout.extra_out_nid[0] =
18853 alc_auto_look_for_dac(codec, cfg->speaker_pins[0]);
18858 static int alc662_add_vol_ctl(struct hda_codec *codec,
18859 const char *pfx, int cidx,
18860 hda_nid_t nid, unsigned int chs)
18862 return __add_pb_vol_ctrl(codec->spec, ALC_CTL_WIDGET_VOL, pfx, cidx,
18863 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
18866 #define alc662_add_stereo_vol(codec, pfx, cidx, nid) \
18867 alc662_add_vol_ctl(codec, pfx, cidx, nid, 3)
18869 /* create a mute-switch for the given mixer widget;
18870 * if it has multiple sources (e.g. DAC and loopback), create a bind-mute
18872 static int alc662_add_sw_ctl(struct hda_codec *codec,
18873 const char *pfx, int cidx,
18874 hda_nid_t nid, unsigned int chs)
18878 if (snd_hda_get_conn_list(codec, nid, NULL) == 1) {
18879 type = ALC_CTL_WIDGET_MUTE;
18880 val = HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT);
18882 type = ALC_CTL_BIND_MUTE;
18883 val = HDA_COMPOSE_AMP_VAL(nid, chs, 2, HDA_INPUT);
18885 return __add_pb_sw_ctrl(codec->spec, type, pfx, cidx, val);
18888 #define alc662_add_stereo_sw(codec, pfx, cidx, nid) \
18889 alc662_add_sw_ctl(codec, pfx, cidx, nid, 3)
18891 /* add playback controls from the parsed DAC table */
18892 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
18893 const struct auto_pin_cfg *cfg)
18895 struct alc_spec *spec = codec->spec;
18896 hda_nid_t nid, mix, pin;
18897 int i, err, noutputs;
18899 noutputs = cfg->line_outs;
18900 if (spec->multi_ios > 0)
18901 noutputs += spec->multi_ios;
18903 for (i = 0; i < noutputs; i++) {
18906 nid = spec->multiout.dac_nids[i];
18909 if (i >= cfg->line_outs)
18910 pin = spec->multi_io[i - 1].pin;
18912 pin = cfg->line_out_pins[i];
18913 mix = alc_auto_dac_to_mix(codec, pin, nid);
18916 name = alc_get_line_out_pfx(spec, i, true, &index);
18919 err = alc662_add_vol_ctl(codec, "Center", 0, nid, 1);
18922 err = alc662_add_vol_ctl(codec, "LFE", 0, nid, 2);
18925 err = alc662_add_sw_ctl(codec, "Center", 0, mix, 1);
18928 err = alc662_add_sw_ctl(codec, "LFE", 0, mix, 2);
18932 err = alc662_add_stereo_vol(codec, name, index, nid);
18935 err = alc662_add_stereo_sw(codec, name, index, mix);
18943 /* add playback controls for speaker and HP outputs */
18944 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
18945 hda_nid_t dac, const char *pfx)
18947 struct alc_spec *spec = codec->spec;
18954 /* the corresponding DAC is already occupied */
18955 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
18956 return 0; /* no way */
18957 /* create a switch only */
18958 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
18959 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
18962 mix = alc_auto_dac_to_mix(codec, pin, dac);
18965 err = alc662_add_stereo_vol(codec, pfx, 0, dac);
18968 err = alc662_add_stereo_sw(codec, pfx, 0, mix);
18974 /* create playback/capture controls for input pins */
18975 #define alc662_auto_create_input_ctls \
18976 alc882_auto_create_input_ctls
18978 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
18979 hda_nid_t nid, int pin_type,
18984 hda_nid_t srcs[HDA_MAX_CONNECTIONS];
18986 alc_set_pin_output(codec, nid, pin_type);
18987 nid = alc_go_down_to_selector(codec, nid);
18988 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
18989 for (i = 0; i < num; i++) {
18990 if (alc_auto_mix_to_dac(codec, srcs[i]) != dac)
18998 /* need the manual connection? */
19000 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
19001 /* unmute mixer widget inputs */
19002 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
19004 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
19006 /* initialize volume */
19007 if (query_amp_caps(codec, dac, HDA_OUTPUT) & AC_AMPCAP_NUM_STEPS)
19009 else if (query_amp_caps(codec, mix, HDA_OUTPUT) & AC_AMPCAP_NUM_STEPS)
19013 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
19017 static void alc662_auto_init_multi_out(struct hda_codec *codec)
19019 struct alc_spec *spec = codec->spec;
19020 int pin_type = get_pin_type(spec->autocfg.line_out_type);
19023 for (i = 0; i <= HDA_SIDE; i++) {
19024 hda_nid_t nid = spec->autocfg.line_out_pins[i];
19026 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
19027 spec->multiout.dac_nids[i]);
19031 static void alc662_auto_init_hp_out(struct hda_codec *codec)
19033 struct alc_spec *spec = codec->spec;
19036 pin = spec->autocfg.hp_pins[0];
19038 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
19039 spec->multiout.hp_nid);
19040 pin = spec->autocfg.speaker_pins[0];
19042 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
19043 spec->multiout.extra_out_nid[0]);
19046 #define alc662_auto_init_analog_input alc882_auto_init_analog_input
19047 #define alc662_auto_init_input_src alc882_auto_init_input_src
19052 static int alc_auto_fill_multi_ios(struct hda_codec *codec,
19053 unsigned int location)
19055 struct alc_spec *spec = codec->spec;
19056 struct auto_pin_cfg *cfg = &spec->autocfg;
19057 int type, i, num_pins = 0;
19059 for (type = AUTO_PIN_LINE_IN; type >= AUTO_PIN_MIC; type--) {
19060 for (i = 0; i < cfg->num_inputs; i++) {
19061 hda_nid_t nid = cfg->inputs[i].pin;
19063 unsigned int defcfg, caps;
19064 if (cfg->inputs[i].type != type)
19066 defcfg = snd_hda_codec_get_pincfg(codec, nid);
19067 if (get_defcfg_connect(defcfg) != AC_JACK_PORT_COMPLEX)
19069 if (location && get_defcfg_location(defcfg) != location)
19071 caps = snd_hda_query_pin_caps(codec, nid);
19072 if (!(caps & AC_PINCAP_OUT))
19074 dac = alc_auto_look_for_dac(codec, nid);
19077 spec->multi_io[num_pins].pin = nid;
19078 spec->multi_io[num_pins].dac = dac;
19080 spec->private_dac_nids[spec->multiout.num_dacs++] = dac;
19083 spec->multiout.num_dacs = 1;
19089 static int alc_auto_ch_mode_info(struct snd_kcontrol *kcontrol,
19090 struct snd_ctl_elem_info *uinfo)
19092 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
19093 struct alc_spec *spec = codec->spec;
19095 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
19097 uinfo->value.enumerated.items = spec->multi_ios + 1;
19098 if (uinfo->value.enumerated.item > spec->multi_ios)
19099 uinfo->value.enumerated.item = spec->multi_ios;
19100 sprintf(uinfo->value.enumerated.name, "%dch",
19101 (uinfo->value.enumerated.item + 1) * 2);
19105 static int alc_auto_ch_mode_get(struct snd_kcontrol *kcontrol,
19106 struct snd_ctl_elem_value *ucontrol)
19108 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
19109 struct alc_spec *spec = codec->spec;
19110 ucontrol->value.enumerated.item[0] = (spec->ext_channel_count - 1) / 2;
19114 static int alc_set_multi_io(struct hda_codec *codec, int idx, bool output)
19116 struct alc_spec *spec = codec->spec;
19117 hda_nid_t nid = spec->multi_io[idx].pin;
19119 if (!spec->multi_io[idx].ctl_in)
19120 spec->multi_io[idx].ctl_in =
19121 snd_hda_codec_read(codec, nid, 0,
19122 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
19124 snd_hda_codec_update_cache(codec, nid, 0,
19125 AC_VERB_SET_PIN_WIDGET_CONTROL,
19127 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
19128 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
19130 alc_auto_select_dac(codec, nid, spec->multi_io[idx].dac);
19132 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
19133 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
19134 HDA_AMP_MUTE, HDA_AMP_MUTE);
19135 snd_hda_codec_update_cache(codec, nid, 0,
19136 AC_VERB_SET_PIN_WIDGET_CONTROL,
19137 spec->multi_io[idx].ctl_in);
19142 static int alc_auto_ch_mode_put(struct snd_kcontrol *kcontrol,
19143 struct snd_ctl_elem_value *ucontrol)
19145 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
19146 struct alc_spec *spec = codec->spec;
19149 ch = ucontrol->value.enumerated.item[0];
19150 if (ch < 0 || ch > spec->multi_ios)
19152 if (ch == (spec->ext_channel_count - 1) / 2)
19154 spec->ext_channel_count = (ch + 1) * 2;
19155 for (i = 0; i < spec->multi_ios; i++)
19156 alc_set_multi_io(codec, i, i < ch);
19157 spec->multiout.max_channels = spec->ext_channel_count;
19161 static const struct snd_kcontrol_new alc_auto_channel_mode_enum = {
19162 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
19163 .name = "Channel Mode",
19164 .info = alc_auto_ch_mode_info,
19165 .get = alc_auto_ch_mode_get,
19166 .put = alc_auto_ch_mode_put,
19169 static int alc_auto_add_multi_channel_mode(struct hda_codec *codec,
19170 int (*fill_dac)(struct hda_codec *))
19172 struct alc_spec *spec = codec->spec;
19173 struct auto_pin_cfg *cfg = &spec->autocfg;
19174 unsigned int location, defcfg;
19177 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT && cfg->hp_outs == 1) {
19178 /* use HP as primary out */
19179 cfg->speaker_outs = cfg->line_outs;
19180 memcpy(cfg->speaker_pins, cfg->line_out_pins,
19181 sizeof(cfg->speaker_pins));
19182 cfg->line_outs = cfg->hp_outs;
19183 memcpy(cfg->line_out_pins, cfg->hp_pins, sizeof(cfg->hp_pins));
19185 memset(cfg->hp_pins, 0, sizeof(cfg->hp_pins));
19186 cfg->line_out_type = AUTO_PIN_HP_OUT;
19190 if (cfg->line_outs != 1 ||
19191 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
19194 defcfg = snd_hda_codec_get_pincfg(codec, cfg->line_out_pins[0]);
19195 location = get_defcfg_location(defcfg);
19197 num_pins = alc_auto_fill_multi_ios(codec, location);
19198 if (num_pins > 0) {
19199 struct snd_kcontrol_new *knew;
19201 knew = alc_kcontrol_new(spec);
19204 *knew = alc_auto_channel_mode_enum;
19205 knew->name = kstrdup("Channel Mode", GFP_KERNEL);
19209 spec->multi_ios = num_pins;
19210 spec->ext_channel_count = 2;
19211 spec->multiout.num_dacs = num_pins + 1;
19216 static int alc662_parse_auto_config(struct hda_codec *codec)
19218 struct alc_spec *spec = codec->spec;
19220 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
19222 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
19226 if (!spec->autocfg.line_outs)
19227 return 0; /* can't find valid BIOS pin config */
19229 err = alc662_auto_fill_dac_nids(codec);
19232 err = alc_auto_add_multi_channel_mode(codec, alc662_auto_fill_dac_nids);
19235 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
19238 err = alc662_auto_create_extra_out(codec,
19239 spec->autocfg.speaker_pins[0],
19240 spec->multiout.extra_out_nid[0],
19244 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
19245 spec->multiout.hp_nid,
19249 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
19253 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
19255 alc_auto_parse_digital(codec);
19257 if (spec->kctls.list)
19258 add_mixer(spec, spec->kctls.list);
19260 spec->num_mux_defs = 1;
19261 spec->input_mux = &spec->private_imux[0];
19263 err = alc_auto_add_mic_boost(codec);
19267 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
19268 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
19269 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21);
19271 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
19276 /* additional initialization for auto-configuration model */
19277 static void alc662_auto_init(struct hda_codec *codec)
19279 struct alc_spec *spec = codec->spec;
19280 alc662_auto_init_multi_out(codec);
19281 alc662_auto_init_hp_out(codec);
19282 alc662_auto_init_analog_input(codec);
19283 alc662_auto_init_input_src(codec);
19284 alc_auto_init_digital(codec);
19285 if (spec->unsol_event)
19286 alc_inithook(codec);
19289 static void alc272_fixup_mario(struct hda_codec *codec,
19290 const struct alc_fixup *fix, int action)
19292 if (action != ALC_FIXUP_ACT_PROBE)
19294 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
19295 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
19296 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
19297 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
19298 (0 << AC_AMPCAP_MUTE_SHIFT)))
19299 printk(KERN_WARNING
19300 "hda_codec: failed to override amp caps for NID 0x2\n");
19304 ALC662_FIXUP_ASPIRE,
19305 ALC662_FIXUP_IDEAPAD,
19306 ALC272_FIXUP_MARIO,
19307 ALC662_FIXUP_CZC_P10T,
19308 ALC662_FIXUP_SKU_IGNORE,
19311 static const struct alc_fixup alc662_fixups[] = {
19312 [ALC662_FIXUP_ASPIRE] = {
19313 .type = ALC_FIXUP_PINS,
19314 .v.pins = (const struct alc_pincfg[]) {
19315 { 0x15, 0x99130112 }, /* subwoofer */
19319 [ALC662_FIXUP_IDEAPAD] = {
19320 .type = ALC_FIXUP_PINS,
19321 .v.pins = (const struct alc_pincfg[]) {
19322 { 0x17, 0x99130112 }, /* subwoofer */
19326 [ALC272_FIXUP_MARIO] = {
19327 .type = ALC_FIXUP_FUNC,
19328 .v.func = alc272_fixup_mario,
19330 [ALC662_FIXUP_CZC_P10T] = {
19331 .type = ALC_FIXUP_VERBS,
19332 .v.verbs = (const struct hda_verb[]) {
19333 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
19337 [ALC662_FIXUP_SKU_IGNORE] = {
19338 .type = ALC_FIXUP_SKU,
19339 .v.sku = ALC_FIXUP_SKU_IGNORE,
19343 static const struct snd_pci_quirk alc662_fixup_tbl[] = {
19344 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
19345 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
19346 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
19347 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
19348 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
19349 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
19350 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
19354 static const struct alc_model_fixup alc662_fixup_models[] = {
19355 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
19360 static int patch_alc662(struct hda_codec *codec)
19362 struct alc_spec *spec;
19363 int err, board_config;
19366 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
19370 codec->spec = spec;
19372 spec->mixer_nid = 0x0b;
19374 alc_auto_parse_customize_define(codec);
19376 alc_fix_pll_init(codec, 0x20, 0x04, 15);
19378 coef = alc_read_coef_idx(codec, 0);
19379 if (coef == 0x8020 || coef == 0x8011)
19380 alc_codec_rename(codec, "ALC661");
19381 else if (coef & (1 << 14) &&
19382 codec->bus->pci->subsystem_vendor == 0x1025 &&
19383 spec->cdefine.platform_type == 1)
19384 alc_codec_rename(codec, "ALC272X");
19385 else if (coef == 0x4011)
19386 alc_codec_rename(codec, "ALC656");
19388 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
19391 if (board_config < 0) {
19392 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
19394 board_config = ALC662_AUTO;
19397 if (board_config == ALC662_AUTO) {
19398 alc_pick_fixup(codec, alc662_fixup_models,
19399 alc662_fixup_tbl, alc662_fixups);
19400 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
19401 /* automatic parse from the BIOS config */
19402 err = alc662_parse_auto_config(codec);
19408 "hda_codec: Cannot set up configuration "
19409 "from BIOS. Using base mode...\n");
19410 board_config = ALC662_3ST_2ch_DIG;
19414 if (has_cdefine_beep(codec)) {
19415 err = snd_hda_attach_beep_device(codec, 0x1);
19422 if (board_config != ALC662_AUTO)
19423 setup_preset(codec, &alc662_presets[board_config]);
19425 spec->stream_analog_playback = &alc662_pcm_analog_playback;
19426 spec->stream_analog_capture = &alc662_pcm_analog_capture;
19428 spec->stream_digital_playback = &alc662_pcm_digital_playback;
19429 spec->stream_digital_capture = &alc662_pcm_digital_capture;
19431 if (!spec->adc_nids) {
19432 spec->adc_nids = alc662_adc_nids;
19433 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
19435 if (!spec->capsrc_nids)
19436 spec->capsrc_nids = alc662_capsrc_nids;
19438 if (!spec->cap_mixer)
19439 set_capture_mixer(codec);
19441 if (has_cdefine_beep(codec)) {
19442 switch (codec->vendor_id) {
19444 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
19449 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
19452 set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
19456 spec->vmaster_nid = 0x02;
19458 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
19460 codec->patch_ops = alc_patch_ops;
19461 if (board_config == ALC662_AUTO)
19462 spec->init_hook = alc662_auto_init;
19463 spec->shutup = alc_eapd_shutup;
19465 alc_init_jacks(codec);
19467 #ifdef CONFIG_SND_HDA_POWER_SAVE
19468 if (!spec->loopback.amplist)
19469 spec->loopback.amplist = alc662_loopbacks;
19475 static int patch_alc888(struct hda_codec *codec)
19477 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
19478 kfree(codec->chip_name);
19479 if (codec->vendor_id == 0x10ec0887)
19480 codec->chip_name = kstrdup("ALC887-VD", GFP_KERNEL);
19482 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
19483 if (!codec->chip_name) {
19487 return patch_alc662(codec);
19489 return patch_alc882(codec);
19492 static int patch_alc899(struct hda_codec *codec)
19494 if ((alc_read_coef_idx(codec, 0) & 0x2000) != 0x2000) {
19495 kfree(codec->chip_name);
19496 codec->chip_name = kstrdup("ALC898", GFP_KERNEL);
19498 return patch_alc882(codec);
19504 #define ALC680_DIGIN_NID ALC880_DIGIN_NID
19505 #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID
19506 #define alc680_modes alc260_modes
19508 static const hda_nid_t alc680_dac_nids[3] = {
19509 /* Lout1, Lout2, hp */
19513 static const hda_nid_t alc680_adc_nids[3] = {
19515 /* DMIC, MIC, Line-in*/
19520 * Analog capture ADC cgange
19522 static void alc680_rec_autoswitch(struct hda_codec *codec)
19524 struct alc_spec *spec = codec->spec;
19525 struct auto_pin_cfg *cfg = &spec->autocfg;
19527 int type_found = AUTO_PIN_LAST;
19531 for (i = 0; i < cfg->num_inputs; i++) {
19532 nid = cfg->inputs[i].pin;
19533 if (!is_jack_detectable(codec, nid))
19535 if (snd_hda_jack_detect(codec, nid)) {
19536 if (cfg->inputs[i].type < type_found) {
19537 type_found = cfg->inputs[i].type;
19545 snd_hda_get_connections(codec, pin_found, &nid, 1);
19547 if (nid != spec->cur_adc)
19548 __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1);
19549 spec->cur_adc = nid;
19550 snd_hda_codec_setup_stream(codec, nid, spec->cur_adc_stream_tag, 0,
19551 spec->cur_adc_format);
19554 static int alc680_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
19555 struct hda_codec *codec,
19556 unsigned int stream_tag,
19557 unsigned int format,
19558 struct snd_pcm_substream *substream)
19560 struct alc_spec *spec = codec->spec;
19562 spec->cur_adc = 0x07;
19563 spec->cur_adc_stream_tag = stream_tag;
19564 spec->cur_adc_format = format;
19566 alc680_rec_autoswitch(codec);
19570 static int alc680_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
19571 struct hda_codec *codec,
19572 struct snd_pcm_substream *substream)
19574 snd_hda_codec_cleanup_stream(codec, 0x07);
19575 snd_hda_codec_cleanup_stream(codec, 0x08);
19576 snd_hda_codec_cleanup_stream(codec, 0x09);
19580 static const struct hda_pcm_stream alc680_pcm_analog_auto_capture = {
19581 .substreams = 1, /* can be overridden */
19584 /* NID is set in alc_build_pcms */
19586 .prepare = alc680_capture_pcm_prepare,
19587 .cleanup = alc680_capture_pcm_cleanup
19591 static const struct snd_kcontrol_new alc680_base_mixer[] = {
19592 /* output mixer control */
19593 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
19594 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
19595 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT),
19596 HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT),
19597 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x12, 0, HDA_INPUT),
19598 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
19599 HDA_CODEC_VOLUME("Line In Boost Volume", 0x19, 0, HDA_INPUT),
19603 static const struct hda_bind_ctls alc680_bind_cap_vol = {
19604 .ops = &snd_hda_bind_vol,
19606 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT),
19607 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
19608 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
19613 static const struct hda_bind_ctls alc680_bind_cap_switch = {
19614 .ops = &snd_hda_bind_sw,
19616 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT),
19617 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
19618 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
19623 static const struct snd_kcontrol_new alc680_master_capture_mixer[] = {
19624 HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol),
19625 HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch),
19630 * generic initialization of ADC, input mixers and output mixers
19632 static const struct hda_verb alc680_init_verbs[] = {
19633 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19634 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19635 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19637 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
19638 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
19639 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
19640 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
19641 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
19642 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
19644 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19645 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19646 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19647 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19648 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19650 {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
19651 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
19652 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
19657 /* toggle speaker-output according to the hp-jack state */
19658 static void alc680_base_setup(struct hda_codec *codec)
19660 struct alc_spec *spec = codec->spec;
19662 spec->autocfg.hp_pins[0] = 0x16;
19663 spec->autocfg.speaker_pins[0] = 0x14;
19664 spec->autocfg.speaker_pins[1] = 0x15;
19665 spec->autocfg.num_inputs = 2;
19666 spec->autocfg.inputs[0].pin = 0x18;
19667 spec->autocfg.inputs[0].type = AUTO_PIN_MIC;
19668 spec->autocfg.inputs[1].pin = 0x19;
19669 spec->autocfg.inputs[1].type = AUTO_PIN_LINE_IN;
19670 spec->automute = 1;
19671 spec->automute_mode = ALC_AUTOMUTE_AMP;
19674 static void alc680_unsol_event(struct hda_codec *codec,
19677 if ((res >> 26) == ALC880_HP_EVENT)
19678 alc_hp_automute(codec);
19679 if ((res >> 26) == ALC880_MIC_EVENT)
19680 alc680_rec_autoswitch(codec);
19683 static void alc680_inithook(struct hda_codec *codec)
19685 alc_hp_automute(codec);
19686 alc680_rec_autoswitch(codec);
19689 /* create input playback/capture controls for the given pin */
19690 static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
19691 const char *ctlname, int idx)
19709 if (spec->multiout.dac_nids[0] != dac &&
19710 spec->multiout.dac_nids[1] != dac) {
19711 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
19712 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
19717 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
19718 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
19722 spec->private_dac_nids[spec->multiout.num_dacs++] = dac;
19728 /* add playback controls from the parsed DAC table */
19729 static int alc680_auto_create_multi_out_ctls(struct alc_spec *spec,
19730 const struct auto_pin_cfg *cfg)
19735 spec->multiout.dac_nids = spec->private_dac_nids;
19737 nid = cfg->line_out_pins[0];
19741 name = alc_get_line_out_pfx(spec, 0, true, &index);
19742 err = alc680_new_analog_output(spec, nid, name, 0);
19747 nid = cfg->speaker_pins[0];
19749 err = alc680_new_analog_output(spec, nid, "Speaker", 0);
19753 nid = cfg->hp_pins[0];
19755 err = alc680_new_analog_output(spec, nid, "Headphone", 0);
19763 static void alc680_auto_set_output_and_unmute(struct hda_codec *codec,
19764 hda_nid_t nid, int pin_type)
19766 alc_set_pin_output(codec, nid, pin_type);
19769 static void alc680_auto_init_multi_out(struct hda_codec *codec)
19771 struct alc_spec *spec = codec->spec;
19772 hda_nid_t nid = spec->autocfg.line_out_pins[0];
19774 int pin_type = get_pin_type(spec->autocfg.line_out_type);
19775 alc680_auto_set_output_and_unmute(codec, nid, pin_type);
19779 static void alc680_auto_init_hp_out(struct hda_codec *codec)
19781 struct alc_spec *spec = codec->spec;
19784 pin = spec->autocfg.hp_pins[0];
19786 alc680_auto_set_output_and_unmute(codec, pin, PIN_HP);
19787 pin = spec->autocfg.speaker_pins[0];
19789 alc680_auto_set_output_and_unmute(codec, pin, PIN_OUT);
19792 /* pcm configuration: identical with ALC880 */
19793 #define alc680_pcm_analog_playback alc880_pcm_analog_playback
19794 #define alc680_pcm_analog_capture alc880_pcm_analog_capture
19795 #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
19796 #define alc680_pcm_digital_playback alc880_pcm_digital_playback
19797 #define alc680_pcm_digital_capture alc880_pcm_digital_capture
19800 * BIOS auto configuration
19802 static int alc680_parse_auto_config(struct hda_codec *codec)
19804 struct alc_spec *spec = codec->spec;
19806 static const hda_nid_t alc680_ignore[] = { 0 };
19808 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
19813 if (!spec->autocfg.line_outs) {
19814 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
19815 spec->multiout.max_channels = 2;
19816 spec->no_analog = 1;
19819 return 0; /* can't find valid BIOS pin config */
19821 err = alc680_auto_create_multi_out_ctls(spec, &spec->autocfg);
19825 spec->multiout.max_channels = 2;
19828 /* digital only support output */
19829 alc_auto_parse_digital(codec);
19830 if (spec->kctls.list)
19831 add_mixer(spec, spec->kctls.list);
19833 err = alc_auto_add_mic_boost(codec);
19840 #define alc680_auto_init_analog_input alc882_auto_init_analog_input
19842 /* init callback for auto-configuration model -- overriding the default init */
19843 static void alc680_auto_init(struct hda_codec *codec)
19845 struct alc_spec *spec = codec->spec;
19846 alc680_auto_init_multi_out(codec);
19847 alc680_auto_init_hp_out(codec);
19848 alc680_auto_init_analog_input(codec);
19849 alc_auto_init_digital(codec);
19850 if (spec->unsol_event)
19851 alc_inithook(codec);
19855 * configuration and preset
19857 static const char * const alc680_models[ALC680_MODEL_LAST] = {
19858 [ALC680_BASE] = "base",
19859 [ALC680_AUTO] = "auto",
19862 static const struct snd_pci_quirk alc680_cfg_tbl[] = {
19863 SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE),
19867 static const struct alc_config_preset alc680_presets[] = {
19869 .mixers = { alc680_base_mixer },
19870 .cap_mixer = alc680_master_capture_mixer,
19871 .init_verbs = { alc680_init_verbs },
19872 .num_dacs = ARRAY_SIZE(alc680_dac_nids),
19873 .dac_nids = alc680_dac_nids,
19874 .dig_out_nid = ALC680_DIGOUT_NID,
19875 .num_channel_mode = ARRAY_SIZE(alc680_modes),
19876 .channel_mode = alc680_modes,
19877 .unsol_event = alc680_unsol_event,
19878 .setup = alc680_base_setup,
19879 .init_hook = alc680_inithook,
19884 static int patch_alc680(struct hda_codec *codec)
19886 struct alc_spec *spec;
19890 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
19894 codec->spec = spec;
19896 /* ALC680 has no aa-loopback mixer */
19898 board_config = snd_hda_check_board_config(codec, ALC680_MODEL_LAST,
19902 if (board_config < 0 || board_config >= ALC680_MODEL_LAST) {
19903 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
19905 board_config = ALC680_AUTO;
19908 if (board_config == ALC680_AUTO) {
19909 /* automatic parse from the BIOS config */
19910 err = alc680_parse_auto_config(codec);
19916 "hda_codec: Cannot set up configuration "
19917 "from BIOS. Using base mode...\n");
19918 board_config = ALC680_BASE;
19922 if (board_config != ALC680_AUTO)
19923 setup_preset(codec, &alc680_presets[board_config]);
19925 spec->stream_analog_playback = &alc680_pcm_analog_playback;
19926 spec->stream_analog_capture = &alc680_pcm_analog_auto_capture;
19927 spec->stream_digital_playback = &alc680_pcm_digital_playback;
19928 spec->stream_digital_capture = &alc680_pcm_digital_capture;
19930 if (!spec->adc_nids) {
19931 spec->adc_nids = alc680_adc_nids;
19932 spec->num_adc_nids = ARRAY_SIZE(alc680_adc_nids);
19935 if (!spec->cap_mixer)
19936 set_capture_mixer(codec);
19938 spec->vmaster_nid = 0x02;
19940 codec->patch_ops = alc_patch_ops;
19941 if (board_config == ALC680_AUTO)
19942 spec->init_hook = alc680_auto_init;
19950 static const struct hda_codec_preset snd_hda_preset_realtek[] = {
19951 { .id = 0x10ec0221, .name = "ALC221", .patch = patch_alc269 },
19952 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
19953 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
19954 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
19955 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
19956 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
19957 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
19958 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
19959 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
19960 { .id = 0x10ec0276, .name = "ALC276", .patch = patch_alc269 },
19961 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
19962 .patch = patch_alc861 },
19963 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
19964 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
19965 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
19966 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
19967 .patch = patch_alc882 },
19968 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
19969 .patch = patch_alc662 },
19970 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
19971 { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
19972 { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
19973 { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 },
19974 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
19975 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
19976 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
19977 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
19978 .patch = patch_alc882 },
19979 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
19980 .patch = patch_alc882 },
19981 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
19982 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc888 },
19983 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
19984 .patch = patch_alc882 },
19985 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
19986 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
19987 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
19988 { .id = 0x10ec0899, .name = "ALC899", .patch = patch_alc899 },
19989 {} /* terminator */
19992 MODULE_ALIAS("snd-hda-codec-id:10ec*");
19994 MODULE_LICENSE("GPL");
19995 MODULE_DESCRIPTION("Realtek HD-audio codec");
19997 static struct hda_codec_preset_list realtek_list = {
19998 .preset = snd_hda_preset_realtek,
19999 .owner = THIS_MODULE,
20002 static int __init patch_realtek_init(void)
20004 return snd_hda_add_codec_preset(&realtek_list);
20007 static void __exit patch_realtek_exit(void)
20009 snd_hda_delete_codec_preset(&realtek_list);
20012 module_init(patch_realtek_init)
20013 module_exit(patch_realtek_exit)