2 * Universal Interface for Intel High Definition Audio Codec
4 * HD audio interface patch for ALC 260/880/882 codecs
6 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
7 * PeiSen Hou <pshou@realtek.com.tw>
8 * Takashi Iwai <tiwai@suse.de>
9 * Jonathan Woithe <jwoithe@physics.adelaide.edu.au>
11 * This driver is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This driver is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include <linux/init.h>
27 #include <linux/delay.h>
28 #include <linux/slab.h>
29 #include <linux/pci.h>
30 #include <sound/core.h>
31 #include "hda_codec.h"
32 #include "hda_local.h"
35 #define ALC880_FRONT_EVENT 0x01
36 #define ALC880_DCVOL_EVENT 0x02
37 #define ALC880_HP_EVENT 0x04
38 #define ALC880_MIC_EVENT 0x08
40 /* ALC880 board config type */
64 #ifdef CONFIG_SND_DEBUG
68 ALC880_MODEL_LAST /* last tag */
82 #ifdef CONFIG_SND_DEBUG
86 ALC260_MODEL_LAST /* last tag */
96 ALC262_HP_BPC_D7000_WL,
97 ALC262_HP_BPC_D7000_WF,
110 ALC262_MODEL_LAST /* last tag */
120 ALC268_ACER_ASPIRE_ONE,
123 #ifdef CONFIG_SND_DEBUG
127 ALC268_MODEL_LAST /* last tag */
141 ALC269_MODEL_LAST /* last tag */
158 /* ALC861-VD models */
180 ALC662_ASUS_EEEPC_P701,
181 ALC662_ASUS_EEEPC_EP20,
222 ALC883_TARGA_2ch_DIG,
223 ALC883_TARGA_8ch_DIG,
226 ALC888_ACER_ASPIRE_4930G,
227 ALC888_ACER_ASPIRE_6530G,
228 ALC888_ACER_ASPIRE_8930G,
229 ALC888_ACER_ASPIRE_7730G,
233 ALC883_LENOVO_101E_2ch,
234 ALC883_LENOVO_NB0763,
235 ALC888_LENOVO_MS7195_DIG,
243 ALC883_FUJITSU_PI2515,
244 ALC888_FUJITSU_XA3530,
245 ALC883_3ST_6ch_INTEL,
258 #define GPIO_MASK 0x03
260 /* extra amp-initialization sequence types */
269 struct alc_mic_route {
271 unsigned char mux_idx;
272 unsigned char amix_idx;
275 #define MUX_IDX_UNDEF ((unsigned char)-1)
278 /* codec parameterization */
279 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
280 unsigned int num_mixers;
281 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
282 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
284 const struct hda_verb *init_verbs[10]; /* initialization verbs
288 unsigned int num_init_verbs;
290 char stream_name_analog[32]; /* analog PCM stream */
291 struct hda_pcm_stream *stream_analog_playback;
292 struct hda_pcm_stream *stream_analog_capture;
293 struct hda_pcm_stream *stream_analog_alt_playback;
294 struct hda_pcm_stream *stream_analog_alt_capture;
296 char stream_name_digital[32]; /* digital PCM stream */
297 struct hda_pcm_stream *stream_digital_playback;
298 struct hda_pcm_stream *stream_digital_capture;
301 struct hda_multi_out multiout; /* playback set-up
302 * max_channels, dacs must be set
303 * dig_out_nid and hp_nid are optional
305 hda_nid_t alt_dac_nid;
306 hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */
310 unsigned int num_adc_nids;
312 hda_nid_t *capsrc_nids;
313 hda_nid_t dig_in_nid; /* digital-in NID; optional */
316 unsigned int num_mux_defs;
317 const struct hda_input_mux *input_mux;
318 unsigned int cur_mux[3];
319 struct alc_mic_route ext_mic;
320 struct alc_mic_route int_mic;
323 const struct hda_channel_mode *channel_mode;
324 int num_channel_mode;
326 int const_channel_count;
327 int ext_channel_count;
329 /* PCM information */
330 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
332 /* dynamic controls, init_verbs and input_mux */
333 struct auto_pin_cfg autocfg;
334 struct snd_array kctls;
335 struct hda_input_mux private_imux[3];
336 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
337 hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS];
338 hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS];
341 void (*init_hook)(struct hda_codec *codec);
342 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
343 #ifdef CONFIG_SND_HDA_POWER_SAVE
344 void (*power_hook)(struct hda_codec *codec);
347 /* for pin sensing */
348 unsigned int sense_updated: 1;
349 unsigned int jack_present: 1;
350 unsigned int master_sw: 1;
351 unsigned int auto_mic:1;
354 unsigned int no_analog :1; /* digital I/O only */
357 /* for virtual master */
358 hda_nid_t vmaster_nid;
359 #ifdef CONFIG_SND_HDA_POWER_SAVE
360 struct hda_loopback_check loopback;
365 unsigned int pll_coef_idx, pll_coef_bit;
369 * configuration template - to be copied to the spec instance
371 struct alc_config_preset {
372 struct snd_kcontrol_new *mixers[5]; /* should be identical size
375 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
376 const struct hda_verb *init_verbs[5];
377 unsigned int num_dacs;
379 hda_nid_t dig_out_nid; /* optional */
380 hda_nid_t hp_nid; /* optional */
381 hda_nid_t *slave_dig_outs;
382 unsigned int num_adc_nids;
384 hda_nid_t *capsrc_nids;
385 hda_nid_t dig_in_nid;
386 unsigned int num_channel_mode;
387 const struct hda_channel_mode *channel_mode;
389 int const_channel_count;
390 unsigned int num_mux_defs;
391 const struct hda_input_mux *input_mux;
392 void (*unsol_event)(struct hda_codec *, unsigned int);
393 void (*setup)(struct hda_codec *);
394 void (*init_hook)(struct hda_codec *);
395 #ifdef CONFIG_SND_HDA_POWER_SAVE
396 struct hda_amp_list *loopbacks;
397 void (*power_hook)(struct hda_codec *codec);
405 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
406 struct snd_ctl_elem_info *uinfo)
408 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
409 struct alc_spec *spec = codec->spec;
410 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
411 if (mux_idx >= spec->num_mux_defs)
413 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
416 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
417 struct snd_ctl_elem_value *ucontrol)
419 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
420 struct alc_spec *spec = codec->spec;
421 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
423 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
427 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
428 struct snd_ctl_elem_value *ucontrol)
430 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
431 struct alc_spec *spec = codec->spec;
432 const struct hda_input_mux *imux;
433 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
434 unsigned int mux_idx;
435 hda_nid_t nid = spec->capsrc_nids ?
436 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
439 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
440 imux = &spec->input_mux[mux_idx];
442 type = get_wcaps_type(get_wcaps(codec, nid));
443 if (type == AC_WID_AUD_MIX) {
444 /* Matrix-mixer style (e.g. ALC882) */
445 unsigned int *cur_val = &spec->cur_mux[adc_idx];
448 idx = ucontrol->value.enumerated.item[0];
449 if (idx >= imux->num_items)
450 idx = imux->num_items - 1;
453 for (i = 0; i < imux->num_items; i++) {
454 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
455 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
456 imux->items[i].index,
462 /* MUX style (e.g. ALC880) */
463 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
464 &spec->cur_mux[adc_idx]);
469 * channel mode setting
471 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
472 struct snd_ctl_elem_info *uinfo)
474 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
475 struct alc_spec *spec = codec->spec;
476 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
477 spec->num_channel_mode);
480 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
481 struct snd_ctl_elem_value *ucontrol)
483 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
484 struct alc_spec *spec = codec->spec;
485 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
486 spec->num_channel_mode,
487 spec->ext_channel_count);
490 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
491 struct snd_ctl_elem_value *ucontrol)
493 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
494 struct alc_spec *spec = codec->spec;
495 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
496 spec->num_channel_mode,
497 &spec->ext_channel_count);
498 if (err >= 0 && !spec->const_channel_count) {
499 spec->multiout.max_channels = spec->ext_channel_count;
500 if (spec->need_dac_fix)
501 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
507 * Control the mode of pin widget settings via the mixer. "pc" is used
508 * instead of "%" to avoid consequences of accidently treating the % as
509 * being part of a format specifier. Maximum allowed length of a value is
510 * 63 characters plus NULL terminator.
512 * Note: some retasking pin complexes seem to ignore requests for input
513 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
514 * are requested. Therefore order this list so that this behaviour will not
515 * cause problems when mixer clients move through the enum sequentially.
516 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
519 static char *alc_pin_mode_names[] = {
520 "Mic 50pc bias", "Mic 80pc bias",
521 "Line in", "Line out", "Headphone out",
523 static unsigned char alc_pin_mode_values[] = {
524 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
526 /* The control can present all 5 options, or it can limit the options based
527 * in the pin being assumed to be exclusively an input or an output pin. In
528 * addition, "input" pins may or may not process the mic bias option
529 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
530 * accept requests for bias as of chip versions up to March 2006) and/or
531 * wiring in the computer.
533 #define ALC_PIN_DIR_IN 0x00
534 #define ALC_PIN_DIR_OUT 0x01
535 #define ALC_PIN_DIR_INOUT 0x02
536 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
537 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
539 /* Info about the pin modes supported by the different pin direction modes.
540 * For each direction the minimum and maximum values are given.
542 static signed char alc_pin_mode_dir_info[5][2] = {
543 { 0, 2 }, /* ALC_PIN_DIR_IN */
544 { 3, 4 }, /* ALC_PIN_DIR_OUT */
545 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
546 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
547 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
549 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
550 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
551 #define alc_pin_mode_n_items(_dir) \
552 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
554 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
555 struct snd_ctl_elem_info *uinfo)
557 unsigned int item_num = uinfo->value.enumerated.item;
558 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
560 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
562 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
564 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
565 item_num = alc_pin_mode_min(dir);
566 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
570 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
571 struct snd_ctl_elem_value *ucontrol)
574 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
575 hda_nid_t nid = kcontrol->private_value & 0xffff;
576 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
577 long *valp = ucontrol->value.integer.value;
578 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
579 AC_VERB_GET_PIN_WIDGET_CONTROL,
582 /* Find enumerated value for current pinctl setting */
583 i = alc_pin_mode_min(dir);
584 while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl)
586 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
590 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
591 struct snd_ctl_elem_value *ucontrol)
594 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
595 hda_nid_t nid = kcontrol->private_value & 0xffff;
596 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
597 long val = *ucontrol->value.integer.value;
598 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
599 AC_VERB_GET_PIN_WIDGET_CONTROL,
602 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
603 val = alc_pin_mode_min(dir);
605 change = pinctl != alc_pin_mode_values[val];
607 /* Set pin mode to that requested */
608 snd_hda_codec_write_cache(codec, nid, 0,
609 AC_VERB_SET_PIN_WIDGET_CONTROL,
610 alc_pin_mode_values[val]);
612 /* Also enable the retasking pin's input/output as required
613 * for the requested pin mode. Enum values of 2 or less are
616 * Dynamically switching the input/output buffers probably
617 * reduces noise slightly (particularly on input) so we'll
618 * do it. However, having both input and output buffers
619 * enabled simultaneously doesn't seem to be problematic if
620 * this turns out to be necessary in the future.
623 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
624 HDA_AMP_MUTE, HDA_AMP_MUTE);
625 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
628 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
629 HDA_AMP_MUTE, HDA_AMP_MUTE);
630 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
637 #define ALC_PIN_MODE(xname, nid, dir) \
638 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
639 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
640 .info = alc_pin_mode_info, \
641 .get = alc_pin_mode_get, \
642 .put = alc_pin_mode_put, \
643 .private_value = nid | (dir<<16) }
645 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
646 * together using a mask with more than one bit set. This control is
647 * currently used only by the ALC260 test model. At this stage they are not
648 * needed for any "production" models.
650 #ifdef CONFIG_SND_DEBUG
651 #define alc_gpio_data_info snd_ctl_boolean_mono_info
653 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
654 struct snd_ctl_elem_value *ucontrol)
656 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
657 hda_nid_t nid = kcontrol->private_value & 0xffff;
658 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
659 long *valp = ucontrol->value.integer.value;
660 unsigned int val = snd_hda_codec_read(codec, nid, 0,
661 AC_VERB_GET_GPIO_DATA, 0x00);
663 *valp = (val & mask) != 0;
666 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
667 struct snd_ctl_elem_value *ucontrol)
670 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
671 hda_nid_t nid = kcontrol->private_value & 0xffff;
672 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
673 long val = *ucontrol->value.integer.value;
674 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
675 AC_VERB_GET_GPIO_DATA,
678 /* Set/unset the masked GPIO bit(s) as needed */
679 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
684 snd_hda_codec_write_cache(codec, nid, 0,
685 AC_VERB_SET_GPIO_DATA, gpio_data);
689 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
690 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
691 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
692 .info = alc_gpio_data_info, \
693 .get = alc_gpio_data_get, \
694 .put = alc_gpio_data_put, \
695 .private_value = nid | (mask<<16) }
696 #endif /* CONFIG_SND_DEBUG */
698 /* A switch control to allow the enabling of the digital IO pins on the
699 * ALC260. This is incredibly simplistic; the intention of this control is
700 * to provide something in the test model allowing digital outputs to be
701 * identified if present. If models are found which can utilise these
702 * outputs a more complete mixer control can be devised for those models if
705 #ifdef CONFIG_SND_DEBUG
706 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
708 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
709 struct snd_ctl_elem_value *ucontrol)
711 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
712 hda_nid_t nid = kcontrol->private_value & 0xffff;
713 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
714 long *valp = ucontrol->value.integer.value;
715 unsigned int val = snd_hda_codec_read(codec, nid, 0,
716 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
718 *valp = (val & mask) != 0;
721 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
722 struct snd_ctl_elem_value *ucontrol)
725 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
726 hda_nid_t nid = kcontrol->private_value & 0xffff;
727 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
728 long val = *ucontrol->value.integer.value;
729 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
730 AC_VERB_GET_DIGI_CONVERT_1,
733 /* Set/unset the masked control bit(s) as needed */
734 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
739 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
744 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
745 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
746 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
747 .info = alc_spdif_ctrl_info, \
748 .get = alc_spdif_ctrl_get, \
749 .put = alc_spdif_ctrl_put, \
750 .private_value = nid | (mask<<16) }
751 #endif /* CONFIG_SND_DEBUG */
753 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
754 * Again, this is only used in the ALC26x test models to help identify when
755 * the EAPD line must be asserted for features to work.
757 #ifdef CONFIG_SND_DEBUG
758 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
760 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
761 struct snd_ctl_elem_value *ucontrol)
763 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
764 hda_nid_t nid = kcontrol->private_value & 0xffff;
765 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
766 long *valp = ucontrol->value.integer.value;
767 unsigned int val = snd_hda_codec_read(codec, nid, 0,
768 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
770 *valp = (val & mask) != 0;
774 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
775 struct snd_ctl_elem_value *ucontrol)
778 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
779 hda_nid_t nid = kcontrol->private_value & 0xffff;
780 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
781 long val = *ucontrol->value.integer.value;
782 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
783 AC_VERB_GET_EAPD_BTLENABLE,
786 /* Set/unset the masked control bit(s) as needed */
787 change = (!val ? 0 : mask) != (ctrl_data & mask);
792 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
798 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
799 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
800 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
801 .info = alc_eapd_ctrl_info, \
802 .get = alc_eapd_ctrl_get, \
803 .put = alc_eapd_ctrl_put, \
804 .private_value = nid | (mask<<16) }
805 #endif /* CONFIG_SND_DEBUG */
808 * set up the input pin config (depending on the given auto-pin type)
810 static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
813 unsigned int val = PIN_IN;
815 if (auto_pin_type <= AUTO_PIN_FRONT_MIC) {
817 pincap = snd_hda_query_pin_caps(codec, nid);
818 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
819 if (pincap & AC_PINCAP_VREF_80)
821 else if (pincap & AC_PINCAP_VREF_50)
823 else if (pincap & AC_PINCAP_VREF_100)
825 else if (pincap & AC_PINCAP_VREF_GRD)
828 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val);
833 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
835 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
837 spec->mixers[spec->num_mixers++] = mix;
840 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
842 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
844 spec->init_verbs[spec->num_init_verbs++] = verb;
848 * set up from the preset table
850 static void setup_preset(struct hda_codec *codec,
851 const struct alc_config_preset *preset)
853 struct alc_spec *spec = codec->spec;
856 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
857 add_mixer(spec, preset->mixers[i]);
858 spec->cap_mixer = preset->cap_mixer;
859 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
861 add_verb(spec, preset->init_verbs[i]);
863 spec->channel_mode = preset->channel_mode;
864 spec->num_channel_mode = preset->num_channel_mode;
865 spec->need_dac_fix = preset->need_dac_fix;
866 spec->const_channel_count = preset->const_channel_count;
868 if (preset->const_channel_count)
869 spec->multiout.max_channels = preset->const_channel_count;
871 spec->multiout.max_channels = spec->channel_mode[0].channels;
872 spec->ext_channel_count = spec->channel_mode[0].channels;
874 spec->multiout.num_dacs = preset->num_dacs;
875 spec->multiout.dac_nids = preset->dac_nids;
876 spec->multiout.dig_out_nid = preset->dig_out_nid;
877 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
878 spec->multiout.hp_nid = preset->hp_nid;
880 spec->num_mux_defs = preset->num_mux_defs;
881 if (!spec->num_mux_defs)
882 spec->num_mux_defs = 1;
883 spec->input_mux = preset->input_mux;
885 spec->num_adc_nids = preset->num_adc_nids;
886 spec->adc_nids = preset->adc_nids;
887 spec->capsrc_nids = preset->capsrc_nids;
888 spec->dig_in_nid = preset->dig_in_nid;
890 spec->unsol_event = preset->unsol_event;
891 spec->init_hook = preset->init_hook;
892 #ifdef CONFIG_SND_HDA_POWER_SAVE
893 spec->power_hook = preset->power_hook;
894 spec->loopback.amplist = preset->loopbacks;
898 preset->setup(codec);
901 /* Enable GPIO mask and set output */
902 static struct hda_verb alc_gpio1_init_verbs[] = {
903 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
904 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
905 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
909 static struct hda_verb alc_gpio2_init_verbs[] = {
910 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
911 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
912 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
916 static struct hda_verb alc_gpio3_init_verbs[] = {
917 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
918 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
919 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
924 * Fix hardware PLL issue
925 * On some codecs, the analog PLL gating control must be off while
926 * the default value is 1.
928 static void alc_fix_pll(struct hda_codec *codec)
930 struct alc_spec *spec = codec->spec;
935 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
937 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
938 AC_VERB_GET_PROC_COEF, 0);
939 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
941 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
942 val & ~(1 << spec->pll_coef_bit));
945 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
946 unsigned int coef_idx, unsigned int coef_bit)
948 struct alc_spec *spec = codec->spec;
950 spec->pll_coef_idx = coef_idx;
951 spec->pll_coef_bit = coef_bit;
955 static void alc_automute_pin(struct hda_codec *codec)
957 struct alc_spec *spec = codec->spec;
958 unsigned int nid = spec->autocfg.hp_pins[0];
963 spec->jack_present = snd_hda_jack_detect(codec, nid);
964 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
965 nid = spec->autocfg.speaker_pins[i];
968 snd_hda_codec_write(codec, nid, 0,
969 AC_VERB_SET_PIN_WIDGET_CONTROL,
970 spec->jack_present ? 0 : PIN_OUT);
974 static int get_connection_index(struct hda_codec *codec, hda_nid_t mux,
977 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
980 nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn));
981 for (i = 0; i < nums; i++)
987 static void alc_mic_automute(struct hda_codec *codec)
989 struct alc_spec *spec = codec->spec;
990 struct alc_mic_route *dead, *alive;
991 unsigned int present, type;
996 if (!spec->int_mic.pin || !spec->ext_mic.pin)
998 if (snd_BUG_ON(!spec->adc_nids))
1001 cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0];
1003 present = snd_hda_jack_detect(codec, spec->ext_mic.pin);
1005 alive = &spec->ext_mic;
1006 dead = &spec->int_mic;
1008 alive = &spec->int_mic;
1009 dead = &spec->ext_mic;
1012 type = get_wcaps_type(get_wcaps(codec, cap_nid));
1013 if (type == AC_WID_AUD_MIX) {
1014 /* Matrix-mixer style (e.g. ALC882) */
1015 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1018 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1020 HDA_AMP_MUTE, HDA_AMP_MUTE);
1022 /* MUX style (e.g. ALC880) */
1023 snd_hda_codec_write_cache(codec, cap_nid, 0,
1024 AC_VERB_SET_CONNECT_SEL,
1028 /* FIXME: analog mixer */
1031 /* unsolicited event for HP jack sensing */
1032 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
1034 if (codec->vendor_id == 0x10ec0880)
1039 case ALC880_HP_EVENT:
1040 alc_automute_pin(codec);
1042 case ALC880_MIC_EVENT:
1043 alc_mic_automute(codec);
1048 static void alc_inithook(struct hda_codec *codec)
1050 alc_automute_pin(codec);
1051 alc_mic_automute(codec);
1054 /* additional initialization for ALC888 variants */
1055 static void alc888_coef_init(struct hda_codec *codec)
1059 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
1060 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1061 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1062 if ((tmp & 0xf0) == 0x20)
1064 snd_hda_codec_read(codec, 0x20, 0,
1065 AC_VERB_SET_PROC_COEF, 0x830);
1068 snd_hda_codec_read(codec, 0x20, 0,
1069 AC_VERB_SET_PROC_COEF, 0x3030);
1072 static void alc889_coef_init(struct hda_codec *codec)
1076 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1077 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1078 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1079 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010);
1082 /* turn on/off EAPD control (only if available) */
1083 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
1085 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
1087 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
1088 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
1092 static void alc_auto_init_amp(struct hda_codec *codec, int type)
1097 case ALC_INIT_GPIO1:
1098 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1100 case ALC_INIT_GPIO2:
1101 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1103 case ALC_INIT_GPIO3:
1104 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1106 case ALC_INIT_DEFAULT:
1107 switch (codec->vendor_id) {
1109 set_eapd(codec, 0x0f, 1);
1110 set_eapd(codec, 0x10, 1);
1123 set_eapd(codec, 0x14, 1);
1124 set_eapd(codec, 0x15, 1);
1127 switch (codec->vendor_id) {
1129 snd_hda_codec_write(codec, 0x1a, 0,
1130 AC_VERB_SET_COEF_INDEX, 7);
1131 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1132 AC_VERB_GET_PROC_COEF, 0);
1133 snd_hda_codec_write(codec, 0x1a, 0,
1134 AC_VERB_SET_COEF_INDEX, 7);
1135 snd_hda_codec_write(codec, 0x1a, 0,
1136 AC_VERB_SET_PROC_COEF,
1146 alc889_coef_init(codec);
1149 alc888_coef_init(codec);
1151 #if 0 /* XXX: This may cause the silent output on speaker on some machines */
1154 snd_hda_codec_write(codec, 0x20, 0,
1155 AC_VERB_SET_COEF_INDEX, 7);
1156 tmp = snd_hda_codec_read(codec, 0x20, 0,
1157 AC_VERB_GET_PROC_COEF, 0);
1158 snd_hda_codec_write(codec, 0x20, 0,
1159 AC_VERB_SET_COEF_INDEX, 7);
1160 snd_hda_codec_write(codec, 0x20, 0,
1161 AC_VERB_SET_PROC_COEF,
1170 static void alc_init_auto_hp(struct hda_codec *codec)
1172 struct alc_spec *spec = codec->spec;
1174 if (!spec->autocfg.hp_pins[0])
1177 if (!spec->autocfg.speaker_pins[0]) {
1178 if (spec->autocfg.line_out_pins[0] &&
1179 spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT)
1180 spec->autocfg.speaker_pins[0] =
1181 spec->autocfg.line_out_pins[0];
1186 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1187 spec->autocfg.hp_pins[0]);
1188 snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0,
1189 AC_VERB_SET_UNSOLICITED_ENABLE,
1190 AC_USRSP_EN | ALC880_HP_EVENT);
1191 spec->unsol_event = alc_sku_unsol_event;
1194 static void alc_init_auto_mic(struct hda_codec *codec)
1196 struct alc_spec *spec = codec->spec;
1197 struct auto_pin_cfg *cfg = &spec->autocfg;
1198 hda_nid_t fixed, ext;
1201 /* there must be only two mic inputs exclusively */
1202 for (i = AUTO_PIN_LINE; i < AUTO_PIN_LAST; i++)
1203 if (cfg->input_pins[i])
1207 for (i = AUTO_PIN_MIC; i <= AUTO_PIN_FRONT_MIC; i++) {
1208 hda_nid_t nid = cfg->input_pins[i];
1209 unsigned int defcfg;
1212 defcfg = snd_hda_codec_get_pincfg(codec, nid);
1213 switch (get_defcfg_connect(defcfg)) {
1214 case AC_JACK_PORT_FIXED:
1216 return; /* already occupied */
1219 case AC_JACK_PORT_COMPLEX:
1221 return; /* already occupied */
1225 return; /* invalid entry */
1230 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP))
1231 return; /* no unsol support */
1232 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n",
1234 spec->ext_mic.pin = ext;
1235 spec->int_mic.pin = fixed;
1236 spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1237 spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1239 snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0,
1240 AC_VERB_SET_UNSOLICITED_ENABLE,
1241 AC_USRSP_EN | ALC880_MIC_EVENT);
1242 spec->unsol_event = alc_sku_unsol_event;
1245 /* check subsystem ID and set up device-specific initialization;
1246 * return 1 if initialized, 0 if invalid SSID
1248 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1249 * 31 ~ 16 : Manufacture ID
1251 * 7 ~ 0 : Assembly ID
1252 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1254 static int alc_subsystem_id(struct hda_codec *codec,
1255 hda_nid_t porta, hda_nid_t porte,
1258 unsigned int ass, tmp, i;
1260 struct alc_spec *spec = codec->spec;
1262 ass = codec->subsystem_id & 0xffff;
1263 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1266 /* invalid SSID, check the special NID pin defcfg instead */
1268 * 31~30 : port connectivity
1271 * 19~16 : Check sum (15:1)
1276 if (codec->vendor_id == 0x10ec0260)
1278 ass = snd_hda_codec_get_pincfg(codec, nid);
1279 snd_printd("realtek: No valid SSID, "
1280 "checking pincfg 0x%08x for NID 0x%x\n",
1282 if (!(ass & 1) && !(ass & 0x100000))
1284 if ((ass >> 30) != 1) /* no physical connection */
1289 for (i = 1; i < 16; i++) {
1293 if (((ass >> 16) & 0xf) != tmp)
1296 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1297 ass & 0xffff, codec->vendor_id);
1301 * 2 : 0 --> Desktop, 1 --> Laptop
1302 * 3~5 : External Amplifier control
1305 tmp = (ass & 0x38) >> 3; /* external Amp control */
1308 spec->init_amp = ALC_INIT_GPIO1;
1311 spec->init_amp = ALC_INIT_GPIO2;
1314 spec->init_amp = ALC_INIT_GPIO3;
1317 spec->init_amp = ALC_INIT_DEFAULT;
1321 /* is laptop or Desktop and enable the function "Mute internal speaker
1322 * when the external headphone out jack is plugged"
1324 if (!(ass & 0x8000))
1327 * 10~8 : Jack location
1328 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1330 * 15 : 1 --> enable the function "Mute internal speaker
1331 * when the external headphone out jack is plugged"
1333 if (!spec->autocfg.hp_pins[0]) {
1335 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1344 for (i = 0; i < spec->autocfg.line_outs; i++)
1345 if (spec->autocfg.line_out_pins[i] == nid)
1347 spec->autocfg.hp_pins[0] = nid;
1350 alc_init_auto_hp(codec);
1351 alc_init_auto_mic(codec);
1355 static void alc_ssid_check(struct hda_codec *codec,
1356 hda_nid_t porta, hda_nid_t porte, hda_nid_t portd)
1358 if (!alc_subsystem_id(codec, porta, porte, portd)) {
1359 struct alc_spec *spec = codec->spec;
1360 snd_printd("realtek: "
1361 "Enable default setup for auto mode as fallback\n");
1362 spec->init_amp = ALC_INIT_DEFAULT;
1363 alc_init_auto_hp(codec);
1364 alc_init_auto_mic(codec);
1369 * Fix-up pin default configurations and add default verbs
1378 const struct alc_pincfg *pins;
1379 const struct hda_verb *verbs;
1382 static void alc_pick_fixup(struct hda_codec *codec,
1383 const struct snd_pci_quirk *quirk,
1384 const struct alc_fixup *fix)
1386 const struct alc_pincfg *cfg;
1388 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1392 fix += quirk->value;
1395 for (; cfg->nid; cfg++)
1396 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1399 add_verb(codec->spec, fix->verbs);
1402 static int alc_read_coef_idx(struct hda_codec *codec,
1403 unsigned int coef_idx)
1406 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX,
1408 val = snd_hda_codec_read(codec, 0x20, 0,
1409 AC_VERB_GET_PROC_COEF, 0);
1420 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1421 /* Mic-in jack as mic in */
1422 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1423 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1424 /* Line-in jack as Line in */
1425 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1426 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1427 /* Line-Out as Front */
1428 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1435 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1436 /* Mic-in jack as mic in */
1437 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1438 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1439 /* Line-in jack as Surround */
1440 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1441 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1442 /* Line-Out as Front */
1443 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1450 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1451 /* Mic-in jack as CLFE */
1452 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1453 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1454 /* Line-in jack as Surround */
1455 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1456 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1457 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1458 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1465 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1466 /* Mic-in jack as CLFE */
1467 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1468 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1469 /* Line-in jack as Surround */
1470 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1471 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1472 /* Line-Out as Side */
1473 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1477 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1478 { 2, alc888_4ST_ch2_intel_init },
1479 { 4, alc888_4ST_ch4_intel_init },
1480 { 6, alc888_4ST_ch6_intel_init },
1481 { 8, alc888_4ST_ch8_intel_init },
1485 * ALC888 Fujitsu Siemens Amillo xa3530
1488 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1489 /* Front Mic: set to PIN_IN (empty by default) */
1490 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1491 /* Connect Internal HP to Front */
1492 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1493 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1494 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1495 /* Connect Bass HP to Front */
1496 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1497 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1498 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1499 /* Connect Line-Out side jack (SPDIF) to Side */
1500 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1501 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1502 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1503 /* Connect Mic jack to CLFE */
1504 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1505 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1506 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1507 /* Connect Line-in jack to Surround */
1508 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1509 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1510 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1511 /* Connect HP out jack to Front */
1512 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1513 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1514 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1515 /* Enable unsolicited event for HP jack and Line-out jack */
1516 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1517 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1521 static void alc_automute_amp(struct hda_codec *codec)
1523 struct alc_spec *spec = codec->spec;
1528 spec->jack_present = 0;
1529 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
1530 nid = spec->autocfg.hp_pins[i];
1533 if (snd_hda_jack_detect(codec, nid)) {
1534 spec->jack_present = 1;
1539 mute = spec->jack_present ? HDA_AMP_MUTE : 0;
1540 /* Toggle internal speakers muting */
1541 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1542 nid = spec->autocfg.speaker_pins[i];
1545 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1546 HDA_AMP_MUTE, mute);
1550 static void alc_automute_amp_unsol_event(struct hda_codec *codec,
1553 if (codec->vendor_id == 0x10ec0880)
1557 if (res == ALC880_HP_EVENT)
1558 alc_automute_amp(codec);
1561 static void alc889_automute_setup(struct hda_codec *codec)
1563 struct alc_spec *spec = codec->spec;
1565 spec->autocfg.hp_pins[0] = 0x15;
1566 spec->autocfg.speaker_pins[0] = 0x14;
1567 spec->autocfg.speaker_pins[1] = 0x16;
1568 spec->autocfg.speaker_pins[2] = 0x17;
1569 spec->autocfg.speaker_pins[3] = 0x19;
1570 spec->autocfg.speaker_pins[4] = 0x1a;
1573 static void alc889_intel_init_hook(struct hda_codec *codec)
1575 alc889_coef_init(codec);
1576 alc_automute_amp(codec);
1579 static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec)
1581 struct alc_spec *spec = codec->spec;
1583 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
1584 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
1585 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
1586 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
1590 * ALC888 Acer Aspire 4930G model
1593 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1594 /* Front Mic: set to PIN_IN (empty by default) */
1595 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1596 /* Unselect Front Mic by default in input mixer 3 */
1597 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1598 /* Enable unsolicited event for HP jack */
1599 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1600 /* Connect Internal HP to front */
1601 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1602 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1603 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1604 /* Connect HP out to front */
1605 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1606 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1607 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1612 * ALC888 Acer Aspire 6530G model
1615 static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
1616 /* Bias voltage on for external mic port */
1617 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
1618 /* Front Mic: set to PIN_IN (empty by default) */
1619 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1620 /* Unselect Front Mic by default in input mixer 3 */
1621 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1622 /* Enable unsolicited event for HP jack */
1623 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1624 /* Enable speaker output */
1625 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1626 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1627 /* Enable headphone output */
1628 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1629 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1630 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1635 * ALC889 Acer Aspire 8930G model
1638 static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
1639 /* Front Mic: set to PIN_IN (empty by default) */
1640 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1641 /* Unselect Front Mic by default in input mixer 3 */
1642 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1643 /* Enable unsolicited event for HP jack */
1644 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1645 /* Connect Internal Front to Front */
1646 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1647 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1648 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1649 /* Connect Internal Rear to Rear */
1650 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1651 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1652 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
1653 /* Connect Internal CLFE to CLFE */
1654 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1655 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1656 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
1657 /* Connect HP out to Front */
1658 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1659 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1660 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1661 /* Enable all DACs */
1662 /* DAC DISABLE/MUTE 1? */
1663 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
1664 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
1665 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1666 /* DAC DISABLE/MUTE 2? */
1667 /* some bit here disables the other DACs. Init=0x4900 */
1668 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
1669 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1671 * This laptop has a stereo digital microphone. The mics are only 1cm apart
1672 * which makes the stereo useless. However, either the mic or the ALC889
1673 * makes the signal become a difference/sum signal instead of standard
1674 * stereo, which is annoying. So instead we flip this bit which makes the
1675 * codec replicate the sum signal to both channels, turning it into a
1678 /* DMIC_CONTROL? Init value = 0x0001 */
1679 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
1680 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
1684 static struct hda_input_mux alc888_2_capture_sources[2] = {
1685 /* Front mic only available on one ADC */
1692 { "Front Mic", 0xb },
1705 static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
1706 /* Interal mic only available on one ADC */
1713 { "Input Mix", 0xa },
1723 { "Input Mix", 0xa },
1728 static struct hda_input_mux alc889_capture_sources[3] = {
1729 /* Digital mic only available on first "ADC" */
1736 { "Front Mic", 0xb },
1737 { "Input Mix", 0xa },
1746 { "Input Mix", 0xa },
1755 { "Input Mix", 0xa },
1760 static struct snd_kcontrol_new alc888_base_mixer[] = {
1761 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1762 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1763 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1764 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1765 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1767 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1768 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1769 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1770 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1771 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1772 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1773 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1774 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1775 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1776 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1777 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1778 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1782 static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = {
1783 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1784 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1785 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1786 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1787 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1789 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1790 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1791 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1792 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1793 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1794 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1795 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1796 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1801 static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
1803 struct alc_spec *spec = codec->spec;
1805 spec->autocfg.hp_pins[0] = 0x15;
1806 spec->autocfg.speaker_pins[0] = 0x14;
1807 spec->autocfg.speaker_pins[1] = 0x16;
1808 spec->autocfg.speaker_pins[2] = 0x17;
1811 static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
1813 struct alc_spec *spec = codec->spec;
1815 spec->autocfg.hp_pins[0] = 0x15;
1816 spec->autocfg.speaker_pins[0] = 0x14;
1817 spec->autocfg.speaker_pins[1] = 0x16;
1818 spec->autocfg.speaker_pins[2] = 0x17;
1821 static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
1823 struct alc_spec *spec = codec->spec;
1825 spec->autocfg.hp_pins[0] = 0x15;
1826 spec->autocfg.speaker_pins[0] = 0x14;
1827 spec->autocfg.speaker_pins[1] = 0x16;
1828 spec->autocfg.speaker_pins[2] = 0x1b;
1832 * ALC880 3-stack model
1834 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1835 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1836 * F-Mic = 0x1b, HP = 0x19
1839 static hda_nid_t alc880_dac_nids[4] = {
1840 /* front, rear, clfe, rear_surr */
1841 0x02, 0x05, 0x04, 0x03
1844 static hda_nid_t alc880_adc_nids[3] = {
1849 /* The datasheet says the node 0x07 is connected from inputs,
1850 * but it shows zero connection in the real implementation on some devices.
1851 * Note: this is a 915GAV bug, fixed on 915GLV
1853 static hda_nid_t alc880_adc_nids_alt[2] = {
1858 #define ALC880_DIGOUT_NID 0x06
1859 #define ALC880_DIGIN_NID 0x0a
1861 static struct hda_input_mux alc880_capture_source = {
1865 { "Front Mic", 0x3 },
1871 /* channel source setting (2/6 channel selection for 3-stack) */
1873 static struct hda_verb alc880_threestack_ch2_init[] = {
1874 /* set line-in to input, mute it */
1875 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1876 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1877 /* set mic-in to input vref 80%, mute it */
1878 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1879 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1884 static struct hda_verb alc880_threestack_ch6_init[] = {
1885 /* set line-in to output, unmute it */
1886 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1887 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1888 /* set mic-in to output, unmute it */
1889 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1890 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1894 static struct hda_channel_mode alc880_threestack_modes[2] = {
1895 { 2, alc880_threestack_ch2_init },
1896 { 6, alc880_threestack_ch6_init },
1899 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1900 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1901 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1902 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1903 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1904 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1905 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1906 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1907 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1908 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1909 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1910 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1911 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1912 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1913 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1914 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1915 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1916 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1918 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1919 .name = "Channel Mode",
1920 .info = alc_ch_mode_info,
1921 .get = alc_ch_mode_get,
1922 .put = alc_ch_mode_put,
1927 /* capture mixer elements */
1928 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1929 struct snd_ctl_elem_info *uinfo)
1931 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1932 struct alc_spec *spec = codec->spec;
1935 mutex_lock(&codec->control_mutex);
1936 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1938 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
1939 mutex_unlock(&codec->control_mutex);
1943 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1944 unsigned int size, unsigned int __user *tlv)
1946 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1947 struct alc_spec *spec = codec->spec;
1950 mutex_lock(&codec->control_mutex);
1951 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1953 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1954 mutex_unlock(&codec->control_mutex);
1958 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
1959 struct snd_ctl_elem_value *ucontrol);
1961 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1962 struct snd_ctl_elem_value *ucontrol,
1965 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1966 struct alc_spec *spec = codec->spec;
1967 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1970 mutex_lock(&codec->control_mutex);
1971 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1973 err = func(kcontrol, ucontrol);
1974 mutex_unlock(&codec->control_mutex);
1978 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
1979 struct snd_ctl_elem_value *ucontrol)
1981 return alc_cap_getput_caller(kcontrol, ucontrol,
1982 snd_hda_mixer_amp_volume_get);
1985 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
1986 struct snd_ctl_elem_value *ucontrol)
1988 return alc_cap_getput_caller(kcontrol, ucontrol,
1989 snd_hda_mixer_amp_volume_put);
1992 /* capture mixer elements */
1993 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
1995 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
1996 struct snd_ctl_elem_value *ucontrol)
1998 return alc_cap_getput_caller(kcontrol, ucontrol,
1999 snd_hda_mixer_amp_switch_get);
2002 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
2003 struct snd_ctl_elem_value *ucontrol)
2005 return alc_cap_getput_caller(kcontrol, ucontrol,
2006 snd_hda_mixer_amp_switch_put);
2009 #define _DEFINE_CAPMIX(num) \
2011 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2012 .name = "Capture Switch", \
2013 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
2015 .info = alc_cap_sw_info, \
2016 .get = alc_cap_sw_get, \
2017 .put = alc_cap_sw_put, \
2020 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2021 .name = "Capture Volume", \
2022 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
2023 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
2024 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
2026 .info = alc_cap_vol_info, \
2027 .get = alc_cap_vol_get, \
2028 .put = alc_cap_vol_put, \
2029 .tlv = { .c = alc_cap_vol_tlv }, \
2032 #define _DEFINE_CAPSRC(num) \
2034 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2035 /* .name = "Capture Source", */ \
2036 .name = "Input Source", \
2038 .info = alc_mux_enum_info, \
2039 .get = alc_mux_enum_get, \
2040 .put = alc_mux_enum_put, \
2043 #define DEFINE_CAPMIX(num) \
2044 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2045 _DEFINE_CAPMIX(num), \
2046 _DEFINE_CAPSRC(num), \
2050 #define DEFINE_CAPMIX_NOSRC(num) \
2051 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2052 _DEFINE_CAPMIX(num), \
2056 /* up to three ADCs */
2060 DEFINE_CAPMIX_NOSRC(1);
2061 DEFINE_CAPMIX_NOSRC(2);
2062 DEFINE_CAPMIX_NOSRC(3);
2065 * ALC880 5-stack model
2067 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2069 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2070 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2073 /* additional mixers to alc880_three_stack_mixer */
2074 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2075 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2076 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2080 /* channel source setting (6/8 channel selection for 5-stack) */
2082 static struct hda_verb alc880_fivestack_ch6_init[] = {
2083 /* set line-in to input, mute it */
2084 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2085 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2090 static struct hda_verb alc880_fivestack_ch8_init[] = {
2091 /* set line-in to output, unmute it */
2092 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2093 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2097 static struct hda_channel_mode alc880_fivestack_modes[2] = {
2098 { 6, alc880_fivestack_ch6_init },
2099 { 8, alc880_fivestack_ch8_init },
2104 * ALC880 6-stack model
2106 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2107 * Side = 0x05 (0x0f)
2108 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2109 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2112 static hda_nid_t alc880_6st_dac_nids[4] = {
2113 /* front, rear, clfe, rear_surr */
2114 0x02, 0x03, 0x04, 0x05
2117 static struct hda_input_mux alc880_6stack_capture_source = {
2121 { "Front Mic", 0x1 },
2127 /* fixed 8-channels */
2128 static struct hda_channel_mode alc880_sixstack_modes[1] = {
2132 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2133 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2134 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2135 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2136 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2137 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2138 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2139 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2140 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2141 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2142 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2143 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2144 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2145 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2146 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2147 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2148 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2149 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2150 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2152 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2153 .name = "Channel Mode",
2154 .info = alc_ch_mode_info,
2155 .get = alc_ch_mode_get,
2156 .put = alc_ch_mode_put,
2165 * W810 has rear IO for:
2168 * Center/LFE (DAC 04)
2171 * The system also has a pair of internal speakers, and a headphone jack.
2172 * These are both connected to Line2 on the codec, hence to DAC 02.
2174 * There is a variable resistor to control the speaker or headphone
2175 * volume. This is a hardware-only device without a software API.
2177 * Plugging headphones in will disable the internal speakers. This is
2178 * implemented in hardware, not via the driver using jack sense. In
2179 * a similar fashion, plugging into the rear socket marked "front" will
2180 * disable both the speakers and headphones.
2182 * For input, there's a microphone jack, and an "audio in" jack.
2183 * These may not do anything useful with this driver yet, because I
2184 * haven't setup any initialization verbs for these yet...
2187 static hda_nid_t alc880_w810_dac_nids[3] = {
2188 /* front, rear/surround, clfe */
2192 /* fixed 6 channels */
2193 static struct hda_channel_mode alc880_w810_modes[1] = {
2197 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2198 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2199 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2200 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2201 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2202 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2203 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2204 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2205 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2206 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2207 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2215 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2216 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2220 static hda_nid_t alc880_z71v_dac_nids[1] = {
2223 #define ALC880_Z71V_HP_DAC 0x03
2225 /* fixed 2 channels */
2226 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2230 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2231 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2232 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2233 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2234 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2235 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2236 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2237 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2238 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2244 * ALC880 F1734 model
2246 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2247 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2250 static hda_nid_t alc880_f1734_dac_nids[1] = {
2253 #define ALC880_F1734_HP_DAC 0x02
2255 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2256 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2257 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2258 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2259 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2260 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2261 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2262 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2263 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2267 static struct hda_input_mux alc880_f1734_capture_source = {
2279 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2280 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2281 * Mic = 0x18, Line = 0x1a
2284 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2285 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2287 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2288 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2289 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2290 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2291 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2292 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2293 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2294 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2295 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2296 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2297 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2298 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2299 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2300 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2301 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2303 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2304 .name = "Channel Mode",
2305 .info = alc_ch_mode_info,
2306 .get = alc_ch_mode_get,
2307 .put = alc_ch_mode_put,
2313 * ALC880 ASUS W1V model
2315 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2316 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2317 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2320 /* additional mixers to alc880_asus_mixer */
2321 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2322 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2323 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2328 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2329 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2330 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2331 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2332 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2333 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2334 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2335 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2336 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2337 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2342 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2343 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2344 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2345 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2346 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2347 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2348 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2349 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2350 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2351 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2352 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2353 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2354 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2355 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2356 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2357 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2358 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2360 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2361 .name = "Channel Mode",
2362 .info = alc_ch_mode_info,
2363 .get = alc_ch_mode_get,
2364 .put = alc_ch_mode_put,
2369 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2370 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2371 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2372 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2373 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2374 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2375 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2376 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2377 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2378 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2379 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2383 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2384 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2385 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2386 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2387 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2388 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2389 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2394 * virtual master controls
2398 * slave controls for virtual master
2400 static const char *alc_slave_vols[] = {
2401 "Front Playback Volume",
2402 "Surround Playback Volume",
2403 "Center Playback Volume",
2404 "LFE Playback Volume",
2405 "Side Playback Volume",
2406 "Headphone Playback Volume",
2407 "Speaker Playback Volume",
2408 "Mono Playback Volume",
2409 "Line-Out Playback Volume",
2410 "PCM Playback Volume",
2414 static const char *alc_slave_sws[] = {
2415 "Front Playback Switch",
2416 "Surround Playback Switch",
2417 "Center Playback Switch",
2418 "LFE Playback Switch",
2419 "Side Playback Switch",
2420 "Headphone Playback Switch",
2421 "Speaker Playback Switch",
2422 "Mono Playback Switch",
2423 "IEC958 Playback Switch",
2424 "Line-Out Playback Switch",
2425 "PCM Playback Switch",
2430 * build control elements
2433 #define NID_MAPPING (-1)
2435 #define SUBDEV_SPEAKER_ (0 << 6)
2436 #define SUBDEV_HP_ (1 << 6)
2437 #define SUBDEV_LINE_ (2 << 6)
2438 #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f))
2439 #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f))
2440 #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f))
2442 static void alc_free_kctls(struct hda_codec *codec);
2444 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2445 /* additional beep mixers; the actual parameters are overwritten at build */
2446 static struct snd_kcontrol_new alc_beep_mixer[] = {
2447 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2448 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
2453 static int alc_build_controls(struct hda_codec *codec)
2455 struct alc_spec *spec = codec->spec;
2456 struct snd_kcontrol *kctl;
2457 struct snd_kcontrol_new *knew;
2462 for (i = 0; i < spec->num_mixers; i++) {
2463 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2467 if (spec->cap_mixer) {
2468 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2472 if (spec->multiout.dig_out_nid) {
2473 err = snd_hda_create_spdif_out_ctls(codec,
2474 spec->multiout.dig_out_nid);
2477 if (!spec->no_analog) {
2478 err = snd_hda_create_spdif_share_sw(codec,
2482 spec->multiout.share_spdif = 1;
2485 if (spec->dig_in_nid) {
2486 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2491 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2492 /* create beep controls if needed */
2493 if (spec->beep_amp) {
2494 struct snd_kcontrol_new *knew;
2495 for (knew = alc_beep_mixer; knew->name; knew++) {
2496 struct snd_kcontrol *kctl;
2497 kctl = snd_ctl_new1(knew, codec);
2500 kctl->private_value = spec->beep_amp;
2501 err = snd_hda_ctl_add(codec, 0, kctl);
2508 /* if we have no master control, let's create it */
2509 if (!spec->no_analog &&
2510 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2511 unsigned int vmaster_tlv[4];
2512 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2513 HDA_OUTPUT, vmaster_tlv);
2514 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2515 vmaster_tlv, alc_slave_vols);
2519 if (!spec->no_analog &&
2520 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2521 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2522 NULL, alc_slave_sws);
2527 alc_free_kctls(codec); /* no longer needed */
2529 /* assign Capture Source enums to NID */
2530 kctl = snd_hda_find_mixer_ctl(codec, "Capture Source");
2532 kctl = snd_hda_find_mixer_ctl(codec, "Input Source");
2533 for (i = 0; kctl && i < kctl->count; i++) {
2534 hda_nid_t *nids = spec->capsrc_nids;
2536 nids = spec->adc_nids;
2537 err = snd_hda_add_nid(codec, kctl, i, nids[i]);
2541 if (spec->cap_mixer) {
2542 const char *kname = kctl ? kctl->id.name : NULL;
2543 for (knew = spec->cap_mixer; knew->name; knew++) {
2544 if (kname && strcmp(knew->name, kname) == 0)
2546 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2547 for (i = 0; kctl && i < kctl->count; i++) {
2548 err = snd_hda_add_nid(codec, kctl, i,
2556 /* other nid->control mapping */
2557 for (i = 0; i < spec->num_mixers; i++) {
2558 for (knew = spec->mixers[i]; knew->name; knew++) {
2559 if (knew->iface != NID_MAPPING)
2561 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2564 u = knew->subdevice;
2565 for (j = 0; j < 4; j++, u >>= 8) {
2570 case SUBDEV_SPEAKER_:
2571 nid = spec->autocfg.speaker_pins[nid];
2574 nid = spec->autocfg.line_out_pins[nid];
2577 nid = spec->autocfg.hp_pins[nid];
2582 err = snd_hda_add_nid(codec, kctl, 0, nid);
2586 u = knew->private_value;
2587 for (j = 0; j < 4; j++, u >>= 8) {
2591 err = snd_hda_add_nid(codec, kctl, 0, nid);
2602 * initialize the codec volumes, etc
2606 * generic initialization of ADC, input mixers and output mixers
2608 static struct hda_verb alc880_volume_init_verbs[] = {
2610 * Unmute ADC0-2 and set the default input to mic-in
2612 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2613 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2614 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2615 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2616 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2617 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2619 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2621 * Note: PASD motherboards uses the Line In 2 as the input for front
2624 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2625 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2626 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2627 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2628 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2629 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2630 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2631 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2634 * Set up output mixers (0x0c - 0x0f)
2636 /* set vol=0 to output mixers */
2637 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2638 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2639 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2640 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2641 /* set up input amps for analog loopback */
2642 /* Amp Indices: DAC = 0, mixer = 1 */
2643 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2644 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2645 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2646 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2647 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2648 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2649 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2650 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2656 * 3-stack pin configuration:
2657 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2659 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2661 * preset connection lists of input pins
2662 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2664 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2665 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2666 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2669 * Set pin mode and muting
2671 /* set front pin widgets 0x14 for output */
2672 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2673 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2674 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2675 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2676 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2677 /* Mic2 (as headphone out) for HP output */
2678 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2679 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2680 /* Line In pin widget for input */
2681 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2682 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2683 /* Line2 (as front mic) pin widget for input and vref at 80% */
2684 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2685 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2686 /* CD pin widget for input */
2687 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2693 * 5-stack pin configuration:
2694 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2695 * line-in/side = 0x1a, f-mic = 0x1b
2697 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2699 * preset connection lists of input pins
2700 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2702 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2703 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2706 * Set pin mode and muting
2708 /* set pin widgets 0x14-0x17 for output */
2709 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2710 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2711 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2712 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2713 /* unmute pins for output (no gain on this amp) */
2714 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2715 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2716 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2717 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2719 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2720 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2721 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2722 /* Mic2 (as headphone out) for HP output */
2723 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2724 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2725 /* Line In pin widget for input */
2726 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2727 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2728 /* Line2 (as front mic) pin widget for input and vref at 80% */
2729 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2730 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2731 /* CD pin widget for input */
2732 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2738 * W810 pin configuration:
2739 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2741 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2742 /* hphone/speaker input selector: front DAC */
2743 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2745 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2746 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2747 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2748 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2749 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2750 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2752 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2753 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2759 * Z71V pin configuration:
2760 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2762 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2763 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2764 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2765 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2766 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2768 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2769 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2770 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2771 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2777 * 6-stack pin configuration:
2778 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2779 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2781 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2782 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2784 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2785 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2786 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2787 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2788 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2789 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2790 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2791 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2793 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2794 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2795 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2796 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2797 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2798 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2799 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2800 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2801 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2807 * Uniwill pin configuration:
2808 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2811 static struct hda_verb alc880_uniwill_init_verbs[] = {
2812 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2814 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2815 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2816 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2817 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2818 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2819 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2820 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2821 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2822 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2823 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2824 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2825 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2826 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2827 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2829 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2830 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2831 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2832 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2833 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2834 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2835 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2836 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2837 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2839 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2840 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2847 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2849 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2850 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2852 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2853 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2854 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2855 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2856 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2857 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2858 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2859 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2860 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2861 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2862 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2863 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2865 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2866 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2867 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2868 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2869 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2870 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2872 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2873 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2878 static struct hda_verb alc880_beep_init_verbs[] = {
2879 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2883 /* auto-toggle front mic */
2884 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2886 unsigned int present;
2889 present = snd_hda_jack_detect(codec, 0x18);
2890 bits = present ? HDA_AMP_MUTE : 0;
2891 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2894 static void alc880_uniwill_setup(struct hda_codec *codec)
2896 struct alc_spec *spec = codec->spec;
2898 spec->autocfg.hp_pins[0] = 0x14;
2899 spec->autocfg.speaker_pins[0] = 0x15;
2900 spec->autocfg.speaker_pins[0] = 0x16;
2903 static void alc880_uniwill_init_hook(struct hda_codec *codec)
2905 alc_automute_amp(codec);
2906 alc880_uniwill_mic_automute(codec);
2909 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2912 /* Looks like the unsol event is incompatible with the standard
2913 * definition. 4bit tag is placed at 28 bit!
2915 switch (res >> 28) {
2916 case ALC880_MIC_EVENT:
2917 alc880_uniwill_mic_automute(codec);
2920 alc_automute_amp_unsol_event(codec, res);
2925 static void alc880_uniwill_p53_setup(struct hda_codec *codec)
2927 struct alc_spec *spec = codec->spec;
2929 spec->autocfg.hp_pins[0] = 0x14;
2930 spec->autocfg.speaker_pins[0] = 0x15;
2933 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2935 unsigned int present;
2937 present = snd_hda_codec_read(codec, 0x21, 0,
2938 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2939 present &= HDA_AMP_VOLMASK;
2940 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2941 HDA_AMP_VOLMASK, present);
2942 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2943 HDA_AMP_VOLMASK, present);
2946 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2949 /* Looks like the unsol event is incompatible with the standard
2950 * definition. 4bit tag is placed at 28 bit!
2952 if ((res >> 28) == ALC880_DCVOL_EVENT)
2953 alc880_uniwill_p53_dcvol_automute(codec);
2955 alc_automute_amp_unsol_event(codec, res);
2959 * F1734 pin configuration:
2960 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2962 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2963 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2964 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2965 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2966 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2967 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2969 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2970 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2971 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2972 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2974 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2975 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2976 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2977 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2978 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2979 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2980 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2981 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2982 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2984 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2985 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2991 * ASUS pin configuration:
2992 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2994 static struct hda_verb alc880_pin_asus_init_verbs[] = {
2995 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2996 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2997 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2998 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3000 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3001 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3002 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3003 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3004 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3005 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3006 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3007 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3009 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3010 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3011 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3012 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3013 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3014 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3015 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3016 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3017 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3022 /* Enable GPIO mask and set output */
3023 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
3024 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
3025 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
3027 /* Clevo m520g init */
3028 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
3029 /* headphone output */
3030 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3032 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3033 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3035 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3036 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3038 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3039 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3040 /* Mic1 (rear panel) */
3041 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3042 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3043 /* Mic2 (front panel) */
3044 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3045 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3047 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3048 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3049 /* change to EAPD mode */
3050 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3051 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3056 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
3057 /* change to EAPD mode */
3058 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3059 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3061 /* Headphone output */
3062 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3064 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3065 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
3067 /* Line In pin widget for input */
3068 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3069 /* CD pin widget for input */
3070 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3071 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3072 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3074 /* change to EAPD mode */
3075 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3076 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
3082 * LG m1 express dual
3085 * Rear Line-In/Out (blue): 0x14
3086 * Build-in Mic-In: 0x15
3088 * HP-Out (green): 0x1b
3089 * Mic-In/Out (red): 0x19
3093 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
3094 static hda_nid_t alc880_lg_dac_nids[3] = {
3098 /* seems analog CD is not working */
3099 static struct hda_input_mux alc880_lg_capture_source = {
3104 { "Internal Mic", 0x6 },
3108 /* 2,4,6 channel modes */
3109 static struct hda_verb alc880_lg_ch2_init[] = {
3110 /* set line-in and mic-in to input */
3111 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
3112 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3116 static struct hda_verb alc880_lg_ch4_init[] = {
3117 /* set line-in to out and mic-in to input */
3118 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3119 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3123 static struct hda_verb alc880_lg_ch6_init[] = {
3124 /* set line-in and mic-in to output */
3125 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3126 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3130 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
3131 { 2, alc880_lg_ch2_init },
3132 { 4, alc880_lg_ch4_init },
3133 { 6, alc880_lg_ch6_init },
3136 static struct snd_kcontrol_new alc880_lg_mixer[] = {
3137 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3138 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3139 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3140 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3141 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3142 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3143 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3144 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3145 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3146 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3147 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3148 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3149 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3150 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3152 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3153 .name = "Channel Mode",
3154 .info = alc_ch_mode_info,
3155 .get = alc_ch_mode_get,
3156 .put = alc_ch_mode_put,
3161 static struct hda_verb alc880_lg_init_verbs[] = {
3162 /* set capture source to mic-in */
3163 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3164 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3165 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3166 /* mute all amp mixer inputs */
3167 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3168 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3169 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3170 /* line-in to input */
3171 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3172 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3174 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3175 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3177 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3178 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3179 /* mic-in to input */
3180 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3181 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3182 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3184 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3185 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3186 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3188 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3192 /* toggle speaker-output according to the hp-jack state */
3193 static void alc880_lg_setup(struct hda_codec *codec)
3195 struct alc_spec *spec = codec->spec;
3197 spec->autocfg.hp_pins[0] = 0x1b;
3198 spec->autocfg.speaker_pins[0] = 0x17;
3207 * Built-in Mic-In: 0x19
3213 static struct hda_input_mux alc880_lg_lw_capture_source = {
3217 { "Internal Mic", 0x1 },
3222 #define alc880_lg_lw_modes alc880_threestack_modes
3224 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3225 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3226 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3227 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3228 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3229 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3230 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3231 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3232 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3233 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3234 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3235 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3236 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3237 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
3238 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
3240 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3241 .name = "Channel Mode",
3242 .info = alc_ch_mode_info,
3243 .get = alc_ch_mode_get,
3244 .put = alc_ch_mode_put,
3249 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3250 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3251 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3252 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3254 /* set capture source to mic-in */
3255 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3256 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3257 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3258 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3260 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3261 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3263 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3264 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3265 /* mic-in to input */
3266 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3267 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3269 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3270 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3272 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3276 /* toggle speaker-output according to the hp-jack state */
3277 static void alc880_lg_lw_setup(struct hda_codec *codec)
3279 struct alc_spec *spec = codec->spec;
3281 spec->autocfg.hp_pins[0] = 0x1b;
3282 spec->autocfg.speaker_pins[0] = 0x14;
3285 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3286 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3287 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3288 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3289 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3290 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3291 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3295 static struct hda_input_mux alc880_medion_rim_capture_source = {
3299 { "Internal Mic", 0x1 },
3303 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3304 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3306 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3307 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3309 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3310 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3311 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3312 /* Mic2 (as headphone out) for HP output */
3313 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3314 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3315 /* Internal Speaker */
3316 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3317 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3319 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3320 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3322 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3326 /* toggle speaker-output according to the hp-jack state */
3327 static void alc880_medion_rim_automute(struct hda_codec *codec)
3329 struct alc_spec *spec = codec->spec;
3330 alc_automute_amp(codec);
3332 if (spec->jack_present)
3333 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3335 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3338 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3341 /* Looks like the unsol event is incompatible with the standard
3342 * definition. 4bit tag is placed at 28 bit!
3344 if ((res >> 28) == ALC880_HP_EVENT)
3345 alc880_medion_rim_automute(codec);
3348 static void alc880_medion_rim_setup(struct hda_codec *codec)
3350 struct alc_spec *spec = codec->spec;
3352 spec->autocfg.hp_pins[0] = 0x14;
3353 spec->autocfg.speaker_pins[0] = 0x1b;
3356 #ifdef CONFIG_SND_HDA_POWER_SAVE
3357 static struct hda_amp_list alc880_loopbacks[] = {
3358 { 0x0b, HDA_INPUT, 0 },
3359 { 0x0b, HDA_INPUT, 1 },
3360 { 0x0b, HDA_INPUT, 2 },
3361 { 0x0b, HDA_INPUT, 3 },
3362 { 0x0b, HDA_INPUT, 4 },
3366 static struct hda_amp_list alc880_lg_loopbacks[] = {
3367 { 0x0b, HDA_INPUT, 1 },
3368 { 0x0b, HDA_INPUT, 6 },
3369 { 0x0b, HDA_INPUT, 7 },
3378 static int alc_init(struct hda_codec *codec)
3380 struct alc_spec *spec = codec->spec;
3384 alc_auto_init_amp(codec, spec->init_amp);
3386 for (i = 0; i < spec->num_init_verbs; i++)
3387 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3389 if (spec->init_hook)
3390 spec->init_hook(codec);
3395 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3397 struct alc_spec *spec = codec->spec;
3399 if (spec->unsol_event)
3400 spec->unsol_event(codec, res);
3403 #ifdef CONFIG_SND_HDA_POWER_SAVE
3404 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3406 struct alc_spec *spec = codec->spec;
3407 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3412 * Analog playback callbacks
3414 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3415 struct hda_codec *codec,
3416 struct snd_pcm_substream *substream)
3418 struct alc_spec *spec = codec->spec;
3419 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3423 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3424 struct hda_codec *codec,
3425 unsigned int stream_tag,
3426 unsigned int format,
3427 struct snd_pcm_substream *substream)
3429 struct alc_spec *spec = codec->spec;
3430 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3431 stream_tag, format, substream);
3434 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3435 struct hda_codec *codec,
3436 struct snd_pcm_substream *substream)
3438 struct alc_spec *spec = codec->spec;
3439 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3445 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3446 struct hda_codec *codec,
3447 struct snd_pcm_substream *substream)
3449 struct alc_spec *spec = codec->spec;
3450 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3453 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3454 struct hda_codec *codec,
3455 unsigned int stream_tag,
3456 unsigned int format,
3457 struct snd_pcm_substream *substream)
3459 struct alc_spec *spec = codec->spec;
3460 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3461 stream_tag, format, substream);
3464 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3465 struct hda_codec *codec,
3466 struct snd_pcm_substream *substream)
3468 struct alc_spec *spec = codec->spec;
3469 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3472 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3473 struct hda_codec *codec,
3474 struct snd_pcm_substream *substream)
3476 struct alc_spec *spec = codec->spec;
3477 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3483 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3484 struct hda_codec *codec,
3485 unsigned int stream_tag,
3486 unsigned int format,
3487 struct snd_pcm_substream *substream)
3489 struct alc_spec *spec = codec->spec;
3491 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3492 stream_tag, 0, format);
3496 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3497 struct hda_codec *codec,
3498 struct snd_pcm_substream *substream)
3500 struct alc_spec *spec = codec->spec;
3502 snd_hda_codec_cleanup_stream(codec,
3503 spec->adc_nids[substream->number + 1]);
3510 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3514 /* NID is set in alc_build_pcms */
3516 .open = alc880_playback_pcm_open,
3517 .prepare = alc880_playback_pcm_prepare,
3518 .cleanup = alc880_playback_pcm_cleanup
3522 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3526 /* NID is set in alc_build_pcms */
3529 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3533 /* NID is set in alc_build_pcms */
3536 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3537 .substreams = 2, /* can be overridden */
3540 /* NID is set in alc_build_pcms */
3542 .prepare = alc880_alt_capture_pcm_prepare,
3543 .cleanup = alc880_alt_capture_pcm_cleanup
3547 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3551 /* NID is set in alc_build_pcms */
3553 .open = alc880_dig_playback_pcm_open,
3554 .close = alc880_dig_playback_pcm_close,
3555 .prepare = alc880_dig_playback_pcm_prepare,
3556 .cleanup = alc880_dig_playback_pcm_cleanup
3560 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3564 /* NID is set in alc_build_pcms */
3567 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3568 static struct hda_pcm_stream alc_pcm_null_stream = {
3574 static int alc_build_pcms(struct hda_codec *codec)
3576 struct alc_spec *spec = codec->spec;
3577 struct hda_pcm *info = spec->pcm_rec;
3580 codec->num_pcms = 1;
3581 codec->pcm_info = info;
3583 if (spec->no_analog)
3586 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
3587 "%s Analog", codec->chip_name);
3588 info->name = spec->stream_name_analog;
3590 if (spec->stream_analog_playback) {
3591 if (snd_BUG_ON(!spec->multiout.dac_nids))
3593 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3594 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3596 if (spec->stream_analog_capture) {
3597 if (snd_BUG_ON(!spec->adc_nids))
3599 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3600 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3603 if (spec->channel_mode) {
3604 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3605 for (i = 0; i < spec->num_channel_mode; i++) {
3606 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3607 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3613 /* SPDIF for stream index #1 */
3614 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3615 snprintf(spec->stream_name_digital,
3616 sizeof(spec->stream_name_digital),
3617 "%s Digital", codec->chip_name);
3618 codec->num_pcms = 2;
3619 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3620 info = spec->pcm_rec + 1;
3621 info->name = spec->stream_name_digital;
3622 if (spec->dig_out_type)
3623 info->pcm_type = spec->dig_out_type;
3625 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3626 if (spec->multiout.dig_out_nid &&
3627 spec->stream_digital_playback) {
3628 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3629 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3631 if (spec->dig_in_nid &&
3632 spec->stream_digital_capture) {
3633 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3634 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3636 /* FIXME: do we need this for all Realtek codec models? */
3637 codec->spdif_status_reset = 1;
3640 if (spec->no_analog)
3643 /* If the use of more than one ADC is requested for the current
3644 * model, configure a second analog capture-only PCM.
3646 /* Additional Analaog capture for index #2 */
3647 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3648 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3649 codec->num_pcms = 3;
3650 info = spec->pcm_rec + 2;
3651 info->name = spec->stream_name_analog;
3652 if (spec->alt_dac_nid) {
3653 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3654 *spec->stream_analog_alt_playback;
3655 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3658 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3659 alc_pcm_null_stream;
3660 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3662 if (spec->num_adc_nids > 1) {
3663 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3664 *spec->stream_analog_alt_capture;
3665 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3667 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3668 spec->num_adc_nids - 1;
3670 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3671 alc_pcm_null_stream;
3672 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3679 static inline void alc_shutup(struct hda_codec *codec)
3681 snd_hda_shutup_pins(codec);
3684 static void alc_free_kctls(struct hda_codec *codec)
3686 struct alc_spec *spec = codec->spec;
3688 if (spec->kctls.list) {
3689 struct snd_kcontrol_new *kctl = spec->kctls.list;
3691 for (i = 0; i < spec->kctls.used; i++)
3692 kfree(kctl[i].name);
3694 snd_array_free(&spec->kctls);
3697 static void alc_free(struct hda_codec *codec)
3699 struct alc_spec *spec = codec->spec;
3705 alc_free_kctls(codec);
3707 snd_hda_detach_beep_device(codec);
3710 #ifdef CONFIG_SND_HDA_POWER_SAVE
3711 static void alc_power_eapd(struct hda_codec *codec)
3713 /* We currently only handle front, HP */
3714 switch (codec->vendor_id) {
3716 set_eapd(codec, 0x0f, 0);
3717 set_eapd(codec, 0x10, 0);
3730 set_eapd(codec, 0x14, 0);
3731 set_eapd(codec, 0x15, 0);
3736 static int alc_suspend(struct hda_codec *codec, pm_message_t state)
3738 struct alc_spec *spec = codec->spec;
3740 if (spec && spec->power_hook)
3741 spec->power_hook(codec);
3746 #ifdef SND_HDA_NEEDS_RESUME
3747 static int alc_resume(struct hda_codec *codec)
3749 codec->patch_ops.init(codec);
3750 snd_hda_codec_resume_amp(codec);
3751 snd_hda_codec_resume_cache(codec);
3758 static struct hda_codec_ops alc_patch_ops = {
3759 .build_controls = alc_build_controls,
3760 .build_pcms = alc_build_pcms,
3763 .unsol_event = alc_unsol_event,
3764 #ifdef SND_HDA_NEEDS_RESUME
3765 .resume = alc_resume,
3767 #ifdef CONFIG_SND_HDA_POWER_SAVE
3768 .suspend = alc_suspend,
3769 .check_power_status = alc_check_power_status,
3771 .reboot_notify = alc_shutup,
3776 * Test configuration for debugging
3778 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3781 #ifdef CONFIG_SND_DEBUG
3782 static hda_nid_t alc880_test_dac_nids[4] = {
3783 0x02, 0x03, 0x04, 0x05
3786 static struct hda_input_mux alc880_test_capture_source = {
3795 { "Surround", 0x6 },
3799 static struct hda_channel_mode alc880_test_modes[4] = {
3806 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3807 struct snd_ctl_elem_info *uinfo)
3809 static char *texts[] = {
3810 "N/A", "Line Out", "HP Out",
3811 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3813 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3815 uinfo->value.enumerated.items = 8;
3816 if (uinfo->value.enumerated.item >= 8)
3817 uinfo->value.enumerated.item = 7;
3818 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3822 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3823 struct snd_ctl_elem_value *ucontrol)
3825 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3826 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3827 unsigned int pin_ctl, item = 0;
3829 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3830 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3831 if (pin_ctl & AC_PINCTL_OUT_EN) {
3832 if (pin_ctl & AC_PINCTL_HP_EN)
3836 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3837 switch (pin_ctl & AC_PINCTL_VREFEN) {
3838 case AC_PINCTL_VREF_HIZ: item = 3; break;
3839 case AC_PINCTL_VREF_50: item = 4; break;
3840 case AC_PINCTL_VREF_GRD: item = 5; break;
3841 case AC_PINCTL_VREF_80: item = 6; break;
3842 case AC_PINCTL_VREF_100: item = 7; break;
3845 ucontrol->value.enumerated.item[0] = item;
3849 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3850 struct snd_ctl_elem_value *ucontrol)
3852 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3853 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3854 static unsigned int ctls[] = {
3855 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3856 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3857 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3858 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3859 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3860 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3862 unsigned int old_ctl, new_ctl;
3864 old_ctl = snd_hda_codec_read(codec, nid, 0,
3865 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3866 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3867 if (old_ctl != new_ctl) {
3869 snd_hda_codec_write_cache(codec, nid, 0,
3870 AC_VERB_SET_PIN_WIDGET_CONTROL,
3872 val = ucontrol->value.enumerated.item[0] >= 3 ?
3874 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3881 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3882 struct snd_ctl_elem_info *uinfo)
3884 static char *texts[] = {
3885 "Front", "Surround", "CLFE", "Side"
3887 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3889 uinfo->value.enumerated.items = 4;
3890 if (uinfo->value.enumerated.item >= 4)
3891 uinfo->value.enumerated.item = 3;
3892 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3896 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3897 struct snd_ctl_elem_value *ucontrol)
3899 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3900 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3903 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3904 ucontrol->value.enumerated.item[0] = sel & 3;
3908 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3909 struct snd_ctl_elem_value *ucontrol)
3911 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3912 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3915 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3916 if (ucontrol->value.enumerated.item[0] != sel) {
3917 sel = ucontrol->value.enumerated.item[0] & 3;
3918 snd_hda_codec_write_cache(codec, nid, 0,
3919 AC_VERB_SET_CONNECT_SEL, sel);
3925 #define PIN_CTL_TEST(xname,nid) { \
3926 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3928 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
3929 .info = alc_test_pin_ctl_info, \
3930 .get = alc_test_pin_ctl_get, \
3931 .put = alc_test_pin_ctl_put, \
3932 .private_value = nid \
3935 #define PIN_SRC_TEST(xname,nid) { \
3936 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3938 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
3939 .info = alc_test_pin_src_info, \
3940 .get = alc_test_pin_src_get, \
3941 .put = alc_test_pin_src_put, \
3942 .private_value = nid \
3945 static struct snd_kcontrol_new alc880_test_mixer[] = {
3946 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3947 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3948 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3949 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3950 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3951 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3952 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3953 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3954 PIN_CTL_TEST("Front Pin Mode", 0x14),
3955 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3956 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3957 PIN_CTL_TEST("Side Pin Mode", 0x17),
3958 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3959 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3960 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3961 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3962 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3963 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3964 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3965 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3966 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3967 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3968 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3969 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3970 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3971 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3972 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3973 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3974 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3975 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3977 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3978 .name = "Channel Mode",
3979 .info = alc_ch_mode_info,
3980 .get = alc_ch_mode_get,
3981 .put = alc_ch_mode_put,
3986 static struct hda_verb alc880_test_init_verbs[] = {
3987 /* Unmute inputs of 0x0c - 0x0f */
3988 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3989 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3990 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3991 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3992 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3993 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3994 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3995 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3996 /* Vol output for 0x0c-0x0f */
3997 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3998 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3999 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4000 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4001 /* Set output pins 0x14-0x17 */
4002 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4003 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4004 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4005 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4006 /* Unmute output pins 0x14-0x17 */
4007 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4008 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4009 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4010 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4011 /* Set input pins 0x18-0x1c */
4012 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4013 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4014 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4015 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4016 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4017 /* Mute input pins 0x18-0x1b */
4018 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4019 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4020 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4021 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4023 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4024 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
4025 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4026 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
4027 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4028 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
4029 /* Analog input/passthru */
4030 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4031 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4032 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4033 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4034 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4042 static const char *alc880_models[ALC880_MODEL_LAST] = {
4043 [ALC880_3ST] = "3stack",
4044 [ALC880_TCL_S700] = "tcl",
4045 [ALC880_3ST_DIG] = "3stack-digout",
4046 [ALC880_CLEVO] = "clevo",
4047 [ALC880_5ST] = "5stack",
4048 [ALC880_5ST_DIG] = "5stack-digout",
4049 [ALC880_W810] = "w810",
4050 [ALC880_Z71V] = "z71v",
4051 [ALC880_6ST] = "6stack",
4052 [ALC880_6ST_DIG] = "6stack-digout",
4053 [ALC880_ASUS] = "asus",
4054 [ALC880_ASUS_W1V] = "asus-w1v",
4055 [ALC880_ASUS_DIG] = "asus-dig",
4056 [ALC880_ASUS_DIG2] = "asus-dig2",
4057 [ALC880_UNIWILL_DIG] = "uniwill",
4058 [ALC880_UNIWILL_P53] = "uniwill-p53",
4059 [ALC880_FUJITSU] = "fujitsu",
4060 [ALC880_F1734] = "F1734",
4062 [ALC880_LG_LW] = "lg-lw",
4063 [ALC880_MEDION_RIM] = "medion",
4064 #ifdef CONFIG_SND_DEBUG
4065 [ALC880_TEST] = "test",
4067 [ALC880_AUTO] = "auto",
4070 static struct snd_pci_quirk alc880_cfg_tbl[] = {
4071 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
4072 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
4073 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
4074 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
4075 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
4076 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
4077 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
4078 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
4079 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
4080 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
4081 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
4082 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
4083 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
4084 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
4085 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
4086 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
4087 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
4088 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
4089 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
4090 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
4091 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
4092 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
4093 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
4094 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
4095 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
4096 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
4097 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
4098 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
4099 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
4100 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
4101 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
4102 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
4103 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
4104 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
4105 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
4106 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
4107 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
4108 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
4109 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
4110 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
4111 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
4112 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
4113 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
4114 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
4115 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
4116 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
4117 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
4118 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
4119 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
4120 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
4121 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
4122 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
4123 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
4124 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
4125 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
4126 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
4127 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
4128 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
4129 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
4130 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
4131 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
4132 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
4133 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
4134 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
4135 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
4136 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
4137 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
4138 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
4140 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
4141 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
4142 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
4147 * ALC880 codec presets
4149 static struct alc_config_preset alc880_presets[] = {
4151 .mixers = { alc880_three_stack_mixer },
4152 .init_verbs = { alc880_volume_init_verbs,
4153 alc880_pin_3stack_init_verbs },
4154 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4155 .dac_nids = alc880_dac_nids,
4156 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4157 .channel_mode = alc880_threestack_modes,
4159 .input_mux = &alc880_capture_source,
4161 [ALC880_3ST_DIG] = {
4162 .mixers = { alc880_three_stack_mixer },
4163 .init_verbs = { alc880_volume_init_verbs,
4164 alc880_pin_3stack_init_verbs },
4165 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4166 .dac_nids = alc880_dac_nids,
4167 .dig_out_nid = ALC880_DIGOUT_NID,
4168 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4169 .channel_mode = alc880_threestack_modes,
4171 .input_mux = &alc880_capture_source,
4173 [ALC880_TCL_S700] = {
4174 .mixers = { alc880_tcl_s700_mixer },
4175 .init_verbs = { alc880_volume_init_verbs,
4176 alc880_pin_tcl_S700_init_verbs,
4177 alc880_gpio2_init_verbs },
4178 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4179 .dac_nids = alc880_dac_nids,
4180 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4181 .num_adc_nids = 1, /* single ADC */
4183 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4184 .channel_mode = alc880_2_jack_modes,
4185 .input_mux = &alc880_capture_source,
4188 .mixers = { alc880_three_stack_mixer,
4189 alc880_five_stack_mixer},
4190 .init_verbs = { alc880_volume_init_verbs,
4191 alc880_pin_5stack_init_verbs },
4192 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4193 .dac_nids = alc880_dac_nids,
4194 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4195 .channel_mode = alc880_fivestack_modes,
4196 .input_mux = &alc880_capture_source,
4198 [ALC880_5ST_DIG] = {
4199 .mixers = { alc880_three_stack_mixer,
4200 alc880_five_stack_mixer },
4201 .init_verbs = { alc880_volume_init_verbs,
4202 alc880_pin_5stack_init_verbs },
4203 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4204 .dac_nids = alc880_dac_nids,
4205 .dig_out_nid = ALC880_DIGOUT_NID,
4206 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4207 .channel_mode = alc880_fivestack_modes,
4208 .input_mux = &alc880_capture_source,
4211 .mixers = { alc880_six_stack_mixer },
4212 .init_verbs = { alc880_volume_init_verbs,
4213 alc880_pin_6stack_init_verbs },
4214 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4215 .dac_nids = alc880_6st_dac_nids,
4216 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4217 .channel_mode = alc880_sixstack_modes,
4218 .input_mux = &alc880_6stack_capture_source,
4220 [ALC880_6ST_DIG] = {
4221 .mixers = { alc880_six_stack_mixer },
4222 .init_verbs = { alc880_volume_init_verbs,
4223 alc880_pin_6stack_init_verbs },
4224 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4225 .dac_nids = alc880_6st_dac_nids,
4226 .dig_out_nid = ALC880_DIGOUT_NID,
4227 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4228 .channel_mode = alc880_sixstack_modes,
4229 .input_mux = &alc880_6stack_capture_source,
4232 .mixers = { alc880_w810_base_mixer },
4233 .init_verbs = { alc880_volume_init_verbs,
4234 alc880_pin_w810_init_verbs,
4235 alc880_gpio2_init_verbs },
4236 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
4237 .dac_nids = alc880_w810_dac_nids,
4238 .dig_out_nid = ALC880_DIGOUT_NID,
4239 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4240 .channel_mode = alc880_w810_modes,
4241 .input_mux = &alc880_capture_source,
4244 .mixers = { alc880_z71v_mixer },
4245 .init_verbs = { alc880_volume_init_verbs,
4246 alc880_pin_z71v_init_verbs },
4247 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
4248 .dac_nids = alc880_z71v_dac_nids,
4249 .dig_out_nid = ALC880_DIGOUT_NID,
4251 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4252 .channel_mode = alc880_2_jack_modes,
4253 .input_mux = &alc880_capture_source,
4256 .mixers = { alc880_f1734_mixer },
4257 .init_verbs = { alc880_volume_init_verbs,
4258 alc880_pin_f1734_init_verbs },
4259 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
4260 .dac_nids = alc880_f1734_dac_nids,
4262 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4263 .channel_mode = alc880_2_jack_modes,
4264 .input_mux = &alc880_f1734_capture_source,
4265 .unsol_event = alc880_uniwill_p53_unsol_event,
4266 .setup = alc880_uniwill_p53_setup,
4267 .init_hook = alc_automute_amp,
4270 .mixers = { alc880_asus_mixer },
4271 .init_verbs = { alc880_volume_init_verbs,
4272 alc880_pin_asus_init_verbs,
4273 alc880_gpio1_init_verbs },
4274 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4275 .dac_nids = alc880_asus_dac_nids,
4276 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4277 .channel_mode = alc880_asus_modes,
4279 .input_mux = &alc880_capture_source,
4281 [ALC880_ASUS_DIG] = {
4282 .mixers = { alc880_asus_mixer },
4283 .init_verbs = { alc880_volume_init_verbs,
4284 alc880_pin_asus_init_verbs,
4285 alc880_gpio1_init_verbs },
4286 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4287 .dac_nids = alc880_asus_dac_nids,
4288 .dig_out_nid = ALC880_DIGOUT_NID,
4289 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4290 .channel_mode = alc880_asus_modes,
4292 .input_mux = &alc880_capture_source,
4294 [ALC880_ASUS_DIG2] = {
4295 .mixers = { alc880_asus_mixer },
4296 .init_verbs = { alc880_volume_init_verbs,
4297 alc880_pin_asus_init_verbs,
4298 alc880_gpio2_init_verbs }, /* use GPIO2 */
4299 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4300 .dac_nids = alc880_asus_dac_nids,
4301 .dig_out_nid = ALC880_DIGOUT_NID,
4302 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4303 .channel_mode = alc880_asus_modes,
4305 .input_mux = &alc880_capture_source,
4307 [ALC880_ASUS_W1V] = {
4308 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4309 .init_verbs = { alc880_volume_init_verbs,
4310 alc880_pin_asus_init_verbs,
4311 alc880_gpio1_init_verbs },
4312 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4313 .dac_nids = alc880_asus_dac_nids,
4314 .dig_out_nid = ALC880_DIGOUT_NID,
4315 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4316 .channel_mode = alc880_asus_modes,
4318 .input_mux = &alc880_capture_source,
4320 [ALC880_UNIWILL_DIG] = {
4321 .mixers = { alc880_asus_mixer },
4322 .init_verbs = { alc880_volume_init_verbs,
4323 alc880_pin_asus_init_verbs },
4324 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4325 .dac_nids = alc880_asus_dac_nids,
4326 .dig_out_nid = ALC880_DIGOUT_NID,
4327 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4328 .channel_mode = alc880_asus_modes,
4330 .input_mux = &alc880_capture_source,
4332 [ALC880_UNIWILL] = {
4333 .mixers = { alc880_uniwill_mixer },
4334 .init_verbs = { alc880_volume_init_verbs,
4335 alc880_uniwill_init_verbs },
4336 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4337 .dac_nids = alc880_asus_dac_nids,
4338 .dig_out_nid = ALC880_DIGOUT_NID,
4339 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4340 .channel_mode = alc880_threestack_modes,
4342 .input_mux = &alc880_capture_source,
4343 .unsol_event = alc880_uniwill_unsol_event,
4344 .setup = alc880_uniwill_setup,
4345 .init_hook = alc880_uniwill_init_hook,
4347 [ALC880_UNIWILL_P53] = {
4348 .mixers = { alc880_uniwill_p53_mixer },
4349 .init_verbs = { alc880_volume_init_verbs,
4350 alc880_uniwill_p53_init_verbs },
4351 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4352 .dac_nids = alc880_asus_dac_nids,
4353 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4354 .channel_mode = alc880_threestack_modes,
4355 .input_mux = &alc880_capture_source,
4356 .unsol_event = alc880_uniwill_p53_unsol_event,
4357 .setup = alc880_uniwill_p53_setup,
4358 .init_hook = alc_automute_amp,
4360 [ALC880_FUJITSU] = {
4361 .mixers = { alc880_fujitsu_mixer },
4362 .init_verbs = { alc880_volume_init_verbs,
4363 alc880_uniwill_p53_init_verbs,
4364 alc880_beep_init_verbs },
4365 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4366 .dac_nids = alc880_dac_nids,
4367 .dig_out_nid = ALC880_DIGOUT_NID,
4368 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4369 .channel_mode = alc880_2_jack_modes,
4370 .input_mux = &alc880_capture_source,
4371 .unsol_event = alc880_uniwill_p53_unsol_event,
4372 .setup = alc880_uniwill_p53_setup,
4373 .init_hook = alc_automute_amp,
4376 .mixers = { alc880_three_stack_mixer },
4377 .init_verbs = { alc880_volume_init_verbs,
4378 alc880_pin_clevo_init_verbs },
4379 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4380 .dac_nids = alc880_dac_nids,
4382 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4383 .channel_mode = alc880_threestack_modes,
4385 .input_mux = &alc880_capture_source,
4388 .mixers = { alc880_lg_mixer },
4389 .init_verbs = { alc880_volume_init_verbs,
4390 alc880_lg_init_verbs },
4391 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4392 .dac_nids = alc880_lg_dac_nids,
4393 .dig_out_nid = ALC880_DIGOUT_NID,
4394 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4395 .channel_mode = alc880_lg_ch_modes,
4397 .input_mux = &alc880_lg_capture_source,
4398 .unsol_event = alc_automute_amp_unsol_event,
4399 .setup = alc880_lg_setup,
4400 .init_hook = alc_automute_amp,
4401 #ifdef CONFIG_SND_HDA_POWER_SAVE
4402 .loopbacks = alc880_lg_loopbacks,
4406 .mixers = { alc880_lg_lw_mixer },
4407 .init_verbs = { alc880_volume_init_verbs,
4408 alc880_lg_lw_init_verbs },
4409 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4410 .dac_nids = alc880_dac_nids,
4411 .dig_out_nid = ALC880_DIGOUT_NID,
4412 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4413 .channel_mode = alc880_lg_lw_modes,
4414 .input_mux = &alc880_lg_lw_capture_source,
4415 .unsol_event = alc_automute_amp_unsol_event,
4416 .setup = alc880_lg_lw_setup,
4417 .init_hook = alc_automute_amp,
4419 [ALC880_MEDION_RIM] = {
4420 .mixers = { alc880_medion_rim_mixer },
4421 .init_verbs = { alc880_volume_init_verbs,
4422 alc880_medion_rim_init_verbs,
4423 alc_gpio2_init_verbs },
4424 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4425 .dac_nids = alc880_dac_nids,
4426 .dig_out_nid = ALC880_DIGOUT_NID,
4427 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4428 .channel_mode = alc880_2_jack_modes,
4429 .input_mux = &alc880_medion_rim_capture_source,
4430 .unsol_event = alc880_medion_rim_unsol_event,
4431 .setup = alc880_medion_rim_setup,
4432 .init_hook = alc880_medion_rim_automute,
4434 #ifdef CONFIG_SND_DEBUG
4436 .mixers = { alc880_test_mixer },
4437 .init_verbs = { alc880_test_init_verbs },
4438 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4439 .dac_nids = alc880_test_dac_nids,
4440 .dig_out_nid = ALC880_DIGOUT_NID,
4441 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4442 .channel_mode = alc880_test_modes,
4443 .input_mux = &alc880_test_capture_source,
4449 * Automatic parse of I/O pins from the BIOS configuration
4454 ALC_CTL_WIDGET_MUTE,
4457 static struct snd_kcontrol_new alc880_control_templates[] = {
4458 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4459 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4460 HDA_BIND_MUTE(NULL, 0, 0, 0),
4463 /* add dynamic controls */
4464 static int add_control(struct alc_spec *spec, int type, const char *name,
4467 struct snd_kcontrol_new *knew;
4469 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4470 knew = snd_array_new(&spec->kctls);
4473 *knew = alc880_control_templates[type];
4474 knew->name = kstrdup(name, GFP_KERNEL);
4477 if (get_amp_nid_(val))
4478 knew->subdevice = HDA_SUBDEV_AMP_FLAG;
4479 knew->private_value = val;
4483 static int add_control_with_pfx(struct alc_spec *spec, int type,
4484 const char *pfx, const char *dir,
4485 const char *sfx, unsigned long val)
4488 snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx);
4489 return add_control(spec, type, name, val);
4492 #define add_pb_vol_ctrl(spec, type, pfx, val) \
4493 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", val)
4494 #define add_pb_sw_ctrl(spec, type, pfx, val) \
4495 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", val)
4497 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4498 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4499 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4500 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4501 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4502 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4503 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4504 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4505 #define ALC880_PIN_CD_NID 0x1c
4507 /* fill in the dac_nids table from the parsed pin configuration */
4508 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4509 const struct auto_pin_cfg *cfg)
4515 memset(assigned, 0, sizeof(assigned));
4516 spec->multiout.dac_nids = spec->private_dac_nids;
4518 /* check the pins hardwired to audio widget */
4519 for (i = 0; i < cfg->line_outs; i++) {
4520 nid = cfg->line_out_pins[i];
4521 if (alc880_is_fixed_pin(nid)) {
4522 int idx = alc880_fixed_pin_idx(nid);
4523 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4527 /* left pins can be connect to any audio widget */
4528 for (i = 0; i < cfg->line_outs; i++) {
4529 nid = cfg->line_out_pins[i];
4530 if (alc880_is_fixed_pin(nid))
4532 /* search for an empty channel */
4533 for (j = 0; j < cfg->line_outs; j++) {
4535 spec->multiout.dac_nids[i] =
4536 alc880_idx_to_dac(j);
4542 spec->multiout.num_dacs = cfg->line_outs;
4546 /* add playback controls from the parsed DAC table */
4547 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4548 const struct auto_pin_cfg *cfg)
4550 static const char *chname[4] = {
4551 "Front", "Surround", NULL /*CLFE*/, "Side"
4556 for (i = 0; i < cfg->line_outs; i++) {
4557 if (!spec->multiout.dac_nids[i])
4559 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4562 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4564 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4568 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4570 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4574 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4576 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4580 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4582 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4588 if (cfg->line_outs == 1 &&
4589 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
4593 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4594 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4598 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4599 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4608 /* add playback controls for speaker and HP outputs */
4609 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4618 if (alc880_is_fixed_pin(pin)) {
4619 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4620 /* specify the DAC as the extra output */
4621 if (!spec->multiout.hp_nid)
4622 spec->multiout.hp_nid = nid;
4624 spec->multiout.extra_out_nid[0] = nid;
4625 /* control HP volume/switch on the output mixer amp */
4626 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4627 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4628 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4631 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4632 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4635 } else if (alc880_is_multi_pin(pin)) {
4636 /* set manual connection */
4637 /* we have only a switch on HP-out PIN */
4638 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
4639 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4646 /* create input playback/capture controls for the given pin */
4647 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4648 const char *ctlname,
4649 int idx, hda_nid_t mix_nid)
4653 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
4654 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4657 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
4658 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4664 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
4666 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
4667 return (pincap & AC_PINCAP_IN) != 0;
4670 /* create playback/capture controls for input pins */
4671 static int alc_auto_create_input_ctls(struct hda_codec *codec,
4672 const struct auto_pin_cfg *cfg,
4674 hda_nid_t cap1, hda_nid_t cap2)
4676 struct alc_spec *spec = codec->spec;
4677 struct hda_input_mux *imux = &spec->private_imux[0];
4680 for (i = 0; i < AUTO_PIN_LAST; i++) {
4683 pin = cfg->input_pins[i];
4684 if (!alc_is_input_pin(codec, pin))
4688 idx = get_connection_index(codec, mixer, pin);
4690 err = new_analog_input(spec, pin,
4691 auto_pin_cfg_labels[i],
4700 idx = get_connection_index(codec, cap1, pin);
4701 if (idx < 0 && cap2)
4702 idx = get_connection_index(codec, cap2, pin);
4704 imux->items[imux->num_items].label =
4705 auto_pin_cfg_labels[i];
4706 imux->items[imux->num_items].index = idx;
4713 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
4714 const struct auto_pin_cfg *cfg)
4716 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
4719 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4720 unsigned int pin_type)
4722 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4725 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4729 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4730 hda_nid_t nid, int pin_type,
4733 alc_set_pin_output(codec, nid, pin_type);
4734 /* need the manual connection? */
4735 if (alc880_is_multi_pin(nid)) {
4736 struct alc_spec *spec = codec->spec;
4737 int idx = alc880_multi_pin_idx(nid);
4738 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4739 AC_VERB_SET_CONNECT_SEL,
4740 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4744 static int get_pin_type(int line_out_type)
4746 if (line_out_type == AUTO_PIN_HP_OUT)
4752 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4754 struct alc_spec *spec = codec->spec;
4757 for (i = 0; i < spec->autocfg.line_outs; i++) {
4758 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4759 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4760 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4764 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4766 struct alc_spec *spec = codec->spec;
4769 pin = spec->autocfg.speaker_pins[0];
4770 if (pin) /* connect to front */
4771 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4772 pin = spec->autocfg.hp_pins[0];
4773 if (pin) /* connect to front */
4774 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4777 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4779 struct alc_spec *spec = codec->spec;
4782 for (i = 0; i < AUTO_PIN_LAST; i++) {
4783 hda_nid_t nid = spec->autocfg.input_pins[i];
4784 if (alc_is_input_pin(codec, nid)) {
4785 alc_set_input_pin(codec, nid, i);
4786 if (nid != ALC880_PIN_CD_NID &&
4787 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
4788 snd_hda_codec_write(codec, nid, 0,
4789 AC_VERB_SET_AMP_GAIN_MUTE,
4795 /* parse the BIOS configuration and set up the alc_spec */
4796 /* return 1 if successful, 0 if the proper config is not found,
4797 * or a negative error code
4799 static int alc880_parse_auto_config(struct hda_codec *codec)
4801 struct alc_spec *spec = codec->spec;
4803 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4805 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4809 if (!spec->autocfg.line_outs)
4810 return 0; /* can't find valid BIOS pin config */
4812 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4815 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4818 err = alc880_auto_create_extra_out(spec,
4819 spec->autocfg.speaker_pins[0],
4823 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4827 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
4831 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4833 /* check multiple SPDIF-out (for recent codecs) */
4834 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4836 err = snd_hda_get_connections(codec,
4837 spec->autocfg.dig_out_pins[i],
4842 spec->multiout.dig_out_nid = dig_nid;
4844 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4845 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
4847 spec->slave_dig_outs[i - 1] = dig_nid;
4850 if (spec->autocfg.dig_in_pin)
4851 spec->dig_in_nid = ALC880_DIGIN_NID;
4853 if (spec->kctls.list)
4854 add_mixer(spec, spec->kctls.list);
4856 add_verb(spec, alc880_volume_init_verbs);
4858 spec->num_mux_defs = 1;
4859 spec->input_mux = &spec->private_imux[0];
4861 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
4866 /* additional initialization for auto-configuration model */
4867 static void alc880_auto_init(struct hda_codec *codec)
4869 struct alc_spec *spec = codec->spec;
4870 alc880_auto_init_multi_out(codec);
4871 alc880_auto_init_extra_out(codec);
4872 alc880_auto_init_analog_input(codec);
4873 if (spec->unsol_event)
4874 alc_inithook(codec);
4877 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
4878 * one of two digital mic pins, e.g. on ALC272
4880 static void fixup_automic_adc(struct hda_codec *codec)
4882 struct alc_spec *spec = codec->spec;
4885 for (i = 0; i < spec->num_adc_nids; i++) {
4886 hda_nid_t cap = spec->capsrc_nids ?
4887 spec->capsrc_nids[i] : spec->adc_nids[i];
4890 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
4893 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
4896 spec->int_mic.mux_idx = iidx;
4897 spec->ext_mic.mux_idx = eidx;
4898 if (spec->capsrc_nids)
4899 spec->capsrc_nids += i;
4900 spec->adc_nids += i;
4901 spec->num_adc_nids = 1;
4904 snd_printd(KERN_INFO "hda_codec: %s: "
4905 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
4906 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
4907 spec->auto_mic = 0; /* disable auto-mic to be sure */
4910 /* choose the ADC/MUX containing the input pin and initialize the setup */
4911 static void fixup_single_adc(struct hda_codec *codec)
4913 struct alc_spec *spec = codec->spec;
4917 /* search for the input pin; there must be only one */
4918 for (i = 0; i < AUTO_PIN_LAST; i++) {
4919 if (spec->autocfg.input_pins[i]) {
4920 pin = spec->autocfg.input_pins[i];
4927 /* set the default connection to that pin */
4928 for (i = 0; i < spec->num_adc_nids; i++) {
4929 hda_nid_t cap = spec->capsrc_nids ?
4930 spec->capsrc_nids[i] : spec->adc_nids[i];
4933 idx = get_connection_index(codec, cap, pin);
4936 /* use only this ADC */
4937 if (spec->capsrc_nids)
4938 spec->capsrc_nids += i;
4939 spec->adc_nids += i;
4940 spec->num_adc_nids = 1;
4941 /* select or unmute this route */
4942 if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) {
4943 snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx,
4946 snd_hda_codec_write_cache(codec, cap, 0,
4947 AC_VERB_SET_CONNECT_SEL, idx);
4953 static void set_capture_mixer(struct hda_codec *codec)
4955 struct alc_spec *spec = codec->spec;
4956 static struct snd_kcontrol_new *caps[2][3] = {
4957 { alc_capture_mixer_nosrc1,
4958 alc_capture_mixer_nosrc2,
4959 alc_capture_mixer_nosrc3 },
4960 { alc_capture_mixer1,
4962 alc_capture_mixer3 },
4964 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
4967 fixup_automic_adc(codec);
4968 else if (spec->input_mux) {
4969 if (spec->input_mux->num_items > 1)
4971 else if (spec->input_mux->num_items == 1)
4972 fixup_single_adc(codec);
4974 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
4978 #ifdef CONFIG_SND_HDA_INPUT_BEEP
4979 #define set_beep_amp(spec, nid, idx, dir) \
4980 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
4982 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
4986 * OK, here we have finally the patch for ALC880
4989 static int patch_alc880(struct hda_codec *codec)
4991 struct alc_spec *spec;
4995 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5001 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
5004 if (board_config < 0) {
5005 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
5007 board_config = ALC880_AUTO;
5010 if (board_config == ALC880_AUTO) {
5011 /* automatic parse from the BIOS config */
5012 err = alc880_parse_auto_config(codec);
5018 "hda_codec: Cannot set up configuration "
5019 "from BIOS. Using 3-stack mode...\n");
5020 board_config = ALC880_3ST;
5024 err = snd_hda_attach_beep_device(codec, 0x1);
5030 if (board_config != ALC880_AUTO)
5031 setup_preset(codec, &alc880_presets[board_config]);
5033 spec->stream_analog_playback = &alc880_pcm_analog_playback;
5034 spec->stream_analog_capture = &alc880_pcm_analog_capture;
5035 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
5037 spec->stream_digital_playback = &alc880_pcm_digital_playback;
5038 spec->stream_digital_capture = &alc880_pcm_digital_capture;
5040 if (!spec->adc_nids && spec->input_mux) {
5041 /* check whether NID 0x07 is valid */
5042 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
5044 wcap = get_wcaps_type(wcap);
5045 if (wcap != AC_WID_AUD_IN) {
5046 spec->adc_nids = alc880_adc_nids_alt;
5047 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
5049 spec->adc_nids = alc880_adc_nids;
5050 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
5053 set_capture_mixer(codec);
5054 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
5056 spec->vmaster_nid = 0x0c;
5058 codec->patch_ops = alc_patch_ops;
5059 if (board_config == ALC880_AUTO)
5060 spec->init_hook = alc880_auto_init;
5061 #ifdef CONFIG_SND_HDA_POWER_SAVE
5062 if (!spec->loopback.amplist)
5063 spec->loopback.amplist = alc880_loopbacks;
5074 static hda_nid_t alc260_dac_nids[1] = {
5079 static hda_nid_t alc260_adc_nids[1] = {
5084 static hda_nid_t alc260_adc_nids_alt[1] = {
5089 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
5090 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
5092 static hda_nid_t alc260_dual_adc_nids[2] = {
5097 #define ALC260_DIGOUT_NID 0x03
5098 #define ALC260_DIGIN_NID 0x06
5100 static struct hda_input_mux alc260_capture_source = {
5104 { "Front Mic", 0x1 },
5110 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
5111 * headphone jack and the internal CD lines since these are the only pins at
5112 * which audio can appear. For flexibility, also allow the option of
5113 * recording the mixer output on the second ADC (ADC0 doesn't have a
5114 * connection to the mixer output).
5116 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
5120 { "Mic/Line", 0x0 },
5122 { "Headphone", 0x2 },
5128 { "Mic/Line", 0x0 },
5130 { "Headphone", 0x2 },
5137 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
5138 * the Fujitsu S702x, but jacks are marked differently.
5140 static struct hda_input_mux alc260_acer_capture_sources[2] = {
5147 { "Headphone", 0x5 },
5156 { "Headphone", 0x6 },
5162 /* Maxdata Favorit 100XS */
5163 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
5167 { "Line/Mic", 0x0 },
5174 { "Line/Mic", 0x0 },
5182 * This is just place-holder, so there's something for alc_build_pcms to look
5183 * at when it calculates the maximum number of channels. ALC260 has no mixer
5184 * element which allows changing the channel mode, so the verb list is
5187 static struct hda_channel_mode alc260_modes[1] = {
5192 /* Mixer combinations
5194 * basic: base_output + input + pc_beep + capture
5195 * HP: base_output + input + capture_alt
5196 * HP_3013: hp_3013 + input + capture
5197 * fujitsu: fujitsu + capture
5198 * acer: acer + capture
5201 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
5202 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5203 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5204 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5205 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5206 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5207 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5211 static struct snd_kcontrol_new alc260_input_mixer[] = {
5212 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5213 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5214 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5215 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5216 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5217 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5218 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
5219 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
5223 /* update HP, line and mono out pins according to the master switch */
5224 static void alc260_hp_master_update(struct hda_codec *codec,
5225 hda_nid_t hp, hda_nid_t line,
5228 struct alc_spec *spec = codec->spec;
5229 unsigned int val = spec->master_sw ? PIN_HP : 0;
5230 /* change HP and line-out pins */
5231 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5233 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5235 /* mono (speaker) depending on the HP jack sense */
5236 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5237 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5241 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5242 struct snd_ctl_elem_value *ucontrol)
5244 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5245 struct alc_spec *spec = codec->spec;
5246 *ucontrol->value.integer.value = spec->master_sw;
5250 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
5251 struct snd_ctl_elem_value *ucontrol)
5253 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5254 struct alc_spec *spec = codec->spec;
5255 int val = !!*ucontrol->value.integer.value;
5256 hda_nid_t hp, line, mono;
5258 if (val == spec->master_sw)
5260 spec->master_sw = val;
5261 hp = (kcontrol->private_value >> 16) & 0xff;
5262 line = (kcontrol->private_value >> 8) & 0xff;
5263 mono = kcontrol->private_value & 0xff;
5264 alc260_hp_master_update(codec, hp, line, mono);
5268 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5270 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5271 .name = "Master Playback Switch",
5272 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5273 .info = snd_ctl_boolean_mono_info,
5274 .get = alc260_hp_master_sw_get,
5275 .put = alc260_hp_master_sw_put,
5276 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5278 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5279 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5280 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5281 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5282 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5284 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5288 static struct hda_verb alc260_hp_unsol_verbs[] = {
5289 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5293 static void alc260_hp_automute(struct hda_codec *codec)
5295 struct alc_spec *spec = codec->spec;
5297 spec->jack_present = snd_hda_jack_detect(codec, 0x10);
5298 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5301 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5303 if ((res >> 26) == ALC880_HP_EVENT)
5304 alc260_hp_automute(codec);
5307 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5309 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5310 .name = "Master Playback Switch",
5311 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5312 .info = snd_ctl_boolean_mono_info,
5313 .get = alc260_hp_master_sw_get,
5314 .put = alc260_hp_master_sw_put,
5315 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5317 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5318 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5319 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
5320 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
5321 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5322 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5323 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5324 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
5328 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
5329 .ops = &snd_hda_bind_vol,
5331 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
5332 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
5333 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
5338 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
5339 .ops = &snd_hda_bind_sw,
5341 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
5342 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
5347 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
5348 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
5349 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
5350 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
5351 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5355 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
5356 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5360 static void alc260_hp_3013_automute(struct hda_codec *codec)
5362 struct alc_spec *spec = codec->spec;
5364 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
5365 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
5368 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
5371 if ((res >> 26) == ALC880_HP_EVENT)
5372 alc260_hp_3013_automute(codec);
5375 static void alc260_hp_3012_automute(struct hda_codec *codec)
5377 unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT;
5379 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5381 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5383 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5387 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
5390 if ((res >> 26) == ALC880_HP_EVENT)
5391 alc260_hp_3012_automute(codec);
5394 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
5395 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
5397 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
5398 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5399 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
5400 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5401 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5402 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5403 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
5404 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
5405 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
5406 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5407 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
5411 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
5412 * versions of the ALC260 don't act on requests to enable mic bias from NID
5413 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5414 * datasheet doesn't mention this restriction. At this stage it's not clear
5415 * whether this behaviour is intentional or is a hardware bug in chip
5416 * revisions available in early 2006. Therefore for now allow the
5417 * "Headphone Jack Mode" control to span all choices, but if it turns out
5418 * that the lack of mic bias for this NID is intentional we could change the
5419 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5421 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5422 * don't appear to make the mic bias available from the "line" jack, even
5423 * though the NID used for this jack (0x14) can supply it. The theory is
5424 * that perhaps Acer have included blocking capacitors between the ALC260
5425 * and the output jack. If this turns out to be the case for all such
5426 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5427 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5429 * The C20x Tablet series have a mono internal speaker which is controlled
5430 * via the chip's Mono sum widget and pin complex, so include the necessary
5431 * controls for such models. On models without a "mono speaker" the control
5432 * won't do anything.
5434 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5435 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5436 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5437 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5438 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5440 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5442 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5443 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5444 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5445 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5446 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5447 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5448 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5449 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5453 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5455 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
5456 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5457 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5458 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5459 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5460 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5461 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5465 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5466 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5468 static struct snd_kcontrol_new alc260_will_mixer[] = {
5469 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5470 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5471 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5472 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5473 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5474 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5475 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5476 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5477 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5478 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5482 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5483 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5485 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5486 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5487 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5488 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5489 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5490 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5491 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
5492 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
5493 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5494 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5495 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5500 * initialization verbs
5502 static struct hda_verb alc260_init_verbs[] = {
5503 /* Line In pin widget for input */
5504 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5505 /* CD pin widget for input */
5506 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5507 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5508 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5509 /* Mic2 (front panel) pin widget for input and vref at 80% */
5510 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5511 /* LINE-2 is used for line-out in rear */
5512 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5513 /* select line-out */
5514 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
5516 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5518 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5520 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5521 /* mute capture amp left and right */
5522 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5523 /* set connection select to line in (default select for this ADC) */
5524 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5525 /* mute capture amp left and right */
5526 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5527 /* set connection select to line in (default select for this ADC) */
5528 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
5529 /* set vol=0 Line-Out mixer amp left and right */
5530 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5531 /* unmute pin widget amp left and right (no gain on this amp) */
5532 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5533 /* set vol=0 HP mixer amp left and right */
5534 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5535 /* unmute pin widget amp left and right (no gain on this amp) */
5536 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5537 /* set vol=0 Mono mixer amp left and right */
5538 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5539 /* unmute pin widget amp left and right (no gain on this amp) */
5540 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5541 /* unmute LINE-2 out pin */
5542 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5543 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5546 /* mute analog inputs */
5547 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5548 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5549 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5550 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5551 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5552 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5553 /* mute Front out path */
5554 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5555 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5556 /* mute Headphone out path */
5557 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5558 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5559 /* mute Mono out path */
5560 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5561 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5565 #if 0 /* should be identical with alc260_init_verbs? */
5566 static struct hda_verb alc260_hp_init_verbs[] = {
5567 /* Headphone and output */
5568 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5570 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5571 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5572 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5573 /* Mic2 (front panel) pin widget for input and vref at 80% */
5574 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5575 /* Line In pin widget for input */
5576 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5577 /* Line-2 pin widget for output */
5578 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5579 /* CD pin widget for input */
5580 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5581 /* unmute amp left and right */
5582 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5583 /* set connection select to line in (default select for this ADC) */
5584 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5585 /* unmute Line-Out mixer amp left and right (volume = 0) */
5586 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5587 /* mute pin widget amp left and right (no gain on this amp) */
5588 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5589 /* unmute HP mixer amp left and right (volume = 0) */
5590 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5591 /* mute pin widget amp left and right (no gain on this amp) */
5592 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5593 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5596 /* mute analog inputs */
5597 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5598 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5599 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5600 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5601 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5602 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5603 /* Unmute Front out path */
5604 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5605 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5606 /* Unmute Headphone out path */
5607 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5608 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5609 /* Unmute Mono out path */
5610 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5611 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5616 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5617 /* Line out and output */
5618 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5620 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5621 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5622 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5623 /* Mic2 (front panel) pin widget for input and vref at 80% */
5624 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5625 /* Line In pin widget for input */
5626 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5627 /* Headphone pin widget for output */
5628 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5629 /* CD pin widget for input */
5630 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5631 /* unmute amp left and right */
5632 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5633 /* set connection select to line in (default select for this ADC) */
5634 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5635 /* unmute Line-Out mixer amp left and right (volume = 0) */
5636 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5637 /* mute pin widget amp left and right (no gain on this amp) */
5638 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5639 /* unmute HP mixer amp left and right (volume = 0) */
5640 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5641 /* mute pin widget amp left and right (no gain on this amp) */
5642 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5643 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5646 /* mute analog inputs */
5647 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5648 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5649 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5650 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5651 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5652 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5653 /* Unmute Front out path */
5654 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5655 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5656 /* Unmute Headphone out path */
5657 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5658 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5659 /* Unmute Mono out path */
5660 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5661 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5665 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5666 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5667 * audio = 0x16, internal speaker = 0x10.
5669 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5670 /* Disable all GPIOs */
5671 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5672 /* Internal speaker is connected to headphone pin */
5673 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5674 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5675 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5676 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5677 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5678 /* Ensure all other unused pins are disabled and muted. */
5679 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5680 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5681 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5682 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5683 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5684 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5685 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5686 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5688 /* Disable digital (SPDIF) pins */
5689 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5690 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5692 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5693 * when acting as an output.
5695 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5697 /* Start with output sum widgets muted and their output gains at min */
5698 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5699 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5700 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5701 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5702 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5703 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5704 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5705 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5706 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5708 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5709 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5710 /* Unmute Line1 pin widget output buffer since it starts as an output.
5711 * If the pin mode is changed by the user the pin mode control will
5712 * take care of enabling the pin's input/output buffers as needed.
5713 * Therefore there's no need to enable the input buffer at this
5716 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5717 /* Unmute input buffer of pin widget used for Line-in (no equiv
5720 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5722 /* Mute capture amp left and right */
5723 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5724 /* Set ADC connection select to match default mixer setting - line
5727 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5729 /* Do the same for the second ADC: mute capture input amp and
5730 * set ADC connection to line in (on mic1 pin)
5732 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5733 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5735 /* Mute all inputs to mixer widget (even unconnected ones) */
5736 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5737 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5738 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5739 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5740 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5741 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5742 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5743 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5748 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5749 * similar laptops (adapted from Fujitsu init verbs).
5751 static struct hda_verb alc260_acer_init_verbs[] = {
5752 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5753 * the headphone jack. Turn this on and rely on the standard mute
5754 * methods whenever the user wants to turn these outputs off.
5756 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5757 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5758 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5759 /* Internal speaker/Headphone jack is connected to Line-out pin */
5760 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5761 /* Internal microphone/Mic jack is connected to Mic1 pin */
5762 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5763 /* Line In jack is connected to Line1 pin */
5764 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5765 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5766 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5767 /* Ensure all other unused pins are disabled and muted. */
5768 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5769 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5770 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5771 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5772 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5773 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5774 /* Disable digital (SPDIF) pins */
5775 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5776 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5778 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5779 * bus when acting as outputs.
5781 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5782 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5784 /* Start with output sum widgets muted and their output gains at min */
5785 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5786 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5787 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5788 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5789 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5790 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5791 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5792 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5793 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5795 /* Unmute Line-out pin widget amp left and right
5796 * (no equiv mixer ctrl)
5798 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5799 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5800 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5801 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5802 * inputs. If the pin mode is changed by the user the pin mode control
5803 * will take care of enabling the pin's input/output buffers as needed.
5804 * Therefore there's no need to enable the input buffer at this
5807 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5808 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5810 /* Mute capture amp left and right */
5811 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5812 /* Set ADC connection select to match default mixer setting - mic
5815 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5817 /* Do similar with the second ADC: mute capture input amp and
5818 * set ADC connection to mic to match ALSA's default state.
5820 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5821 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5823 /* Mute all inputs to mixer widget (even unconnected ones) */
5824 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5825 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5826 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5827 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5828 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5829 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5830 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5831 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5836 /* Initialisation sequence for Maxdata Favorit 100XS
5837 * (adapted from Acer init verbs).
5839 static struct hda_verb alc260_favorit100_init_verbs[] = {
5840 /* GPIO 0 enables the output jack.
5841 * Turn this on and rely on the standard mute
5842 * methods whenever the user wants to turn these outputs off.
5844 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5845 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5846 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5847 /* Line/Mic input jack is connected to Mic1 pin */
5848 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5849 /* Ensure all other unused pins are disabled and muted. */
5850 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5851 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5852 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5853 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5854 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5855 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5856 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5857 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5858 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5859 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5860 /* Disable digital (SPDIF) pins */
5861 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5862 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5864 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5865 * bus when acting as outputs.
5867 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5868 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5870 /* Start with output sum widgets muted and their output gains at min */
5871 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5872 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5873 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5874 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5875 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5876 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5877 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5878 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5879 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5881 /* Unmute Line-out pin widget amp left and right
5882 * (no equiv mixer ctrl)
5884 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5885 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5886 * inputs. If the pin mode is changed by the user the pin mode control
5887 * will take care of enabling the pin's input/output buffers as needed.
5888 * Therefore there's no need to enable the input buffer at this
5891 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5893 /* Mute capture amp left and right */
5894 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5895 /* Set ADC connection select to match default mixer setting - mic
5898 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5900 /* Do similar with the second ADC: mute capture input amp and
5901 * set ADC connection to mic to match ALSA's default state.
5903 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5904 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5906 /* Mute all inputs to mixer widget (even unconnected ones) */
5907 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5908 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5909 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5910 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5911 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5912 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5913 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5914 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5919 static struct hda_verb alc260_will_verbs[] = {
5920 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5921 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5922 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5923 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5924 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5925 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5929 static struct hda_verb alc260_replacer_672v_verbs[] = {
5930 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5931 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5932 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5934 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5935 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5936 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5938 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5942 /* toggle speaker-output according to the hp-jack state */
5943 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5945 unsigned int present;
5947 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5948 present = snd_hda_jack_detect(codec, 0x0f);
5950 snd_hda_codec_write_cache(codec, 0x01, 0,
5951 AC_VERB_SET_GPIO_DATA, 1);
5952 snd_hda_codec_write_cache(codec, 0x0f, 0,
5953 AC_VERB_SET_PIN_WIDGET_CONTROL,
5956 snd_hda_codec_write_cache(codec, 0x01, 0,
5957 AC_VERB_SET_GPIO_DATA, 0);
5958 snd_hda_codec_write_cache(codec, 0x0f, 0,
5959 AC_VERB_SET_PIN_WIDGET_CONTROL,
5964 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5967 if ((res >> 26) == ALC880_HP_EVENT)
5968 alc260_replacer_672v_automute(codec);
5971 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5972 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5973 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5974 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5975 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5976 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5977 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5978 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5979 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5980 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5981 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5985 /* Test configuration for debugging, modelled after the ALC880 test
5988 #ifdef CONFIG_SND_DEBUG
5989 static hda_nid_t alc260_test_dac_nids[1] = {
5992 static hda_nid_t alc260_test_adc_nids[2] = {
5995 /* For testing the ALC260, each input MUX needs its own definition since
5996 * the signal assignments are different. This assumes that the first ADC
5999 static struct hda_input_mux alc260_test_capture_sources[2] = {
6003 { "MIC1 pin", 0x0 },
6004 { "MIC2 pin", 0x1 },
6005 { "LINE1 pin", 0x2 },
6006 { "LINE2 pin", 0x3 },
6008 { "LINE-OUT pin", 0x5 },
6009 { "HP-OUT pin", 0x6 },
6015 { "MIC1 pin", 0x0 },
6016 { "MIC2 pin", 0x1 },
6017 { "LINE1 pin", 0x2 },
6018 { "LINE2 pin", 0x3 },
6021 { "LINE-OUT pin", 0x6 },
6022 { "HP-OUT pin", 0x7 },
6026 static struct snd_kcontrol_new alc260_test_mixer[] = {
6027 /* Output driver widgets */
6028 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
6029 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
6030 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6031 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
6032 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6033 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
6035 /* Modes for retasking pin widgets
6036 * Note: the ALC260 doesn't seem to act on requests to enable mic
6037 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
6038 * mention this restriction. At this stage it's not clear whether
6039 * this behaviour is intentional or is a hardware bug in chip
6040 * revisions available at least up until early 2006. Therefore for
6041 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
6042 * choices, but if it turns out that the lack of mic bias for these
6043 * NIDs is intentional we could change their modes from
6044 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6046 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
6047 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
6048 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
6049 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
6050 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
6051 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
6053 /* Loopback mixer controls */
6054 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
6055 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
6056 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
6057 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
6058 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
6059 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
6060 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
6061 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
6062 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6063 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6064 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
6065 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
6066 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
6067 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
6069 /* Controls for GPIO pins, assuming they are configured as outputs */
6070 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
6071 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
6072 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
6073 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
6075 /* Switches to allow the digital IO pins to be enabled. The datasheet
6076 * is ambigious as to which NID is which; testing on laptops which
6077 * make this output available should provide clarification.
6079 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
6080 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
6082 /* A switch allowing EAPD to be enabled. Some laptops seem to use
6083 * this output to turn on an external amplifier.
6085 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
6086 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
6090 static struct hda_verb alc260_test_init_verbs[] = {
6091 /* Enable all GPIOs as outputs with an initial value of 0 */
6092 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
6093 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6094 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
6096 /* Enable retasking pins as output, initially without power amp */
6097 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6098 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6099 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6100 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6101 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6102 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6104 /* Disable digital (SPDIF) pins initially, but users can enable
6105 * them via a mixer switch. In the case of SPDIF-out, this initverb
6106 * payload also sets the generation to 0, output to be in "consumer"
6107 * PCM format, copyright asserted, no pre-emphasis and no validity
6110 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6111 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6113 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
6114 * OUT1 sum bus when acting as an output.
6116 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6117 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
6118 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6119 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
6121 /* Start with output sum widgets muted and their output gains at min */
6122 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6123 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6124 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6125 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6126 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6127 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6128 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6129 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6130 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6132 /* Unmute retasking pin widget output buffers since the default
6133 * state appears to be output. As the pin mode is changed by the
6134 * user the pin mode control will take care of enabling the pin's
6135 * input/output buffers as needed.
6137 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6138 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6139 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6140 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6141 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6142 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6143 /* Also unmute the mono-out pin widget */
6144 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6146 /* Mute capture amp left and right */
6147 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6148 /* Set ADC connection select to match default mixer setting (mic1
6151 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6153 /* Do the same for the second ADC: mute capture input amp and
6154 * set ADC connection to mic1 pin
6156 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6157 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6159 /* Mute all inputs to mixer widget (even unconnected ones) */
6160 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6161 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6162 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6163 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6164 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6165 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6166 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6167 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6173 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
6174 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
6176 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
6177 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
6180 * for BIOS auto-configuration
6183 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
6184 const char *pfx, int *vol_bits)
6187 unsigned long vol_val, sw_val;
6190 if (nid >= 0x0f && nid < 0x11) {
6191 nid_vol = nid - 0x7;
6192 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6193 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6194 } else if (nid == 0x11) {
6195 nid_vol = nid - 0x7;
6196 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
6197 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
6198 } else if (nid >= 0x12 && nid <= 0x15) {
6200 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6201 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6205 if (!(*vol_bits & (1 << nid_vol))) {
6206 /* first control for the volume widget */
6207 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val);
6210 *vol_bits |= (1 << nid_vol);
6212 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val);
6218 /* add playback controls from the parsed DAC table */
6219 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6220 const struct auto_pin_cfg *cfg)
6226 spec->multiout.num_dacs = 1;
6227 spec->multiout.dac_nids = spec->private_dac_nids;
6228 spec->multiout.dac_nids[0] = 0x02;
6230 nid = cfg->line_out_pins[0];
6233 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6235 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6239 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6244 nid = cfg->speaker_pins[0];
6246 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6251 nid = cfg->hp_pins[0];
6253 err = alc260_add_playback_controls(spec, nid, "Headphone",
6261 /* create playback/capture controls for input pins */
6262 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6263 const struct auto_pin_cfg *cfg)
6265 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
6268 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6269 hda_nid_t nid, int pin_type,
6272 alc_set_pin_output(codec, nid, pin_type);
6273 /* need the manual connection? */
6275 int idx = nid - 0x12;
6276 snd_hda_codec_write(codec, idx + 0x0b, 0,
6277 AC_VERB_SET_CONNECT_SEL, sel_idx);
6281 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6283 struct alc_spec *spec = codec->spec;
6286 nid = spec->autocfg.line_out_pins[0];
6288 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6289 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6292 nid = spec->autocfg.speaker_pins[0];
6294 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6296 nid = spec->autocfg.hp_pins[0];
6298 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6301 #define ALC260_PIN_CD_NID 0x16
6302 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6304 struct alc_spec *spec = codec->spec;
6307 for (i = 0; i < AUTO_PIN_LAST; i++) {
6308 hda_nid_t nid = spec->autocfg.input_pins[i];
6310 alc_set_input_pin(codec, nid, i);
6311 if (nid != ALC260_PIN_CD_NID &&
6312 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6313 snd_hda_codec_write(codec, nid, 0,
6314 AC_VERB_SET_AMP_GAIN_MUTE,
6321 * generic initialization of ADC, input mixers and output mixers
6323 static struct hda_verb alc260_volume_init_verbs[] = {
6325 * Unmute ADC0-1 and set the default input to mic-in
6327 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6328 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6329 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6330 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6332 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6334 * Note: PASD motherboards uses the Line In 2 as the input for
6335 * front panel mic (mic 2)
6337 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6338 /* mute analog inputs */
6339 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6340 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6341 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6342 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6343 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6346 * Set up output mixers (0x08 - 0x0a)
6348 /* set vol=0 to output mixers */
6349 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6350 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6351 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6352 /* set up input amps for analog loopback */
6353 /* Amp Indices: DAC = 0, mixer = 1 */
6354 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6355 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6356 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6357 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6358 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6359 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6364 static int alc260_parse_auto_config(struct hda_codec *codec)
6366 struct alc_spec *spec = codec->spec;
6368 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
6370 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
6374 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
6377 if (!spec->kctls.list)
6378 return 0; /* can't find valid BIOS pin config */
6379 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
6383 spec->multiout.max_channels = 2;
6385 if (spec->autocfg.dig_outs)
6386 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6387 if (spec->kctls.list)
6388 add_mixer(spec, spec->kctls.list);
6390 add_verb(spec, alc260_volume_init_verbs);
6392 spec->num_mux_defs = 1;
6393 spec->input_mux = &spec->private_imux[0];
6395 alc_ssid_check(codec, 0x10, 0x15, 0x0f);
6400 /* additional initialization for auto-configuration model */
6401 static void alc260_auto_init(struct hda_codec *codec)
6403 struct alc_spec *spec = codec->spec;
6404 alc260_auto_init_multi_out(codec);
6405 alc260_auto_init_analog_input(codec);
6406 if (spec->unsol_event)
6407 alc_inithook(codec);
6410 #ifdef CONFIG_SND_HDA_POWER_SAVE
6411 static struct hda_amp_list alc260_loopbacks[] = {
6412 { 0x07, HDA_INPUT, 0 },
6413 { 0x07, HDA_INPUT, 1 },
6414 { 0x07, HDA_INPUT, 2 },
6415 { 0x07, HDA_INPUT, 3 },
6416 { 0x07, HDA_INPUT, 4 },
6422 * ALC260 configurations
6424 static const char *alc260_models[ALC260_MODEL_LAST] = {
6425 [ALC260_BASIC] = "basic",
6427 [ALC260_HP_3013] = "hp-3013",
6428 [ALC260_HP_DC7600] = "hp-dc7600",
6429 [ALC260_FUJITSU_S702X] = "fujitsu",
6430 [ALC260_ACER] = "acer",
6431 [ALC260_WILL] = "will",
6432 [ALC260_REPLACER_672V] = "replacer",
6433 [ALC260_FAVORIT100] = "favorit100",
6434 #ifdef CONFIG_SND_DEBUG
6435 [ALC260_TEST] = "test",
6437 [ALC260_AUTO] = "auto",
6440 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6441 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6442 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
6443 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6444 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6445 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6446 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */
6447 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6448 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6449 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6450 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6451 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6452 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6453 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6454 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6455 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6456 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6457 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6458 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6459 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6460 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6464 static struct alc_config_preset alc260_presets[] = {
6466 .mixers = { alc260_base_output_mixer,
6467 alc260_input_mixer },
6468 .init_verbs = { alc260_init_verbs },
6469 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6470 .dac_nids = alc260_dac_nids,
6471 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6472 .adc_nids = alc260_adc_nids,
6473 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6474 .channel_mode = alc260_modes,
6475 .input_mux = &alc260_capture_source,
6478 .mixers = { alc260_hp_output_mixer,
6479 alc260_input_mixer },
6480 .init_verbs = { alc260_init_verbs,
6481 alc260_hp_unsol_verbs },
6482 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6483 .dac_nids = alc260_dac_nids,
6484 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6485 .adc_nids = alc260_adc_nids_alt,
6486 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6487 .channel_mode = alc260_modes,
6488 .input_mux = &alc260_capture_source,
6489 .unsol_event = alc260_hp_unsol_event,
6490 .init_hook = alc260_hp_automute,
6492 [ALC260_HP_DC7600] = {
6493 .mixers = { alc260_hp_dc7600_mixer,
6494 alc260_input_mixer },
6495 .init_verbs = { alc260_init_verbs,
6496 alc260_hp_dc7600_verbs },
6497 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6498 .dac_nids = alc260_dac_nids,
6499 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6500 .adc_nids = alc260_adc_nids_alt,
6501 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6502 .channel_mode = alc260_modes,
6503 .input_mux = &alc260_capture_source,
6504 .unsol_event = alc260_hp_3012_unsol_event,
6505 .init_hook = alc260_hp_3012_automute,
6507 [ALC260_HP_3013] = {
6508 .mixers = { alc260_hp_3013_mixer,
6509 alc260_input_mixer },
6510 .init_verbs = { alc260_hp_3013_init_verbs,
6511 alc260_hp_3013_unsol_verbs },
6512 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6513 .dac_nids = alc260_dac_nids,
6514 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6515 .adc_nids = alc260_adc_nids_alt,
6516 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6517 .channel_mode = alc260_modes,
6518 .input_mux = &alc260_capture_source,
6519 .unsol_event = alc260_hp_3013_unsol_event,
6520 .init_hook = alc260_hp_3013_automute,
6522 [ALC260_FUJITSU_S702X] = {
6523 .mixers = { alc260_fujitsu_mixer },
6524 .init_verbs = { alc260_fujitsu_init_verbs },
6525 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6526 .dac_nids = alc260_dac_nids,
6527 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6528 .adc_nids = alc260_dual_adc_nids,
6529 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6530 .channel_mode = alc260_modes,
6531 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
6532 .input_mux = alc260_fujitsu_capture_sources,
6535 .mixers = { alc260_acer_mixer },
6536 .init_verbs = { alc260_acer_init_verbs },
6537 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6538 .dac_nids = alc260_dac_nids,
6539 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6540 .adc_nids = alc260_dual_adc_nids,
6541 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6542 .channel_mode = alc260_modes,
6543 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
6544 .input_mux = alc260_acer_capture_sources,
6546 [ALC260_FAVORIT100] = {
6547 .mixers = { alc260_favorit100_mixer },
6548 .init_verbs = { alc260_favorit100_init_verbs },
6549 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6550 .dac_nids = alc260_dac_nids,
6551 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6552 .adc_nids = alc260_dual_adc_nids,
6553 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6554 .channel_mode = alc260_modes,
6555 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
6556 .input_mux = alc260_favorit100_capture_sources,
6559 .mixers = { alc260_will_mixer },
6560 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6561 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6562 .dac_nids = alc260_dac_nids,
6563 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6564 .adc_nids = alc260_adc_nids,
6565 .dig_out_nid = ALC260_DIGOUT_NID,
6566 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6567 .channel_mode = alc260_modes,
6568 .input_mux = &alc260_capture_source,
6570 [ALC260_REPLACER_672V] = {
6571 .mixers = { alc260_replacer_672v_mixer },
6572 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6573 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6574 .dac_nids = alc260_dac_nids,
6575 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6576 .adc_nids = alc260_adc_nids,
6577 .dig_out_nid = ALC260_DIGOUT_NID,
6578 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6579 .channel_mode = alc260_modes,
6580 .input_mux = &alc260_capture_source,
6581 .unsol_event = alc260_replacer_672v_unsol_event,
6582 .init_hook = alc260_replacer_672v_automute,
6584 #ifdef CONFIG_SND_DEBUG
6586 .mixers = { alc260_test_mixer },
6587 .init_verbs = { alc260_test_init_verbs },
6588 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6589 .dac_nids = alc260_test_dac_nids,
6590 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6591 .adc_nids = alc260_test_adc_nids,
6592 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6593 .channel_mode = alc260_modes,
6594 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6595 .input_mux = alc260_test_capture_sources,
6600 static int patch_alc260(struct hda_codec *codec)
6602 struct alc_spec *spec;
6603 int err, board_config;
6605 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6611 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6614 if (board_config < 0) {
6615 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6617 board_config = ALC260_AUTO;
6620 if (board_config == ALC260_AUTO) {
6621 /* automatic parse from the BIOS config */
6622 err = alc260_parse_auto_config(codec);
6628 "hda_codec: Cannot set up configuration "
6629 "from BIOS. Using base mode...\n");
6630 board_config = ALC260_BASIC;
6634 err = snd_hda_attach_beep_device(codec, 0x1);
6640 if (board_config != ALC260_AUTO)
6641 setup_preset(codec, &alc260_presets[board_config]);
6643 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6644 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6646 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6647 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6649 if (!spec->adc_nids && spec->input_mux) {
6650 /* check whether NID 0x04 is valid */
6651 unsigned int wcap = get_wcaps(codec, 0x04);
6652 wcap = get_wcaps_type(wcap);
6654 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6655 spec->adc_nids = alc260_adc_nids_alt;
6656 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6658 spec->adc_nids = alc260_adc_nids;
6659 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6662 set_capture_mixer(codec);
6663 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6665 spec->vmaster_nid = 0x08;
6667 codec->patch_ops = alc_patch_ops;
6668 if (board_config == ALC260_AUTO)
6669 spec->init_hook = alc260_auto_init;
6670 #ifdef CONFIG_SND_HDA_POWER_SAVE
6671 if (!spec->loopback.amplist)
6672 spec->loopback.amplist = alc260_loopbacks;
6680 * ALC882/883/885/888/889 support
6682 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6683 * configuration. Each pin widget can choose any input DACs and a mixer.
6684 * Each ADC is connected from a mixer of all inputs. This makes possible
6685 * 6-channel independent captures.
6687 * In addition, an independent DAC for the multi-playback (not used in this
6690 #define ALC882_DIGOUT_NID 0x06
6691 #define ALC882_DIGIN_NID 0x0a
6692 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
6693 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
6694 #define ALC1200_DIGOUT_NID 0x10
6697 static struct hda_channel_mode alc882_ch_modes[1] = {
6702 static hda_nid_t alc882_dac_nids[4] = {
6703 /* front, rear, clfe, rear_surr */
6704 0x02, 0x03, 0x04, 0x05
6706 #define alc883_dac_nids alc882_dac_nids
6709 #define alc882_adc_nids alc880_adc_nids
6710 #define alc882_adc_nids_alt alc880_adc_nids_alt
6711 #define alc883_adc_nids alc882_adc_nids_alt
6712 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
6713 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
6714 #define alc889_adc_nids alc880_adc_nids
6716 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6717 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6718 #define alc883_capsrc_nids alc882_capsrc_nids_alt
6719 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
6720 #define alc889_capsrc_nids alc882_capsrc_nids
6723 /* FIXME: should be a matrix-type input source selection */
6725 static struct hda_input_mux alc882_capture_source = {
6729 { "Front Mic", 0x1 },
6735 #define alc883_capture_source alc882_capture_source
6737 static struct hda_input_mux alc889_capture_source = {
6740 { "Front Mic", 0x0 },
6746 static struct hda_input_mux mb5_capture_source = {
6755 static struct hda_input_mux macmini3_capture_source = {
6763 static struct hda_input_mux alc883_3stack_6ch_intel = {
6767 { "Front Mic", 0x0 },
6773 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6781 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6791 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6799 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
6803 { "Front Mic", 0x1 },
6808 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
6816 static struct hda_input_mux alc889A_mb31_capture_source = {
6820 /* Front Mic (0x01) unused */
6822 /* Line 2 (0x03) unused */
6823 /* CD (0x04) unused? */
6830 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6837 static struct hda_verb alc882_3ST_ch2_init[] = {
6838 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6839 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6840 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6841 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6848 static struct hda_verb alc882_3ST_ch4_init[] = {
6849 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6850 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6851 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6852 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6853 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6860 static struct hda_verb alc882_3ST_ch6_init[] = {
6861 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6862 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6863 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6864 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6865 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6866 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6870 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
6871 { 2, alc882_3ST_ch2_init },
6872 { 4, alc882_3ST_ch4_init },
6873 { 6, alc882_3ST_ch6_init },
6876 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
6881 static struct hda_verb alc883_3ST_ch2_clevo_init[] = {
6882 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
6883 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6884 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6885 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6886 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6893 static struct hda_verb alc883_3ST_ch4_clevo_init[] = {
6894 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6895 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6896 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6897 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6898 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6899 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6906 static struct hda_verb alc883_3ST_ch6_clevo_init[] = {
6907 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6908 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6909 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6910 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6911 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6912 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6913 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6917 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
6918 { 2, alc883_3ST_ch2_clevo_init },
6919 { 4, alc883_3ST_ch4_clevo_init },
6920 { 6, alc883_3ST_ch6_clevo_init },
6927 static struct hda_verb alc882_sixstack_ch6_init[] = {
6928 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6929 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6930 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6931 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6938 static struct hda_verb alc882_sixstack_ch8_init[] = {
6939 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6940 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6941 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6942 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6946 static struct hda_channel_mode alc882_sixstack_modes[2] = {
6947 { 6, alc882_sixstack_ch6_init },
6948 { 8, alc882_sixstack_ch8_init },
6952 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
6958 static struct hda_verb alc885_mbp_ch2_init[] = {
6959 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6960 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6961 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6968 static struct hda_verb alc885_mbp_ch4_init[] = {
6969 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6970 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6971 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6972 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6973 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6977 static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
6978 { 2, alc885_mbp_ch2_init },
6979 { 4, alc885_mbp_ch4_init },
6984 * Speakers/Woofer/HP = Front
6987 static struct hda_verb alc885_mb5_ch2_init[] = {
6988 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6989 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6995 * Speakers/HP = Front
6999 static struct hda_verb alc885_mb5_ch6_init[] = {
7000 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7001 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7002 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7006 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
7007 { 2, alc885_mb5_ch2_init },
7008 { 6, alc885_mb5_ch6_init },
7011 #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes
7016 static struct hda_verb alc883_4ST_ch2_init[] = {
7017 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7018 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7019 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7020 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7021 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7022 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7029 static struct hda_verb alc883_4ST_ch4_init[] = {
7030 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7031 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7032 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7033 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7034 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7035 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7036 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7043 static struct hda_verb alc883_4ST_ch6_init[] = {
7044 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7045 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7046 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7047 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7048 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7049 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7050 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7051 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7058 static struct hda_verb alc883_4ST_ch8_init[] = {
7059 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7060 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7061 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7062 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7063 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7064 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7065 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7066 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7067 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7071 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
7072 { 2, alc883_4ST_ch2_init },
7073 { 4, alc883_4ST_ch4_init },
7074 { 6, alc883_4ST_ch6_init },
7075 { 8, alc883_4ST_ch8_init },
7082 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7083 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7084 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7085 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7086 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7093 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7094 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7095 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7096 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7097 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7098 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7105 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7106 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7107 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7108 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7109 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7110 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7111 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7115 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7116 { 2, alc883_3ST_ch2_intel_init },
7117 { 4, alc883_3ST_ch4_intel_init },
7118 { 6, alc883_3ST_ch6_intel_init },
7124 static struct hda_verb alc889_ch2_intel_init[] = {
7125 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7126 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
7127 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
7128 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
7129 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7130 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7137 static struct hda_verb alc889_ch6_intel_init[] = {
7138 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7139 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7140 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7141 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7142 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7143 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7150 static struct hda_verb alc889_ch8_intel_init[] = {
7151 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7152 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7153 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7154 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7155 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
7156 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7157 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7161 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
7162 { 2, alc889_ch2_intel_init },
7163 { 6, alc889_ch6_intel_init },
7164 { 8, alc889_ch8_intel_init },
7170 static struct hda_verb alc883_sixstack_ch6_init[] = {
7171 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7172 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7173 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7174 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7181 static struct hda_verb alc883_sixstack_ch8_init[] = {
7182 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7183 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7184 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7185 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7189 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7190 { 6, alc883_sixstack_ch6_init },
7191 { 8, alc883_sixstack_ch8_init },
7195 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7196 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7198 static struct snd_kcontrol_new alc882_base_mixer[] = {
7199 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7200 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7201 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7202 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7203 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7204 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7205 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7206 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7207 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7208 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7209 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7210 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7211 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7212 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7213 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7214 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7215 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7216 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7217 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7218 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7219 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7223 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
7224 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7225 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7226 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7227 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
7228 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7229 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7230 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7231 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7232 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7233 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
7234 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7238 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7239 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7240 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7241 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7242 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7243 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7244 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7245 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7246 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7247 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7248 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7249 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7250 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7251 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7252 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
7256 static struct snd_kcontrol_new alc885_macmini3_mixer[] = {
7257 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7258 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7259 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7260 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7261 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7262 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7263 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7264 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7265 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
7266 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
7267 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7271 static struct snd_kcontrol_new alc885_imac91_mixer[] = {
7272 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7273 HDA_BIND_MUTE ("Line-Out Playback Switch", 0x0c, 0x02, HDA_INPUT),
7274 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
7275 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7276 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7277 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7278 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7279 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7280 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7285 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
7286 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7287 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7288 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7289 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7290 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7291 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7292 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7293 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7294 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7298 static struct snd_kcontrol_new alc882_targa_mixer[] = {
7299 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7300 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7301 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7302 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7303 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7304 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7305 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7306 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7307 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7308 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7309 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7310 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7311 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7315 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
7316 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
7318 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
7319 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7320 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7321 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7322 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
7323 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7324 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7325 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7326 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7327 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
7328 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
7329 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7330 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7331 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7335 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
7336 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7337 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7338 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7339 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7340 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7341 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7342 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7343 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7344 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7345 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7349 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
7351 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7352 .name = "Channel Mode",
7353 .info = alc_ch_mode_info,
7354 .get = alc_ch_mode_get,
7355 .put = alc_ch_mode_put,
7360 static struct hda_verb alc882_base_init_verbs[] = {
7361 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7362 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7363 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7365 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7366 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7368 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7369 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7371 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7372 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7374 /* Front Pin: output 0 (0x0c) */
7375 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7376 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7377 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7378 /* Rear Pin: output 1 (0x0d) */
7379 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7380 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7381 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7382 /* CLFE Pin: output 2 (0x0e) */
7383 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7384 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7385 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7386 /* Side Pin: output 3 (0x0f) */
7387 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7388 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7389 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7390 /* Mic (rear) pin: input vref at 80% */
7391 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7392 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7393 /* Front Mic pin: input vref at 80% */
7394 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7395 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7396 /* Line In pin: input */
7397 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7398 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7399 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7400 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7401 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7402 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7403 /* CD pin widget for input */
7404 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7406 /* FIXME: use matrix-type input source selection */
7407 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7409 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7411 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7412 /* ADC2: mute amp left and right */
7413 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7414 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7415 /* ADC3: mute amp left and right */
7416 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7417 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7422 static struct hda_verb alc882_adc1_init_verbs[] = {
7423 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7424 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7425 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7426 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7427 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7428 /* ADC1: mute amp left and right */
7429 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7430 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7434 static struct hda_verb alc882_eapd_verbs[] = {
7435 /* change to EAPD mode */
7436 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7437 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
7441 static struct hda_verb alc889_eapd_verbs[] = {
7442 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
7443 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
7447 static struct hda_verb alc_hp15_unsol_verbs[] = {
7448 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7449 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7453 static struct hda_verb alc885_init_verbs[] = {
7454 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7455 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7456 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7458 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7459 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7461 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7462 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7464 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7465 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7467 /* Front HP Pin: output 0 (0x0c) */
7468 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7469 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7470 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7471 /* Front Pin: output 0 (0x0c) */
7472 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7473 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7474 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7475 /* Rear Pin: output 1 (0x0d) */
7476 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7477 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7478 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
7479 /* CLFE Pin: output 2 (0x0e) */
7480 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7481 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7482 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7483 /* Side Pin: output 3 (0x0f) */
7484 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7485 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7486 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7487 /* Mic (rear) pin: input vref at 80% */
7488 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7489 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7490 /* Front Mic pin: input vref at 80% */
7491 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7492 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7493 /* Line In pin: input */
7494 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7495 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7497 /* Mixer elements: 0x18, , 0x1a, 0x1b */
7499 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7501 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7503 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7504 /* ADC2: mute amp left and right */
7505 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7506 /* ADC3: mute amp left and right */
7507 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7512 static struct hda_verb alc885_init_input_verbs[] = {
7513 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7514 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7515 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7520 /* Unmute Selector 24h and set the default input to front mic */
7521 static struct hda_verb alc889_init_input_verbs[] = {
7522 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
7523 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7528 #define alc883_init_verbs alc882_base_init_verbs
7531 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
7532 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7533 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7534 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
7535 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7536 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7537 /* FIXME: this looks suspicious...
7538 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
7539 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
7544 static struct hda_verb alc882_macpro_init_verbs[] = {
7545 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7546 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7547 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7548 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7549 /* Front Pin: output 0 (0x0c) */
7550 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7551 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7552 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7553 /* Front Mic pin: input vref at 80% */
7554 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7555 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7556 /* Speaker: output */
7557 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7558 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7559 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
7560 /* Headphone output (output 0 - 0x0c) */
7561 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7562 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7563 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7565 /* FIXME: use matrix-type input source selection */
7566 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7567 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7568 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7569 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7570 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7571 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7573 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7574 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7575 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7576 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7578 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7579 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7580 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7581 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7582 /* ADC1: mute amp left and right */
7583 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7584 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7585 /* ADC2: mute amp left and right */
7586 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7587 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7588 /* ADC3: mute amp left and right */
7589 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7590 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7596 static struct hda_verb alc885_mb5_init_verbs[] = {
7598 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7599 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7600 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7601 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7603 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7604 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7605 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7606 /* Surround mixer */
7607 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7608 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7609 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7611 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7612 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7613 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7615 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7616 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7617 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7618 /* Front Pin (0x0c) */
7619 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7620 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7621 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7622 /* LFE Pin (0x0e) */
7623 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7624 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7625 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7627 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7628 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7629 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7630 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7631 /* Front Mic pin: input vref at 80% */
7632 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7633 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7635 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7636 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7638 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7639 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7640 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7641 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7646 static struct hda_verb alc885_macmini3_init_verbs[] = {
7648 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7649 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7650 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7651 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7653 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7654 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7655 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7656 /* Surround mixer */
7657 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7658 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7659 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7661 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7662 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7663 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7665 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7666 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7667 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7668 /* Front Pin (0x0c) */
7669 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7670 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7671 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7672 /* LFE Pin (0x0e) */
7673 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7674 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7675 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7677 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7678 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7679 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7680 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7682 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7683 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7685 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7686 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7687 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7688 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7692 /* Macbook Pro rev3 */
7693 static struct hda_verb alc885_mbp3_init_verbs[] = {
7694 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7695 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7696 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7697 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7699 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7700 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7701 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7703 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7704 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7705 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7706 /* Front Pin: output 0 (0x0c) */
7707 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7708 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7709 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7710 /* HP Pin: output 0 (0x0e) */
7711 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7712 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7713 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
7714 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7715 /* Mic (rear) pin: input vref at 80% */
7716 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7717 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7718 /* Front Mic pin: input vref at 80% */
7719 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7720 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7721 /* Line In pin: use output 1 when in LineOut mode */
7722 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7723 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7724 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7726 /* FIXME: use matrix-type input source selection */
7727 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7728 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7729 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7730 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7731 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7732 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7734 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7735 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7736 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7737 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7739 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7740 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7741 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7742 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7743 /* ADC1: mute amp left and right */
7744 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7745 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7746 /* ADC2: mute amp left and right */
7747 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7748 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7749 /* ADC3: mute amp left and right */
7750 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7751 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7757 static struct hda_verb alc885_imac91_init_verbs[] = {
7758 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
7759 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7760 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7761 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7763 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7764 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7765 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7766 /* HP Pin: output 0 (0x0c) */
7767 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7768 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7769 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7770 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7771 /* Internal Speakers: output 0 (0x0d) */
7772 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7773 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7774 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7775 /* Mic (rear) pin: input vref at 80% */
7776 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7777 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7778 /* Front Mic pin: input vref at 80% */
7779 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7780 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7781 /* Line In pin: use output 1 when in LineOut mode */
7782 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7783 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7784 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7786 /* FIXME: use matrix-type input source selection */
7787 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7788 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7789 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7790 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7791 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7792 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7794 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7795 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7796 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7797 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7799 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7800 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7801 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7802 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7803 /* ADC1: mute amp left and right */
7804 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7805 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7806 /* ADC2: mute amp left and right */
7807 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7808 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7809 /* ADC3: mute amp left and right */
7810 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7811 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7816 /* iMac 24 mixer. */
7817 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
7818 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7819 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
7823 /* iMac 24 init verbs. */
7824 static struct hda_verb alc885_imac24_init_verbs[] = {
7825 /* Internal speakers: output 0 (0x0c) */
7826 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7827 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7828 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7829 /* Internal speakers: output 0 (0x0c) */
7830 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7831 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7832 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7833 /* Headphone: output 0 (0x0c) */
7834 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7835 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7836 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7837 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7838 /* Front Mic: input vref at 80% */
7839 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7840 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7844 /* Toggle speaker-output according to the hp-jack state */
7845 static void alc885_imac24_setup(struct hda_codec *codec)
7847 struct alc_spec *spec = codec->spec;
7849 spec->autocfg.hp_pins[0] = 0x14;
7850 spec->autocfg.speaker_pins[0] = 0x18;
7851 spec->autocfg.speaker_pins[1] = 0x1a;
7854 #define alc885_mb5_setup alc885_imac24_setup
7855 #define alc885_macmini3_setup alc885_imac24_setup
7857 static void alc885_mbp3_setup(struct hda_codec *codec)
7859 struct alc_spec *spec = codec->spec;
7861 spec->autocfg.hp_pins[0] = 0x15;
7862 spec->autocfg.speaker_pins[0] = 0x14;
7865 static void alc885_imac91_setup(struct hda_codec *codec)
7867 struct alc_spec *spec = codec->spec;
7869 spec->autocfg.hp_pins[0] = 0x14;
7870 spec->autocfg.speaker_pins[0] = 0x15;
7871 spec->autocfg.speaker_pins[1] = 0x1a;
7874 static struct hda_verb alc882_targa_verbs[] = {
7875 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7876 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7878 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7879 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7881 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7882 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7883 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7885 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7889 /* toggle speaker-output according to the hp-jack state */
7890 static void alc882_targa_automute(struct hda_codec *codec)
7892 struct alc_spec *spec = codec->spec;
7893 alc_automute_amp(codec);
7894 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7895 spec->jack_present ? 1 : 3);
7898 static void alc882_targa_setup(struct hda_codec *codec)
7900 struct alc_spec *spec = codec->spec;
7902 spec->autocfg.hp_pins[0] = 0x14;
7903 spec->autocfg.speaker_pins[0] = 0x1b;
7906 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
7908 if ((res >> 26) == ALC880_HP_EVENT)
7909 alc882_targa_automute(codec);
7912 static struct hda_verb alc882_asus_a7j_verbs[] = {
7913 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7914 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7916 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7917 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7918 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7920 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7921 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7922 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7924 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7925 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7926 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7930 static struct hda_verb alc882_asus_a7m_verbs[] = {
7931 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7932 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7934 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7935 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7936 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7938 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7939 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7940 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7942 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7943 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7944 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7948 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
7950 unsigned int gpiostate, gpiomask, gpiodir;
7952 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
7953 AC_VERB_GET_GPIO_DATA, 0);
7956 gpiostate |= (1 << pin);
7958 gpiostate &= ~(1 << pin);
7960 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
7961 AC_VERB_GET_GPIO_MASK, 0);
7962 gpiomask |= (1 << pin);
7964 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
7965 AC_VERB_GET_GPIO_DIRECTION, 0);
7966 gpiodir |= (1 << pin);
7969 snd_hda_codec_write(codec, codec->afg, 0,
7970 AC_VERB_SET_GPIO_MASK, gpiomask);
7971 snd_hda_codec_write(codec, codec->afg, 0,
7972 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
7976 snd_hda_codec_write(codec, codec->afg, 0,
7977 AC_VERB_SET_GPIO_DATA, gpiostate);
7980 /* set up GPIO at initialization */
7981 static void alc885_macpro_init_hook(struct hda_codec *codec)
7983 alc882_gpio_mute(codec, 0, 0);
7984 alc882_gpio_mute(codec, 1, 0);
7987 /* set up GPIO and update auto-muting at initialization */
7988 static void alc885_imac24_init_hook(struct hda_codec *codec)
7990 alc885_macpro_init_hook(codec);
7991 alc_automute_amp(codec);
7995 * generic initialization of ADC, input mixers and output mixers
7997 static struct hda_verb alc883_auto_init_verbs[] = {
7999 * Unmute ADC0-2 and set the default input to mic-in
8001 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8002 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8003 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8004 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8007 * Set up output mixers (0x0c - 0x0f)
8009 /* set vol=0 to output mixers */
8010 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8011 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8012 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8013 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8014 /* set up input amps for analog loopback */
8015 /* Amp Indices: DAC = 0, mixer = 1 */
8016 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8017 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8018 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8019 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8020 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8021 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8022 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8023 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8024 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8025 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8027 /* FIXME: use matrix-type input source selection */
8028 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8030 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8032 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8036 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
8037 static struct hda_verb alc889A_mb31_ch2_init[] = {
8038 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8039 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8040 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8041 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8045 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
8046 static struct hda_verb alc889A_mb31_ch4_init[] = {
8047 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8048 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8049 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8050 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8054 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
8055 static struct hda_verb alc889A_mb31_ch5_init[] = {
8056 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
8057 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8058 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8059 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8063 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
8064 static struct hda_verb alc889A_mb31_ch6_init[] = {
8065 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
8066 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
8067 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8068 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8072 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
8073 { 2, alc889A_mb31_ch2_init },
8074 { 4, alc889A_mb31_ch4_init },
8075 { 5, alc889A_mb31_ch5_init },
8076 { 6, alc889A_mb31_ch6_init },
8079 static struct hda_verb alc883_medion_eapd_verbs[] = {
8080 /* eanable EAPD on medion laptop */
8081 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8082 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
8086 #define alc883_base_mixer alc882_base_mixer
8088 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
8089 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8090 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8091 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8092 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8093 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8094 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8095 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8096 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8097 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8098 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8099 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8100 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8101 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8105 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
8106 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8107 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8108 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8109 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8110 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8111 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8112 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8113 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8114 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8115 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8119 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
8120 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8121 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8122 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8123 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8124 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8125 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8126 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8127 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8128 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8129 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8133 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
8134 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8135 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8136 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8137 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8138 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8139 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8140 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8141 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8142 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8143 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8144 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8145 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8146 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8150 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
8151 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8152 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8153 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8154 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8155 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8156 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8157 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8158 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8159 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8160 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8161 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8162 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8163 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8164 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8165 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8166 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8167 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8168 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8169 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8173 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
8174 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8175 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8176 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8177 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8178 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8180 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8181 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8182 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8183 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8184 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8185 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8186 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8187 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8188 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8189 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8190 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8191 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8192 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8193 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8197 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
8198 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8199 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8200 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8201 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8202 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8204 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8205 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8206 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8207 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8208 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
8209 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8210 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8211 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8212 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
8213 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT),
8214 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
8215 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8216 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8217 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8221 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
8222 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8223 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8224 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8225 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8226 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8227 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8228 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8229 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8230 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8231 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8232 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8233 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8234 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8235 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8236 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8237 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8238 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8239 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8240 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8244 static struct snd_kcontrol_new alc883_targa_mixer[] = {
8245 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8246 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8247 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8248 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8249 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8250 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8251 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8252 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8253 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8254 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8255 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8256 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8257 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8258 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8259 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8260 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8261 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8265 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
8266 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8267 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8268 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8269 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8270 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8271 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8272 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8273 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8274 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8275 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8276 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8277 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8281 static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
8282 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8283 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8284 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8285 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8286 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8290 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
8291 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8292 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8293 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8294 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8295 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8296 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8297 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8298 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8302 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
8303 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8304 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
8305 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8306 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8307 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8308 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8309 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8310 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8311 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8315 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
8316 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8317 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8318 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8319 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8320 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8321 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8322 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8323 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8324 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8328 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
8329 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8330 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8331 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8332 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8333 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8334 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8335 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8336 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8340 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
8341 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8342 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8343 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8344 HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT),
8345 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8346 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8347 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8348 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8349 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8350 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8351 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8355 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
8356 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8357 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8358 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8359 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
8360 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
8361 0x0d, 1, 0x0, HDA_OUTPUT),
8362 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
8363 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
8364 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
8365 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8366 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8367 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8368 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8369 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8370 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8371 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8372 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8373 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8374 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8375 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8376 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8380 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
8382 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8383 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8384 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8385 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8386 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
8388 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
8389 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
8390 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
8391 /* Output switches */
8392 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
8393 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
8394 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
8396 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
8397 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
8399 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8400 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8401 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8402 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8406 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
8407 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8408 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8409 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8410 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8411 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8412 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8416 static struct hda_bind_ctls alc883_bind_cap_vol = {
8417 .ops = &snd_hda_bind_vol,
8419 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8420 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8425 static struct hda_bind_ctls alc883_bind_cap_switch = {
8426 .ops = &snd_hda_bind_sw,
8428 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8429 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8434 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
8435 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8436 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8437 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8438 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8439 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8440 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8441 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8442 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8446 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
8447 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
8448 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
8450 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8451 /* .name = "Capture Source", */
8452 .name = "Input Source",
8454 .info = alc_mux_enum_info,
8455 .get = alc_mux_enum_get,
8456 .put = alc_mux_enum_put,
8461 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
8463 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8464 .name = "Channel Mode",
8465 .info = alc_ch_mode_info,
8466 .get = alc_ch_mode_get,
8467 .put = alc_ch_mode_put,
8472 /* toggle speaker-output according to the hp-jack state */
8473 static void alc883_mitac_setup(struct hda_codec *codec)
8475 struct alc_spec *spec = codec->spec;
8477 spec->autocfg.hp_pins[0] = 0x15;
8478 spec->autocfg.speaker_pins[0] = 0x14;
8479 spec->autocfg.speaker_pins[1] = 0x17;
8482 /* auto-toggle front mic */
8484 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8486 unsigned char bits = snd_hda_jack_detect(codec, 0x18) ? HDA_AMP_MUTE : 0;
8488 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8492 static struct hda_verb alc883_mitac_verbs[] = {
8494 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8495 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8497 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8498 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8500 /* enable unsolicited event */
8501 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8502 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8507 static struct hda_verb alc883_clevo_m540r_verbs[] = {
8509 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8510 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8512 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
8514 /* enable unsolicited event */
8516 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8517 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8523 static struct hda_verb alc883_clevo_m720_verbs[] = {
8525 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8526 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8528 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
8529 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8531 /* enable unsolicited event */
8532 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8533 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8538 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8540 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8541 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8543 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8544 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8546 /* enable unsolicited event */
8547 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8552 static struct hda_verb alc883_targa_verbs[] = {
8553 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8554 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8556 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8557 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8559 /* Connect Line-Out side jack (SPDIF) to Side */
8560 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8561 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8562 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8563 /* Connect Mic jack to CLFE */
8564 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8565 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8566 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
8567 /* Connect Line-in jack to Surround */
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, 0x01},
8571 /* Connect HP out jack to Front */
8572 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8573 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8574 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8576 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8581 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8582 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8583 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8584 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8588 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8589 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8590 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8591 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8592 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8596 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8597 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8598 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8599 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8600 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8601 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8605 static struct hda_verb alc883_haier_w66_verbs[] = {
8606 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8607 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8609 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8611 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8612 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8613 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8614 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8618 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8619 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8620 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8621 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8622 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8623 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8624 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8625 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8626 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8630 static struct hda_verb alc888_6st_dell_verbs[] = {
8631 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8635 static struct hda_verb alc883_vaiott_verbs[] = {
8637 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8638 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8640 /* enable unsolicited event */
8641 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8646 static void alc888_3st_hp_setup(struct hda_codec *codec)
8648 struct alc_spec *spec = codec->spec;
8650 spec->autocfg.hp_pins[0] = 0x1b;
8651 spec->autocfg.speaker_pins[0] = 0x14;
8652 spec->autocfg.speaker_pins[1] = 0x16;
8653 spec->autocfg.speaker_pins[2] = 0x18;
8656 static struct hda_verb alc888_3st_hp_verbs[] = {
8657 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8658 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8659 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8660 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8667 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8668 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8669 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8670 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8671 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8678 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8679 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8680 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8681 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8682 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8683 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8690 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8691 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8692 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8693 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8694 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8695 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8696 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8700 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8701 { 2, alc888_3st_hp_2ch_init },
8702 { 4, alc888_3st_hp_4ch_init },
8703 { 6, alc888_3st_hp_6ch_init },
8706 /* toggle front-jack and RCA according to the hp-jack state */
8707 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8709 unsigned int present = snd_hda_jack_detect(codec, 0x1b);
8711 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8712 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8713 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8714 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8717 /* toggle RCA according to the front-jack state */
8718 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8720 unsigned int present = snd_hda_jack_detect(codec, 0x14);
8722 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8723 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8726 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8729 if ((res >> 26) == ALC880_HP_EVENT)
8730 alc888_lenovo_ms7195_front_automute(codec);
8731 if ((res >> 26) == ALC880_FRONT_EVENT)
8732 alc888_lenovo_ms7195_rca_automute(codec);
8735 static struct hda_verb alc883_medion_md2_verbs[] = {
8736 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8737 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8739 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8741 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8745 /* toggle speaker-output according to the hp-jack state */
8746 static void alc883_medion_md2_setup(struct hda_codec *codec)
8748 struct alc_spec *spec = codec->spec;
8750 spec->autocfg.hp_pins[0] = 0x14;
8751 spec->autocfg.speaker_pins[0] = 0x15;
8754 /* toggle speaker-output according to the hp-jack state */
8755 #define alc883_targa_init_hook alc882_targa_init_hook
8756 #define alc883_targa_unsol_event alc882_targa_unsol_event
8758 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8760 unsigned int present;
8762 present = snd_hda_jack_detect(codec, 0x18);
8763 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8764 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8767 static void alc883_clevo_m720_setup(struct hda_codec *codec)
8769 struct alc_spec *spec = codec->spec;
8771 spec->autocfg.hp_pins[0] = 0x15;
8772 spec->autocfg.speaker_pins[0] = 0x14;
8775 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
8777 alc_automute_amp(codec);
8778 alc883_clevo_m720_mic_automute(codec);
8781 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8784 switch (res >> 26) {
8785 case ALC880_MIC_EVENT:
8786 alc883_clevo_m720_mic_automute(codec);
8789 alc_automute_amp_unsol_event(codec, res);
8794 /* toggle speaker-output according to the hp-jack state */
8795 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
8797 struct alc_spec *spec = codec->spec;
8799 spec->autocfg.hp_pins[0] = 0x14;
8800 spec->autocfg.speaker_pins[0] = 0x15;
8803 static void alc883_haier_w66_setup(struct hda_codec *codec)
8805 struct alc_spec *spec = codec->spec;
8807 spec->autocfg.hp_pins[0] = 0x1b;
8808 spec->autocfg.speaker_pins[0] = 0x14;
8811 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8813 int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0;
8815 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8816 HDA_AMP_MUTE, bits);
8819 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8821 int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0;
8823 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8824 HDA_AMP_MUTE, bits);
8825 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8826 HDA_AMP_MUTE, bits);
8829 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8832 if ((res >> 26) == ALC880_HP_EVENT)
8833 alc883_lenovo_101e_all_automute(codec);
8834 if ((res >> 26) == ALC880_FRONT_EVENT)
8835 alc883_lenovo_101e_ispeaker_automute(codec);
8838 /* toggle speaker-output according to the hp-jack state */
8839 static void alc883_acer_aspire_setup(struct hda_codec *codec)
8841 struct alc_spec *spec = codec->spec;
8843 spec->autocfg.hp_pins[0] = 0x14;
8844 spec->autocfg.speaker_pins[0] = 0x15;
8845 spec->autocfg.speaker_pins[1] = 0x16;
8848 static struct hda_verb alc883_acer_eapd_verbs[] = {
8849 /* HP Pin: output 0 (0x0c) */
8850 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8851 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8852 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8853 /* Front Pin: output 0 (0x0c) */
8854 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8855 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8856 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8857 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8858 /* eanable EAPD on medion laptop */
8859 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8860 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8861 /* enable unsolicited event */
8862 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8866 static struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
8867 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8868 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8869 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8873 static void alc888_6st_dell_setup(struct hda_codec *codec)
8875 struct alc_spec *spec = codec->spec;
8877 spec->autocfg.hp_pins[0] = 0x1b;
8878 spec->autocfg.speaker_pins[0] = 0x14;
8879 spec->autocfg.speaker_pins[1] = 0x15;
8880 spec->autocfg.speaker_pins[2] = 0x16;
8881 spec->autocfg.speaker_pins[3] = 0x17;
8884 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
8886 struct alc_spec *spec = codec->spec;
8888 spec->autocfg.hp_pins[0] = 0x1b;
8889 spec->autocfg.speaker_pins[0] = 0x14;
8890 spec->autocfg.speaker_pins[1] = 0x15;
8891 spec->autocfg.speaker_pins[2] = 0x16;
8892 spec->autocfg.speaker_pins[3] = 0x17;
8893 spec->autocfg.speaker_pins[4] = 0x1a;
8896 static void alc883_vaiott_setup(struct hda_codec *codec)
8898 struct alc_spec *spec = codec->spec;
8900 spec->autocfg.hp_pins[0] = 0x15;
8901 spec->autocfg.speaker_pins[0] = 0x14;
8902 spec->autocfg.speaker_pins[1] = 0x17;
8905 static struct hda_verb alc888_asus_m90v_verbs[] = {
8906 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8907 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8908 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8909 /* enable unsolicited event */
8910 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8911 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8915 static void alc883_mode2_setup(struct hda_codec *codec)
8917 struct alc_spec *spec = codec->spec;
8919 spec->autocfg.hp_pins[0] = 0x1b;
8920 spec->autocfg.speaker_pins[0] = 0x14;
8921 spec->autocfg.speaker_pins[1] = 0x15;
8922 spec->autocfg.speaker_pins[2] = 0x16;
8923 spec->ext_mic.pin = 0x18;
8924 spec->int_mic.pin = 0x19;
8925 spec->ext_mic.mux_idx = 0;
8926 spec->int_mic.mux_idx = 1;
8930 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8931 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8932 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8933 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8934 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8935 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8936 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8937 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8938 /* enable unsolicited event */
8939 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8943 static void alc883_eee1601_inithook(struct hda_codec *codec)
8945 struct alc_spec *spec = codec->spec;
8947 spec->autocfg.hp_pins[0] = 0x14;
8948 spec->autocfg.speaker_pins[0] = 0x1b;
8949 alc_automute_pin(codec);
8952 static struct hda_verb alc889A_mb31_verbs[] = {
8953 /* Init rear pin (used as headphone output) */
8954 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
8955 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
8956 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8957 /* Init line pin (used as output in 4ch and 6ch mode) */
8958 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
8959 /* Init line 2 pin (used as headphone out by default) */
8960 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
8961 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
8965 /* Mute speakers according to the headphone jack state */
8966 static void alc889A_mb31_automute(struct hda_codec *codec)
8968 unsigned int present;
8970 /* Mute only in 2ch or 4ch mode */
8971 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
8973 present = snd_hda_jack_detect(codec, 0x15);
8974 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8975 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8976 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8977 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8981 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
8983 if ((res >> 26) == ALC880_HP_EVENT)
8984 alc889A_mb31_automute(codec);
8988 #ifdef CONFIG_SND_HDA_POWER_SAVE
8989 #define alc882_loopbacks alc880_loopbacks
8992 /* pcm configuration: identical with ALC880 */
8993 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
8994 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
8995 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
8996 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
8998 static hda_nid_t alc883_slave_dig_outs[] = {
8999 ALC1200_DIGOUT_NID, 0,
9002 static hda_nid_t alc1200_slave_dig_outs[] = {
9003 ALC883_DIGOUT_NID, 0,
9007 * configuration and preset
9009 static const char *alc882_models[ALC882_MODEL_LAST] = {
9010 [ALC882_3ST_DIG] = "3stack-dig",
9011 [ALC882_6ST_DIG] = "6stack-dig",
9012 [ALC882_ARIMA] = "arima",
9013 [ALC882_W2JC] = "w2jc",
9014 [ALC882_TARGA] = "targa",
9015 [ALC882_ASUS_A7J] = "asus-a7j",
9016 [ALC882_ASUS_A7M] = "asus-a7m",
9017 [ALC885_MACPRO] = "macpro",
9018 [ALC885_MB5] = "mb5",
9019 [ALC885_MACMINI3] = "macmini3",
9020 [ALC885_MBP3] = "mbp3",
9021 [ALC885_IMAC24] = "imac24",
9022 [ALC885_IMAC91] = "imac91",
9023 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
9024 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
9025 [ALC883_3ST_6ch] = "3stack-6ch",
9026 [ALC883_6ST_DIG] = "alc883-6stack-dig",
9027 [ALC883_TARGA_DIG] = "targa-dig",
9028 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
9029 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
9030 [ALC883_ACER] = "acer",
9031 [ALC883_ACER_ASPIRE] = "acer-aspire",
9032 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
9033 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
9034 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
9035 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
9036 [ALC883_MEDION] = "medion",
9037 [ALC883_MEDION_MD2] = "medion-md2",
9038 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
9039 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
9040 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
9041 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
9042 [ALC888_LENOVO_SKY] = "lenovo-sky",
9043 [ALC883_HAIER_W66] = "haier-w66",
9044 [ALC888_3ST_HP] = "3stack-hp",
9045 [ALC888_6ST_DELL] = "6stack-dell",
9046 [ALC883_MITAC] = "mitac",
9047 [ALC883_CLEVO_M540R] = "clevo-m540r",
9048 [ALC883_CLEVO_M720] = "clevo-m720",
9049 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
9050 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
9051 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
9052 [ALC889A_INTEL] = "intel-alc889a",
9053 [ALC889_INTEL] = "intel-x58",
9054 [ALC1200_ASUS_P5Q] = "asus-p5q",
9055 [ALC889A_MB31] = "mb31",
9056 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
9057 [ALC882_AUTO] = "auto",
9060 static struct snd_pci_quirk alc882_cfg_tbl[] = {
9061 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
9063 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
9064 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
9065 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
9066 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
9067 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
9068 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
9069 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
9070 ALC888_ACER_ASPIRE_4930G),
9071 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
9072 ALC888_ACER_ASPIRE_4930G),
9073 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
9074 ALC888_ACER_ASPIRE_8930G),
9075 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
9076 ALC888_ACER_ASPIRE_8930G),
9077 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
9078 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
9079 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
9080 ALC888_ACER_ASPIRE_6530G),
9081 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
9082 ALC888_ACER_ASPIRE_6530G),
9083 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
9084 ALC888_ACER_ASPIRE_7730G),
9085 /* default Acer -- disabled as it causes more problems.
9086 * model=auto should work fine now
9088 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
9090 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
9092 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
9093 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
9094 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
9095 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
9096 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
9097 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
9099 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
9100 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
9101 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
9102 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
9103 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
9104 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
9105 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
9106 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
9107 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
9108 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
9109 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
9111 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
9112 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
9113 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
9114 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
9115 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
9116 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
9117 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
9118 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
9119 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
9121 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
9122 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
9123 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
9124 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
9125 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
9126 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
9127 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
9128 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
9129 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
9130 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
9131 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
9132 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
9133 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
9134 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
9135 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
9136 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
9137 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
9138 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
9139 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
9140 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
9141 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
9142 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
9143 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
9144 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
9145 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
9146 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
9147 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
9148 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
9149 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
9151 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
9152 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
9153 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
9154 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
9155 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
9156 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
9157 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
9158 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
9159 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9160 ALC883_FUJITSU_PI2515),
9161 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9162 ALC888_FUJITSU_XA3530),
9163 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
9164 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9165 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9166 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9167 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
9168 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
9169 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
9170 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
9171 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
9173 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
9174 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
9175 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
9176 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
9177 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
9178 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
9179 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
9184 /* codec SSID table for Intel Mac */
9185 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
9186 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
9187 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
9188 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
9189 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
9190 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
9191 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
9192 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
9193 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
9194 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
9195 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
9196 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
9197 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
9198 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
9199 * so apparently no perfect solution yet
9201 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
9202 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
9203 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3),
9207 static struct alc_config_preset alc882_presets[] = {
9208 [ALC882_3ST_DIG] = {
9209 .mixers = { alc882_base_mixer },
9210 .init_verbs = { alc882_base_init_verbs,
9211 alc882_adc1_init_verbs },
9212 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9213 .dac_nids = alc882_dac_nids,
9214 .dig_out_nid = ALC882_DIGOUT_NID,
9215 .dig_in_nid = ALC882_DIGIN_NID,
9216 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9217 .channel_mode = alc882_ch_modes,
9219 .input_mux = &alc882_capture_source,
9221 [ALC882_6ST_DIG] = {
9222 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9223 .init_verbs = { alc882_base_init_verbs,
9224 alc882_adc1_init_verbs },
9225 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9226 .dac_nids = alc882_dac_nids,
9227 .dig_out_nid = ALC882_DIGOUT_NID,
9228 .dig_in_nid = ALC882_DIGIN_NID,
9229 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9230 .channel_mode = alc882_sixstack_modes,
9231 .input_mux = &alc882_capture_source,
9234 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9235 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9236 alc882_eapd_verbs },
9237 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9238 .dac_nids = alc882_dac_nids,
9239 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9240 .channel_mode = alc882_sixstack_modes,
9241 .input_mux = &alc882_capture_source,
9244 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
9245 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9246 alc882_eapd_verbs, alc880_gpio1_init_verbs },
9247 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9248 .dac_nids = alc882_dac_nids,
9249 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9250 .channel_mode = alc880_threestack_modes,
9252 .input_mux = &alc882_capture_source,
9253 .dig_out_nid = ALC882_DIGOUT_NID,
9256 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
9257 .init_verbs = { alc885_mbp3_init_verbs,
9258 alc880_gpio1_init_verbs },
9260 .dac_nids = alc882_dac_nids,
9262 .channel_mode = alc885_mbp_4ch_modes,
9263 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9264 .input_mux = &alc882_capture_source,
9265 .dig_out_nid = ALC882_DIGOUT_NID,
9266 .dig_in_nid = ALC882_DIGIN_NID,
9267 .unsol_event = alc_automute_amp_unsol_event,
9268 .setup = alc885_mbp3_setup,
9269 .init_hook = alc_automute_amp,
9272 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
9273 .init_verbs = { alc885_mb5_init_verbs,
9274 alc880_gpio1_init_verbs },
9275 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9276 .dac_nids = alc882_dac_nids,
9277 .channel_mode = alc885_mb5_6ch_modes,
9278 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
9279 .input_mux = &mb5_capture_source,
9280 .dig_out_nid = ALC882_DIGOUT_NID,
9281 .dig_in_nid = ALC882_DIGIN_NID,
9282 .unsol_event = alc_automute_amp_unsol_event,
9283 .setup = alc885_mb5_setup,
9284 .init_hook = alc_automute_amp,
9286 [ALC885_MACMINI3] = {
9287 .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer },
9288 .init_verbs = { alc885_macmini3_init_verbs,
9289 alc880_gpio1_init_verbs },
9290 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9291 .dac_nids = alc882_dac_nids,
9292 .channel_mode = alc885_macmini3_6ch_modes,
9293 .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes),
9294 .input_mux = &macmini3_capture_source,
9295 .dig_out_nid = ALC882_DIGOUT_NID,
9296 .dig_in_nid = ALC882_DIGIN_NID,
9297 .unsol_event = alc_automute_amp_unsol_event,
9298 .setup = alc885_macmini3_setup,
9299 .init_hook = alc_automute_amp,
9302 .mixers = { alc882_macpro_mixer },
9303 .init_verbs = { alc882_macpro_init_verbs },
9304 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9305 .dac_nids = alc882_dac_nids,
9306 .dig_out_nid = ALC882_DIGOUT_NID,
9307 .dig_in_nid = ALC882_DIGIN_NID,
9308 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9309 .channel_mode = alc882_ch_modes,
9310 .input_mux = &alc882_capture_source,
9311 .init_hook = alc885_macpro_init_hook,
9314 .mixers = { alc885_imac24_mixer },
9315 .init_verbs = { alc885_imac24_init_verbs },
9316 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9317 .dac_nids = alc882_dac_nids,
9318 .dig_out_nid = ALC882_DIGOUT_NID,
9319 .dig_in_nid = ALC882_DIGIN_NID,
9320 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9321 .channel_mode = alc882_ch_modes,
9322 .input_mux = &alc882_capture_source,
9323 .unsol_event = alc_automute_amp_unsol_event,
9324 .setup = alc885_imac24_setup,
9325 .init_hook = alc885_imac24_init_hook,
9328 .mixers = { alc885_imac91_mixer, alc882_chmode_mixer },
9329 .init_verbs = { alc885_imac91_init_verbs,
9330 alc880_gpio1_init_verbs },
9331 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9332 .dac_nids = alc882_dac_nids,
9333 .channel_mode = alc885_mbp_4ch_modes,
9334 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9335 .input_mux = &alc882_capture_source,
9336 .dig_out_nid = ALC882_DIGOUT_NID,
9337 .dig_in_nid = ALC882_DIGIN_NID,
9338 .unsol_event = alc_automute_amp_unsol_event,
9339 .setup = alc885_imac91_setup,
9340 .init_hook = alc_automute_amp,
9343 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
9344 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9345 alc880_gpio3_init_verbs, alc882_targa_verbs},
9346 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9347 .dac_nids = alc882_dac_nids,
9348 .dig_out_nid = ALC882_DIGOUT_NID,
9349 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9350 .adc_nids = alc882_adc_nids,
9351 .capsrc_nids = alc882_capsrc_nids,
9352 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9353 .channel_mode = alc882_3ST_6ch_modes,
9355 .input_mux = &alc882_capture_source,
9356 .unsol_event = alc882_targa_unsol_event,
9357 .setup = alc882_targa_setup,
9358 .init_hook = alc882_targa_automute,
9360 [ALC882_ASUS_A7J] = {
9361 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
9362 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9363 alc882_asus_a7j_verbs},
9364 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9365 .dac_nids = alc882_dac_nids,
9366 .dig_out_nid = ALC882_DIGOUT_NID,
9367 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9368 .adc_nids = alc882_adc_nids,
9369 .capsrc_nids = alc882_capsrc_nids,
9370 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9371 .channel_mode = alc882_3ST_6ch_modes,
9373 .input_mux = &alc882_capture_source,
9375 [ALC882_ASUS_A7M] = {
9376 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
9377 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9378 alc882_eapd_verbs, alc880_gpio1_init_verbs,
9379 alc882_asus_a7m_verbs },
9380 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9381 .dac_nids = alc882_dac_nids,
9382 .dig_out_nid = ALC882_DIGOUT_NID,
9383 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9384 .channel_mode = alc880_threestack_modes,
9386 .input_mux = &alc882_capture_source,
9388 [ALC883_3ST_2ch_DIG] = {
9389 .mixers = { alc883_3ST_2ch_mixer },
9390 .init_verbs = { alc883_init_verbs },
9391 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9392 .dac_nids = alc883_dac_nids,
9393 .dig_out_nid = ALC883_DIGOUT_NID,
9394 .dig_in_nid = ALC883_DIGIN_NID,
9395 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9396 .channel_mode = alc883_3ST_2ch_modes,
9397 .input_mux = &alc883_capture_source,
9399 [ALC883_3ST_6ch_DIG] = {
9400 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9401 .init_verbs = { alc883_init_verbs },
9402 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9403 .dac_nids = alc883_dac_nids,
9404 .dig_out_nid = ALC883_DIGOUT_NID,
9405 .dig_in_nid = ALC883_DIGIN_NID,
9406 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9407 .channel_mode = alc883_3ST_6ch_modes,
9409 .input_mux = &alc883_capture_source,
9411 [ALC883_3ST_6ch] = {
9412 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9413 .init_verbs = { alc883_init_verbs },
9414 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9415 .dac_nids = alc883_dac_nids,
9416 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9417 .channel_mode = alc883_3ST_6ch_modes,
9419 .input_mux = &alc883_capture_source,
9421 [ALC883_3ST_6ch_INTEL] = {
9422 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
9423 .init_verbs = { alc883_init_verbs },
9424 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9425 .dac_nids = alc883_dac_nids,
9426 .dig_out_nid = ALC883_DIGOUT_NID,
9427 .dig_in_nid = ALC883_DIGIN_NID,
9428 .slave_dig_outs = alc883_slave_dig_outs,
9429 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
9430 .channel_mode = alc883_3ST_6ch_intel_modes,
9432 .input_mux = &alc883_3stack_6ch_intel,
9435 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9436 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
9437 alc_hp15_unsol_verbs },
9438 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9439 .dac_nids = alc883_dac_nids,
9440 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9441 .adc_nids = alc889_adc_nids,
9442 .dig_out_nid = ALC883_DIGOUT_NID,
9443 .dig_in_nid = ALC883_DIGIN_NID,
9444 .slave_dig_outs = alc883_slave_dig_outs,
9445 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9446 .channel_mode = alc889_8ch_intel_modes,
9447 .capsrc_nids = alc889_capsrc_nids,
9448 .input_mux = &alc889_capture_source,
9449 .setup = alc889_automute_setup,
9450 .init_hook = alc_automute_amp,
9451 .unsol_event = alc_automute_amp_unsol_event,
9455 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9456 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
9457 alc889_eapd_verbs, alc_hp15_unsol_verbs},
9458 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9459 .dac_nids = alc883_dac_nids,
9460 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9461 .adc_nids = alc889_adc_nids,
9462 .dig_out_nid = ALC883_DIGOUT_NID,
9463 .dig_in_nid = ALC883_DIGIN_NID,
9464 .slave_dig_outs = alc883_slave_dig_outs,
9465 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9466 .channel_mode = alc889_8ch_intel_modes,
9467 .capsrc_nids = alc889_capsrc_nids,
9468 .input_mux = &alc889_capture_source,
9469 .setup = alc889_automute_setup,
9470 .init_hook = alc889_intel_init_hook,
9471 .unsol_event = alc_automute_amp_unsol_event,
9474 [ALC883_6ST_DIG] = {
9475 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9476 .init_verbs = { alc883_init_verbs },
9477 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9478 .dac_nids = alc883_dac_nids,
9479 .dig_out_nid = ALC883_DIGOUT_NID,
9480 .dig_in_nid = ALC883_DIGIN_NID,
9481 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9482 .channel_mode = alc883_sixstack_modes,
9483 .input_mux = &alc883_capture_source,
9485 [ALC883_TARGA_DIG] = {
9486 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
9487 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9488 alc883_targa_verbs},
9489 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9490 .dac_nids = alc883_dac_nids,
9491 .dig_out_nid = ALC883_DIGOUT_NID,
9492 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9493 .channel_mode = alc883_3ST_6ch_modes,
9495 .input_mux = &alc883_capture_source,
9496 .unsol_event = alc883_targa_unsol_event,
9497 .setup = alc882_targa_setup,
9498 .init_hook = alc882_targa_automute,
9500 [ALC883_TARGA_2ch_DIG] = {
9501 .mixers = { alc883_targa_2ch_mixer},
9502 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9503 alc883_targa_verbs},
9504 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9505 .dac_nids = alc883_dac_nids,
9506 .adc_nids = alc883_adc_nids_alt,
9507 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9508 .capsrc_nids = alc883_capsrc_nids,
9509 .dig_out_nid = ALC883_DIGOUT_NID,
9510 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9511 .channel_mode = alc883_3ST_2ch_modes,
9512 .input_mux = &alc883_capture_source,
9513 .unsol_event = alc883_targa_unsol_event,
9514 .setup = alc882_targa_setup,
9515 .init_hook = alc882_targa_automute,
9517 [ALC883_TARGA_8ch_DIG] = {
9518 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
9519 alc883_chmode_mixer },
9520 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9521 alc883_targa_verbs },
9522 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9523 .dac_nids = alc883_dac_nids,
9524 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9525 .adc_nids = alc883_adc_nids_rev,
9526 .capsrc_nids = alc883_capsrc_nids_rev,
9527 .dig_out_nid = ALC883_DIGOUT_NID,
9528 .dig_in_nid = ALC883_DIGIN_NID,
9529 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
9530 .channel_mode = alc883_4ST_8ch_modes,
9532 .input_mux = &alc883_capture_source,
9533 .unsol_event = alc883_targa_unsol_event,
9534 .setup = alc882_targa_setup,
9535 .init_hook = alc882_targa_automute,
9538 .mixers = { alc883_base_mixer },
9539 /* On TravelMate laptops, GPIO 0 enables the internal speaker
9540 * and the headphone jack. Turn this on and rely on the
9541 * standard mute methods whenever the user wants to turn
9542 * these outputs off.
9544 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
9545 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9546 .dac_nids = alc883_dac_nids,
9547 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9548 .channel_mode = alc883_3ST_2ch_modes,
9549 .input_mux = &alc883_capture_source,
9551 [ALC883_ACER_ASPIRE] = {
9552 .mixers = { alc883_acer_aspire_mixer },
9553 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
9554 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9555 .dac_nids = alc883_dac_nids,
9556 .dig_out_nid = ALC883_DIGOUT_NID,
9557 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9558 .channel_mode = alc883_3ST_2ch_modes,
9559 .input_mux = &alc883_capture_source,
9560 .unsol_event = alc_automute_amp_unsol_event,
9561 .setup = alc883_acer_aspire_setup,
9562 .init_hook = alc_automute_amp,
9564 [ALC888_ACER_ASPIRE_4930G] = {
9565 .mixers = { alc888_base_mixer,
9566 alc883_chmode_mixer },
9567 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9568 alc888_acer_aspire_4930g_verbs },
9569 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9570 .dac_nids = alc883_dac_nids,
9571 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9572 .adc_nids = alc883_adc_nids_rev,
9573 .capsrc_nids = alc883_capsrc_nids_rev,
9574 .dig_out_nid = ALC883_DIGOUT_NID,
9575 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9576 .channel_mode = alc883_3ST_6ch_modes,
9578 .const_channel_count = 6,
9580 ARRAY_SIZE(alc888_2_capture_sources),
9581 .input_mux = alc888_2_capture_sources,
9582 .unsol_event = alc_automute_amp_unsol_event,
9583 .setup = alc888_acer_aspire_4930g_setup,
9584 .init_hook = alc_automute_amp,
9586 [ALC888_ACER_ASPIRE_6530G] = {
9587 .mixers = { alc888_acer_aspire_6530_mixer },
9588 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9589 alc888_acer_aspire_6530g_verbs },
9590 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9591 .dac_nids = alc883_dac_nids,
9592 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9593 .adc_nids = alc883_adc_nids_rev,
9594 .capsrc_nids = alc883_capsrc_nids_rev,
9595 .dig_out_nid = ALC883_DIGOUT_NID,
9596 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9597 .channel_mode = alc883_3ST_2ch_modes,
9599 ARRAY_SIZE(alc888_2_capture_sources),
9600 .input_mux = alc888_acer_aspire_6530_sources,
9601 .unsol_event = alc_automute_amp_unsol_event,
9602 .setup = alc888_acer_aspire_6530g_setup,
9603 .init_hook = alc_automute_amp,
9605 [ALC888_ACER_ASPIRE_8930G] = {
9606 .mixers = { alc889_acer_aspire_8930g_mixer,
9607 alc883_chmode_mixer },
9608 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9609 alc889_acer_aspire_8930g_verbs,
9611 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9612 .dac_nids = alc883_dac_nids,
9613 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9614 .adc_nids = alc889_adc_nids,
9615 .capsrc_nids = alc889_capsrc_nids,
9616 .dig_out_nid = ALC883_DIGOUT_NID,
9617 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9618 .channel_mode = alc883_3ST_6ch_modes,
9620 .const_channel_count = 6,
9622 ARRAY_SIZE(alc889_capture_sources),
9623 .input_mux = alc889_capture_sources,
9624 .unsol_event = alc_automute_amp_unsol_event,
9625 .setup = alc889_acer_aspire_8930g_setup,
9626 .init_hook = alc_automute_amp,
9627 #ifdef CONFIG_SND_HDA_POWER_SAVE
9628 .power_hook = alc_power_eapd,
9631 [ALC888_ACER_ASPIRE_7730G] = {
9632 .mixers = { alc883_3ST_6ch_mixer,
9633 alc883_chmode_mixer },
9634 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9635 alc888_acer_aspire_7730G_verbs },
9636 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9637 .dac_nids = alc883_dac_nids,
9638 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9639 .adc_nids = alc883_adc_nids_rev,
9640 .capsrc_nids = alc883_capsrc_nids_rev,
9641 .dig_out_nid = ALC883_DIGOUT_NID,
9642 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9643 .channel_mode = alc883_3ST_6ch_modes,
9645 .const_channel_count = 6,
9646 .input_mux = &alc883_capture_source,
9647 .unsol_event = alc_automute_amp_unsol_event,
9648 .setup = alc888_acer_aspire_6530g_setup,
9649 .init_hook = alc_automute_amp,
9652 .mixers = { alc883_fivestack_mixer,
9653 alc883_chmode_mixer },
9654 .init_verbs = { alc883_init_verbs,
9655 alc883_medion_eapd_verbs },
9656 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9657 .dac_nids = alc883_dac_nids,
9658 .adc_nids = alc883_adc_nids_alt,
9659 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9660 .capsrc_nids = alc883_capsrc_nids,
9661 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9662 .channel_mode = alc883_sixstack_modes,
9663 .input_mux = &alc883_capture_source,
9665 [ALC883_MEDION_MD2] = {
9666 .mixers = { alc883_medion_md2_mixer},
9667 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
9668 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9669 .dac_nids = alc883_dac_nids,
9670 .dig_out_nid = ALC883_DIGOUT_NID,
9671 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9672 .channel_mode = alc883_3ST_2ch_modes,
9673 .input_mux = &alc883_capture_source,
9674 .unsol_event = alc_automute_amp_unsol_event,
9675 .setup = alc883_medion_md2_setup,
9676 .init_hook = alc_automute_amp,
9678 [ALC883_LAPTOP_EAPD] = {
9679 .mixers = { alc883_base_mixer },
9680 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
9681 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9682 .dac_nids = alc883_dac_nids,
9683 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9684 .channel_mode = alc883_3ST_2ch_modes,
9685 .input_mux = &alc883_capture_source,
9687 [ALC883_CLEVO_M540R] = {
9688 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9689 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
9690 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9691 .dac_nids = alc883_dac_nids,
9692 .dig_out_nid = ALC883_DIGOUT_NID,
9693 .dig_in_nid = ALC883_DIGIN_NID,
9694 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
9695 .channel_mode = alc883_3ST_6ch_clevo_modes,
9697 .input_mux = &alc883_capture_source,
9698 /* This machine has the hardware HP auto-muting, thus
9699 * we need no software mute via unsol event
9702 [ALC883_CLEVO_M720] = {
9703 .mixers = { alc883_clevo_m720_mixer },
9704 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
9705 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9706 .dac_nids = alc883_dac_nids,
9707 .dig_out_nid = ALC883_DIGOUT_NID,
9708 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9709 .channel_mode = alc883_3ST_2ch_modes,
9710 .input_mux = &alc883_capture_source,
9711 .unsol_event = alc883_clevo_m720_unsol_event,
9712 .setup = alc883_clevo_m720_setup,
9713 .init_hook = alc883_clevo_m720_init_hook,
9715 [ALC883_LENOVO_101E_2ch] = {
9716 .mixers = { alc883_lenovo_101e_2ch_mixer},
9717 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
9718 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9719 .dac_nids = alc883_dac_nids,
9720 .adc_nids = alc883_adc_nids_alt,
9721 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9722 .capsrc_nids = alc883_capsrc_nids,
9723 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9724 .channel_mode = alc883_3ST_2ch_modes,
9725 .input_mux = &alc883_lenovo_101e_capture_source,
9726 .unsol_event = alc883_lenovo_101e_unsol_event,
9727 .init_hook = alc883_lenovo_101e_all_automute,
9729 [ALC883_LENOVO_NB0763] = {
9730 .mixers = { alc883_lenovo_nb0763_mixer },
9731 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
9732 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9733 .dac_nids = alc883_dac_nids,
9734 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9735 .channel_mode = alc883_3ST_2ch_modes,
9737 .input_mux = &alc883_lenovo_nb0763_capture_source,
9738 .unsol_event = alc_automute_amp_unsol_event,
9739 .setup = alc883_medion_md2_setup,
9740 .init_hook = alc_automute_amp,
9742 [ALC888_LENOVO_MS7195_DIG] = {
9743 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9744 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
9745 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9746 .dac_nids = alc883_dac_nids,
9747 .dig_out_nid = ALC883_DIGOUT_NID,
9748 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9749 .channel_mode = alc883_3ST_6ch_modes,
9751 .input_mux = &alc883_capture_source,
9752 .unsol_event = alc883_lenovo_ms7195_unsol_event,
9753 .init_hook = alc888_lenovo_ms7195_front_automute,
9755 [ALC883_HAIER_W66] = {
9756 .mixers = { alc883_targa_2ch_mixer},
9757 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
9758 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9759 .dac_nids = alc883_dac_nids,
9760 .dig_out_nid = ALC883_DIGOUT_NID,
9761 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9762 .channel_mode = alc883_3ST_2ch_modes,
9763 .input_mux = &alc883_capture_source,
9764 .unsol_event = alc_automute_amp_unsol_event,
9765 .setup = alc883_haier_w66_setup,
9766 .init_hook = alc_automute_amp,
9769 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9770 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
9771 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9772 .dac_nids = alc883_dac_nids,
9773 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
9774 .channel_mode = alc888_3st_hp_modes,
9776 .input_mux = &alc883_capture_source,
9777 .unsol_event = alc_automute_amp_unsol_event,
9778 .setup = alc888_3st_hp_setup,
9779 .init_hook = alc_automute_amp,
9781 [ALC888_6ST_DELL] = {
9782 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9783 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
9784 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9785 .dac_nids = alc883_dac_nids,
9786 .dig_out_nid = ALC883_DIGOUT_NID,
9787 .dig_in_nid = ALC883_DIGIN_NID,
9788 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9789 .channel_mode = alc883_sixstack_modes,
9790 .input_mux = &alc883_capture_source,
9791 .unsol_event = alc_automute_amp_unsol_event,
9792 .setup = alc888_6st_dell_setup,
9793 .init_hook = alc_automute_amp,
9796 .mixers = { alc883_mitac_mixer },
9797 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
9798 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9799 .dac_nids = alc883_dac_nids,
9800 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9801 .channel_mode = alc883_3ST_2ch_modes,
9802 .input_mux = &alc883_capture_source,
9803 .unsol_event = alc_automute_amp_unsol_event,
9804 .setup = alc883_mitac_setup,
9805 .init_hook = alc_automute_amp,
9807 [ALC883_FUJITSU_PI2515] = {
9808 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
9809 .init_verbs = { alc883_init_verbs,
9810 alc883_2ch_fujitsu_pi2515_verbs},
9811 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9812 .dac_nids = alc883_dac_nids,
9813 .dig_out_nid = ALC883_DIGOUT_NID,
9814 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9815 .channel_mode = alc883_3ST_2ch_modes,
9816 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9817 .unsol_event = alc_automute_amp_unsol_event,
9818 .setup = alc883_2ch_fujitsu_pi2515_setup,
9819 .init_hook = alc_automute_amp,
9821 [ALC888_FUJITSU_XA3530] = {
9822 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
9823 .init_verbs = { alc883_init_verbs,
9824 alc888_fujitsu_xa3530_verbs },
9825 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9826 .dac_nids = alc883_dac_nids,
9827 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9828 .adc_nids = alc883_adc_nids_rev,
9829 .capsrc_nids = alc883_capsrc_nids_rev,
9830 .dig_out_nid = ALC883_DIGOUT_NID,
9831 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
9832 .channel_mode = alc888_4ST_8ch_intel_modes,
9834 ARRAY_SIZE(alc888_2_capture_sources),
9835 .input_mux = alc888_2_capture_sources,
9836 .unsol_event = alc_automute_amp_unsol_event,
9837 .setup = alc888_fujitsu_xa3530_setup,
9838 .init_hook = alc_automute_amp,
9840 [ALC888_LENOVO_SKY] = {
9841 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
9842 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
9843 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9844 .dac_nids = alc883_dac_nids,
9845 .dig_out_nid = ALC883_DIGOUT_NID,
9846 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9847 .channel_mode = alc883_sixstack_modes,
9849 .input_mux = &alc883_lenovo_sky_capture_source,
9850 .unsol_event = alc_automute_amp_unsol_event,
9851 .setup = alc888_lenovo_sky_setup,
9852 .init_hook = alc_automute_amp,
9854 [ALC888_ASUS_M90V] = {
9855 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9856 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
9857 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9858 .dac_nids = alc883_dac_nids,
9859 .dig_out_nid = ALC883_DIGOUT_NID,
9860 .dig_in_nid = ALC883_DIGIN_NID,
9861 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9862 .channel_mode = alc883_3ST_6ch_modes,
9864 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9865 .unsol_event = alc_sku_unsol_event,
9866 .setup = alc883_mode2_setup,
9867 .init_hook = alc_inithook,
9869 [ALC888_ASUS_EEE1601] = {
9870 .mixers = { alc883_asus_eee1601_mixer },
9871 .cap_mixer = alc883_asus_eee1601_cap_mixer,
9872 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
9873 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9874 .dac_nids = alc883_dac_nids,
9875 .dig_out_nid = ALC883_DIGOUT_NID,
9876 .dig_in_nid = ALC883_DIGIN_NID,
9877 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9878 .channel_mode = alc883_3ST_2ch_modes,
9880 .input_mux = &alc883_asus_eee1601_capture_source,
9881 .unsol_event = alc_sku_unsol_event,
9882 .init_hook = alc883_eee1601_inithook,
9884 [ALC1200_ASUS_P5Q] = {
9885 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9886 .init_verbs = { alc883_init_verbs },
9887 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9888 .dac_nids = alc883_dac_nids,
9889 .dig_out_nid = ALC1200_DIGOUT_NID,
9890 .dig_in_nid = ALC883_DIGIN_NID,
9891 .slave_dig_outs = alc1200_slave_dig_outs,
9892 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9893 .channel_mode = alc883_sixstack_modes,
9894 .input_mux = &alc883_capture_source,
9897 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
9898 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
9899 alc880_gpio1_init_verbs },
9900 .adc_nids = alc883_adc_nids,
9901 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
9902 .capsrc_nids = alc883_capsrc_nids,
9903 .dac_nids = alc883_dac_nids,
9904 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9905 .channel_mode = alc889A_mb31_6ch_modes,
9906 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
9907 .input_mux = &alc889A_mb31_capture_source,
9908 .dig_out_nid = ALC883_DIGOUT_NID,
9909 .unsol_event = alc889A_mb31_unsol_event,
9910 .init_hook = alc889A_mb31_automute,
9912 [ALC883_SONY_VAIO_TT] = {
9913 .mixers = { alc883_vaiott_mixer },
9914 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
9915 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9916 .dac_nids = alc883_dac_nids,
9917 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9918 .channel_mode = alc883_3ST_2ch_modes,
9919 .input_mux = &alc883_capture_source,
9920 .unsol_event = alc_automute_amp_unsol_event,
9921 .setup = alc883_vaiott_setup,
9922 .init_hook = alc_automute_amp,
9931 PINFIX_ABIT_AW9D_MAX
9934 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
9935 { 0x15, 0x01080104 }, /* side */
9936 { 0x16, 0x01011012 }, /* rear */
9937 { 0x17, 0x01016011 }, /* clfe */
9941 static const struct alc_fixup alc882_fixups[] = {
9942 [PINFIX_ABIT_AW9D_MAX] = {
9943 .pins = alc882_abit_aw9d_pinfix
9947 static struct snd_pci_quirk alc882_fixup_tbl[] = {
9948 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
9953 * BIOS auto configuration
9955 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
9956 const struct auto_pin_cfg *cfg)
9958 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
9961 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
9962 hda_nid_t nid, int pin_type,
9966 struct alc_spec *spec = codec->spec;
9969 alc_set_pin_output(codec, nid, pin_type);
9970 if (spec->multiout.dac_nids[dac_idx] == 0x25)
9973 idx = spec->multiout.dac_nids[dac_idx] - 2;
9974 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
9978 static void alc882_auto_init_multi_out(struct hda_codec *codec)
9980 struct alc_spec *spec = codec->spec;
9983 for (i = 0; i <= HDA_SIDE; i++) {
9984 hda_nid_t nid = spec->autocfg.line_out_pins[i];
9985 int pin_type = get_pin_type(spec->autocfg.line_out_type);
9987 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
9992 static void alc882_auto_init_hp_out(struct hda_codec *codec)
9994 struct alc_spec *spec = codec->spec;
9997 pin = spec->autocfg.hp_pins[0];
9998 if (pin) /* connect to front */
10000 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
10001 pin = spec->autocfg.speaker_pins[0];
10003 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
10006 static void alc882_auto_init_analog_input(struct hda_codec *codec)
10008 struct alc_spec *spec = codec->spec;
10011 for (i = 0; i < AUTO_PIN_LAST; i++) {
10012 hda_nid_t nid = spec->autocfg.input_pins[i];
10015 alc_set_input_pin(codec, nid, i);
10016 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
10017 snd_hda_codec_write(codec, nid, 0,
10018 AC_VERB_SET_AMP_GAIN_MUTE,
10023 static void alc882_auto_init_input_src(struct hda_codec *codec)
10025 struct alc_spec *spec = codec->spec;
10028 for (c = 0; c < spec->num_adc_nids; c++) {
10029 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
10030 hda_nid_t nid = spec->capsrc_nids[c];
10031 unsigned int mux_idx;
10032 const struct hda_input_mux *imux;
10033 int conns, mute, idx, item;
10035 conns = snd_hda_get_connections(codec, nid, conn_list,
10036 ARRAY_SIZE(conn_list));
10039 mux_idx = c >= spec->num_mux_defs ? 0 : c;
10040 imux = &spec->input_mux[mux_idx];
10041 for (idx = 0; idx < conns; idx++) {
10042 /* if the current connection is the selected one,
10043 * unmute it as default - otherwise mute it
10045 mute = AMP_IN_MUTE(idx);
10046 for (item = 0; item < imux->num_items; item++) {
10047 if (imux->items[item].index == idx) {
10048 if (spec->cur_mux[c] == item)
10049 mute = AMP_IN_UNMUTE(idx);
10053 /* check if we have a selector or mixer
10054 * we could check for the widget type instead, but
10055 * just check for Amp-In presence (in case of mixer
10056 * without amp-in there is something wrong, this
10057 * function shouldn't be used or capsrc nid is wrong)
10059 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
10060 snd_hda_codec_write(codec, nid, 0,
10061 AC_VERB_SET_AMP_GAIN_MUTE,
10063 else if (mute != AMP_IN_MUTE(idx))
10064 snd_hda_codec_write(codec, nid, 0,
10065 AC_VERB_SET_CONNECT_SEL,
10071 /* add mic boosts if needed */
10072 static int alc_auto_add_mic_boost(struct hda_codec *codec)
10074 struct alc_spec *spec = codec->spec;
10078 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
10079 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
10080 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10082 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10086 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
10087 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
10088 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10090 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10097 /* almost identical with ALC880 parser... */
10098 static int alc882_parse_auto_config(struct hda_codec *codec)
10100 struct alc_spec *spec = codec->spec;
10101 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
10104 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10108 if (!spec->autocfg.line_outs)
10109 return 0; /* can't find valid BIOS pin config */
10111 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
10114 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
10117 err = alc880_auto_create_extra_out(spec,
10118 spec->autocfg.speaker_pins[0],
10122 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
10126 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
10130 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10132 /* check multiple SPDIF-out (for recent codecs) */
10133 for (i = 0; i < spec->autocfg.dig_outs; i++) {
10135 err = snd_hda_get_connections(codec,
10136 spec->autocfg.dig_out_pins[i],
10141 spec->multiout.dig_out_nid = dig_nid;
10143 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
10144 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
10146 spec->slave_dig_outs[i - 1] = dig_nid;
10149 if (spec->autocfg.dig_in_pin)
10150 spec->dig_in_nid = ALC880_DIGIN_NID;
10152 if (spec->kctls.list)
10153 add_mixer(spec, spec->kctls.list);
10155 add_verb(spec, alc883_auto_init_verbs);
10156 /* if ADC 0x07 is available, initialize it, too */
10157 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
10158 add_verb(spec, alc882_adc1_init_verbs);
10160 spec->num_mux_defs = 1;
10161 spec->input_mux = &spec->private_imux[0];
10163 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
10165 err = alc_auto_add_mic_boost(codec);
10169 return 1; /* config found */
10172 /* additional initialization for auto-configuration model */
10173 static void alc882_auto_init(struct hda_codec *codec)
10175 struct alc_spec *spec = codec->spec;
10176 alc882_auto_init_multi_out(codec);
10177 alc882_auto_init_hp_out(codec);
10178 alc882_auto_init_analog_input(codec);
10179 alc882_auto_init_input_src(codec);
10180 if (spec->unsol_event)
10181 alc_inithook(codec);
10184 static int patch_alc882(struct hda_codec *codec)
10186 struct alc_spec *spec;
10187 int err, board_config;
10189 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10193 codec->spec = spec;
10195 switch (codec->vendor_id) {
10200 /* ALC883 and variants */
10201 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10205 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
10209 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
10210 board_config = snd_hda_check_board_codec_sid_config(codec,
10211 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
10213 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
10214 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
10216 board_config = ALC882_AUTO;
10219 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups);
10221 if (board_config == ALC882_AUTO) {
10222 /* automatic parse from the BIOS config */
10223 err = alc882_parse_auto_config(codec);
10229 "hda_codec: Cannot set up configuration "
10230 "from BIOS. Using base mode...\n");
10231 board_config = ALC882_3ST_DIG;
10235 err = snd_hda_attach_beep_device(codec, 0x1);
10241 if (board_config != ALC882_AUTO)
10242 setup_preset(codec, &alc882_presets[board_config]);
10244 spec->stream_analog_playback = &alc882_pcm_analog_playback;
10245 spec->stream_analog_capture = &alc882_pcm_analog_capture;
10246 /* FIXME: setup DAC5 */
10247 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
10248 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
10250 spec->stream_digital_playback = &alc882_pcm_digital_playback;
10251 spec->stream_digital_capture = &alc882_pcm_digital_capture;
10253 if (codec->vendor_id == 0x10ec0888)
10254 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
10256 if (!spec->adc_nids && spec->input_mux) {
10258 spec->num_adc_nids = 0;
10259 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
10260 const struct hda_input_mux *imux = spec->input_mux;
10262 hda_nid_t items[16];
10263 hda_nid_t nid = alc882_adc_nids[i];
10264 unsigned int wcap = get_wcaps(codec, nid);
10266 wcap = get_wcaps_type(wcap);
10267 if (wcap != AC_WID_AUD_IN)
10269 spec->private_adc_nids[spec->num_adc_nids] = nid;
10270 err = snd_hda_get_connections(codec, nid, &cap, 1);
10273 err = snd_hda_get_connections(codec, cap, items,
10274 ARRAY_SIZE(items));
10277 for (j = 0; j < imux->num_items; j++)
10278 if (imux->items[j].index >= err)
10280 if (j < imux->num_items)
10282 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
10283 spec->num_adc_nids++;
10285 spec->adc_nids = spec->private_adc_nids;
10286 spec->capsrc_nids = spec->private_capsrc_nids;
10289 set_capture_mixer(codec);
10290 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10292 spec->vmaster_nid = 0x0c;
10294 codec->patch_ops = alc_patch_ops;
10295 if (board_config == ALC882_AUTO)
10296 spec->init_hook = alc882_auto_init;
10297 #ifdef CONFIG_SND_HDA_POWER_SAVE
10298 if (!spec->loopback.amplist)
10299 spec->loopback.amplist = alc882_loopbacks;
10310 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
10311 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
10313 #define alc262_dac_nids alc260_dac_nids
10314 #define alc262_adc_nids alc882_adc_nids
10315 #define alc262_adc_nids_alt alc882_adc_nids_alt
10316 #define alc262_capsrc_nids alc882_capsrc_nids
10317 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
10319 #define alc262_modes alc260_modes
10320 #define alc262_capture_source alc882_capture_source
10322 static hda_nid_t alc262_dmic_adc_nids[1] = {
10327 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
10329 static struct snd_kcontrol_new alc262_base_mixer[] = {
10330 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10331 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10332 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10333 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10334 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10335 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10336 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10337 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10338 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10339 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10340 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10341 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10342 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
10343 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10344 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
10345 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
10349 /* update HP, line and mono-out pins according to the master switch */
10350 static void alc262_hp_master_update(struct hda_codec *codec)
10352 struct alc_spec *spec = codec->spec;
10353 int val = spec->master_sw;
10355 /* HP & line-out */
10356 snd_hda_codec_write_cache(codec, 0x1b, 0,
10357 AC_VERB_SET_PIN_WIDGET_CONTROL,
10359 snd_hda_codec_write_cache(codec, 0x15, 0,
10360 AC_VERB_SET_PIN_WIDGET_CONTROL,
10362 /* mono (speaker) depending on the HP jack sense */
10363 val = val && !spec->jack_present;
10364 snd_hda_codec_write_cache(codec, 0x16, 0,
10365 AC_VERB_SET_PIN_WIDGET_CONTROL,
10366 val ? PIN_OUT : 0);
10369 static void alc262_hp_bpc_automute(struct hda_codec *codec)
10371 struct alc_spec *spec = codec->spec;
10373 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
10374 alc262_hp_master_update(codec);
10377 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
10379 if ((res >> 26) != ALC880_HP_EVENT)
10381 alc262_hp_bpc_automute(codec);
10384 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
10386 struct alc_spec *spec = codec->spec;
10388 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
10389 alc262_hp_master_update(codec);
10392 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
10395 if ((res >> 26) != ALC880_HP_EVENT)
10397 alc262_hp_wildwest_automute(codec);
10400 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
10402 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
10403 struct snd_ctl_elem_value *ucontrol)
10405 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10406 struct alc_spec *spec = codec->spec;
10407 int val = !!*ucontrol->value.integer.value;
10409 if (val == spec->master_sw)
10411 spec->master_sw = val;
10412 alc262_hp_master_update(codec);
10416 #define ALC262_HP_MASTER_SWITCH \
10418 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10419 .name = "Master Playback Switch", \
10420 .info = snd_ctl_boolean_mono_info, \
10421 .get = alc262_hp_master_sw_get, \
10422 .put = alc262_hp_master_sw_put, \
10425 .iface = NID_MAPPING, \
10426 .name = "Master Playback Switch", \
10427 .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \
10431 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
10432 ALC262_HP_MASTER_SWITCH,
10433 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10434 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10435 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10436 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10438 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10440 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10441 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10442 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10443 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10444 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10445 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10446 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10447 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10448 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10449 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10450 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
10451 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
10455 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
10456 ALC262_HP_MASTER_SWITCH,
10457 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10458 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10459 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10460 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10461 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10463 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10465 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
10466 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
10467 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
10468 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10469 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10470 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10471 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10475 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
10476 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10477 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10478 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
10482 /* mute/unmute internal speaker according to the hp jack and mute state */
10483 static void alc262_hp_t5735_setup(struct hda_codec *codec)
10485 struct alc_spec *spec = codec->spec;
10487 spec->autocfg.hp_pins[0] = 0x15;
10488 spec->autocfg.speaker_pins[0] = 0x14;
10491 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
10492 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10493 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10494 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10495 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10496 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10497 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10498 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10502 static struct hda_verb alc262_hp_t5735_verbs[] = {
10503 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10504 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10506 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10510 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
10511 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10512 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10513 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
10514 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
10515 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10516 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10520 static struct hda_verb alc262_hp_rp5700_verbs[] = {
10521 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10522 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10523 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10524 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10525 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10526 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10527 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10528 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10529 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10530 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10534 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
10541 /* bind hp and internal speaker mute (with plug check) as master switch */
10542 static void alc262_hippo_master_update(struct hda_codec *codec)
10544 struct alc_spec *spec = codec->spec;
10545 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10546 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10547 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10551 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
10552 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
10553 HDA_AMP_MUTE, mute);
10554 /* mute internal speaker per jack sense */
10555 if (spec->jack_present)
10556 mute = HDA_AMP_MUTE;
10558 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
10559 HDA_AMP_MUTE, mute);
10560 if (speaker_nid && speaker_nid != line_nid)
10561 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
10562 HDA_AMP_MUTE, mute);
10565 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
10567 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
10568 struct snd_ctl_elem_value *ucontrol)
10570 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10571 struct alc_spec *spec = codec->spec;
10572 int val = !!*ucontrol->value.integer.value;
10574 if (val == spec->master_sw)
10576 spec->master_sw = val;
10577 alc262_hippo_master_update(codec);
10581 #define ALC262_HIPPO_MASTER_SWITCH \
10583 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10584 .name = "Master Playback Switch", \
10585 .info = snd_ctl_boolean_mono_info, \
10586 .get = alc262_hippo_master_sw_get, \
10587 .put = alc262_hippo_master_sw_put, \
10590 .iface = NID_MAPPING, \
10591 .name = "Master Playback Switch", \
10592 .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \
10593 (SUBDEV_SPEAKER(0) << 16), \
10596 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
10597 ALC262_HIPPO_MASTER_SWITCH,
10598 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10599 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10600 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10601 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10602 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10603 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10604 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10605 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10606 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10607 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10608 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10609 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10613 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
10614 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10615 ALC262_HIPPO_MASTER_SWITCH,
10616 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10617 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10618 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10619 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10620 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10621 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10622 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10623 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10624 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10625 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10629 /* mute/unmute internal speaker according to the hp jack and mute state */
10630 static void alc262_hippo_automute(struct hda_codec *codec)
10632 struct alc_spec *spec = codec->spec;
10633 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10635 spec->jack_present = snd_hda_jack_detect(codec, hp_nid);
10636 alc262_hippo_master_update(codec);
10639 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
10641 if ((res >> 26) != ALC880_HP_EVENT)
10643 alc262_hippo_automute(codec);
10646 static void alc262_hippo_setup(struct hda_codec *codec)
10648 struct alc_spec *spec = codec->spec;
10650 spec->autocfg.hp_pins[0] = 0x15;
10651 spec->autocfg.speaker_pins[0] = 0x14;
10654 static void alc262_hippo1_setup(struct hda_codec *codec)
10656 struct alc_spec *spec = codec->spec;
10658 spec->autocfg.hp_pins[0] = 0x1b;
10659 spec->autocfg.speaker_pins[0] = 0x14;
10663 static struct snd_kcontrol_new alc262_sony_mixer[] = {
10664 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10665 ALC262_HIPPO_MASTER_SWITCH,
10666 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10667 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10668 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10669 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10673 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
10674 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10675 ALC262_HIPPO_MASTER_SWITCH,
10676 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10677 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10678 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10679 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10680 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10684 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
10685 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10686 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10687 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
10688 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
10689 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10690 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10691 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10692 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10693 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10694 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10695 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10696 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10700 static struct hda_verb alc262_tyan_verbs[] = {
10701 /* Headphone automute */
10702 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10703 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10704 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10706 /* P11 AUX_IN, white 4-pin connector */
10707 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10708 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
10709 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
10710 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
10715 /* unsolicited event for HP jack sensing */
10716 static void alc262_tyan_setup(struct hda_codec *codec)
10718 struct alc_spec *spec = codec->spec;
10720 spec->autocfg.hp_pins[0] = 0x1b;
10721 spec->autocfg.speaker_pins[0] = 0x15;
10725 #define alc262_capture_mixer alc882_capture_mixer
10726 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
10729 * generic initialization of ADC, input mixers and output mixers
10731 static struct hda_verb alc262_init_verbs[] = {
10733 * Unmute ADC0-2 and set the default input to mic-in
10735 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10736 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10737 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10738 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10739 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10740 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10742 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10744 * Note: PASD motherboards uses the Line In 2 as the input for
10745 * front panel mic (mic 2)
10747 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10748 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10749 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10750 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10751 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10752 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10755 * Set up output mixers (0x0c - 0x0e)
10757 /* set vol=0 to output mixers */
10758 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10759 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10760 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10761 /* set up input amps for analog loopback */
10762 /* Amp Indices: DAC = 0, mixer = 1 */
10763 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10764 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10765 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10766 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10767 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10768 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10770 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10771 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10772 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10773 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10774 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10775 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10777 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10778 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10779 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10780 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10781 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10783 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10784 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10786 /* FIXME: use matrix-type input source selection */
10787 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10788 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10789 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10790 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10791 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10792 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10794 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10795 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10796 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10797 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10799 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10800 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10801 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10802 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10807 static struct hda_verb alc262_eapd_verbs[] = {
10808 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10809 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10813 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
10814 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10815 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10816 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10818 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10819 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10823 static struct hda_verb alc262_sony_unsol_verbs[] = {
10824 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10825 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10826 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
10828 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10829 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10833 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
10834 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10835 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10836 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10837 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10838 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10842 static struct hda_verb alc262_toshiba_s06_verbs[] = {
10843 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10844 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10845 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10846 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10847 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
10848 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10849 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10850 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10854 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
10856 struct alc_spec *spec = codec->spec;
10858 spec->autocfg.hp_pins[0] = 0x15;
10859 spec->autocfg.speaker_pins[0] = 0x14;
10860 spec->ext_mic.pin = 0x18;
10861 spec->ext_mic.mux_idx = 0;
10862 spec->int_mic.pin = 0x12;
10863 spec->int_mic.mux_idx = 9;
10864 spec->auto_mic = 1;
10870 * 0x16 = internal speaker
10871 * 0x18 = external mic
10874 static struct snd_kcontrol_new alc262_nec_mixer[] = {
10875 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
10876 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
10878 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10879 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10880 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10882 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10883 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10887 static struct hda_verb alc262_nec_verbs[] = {
10888 /* Unmute Speaker */
10889 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10892 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10893 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10895 /* External mic to headphone */
10896 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10897 /* External mic to speaker */
10898 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10904 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
10905 * 0x1b = port replicator headphone out
10908 #define ALC_HP_EVENT 0x37
10910 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
10911 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10912 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10913 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10914 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10918 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
10919 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10920 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10924 static struct hda_verb alc262_lenovo_3000_init_verbs[] = {
10925 /* Front Mic pin: input vref at 50% */
10926 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
10927 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10931 static struct hda_input_mux alc262_fujitsu_capture_source = {
10935 { "Int Mic", 0x1 },
10940 static struct hda_input_mux alc262_HP_capture_source = {
10944 { "Front Mic", 0x1 },
10951 static struct hda_input_mux alc262_HP_D7000_capture_source = {
10955 { "Front Mic", 0x2 },
10961 /* mute/unmute internal speaker according to the hp jacks and mute state */
10962 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
10964 struct alc_spec *spec = codec->spec;
10967 if (force || !spec->sense_updated) {
10968 spec->jack_present = snd_hda_jack_detect(codec, 0x14) ||
10969 snd_hda_jack_detect(codec, 0x1b);
10970 spec->sense_updated = 1;
10972 /* unmute internal speaker only if both HPs are unplugged and
10973 * master switch is on
10975 if (spec->jack_present)
10976 mute = HDA_AMP_MUTE;
10978 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10979 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10980 HDA_AMP_MUTE, mute);
10983 /* unsolicited event for HP jack sensing */
10984 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
10987 if ((res >> 26) != ALC_HP_EVENT)
10989 alc262_fujitsu_automute(codec, 1);
10992 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
10994 alc262_fujitsu_automute(codec, 1);
10997 /* bind volumes of both NID 0x0c and 0x0d */
10998 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
10999 .ops = &snd_hda_bind_vol,
11001 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
11002 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
11007 /* mute/unmute internal speaker according to the hp jack and mute state */
11008 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
11010 struct alc_spec *spec = codec->spec;
11013 if (force || !spec->sense_updated) {
11014 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
11015 spec->sense_updated = 1;
11017 if (spec->jack_present) {
11018 /* mute internal speaker */
11019 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11020 HDA_AMP_MUTE, HDA_AMP_MUTE);
11021 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11022 HDA_AMP_MUTE, HDA_AMP_MUTE);
11024 /* unmute internal speaker if necessary */
11025 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
11026 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11027 HDA_AMP_MUTE, mute);
11028 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11029 HDA_AMP_MUTE, mute);
11033 /* unsolicited event for HP jack sensing */
11034 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
11037 if ((res >> 26) != ALC_HP_EVENT)
11039 alc262_lenovo_3000_automute(codec, 1);
11042 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
11043 int dir, int idx, long *valp)
11047 for (i = 0; i < 2; i++, valp++)
11048 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
11050 *valp ? 0 : HDA_AMP_MUTE);
11054 /* bind hp and internal speaker mute (with plug check) */
11055 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
11056 struct snd_ctl_elem_value *ucontrol)
11058 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11059 long *valp = ucontrol->value.integer.value;
11062 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
11063 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11065 alc262_fujitsu_automute(codec, 0);
11069 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
11070 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11072 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11073 .name = "Master Playback Switch",
11074 .subdevice = HDA_SUBDEV_AMP_FLAG,
11075 .info = snd_hda_mixer_amp_switch_info,
11076 .get = snd_hda_mixer_amp_switch_get,
11077 .put = alc262_fujitsu_master_sw_put,
11078 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11081 .iface = NID_MAPPING,
11082 .name = "Master Playback Switch",
11083 .private_value = 0x1b,
11085 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11086 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11087 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11088 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11089 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11090 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11091 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11092 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11096 /* bind hp and internal speaker mute (with plug check) */
11097 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
11098 struct snd_ctl_elem_value *ucontrol)
11100 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11101 long *valp = ucontrol->value.integer.value;
11104 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11106 alc262_lenovo_3000_automute(codec, 0);
11110 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
11111 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11113 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11114 .name = "Master Playback Switch",
11115 .subdevice = HDA_SUBDEV_AMP_FLAG,
11116 .info = snd_hda_mixer_amp_switch_info,
11117 .get = snd_hda_mixer_amp_switch_get,
11118 .put = alc262_lenovo_3000_master_sw_put,
11119 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
11121 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11122 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11123 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11124 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11125 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11126 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11127 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11128 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11132 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
11133 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11134 ALC262_HIPPO_MASTER_SWITCH,
11135 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11136 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11137 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11138 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11139 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11140 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11144 /* additional init verbs for Benq laptops */
11145 static struct hda_verb alc262_EAPD_verbs[] = {
11146 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11147 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
11151 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
11152 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11153 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11155 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11156 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
11160 /* Samsung Q1 Ultra Vista model setup */
11161 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
11162 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11163 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11164 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11165 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11166 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
11167 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
11171 static struct hda_verb alc262_ultra_verbs[] = {
11173 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11174 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11175 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11177 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11178 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11179 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11180 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11182 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11183 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11184 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11185 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11186 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11188 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11189 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11190 /* ADC, choose mic */
11191 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11192 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11193 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11194 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11195 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11196 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11197 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11198 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11199 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11200 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
11204 /* mute/unmute internal speaker according to the hp jack and mute state */
11205 static void alc262_ultra_automute(struct hda_codec *codec)
11207 struct alc_spec *spec = codec->spec;
11211 /* auto-mute only when HP is used as HP */
11212 if (!spec->cur_mux[0]) {
11213 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11214 if (spec->jack_present)
11215 mute = HDA_AMP_MUTE;
11217 /* mute/unmute internal speaker */
11218 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11219 HDA_AMP_MUTE, mute);
11220 /* mute/unmute HP */
11221 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11222 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
11225 /* unsolicited event for HP jack sensing */
11226 static void alc262_ultra_unsol_event(struct hda_codec *codec,
11229 if ((res >> 26) != ALC880_HP_EVENT)
11231 alc262_ultra_automute(codec);
11234 static struct hda_input_mux alc262_ultra_capture_source = {
11238 { "Headphone", 0x7 },
11242 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
11243 struct snd_ctl_elem_value *ucontrol)
11245 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11246 struct alc_spec *spec = codec->spec;
11249 ret = alc_mux_enum_put(kcontrol, ucontrol);
11252 /* reprogram the HP pin as mic or HP according to the input source */
11253 snd_hda_codec_write_cache(codec, 0x15, 0,
11254 AC_VERB_SET_PIN_WIDGET_CONTROL,
11255 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
11256 alc262_ultra_automute(codec); /* mute/unmute HP */
11260 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
11261 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
11262 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
11264 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11265 .name = "Capture Source",
11266 .info = alc_mux_enum_info,
11267 .get = alc_mux_enum_get,
11268 .put = alc262_ultra_mux_enum_put,
11271 .iface = NID_MAPPING,
11272 .name = "Capture Source",
11273 .private_value = 0x15,
11278 /* We use two mixers depending on the output pin; 0x16 is a mono output
11279 * and thus it's bound with a different mixer.
11280 * This function returns which mixer amp should be used.
11282 static int alc262_check_volbit(hda_nid_t nid)
11286 else if (nid == 0x16)
11292 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
11293 const char *pfx, int *vbits)
11298 vbit = alc262_check_volbit(nid);
11301 if (*vbits & vbit) /* a volume control for this mixer already there */
11305 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
11307 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
11308 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, val);
11311 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
11319 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
11321 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
11322 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val);
11325 /* add playback controls from the parsed DAC table */
11326 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
11327 const struct auto_pin_cfg *cfg)
11333 spec->multiout.num_dacs = 1; /* only use one dac */
11334 spec->multiout.dac_nids = spec->private_dac_nids;
11335 spec->multiout.dac_nids[0] = 2;
11337 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
11339 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11343 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx);
11346 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker");
11349 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone");
11353 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
11354 alc262_check_volbit(cfg->speaker_pins[0]) |
11355 alc262_check_volbit(cfg->hp_pins[0]);
11356 if (vbits == 1 || vbits == 2)
11357 pfx = "Master"; /* only one mixer is used */
11358 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11363 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits);
11366 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker",
11370 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone",
11377 #define alc262_auto_create_input_ctls \
11378 alc882_auto_create_input_ctls
11381 * generic initialization of ADC, input mixers and output mixers
11383 static struct hda_verb alc262_volume_init_verbs[] = {
11385 * Unmute ADC0-2 and set the default input to mic-in
11387 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11388 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11389 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11390 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11391 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11392 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11394 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11396 * Note: PASD motherboards uses the Line In 2 as the input for
11397 * front panel mic (mic 2)
11399 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11400 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11401 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11402 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11403 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11404 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11407 * Set up output mixers (0x0c - 0x0f)
11409 /* set vol=0 to output mixers */
11410 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11411 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11412 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11414 /* set up input amps for analog loopback */
11415 /* Amp Indices: DAC = 0, mixer = 1 */
11416 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11417 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11418 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11419 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11420 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11421 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11423 /* FIXME: use matrix-type input source selection */
11424 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11425 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11426 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11427 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11428 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11429 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11431 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11432 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11433 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11434 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11436 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11437 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11438 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11439 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11444 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
11446 * Unmute ADC0-2 and set the default input to mic-in
11448 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11449 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11450 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11451 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11452 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11453 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11455 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11457 * Note: PASD motherboards uses the Line In 2 as the input for
11458 * front panel mic (mic 2)
11460 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11461 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11462 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11463 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11464 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11465 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11466 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11467 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11470 * Set up output mixers (0x0c - 0x0e)
11472 /* set vol=0 to output mixers */
11473 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11474 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11475 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11477 /* set up input amps for analog loopback */
11478 /* Amp Indices: DAC = 0, mixer = 1 */
11479 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11480 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11481 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11482 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11483 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11484 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11486 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11487 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11488 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11490 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11491 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11493 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11494 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11496 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11497 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11498 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11499 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11500 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11502 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11503 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11504 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11505 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11506 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11507 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11510 /* FIXME: use matrix-type input source selection */
11511 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
11512 /* Input mixer1: only unmute Mic */
11513 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11514 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11515 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11516 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11517 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11518 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11519 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11520 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11521 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11523 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11524 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11525 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11526 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11527 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11528 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11529 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11530 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11531 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11533 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11534 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11535 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11536 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11537 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11538 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11539 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11540 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11541 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11543 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11548 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
11550 * Unmute ADC0-2 and set the default input to mic-in
11552 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11553 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11554 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11555 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11556 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11557 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11559 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11561 * Note: PASD motherboards uses the Line In 2 as the input for front
11562 * panel mic (mic 2)
11564 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11565 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11566 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11567 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11568 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11569 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11570 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11571 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11572 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11574 * Set up output mixers (0x0c - 0x0e)
11576 /* set vol=0 to output mixers */
11577 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11578 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11579 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11581 /* set up input amps for analog loopback */
11582 /* Amp Indices: DAC = 0, mixer = 1 */
11583 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11584 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11585 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11586 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11587 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11588 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11591 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
11592 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
11593 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
11594 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
11595 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11596 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
11597 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
11599 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11600 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11602 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11603 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11605 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
11606 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11607 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11608 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
11609 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11610 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11612 /* FIXME: use matrix-type input source selection */
11613 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11614 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11615 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
11616 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
11617 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
11618 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
11619 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
11620 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11621 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
11623 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11624 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11625 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11626 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11627 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11628 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11629 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11631 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11632 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11633 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11634 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11635 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11636 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11637 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11639 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11644 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
11646 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
11647 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11648 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
11650 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
11651 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11652 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11653 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11655 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
11656 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11657 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11662 #ifdef CONFIG_SND_HDA_POWER_SAVE
11663 #define alc262_loopbacks alc880_loopbacks
11666 /* pcm configuration: identical with ALC880 */
11667 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
11668 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
11669 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
11670 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
11673 * BIOS auto configuration
11675 static int alc262_parse_auto_config(struct hda_codec *codec)
11677 struct alc_spec *spec = codec->spec;
11679 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
11681 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11685 if (!spec->autocfg.line_outs) {
11686 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11687 spec->multiout.max_channels = 2;
11688 spec->no_analog = 1;
11691 return 0; /* can't find valid BIOS pin config */
11693 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
11696 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
11700 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11703 if (spec->autocfg.dig_outs) {
11704 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
11705 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11707 if (spec->autocfg.dig_in_pin)
11708 spec->dig_in_nid = ALC262_DIGIN_NID;
11710 if (spec->kctls.list)
11711 add_mixer(spec, spec->kctls.list);
11713 add_verb(spec, alc262_volume_init_verbs);
11714 spec->num_mux_defs = 1;
11715 spec->input_mux = &spec->private_imux[0];
11717 err = alc_auto_add_mic_boost(codec);
11721 alc_ssid_check(codec, 0x15, 0x14, 0x1b);
11726 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
11727 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
11728 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
11729 #define alc262_auto_init_input_src alc882_auto_init_input_src
11732 /* init callback for auto-configuration model -- overriding the default init */
11733 static void alc262_auto_init(struct hda_codec *codec)
11735 struct alc_spec *spec = codec->spec;
11736 alc262_auto_init_multi_out(codec);
11737 alc262_auto_init_hp_out(codec);
11738 alc262_auto_init_analog_input(codec);
11739 alc262_auto_init_input_src(codec);
11740 if (spec->unsol_event)
11741 alc_inithook(codec);
11745 * configuration and preset
11747 static const char *alc262_models[ALC262_MODEL_LAST] = {
11748 [ALC262_BASIC] = "basic",
11749 [ALC262_HIPPO] = "hippo",
11750 [ALC262_HIPPO_1] = "hippo_1",
11751 [ALC262_FUJITSU] = "fujitsu",
11752 [ALC262_HP_BPC] = "hp-bpc",
11753 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
11754 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
11755 [ALC262_HP_RP5700] = "hp-rp5700",
11756 [ALC262_BENQ_ED8] = "benq",
11757 [ALC262_BENQ_T31] = "benq-t31",
11758 [ALC262_SONY_ASSAMD] = "sony-assamd",
11759 [ALC262_TOSHIBA_S06] = "toshiba-s06",
11760 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
11761 [ALC262_ULTRA] = "ultra",
11762 [ALC262_LENOVO_3000] = "lenovo-3000",
11763 [ALC262_NEC] = "nec",
11764 [ALC262_TYAN] = "tyan",
11765 [ALC262_AUTO] = "auto",
11768 static struct snd_pci_quirk alc262_cfg_tbl[] = {
11769 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
11770 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
11771 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
11773 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
11775 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
11777 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
11778 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
11779 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
11780 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
11781 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
11782 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
11783 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
11784 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
11785 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
11786 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
11787 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
11788 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
11789 ALC262_HP_TC_T5735),
11790 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
11791 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11792 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
11793 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11794 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
11795 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
11796 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
11797 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
11798 #if 0 /* disable the quirk since model=auto works better in recent versions */
11799 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
11800 ALC262_SONY_ASSAMD),
11802 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
11803 ALC262_TOSHIBA_RX1),
11804 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
11805 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
11806 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
11807 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
11808 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
11810 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
11811 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
11812 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
11813 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
11814 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
11818 static struct alc_config_preset alc262_presets[] = {
11820 .mixers = { alc262_base_mixer },
11821 .init_verbs = { alc262_init_verbs },
11822 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11823 .dac_nids = alc262_dac_nids,
11825 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11826 .channel_mode = alc262_modes,
11827 .input_mux = &alc262_capture_source,
11830 .mixers = { alc262_hippo_mixer },
11831 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
11832 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11833 .dac_nids = alc262_dac_nids,
11835 .dig_out_nid = ALC262_DIGOUT_NID,
11836 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11837 .channel_mode = alc262_modes,
11838 .input_mux = &alc262_capture_source,
11839 .unsol_event = alc262_hippo_unsol_event,
11840 .setup = alc262_hippo_setup,
11841 .init_hook = alc262_hippo_automute,
11843 [ALC262_HIPPO_1] = {
11844 .mixers = { alc262_hippo1_mixer },
11845 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
11846 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11847 .dac_nids = alc262_dac_nids,
11849 .dig_out_nid = ALC262_DIGOUT_NID,
11850 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11851 .channel_mode = alc262_modes,
11852 .input_mux = &alc262_capture_source,
11853 .unsol_event = alc262_hippo_unsol_event,
11854 .setup = alc262_hippo1_setup,
11855 .init_hook = alc262_hippo_automute,
11857 [ALC262_FUJITSU] = {
11858 .mixers = { alc262_fujitsu_mixer },
11859 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11860 alc262_fujitsu_unsol_verbs },
11861 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11862 .dac_nids = alc262_dac_nids,
11864 .dig_out_nid = ALC262_DIGOUT_NID,
11865 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11866 .channel_mode = alc262_modes,
11867 .input_mux = &alc262_fujitsu_capture_source,
11868 .unsol_event = alc262_fujitsu_unsol_event,
11869 .init_hook = alc262_fujitsu_init_hook,
11871 [ALC262_HP_BPC] = {
11872 .mixers = { alc262_HP_BPC_mixer },
11873 .init_verbs = { alc262_HP_BPC_init_verbs },
11874 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11875 .dac_nids = alc262_dac_nids,
11877 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11878 .channel_mode = alc262_modes,
11879 .input_mux = &alc262_HP_capture_source,
11880 .unsol_event = alc262_hp_bpc_unsol_event,
11881 .init_hook = alc262_hp_bpc_automute,
11883 [ALC262_HP_BPC_D7000_WF] = {
11884 .mixers = { alc262_HP_BPC_WildWest_mixer },
11885 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11886 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11887 .dac_nids = alc262_dac_nids,
11889 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11890 .channel_mode = alc262_modes,
11891 .input_mux = &alc262_HP_D7000_capture_source,
11892 .unsol_event = alc262_hp_wildwest_unsol_event,
11893 .init_hook = alc262_hp_wildwest_automute,
11895 [ALC262_HP_BPC_D7000_WL] = {
11896 .mixers = { alc262_HP_BPC_WildWest_mixer,
11897 alc262_HP_BPC_WildWest_option_mixer },
11898 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11899 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11900 .dac_nids = alc262_dac_nids,
11902 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11903 .channel_mode = alc262_modes,
11904 .input_mux = &alc262_HP_D7000_capture_source,
11905 .unsol_event = alc262_hp_wildwest_unsol_event,
11906 .init_hook = alc262_hp_wildwest_automute,
11908 [ALC262_HP_TC_T5735] = {
11909 .mixers = { alc262_hp_t5735_mixer },
11910 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
11911 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11912 .dac_nids = alc262_dac_nids,
11914 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11915 .channel_mode = alc262_modes,
11916 .input_mux = &alc262_capture_source,
11917 .unsol_event = alc_sku_unsol_event,
11918 .setup = alc262_hp_t5735_setup,
11919 .init_hook = alc_inithook,
11921 [ALC262_HP_RP5700] = {
11922 .mixers = { alc262_hp_rp5700_mixer },
11923 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
11924 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11925 .dac_nids = alc262_dac_nids,
11926 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11927 .channel_mode = alc262_modes,
11928 .input_mux = &alc262_hp_rp5700_capture_source,
11930 [ALC262_BENQ_ED8] = {
11931 .mixers = { alc262_base_mixer },
11932 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
11933 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11934 .dac_nids = alc262_dac_nids,
11936 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11937 .channel_mode = alc262_modes,
11938 .input_mux = &alc262_capture_source,
11940 [ALC262_SONY_ASSAMD] = {
11941 .mixers = { alc262_sony_mixer },
11942 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
11943 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11944 .dac_nids = alc262_dac_nids,
11946 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11947 .channel_mode = alc262_modes,
11948 .input_mux = &alc262_capture_source,
11949 .unsol_event = alc262_hippo_unsol_event,
11950 .setup = alc262_hippo_setup,
11951 .init_hook = alc262_hippo_automute,
11953 [ALC262_BENQ_T31] = {
11954 .mixers = { alc262_benq_t31_mixer },
11955 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
11956 alc_hp15_unsol_verbs },
11957 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11958 .dac_nids = alc262_dac_nids,
11960 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11961 .channel_mode = alc262_modes,
11962 .input_mux = &alc262_capture_source,
11963 .unsol_event = alc262_hippo_unsol_event,
11964 .setup = alc262_hippo_setup,
11965 .init_hook = alc262_hippo_automute,
11968 .mixers = { alc262_ultra_mixer },
11969 .cap_mixer = alc262_ultra_capture_mixer,
11970 .init_verbs = { alc262_ultra_verbs },
11971 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11972 .dac_nids = alc262_dac_nids,
11973 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11974 .channel_mode = alc262_modes,
11975 .input_mux = &alc262_ultra_capture_source,
11976 .adc_nids = alc262_adc_nids, /* ADC0 */
11977 .capsrc_nids = alc262_capsrc_nids,
11978 .num_adc_nids = 1, /* single ADC */
11979 .unsol_event = alc262_ultra_unsol_event,
11980 .init_hook = alc262_ultra_automute,
11982 [ALC262_LENOVO_3000] = {
11983 .mixers = { alc262_lenovo_3000_mixer },
11984 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11985 alc262_lenovo_3000_unsol_verbs,
11986 alc262_lenovo_3000_init_verbs },
11987 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11988 .dac_nids = alc262_dac_nids,
11990 .dig_out_nid = ALC262_DIGOUT_NID,
11991 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11992 .channel_mode = alc262_modes,
11993 .input_mux = &alc262_fujitsu_capture_source,
11994 .unsol_event = alc262_lenovo_3000_unsol_event,
11997 .mixers = { alc262_nec_mixer },
11998 .init_verbs = { alc262_nec_verbs },
11999 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12000 .dac_nids = alc262_dac_nids,
12002 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12003 .channel_mode = alc262_modes,
12004 .input_mux = &alc262_capture_source,
12006 [ALC262_TOSHIBA_S06] = {
12007 .mixers = { alc262_toshiba_s06_mixer },
12008 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
12009 alc262_eapd_verbs },
12010 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12011 .capsrc_nids = alc262_dmic_capsrc_nids,
12012 .dac_nids = alc262_dac_nids,
12013 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
12014 .num_adc_nids = 1, /* single ADC */
12015 .dig_out_nid = ALC262_DIGOUT_NID,
12016 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12017 .channel_mode = alc262_modes,
12018 .unsol_event = alc_sku_unsol_event,
12019 .setup = alc262_toshiba_s06_setup,
12020 .init_hook = alc_inithook,
12022 [ALC262_TOSHIBA_RX1] = {
12023 .mixers = { alc262_toshiba_rx1_mixer },
12024 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
12025 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12026 .dac_nids = alc262_dac_nids,
12028 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12029 .channel_mode = alc262_modes,
12030 .input_mux = &alc262_capture_source,
12031 .unsol_event = alc262_hippo_unsol_event,
12032 .setup = alc262_hippo_setup,
12033 .init_hook = alc262_hippo_automute,
12036 .mixers = { alc262_tyan_mixer },
12037 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
12038 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12039 .dac_nids = alc262_dac_nids,
12041 .dig_out_nid = ALC262_DIGOUT_NID,
12042 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12043 .channel_mode = alc262_modes,
12044 .input_mux = &alc262_capture_source,
12045 .unsol_event = alc_automute_amp_unsol_event,
12046 .setup = alc262_tyan_setup,
12047 .init_hook = alc_automute_amp,
12051 static int patch_alc262(struct hda_codec *codec)
12053 struct alc_spec *spec;
12057 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12061 codec->spec = spec;
12063 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
12068 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12069 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
12070 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12071 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
12075 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
12077 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
12081 if (board_config < 0) {
12082 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12084 board_config = ALC262_AUTO;
12087 if (board_config == ALC262_AUTO) {
12088 /* automatic parse from the BIOS config */
12089 err = alc262_parse_auto_config(codec);
12095 "hda_codec: Cannot set up configuration "
12096 "from BIOS. Using base mode...\n");
12097 board_config = ALC262_BASIC;
12101 if (!spec->no_analog) {
12102 err = snd_hda_attach_beep_device(codec, 0x1);
12109 if (board_config != ALC262_AUTO)
12110 setup_preset(codec, &alc262_presets[board_config]);
12112 spec->stream_analog_playback = &alc262_pcm_analog_playback;
12113 spec->stream_analog_capture = &alc262_pcm_analog_capture;
12115 spec->stream_digital_playback = &alc262_pcm_digital_playback;
12116 spec->stream_digital_capture = &alc262_pcm_digital_capture;
12118 if (!spec->adc_nids && spec->input_mux) {
12120 /* check whether the digital-mic has to be supported */
12121 for (i = 0; i < spec->input_mux->num_items; i++) {
12122 if (spec->input_mux->items[i].index >= 9)
12125 if (i < spec->input_mux->num_items) {
12126 /* use only ADC0 */
12127 spec->adc_nids = alc262_dmic_adc_nids;
12128 spec->num_adc_nids = 1;
12129 spec->capsrc_nids = alc262_dmic_capsrc_nids;
12131 /* all analog inputs */
12132 /* check whether NID 0x07 is valid */
12133 unsigned int wcap = get_wcaps(codec, 0x07);
12136 wcap = get_wcaps_type(wcap);
12137 if (wcap != AC_WID_AUD_IN) {
12138 spec->adc_nids = alc262_adc_nids_alt;
12139 spec->num_adc_nids =
12140 ARRAY_SIZE(alc262_adc_nids_alt);
12141 spec->capsrc_nids = alc262_capsrc_nids_alt;
12143 spec->adc_nids = alc262_adc_nids;
12144 spec->num_adc_nids =
12145 ARRAY_SIZE(alc262_adc_nids);
12146 spec->capsrc_nids = alc262_capsrc_nids;
12150 if (!spec->cap_mixer && !spec->no_analog)
12151 set_capture_mixer(codec);
12152 if (!spec->no_analog)
12153 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12155 spec->vmaster_nid = 0x0c;
12157 codec->patch_ops = alc_patch_ops;
12158 if (board_config == ALC262_AUTO)
12159 spec->init_hook = alc262_auto_init;
12160 #ifdef CONFIG_SND_HDA_POWER_SAVE
12161 if (!spec->loopback.amplist)
12162 spec->loopback.amplist = alc262_loopbacks;
12169 * ALC268 channel source setting (2 channel)
12171 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
12172 #define alc268_modes alc260_modes
12174 static hda_nid_t alc268_dac_nids[2] = {
12179 static hda_nid_t alc268_adc_nids[2] = {
12184 static hda_nid_t alc268_adc_nids_alt[1] = {
12189 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
12191 static struct snd_kcontrol_new alc268_base_mixer[] = {
12192 /* output mixer control */
12193 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12194 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12195 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12196 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12197 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12198 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12199 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12203 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
12204 /* output mixer control */
12205 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12206 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12207 ALC262_HIPPO_MASTER_SWITCH,
12208 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12209 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12210 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12214 /* bind Beep switches of both NID 0x0f and 0x10 */
12215 static struct hda_bind_ctls alc268_bind_beep_sw = {
12216 .ops = &snd_hda_bind_sw,
12218 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
12219 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
12224 static struct snd_kcontrol_new alc268_beep_mixer[] = {
12225 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
12226 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
12230 static struct hda_verb alc268_eapd_verbs[] = {
12231 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12232 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12236 /* Toshiba specific */
12237 static struct hda_verb alc268_toshiba_verbs[] = {
12238 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12242 /* Acer specific */
12243 /* bind volumes of both NID 0x02 and 0x03 */
12244 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
12245 .ops = &snd_hda_bind_vol,
12247 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12248 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12253 /* mute/unmute internal speaker according to the hp jack and mute state */
12254 static void alc268_acer_automute(struct hda_codec *codec, int force)
12256 struct alc_spec *spec = codec->spec;
12259 if (force || !spec->sense_updated) {
12260 spec->jack_present = snd_hda_jack_detect(codec, 0x14);
12261 spec->sense_updated = 1;
12263 if (spec->jack_present)
12264 mute = HDA_AMP_MUTE; /* mute internal speaker */
12265 else /* unmute internal speaker if necessary */
12266 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
12267 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12268 HDA_AMP_MUTE, mute);
12272 /* bind hp and internal speaker mute (with plug check) */
12273 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
12274 struct snd_ctl_elem_value *ucontrol)
12276 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12277 long *valp = ucontrol->value.integer.value;
12280 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
12282 alc268_acer_automute(codec, 0);
12286 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
12287 /* output mixer control */
12288 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12290 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12291 .name = "Master Playback Switch",
12292 .subdevice = HDA_SUBDEV_AMP_FLAG,
12293 .info = snd_hda_mixer_amp_switch_info,
12294 .get = snd_hda_mixer_amp_switch_get,
12295 .put = alc268_acer_master_sw_put,
12296 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12298 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
12302 static struct snd_kcontrol_new alc268_acer_mixer[] = {
12303 /* output mixer control */
12304 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12306 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12307 .name = "Master Playback Switch",
12308 .subdevice = HDA_SUBDEV_AMP_FLAG,
12309 .info = snd_hda_mixer_amp_switch_info,
12310 .get = snd_hda_mixer_amp_switch_get,
12311 .put = alc268_acer_master_sw_put,
12312 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12314 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12315 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12316 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12320 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
12321 /* output mixer control */
12322 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12324 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12325 .name = "Master Playback Switch",
12326 .subdevice = HDA_SUBDEV_AMP_FLAG,
12327 .info = snd_hda_mixer_amp_switch_info,
12328 .get = snd_hda_mixer_amp_switch_get,
12329 .put = alc268_acer_master_sw_put,
12330 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12332 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12333 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12337 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
12338 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12339 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12340 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12341 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12342 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
12343 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
12347 static struct hda_verb alc268_acer_verbs[] = {
12348 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
12349 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12350 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12351 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12352 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12353 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12354 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12358 /* unsolicited event for HP jack sensing */
12359 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
12360 #define alc268_toshiba_setup alc262_hippo_setup
12361 #define alc268_toshiba_automute alc262_hippo_automute
12363 static void alc268_acer_unsol_event(struct hda_codec *codec,
12366 if ((res >> 26) != ALC880_HP_EVENT)
12368 alc268_acer_automute(codec, 1);
12371 static void alc268_acer_init_hook(struct hda_codec *codec)
12373 alc268_acer_automute(codec, 1);
12376 /* toggle speaker-output according to the hp-jack state */
12377 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
12379 unsigned int present;
12380 unsigned char bits;
12382 present = snd_hda_jack_detect(codec, 0x15);
12383 bits = present ? AMP_IN_MUTE(0) : 0;
12384 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
12385 AMP_IN_MUTE(0), bits);
12386 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
12387 AMP_IN_MUTE(0), bits);
12390 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
12393 switch (res >> 26) {
12394 case ALC880_HP_EVENT:
12395 alc268_aspire_one_speaker_automute(codec);
12397 case ALC880_MIC_EVENT:
12398 alc_mic_automute(codec);
12403 static void alc268_acer_lc_setup(struct hda_codec *codec)
12405 struct alc_spec *spec = codec->spec;
12406 spec->ext_mic.pin = 0x18;
12407 spec->ext_mic.mux_idx = 0;
12408 spec->int_mic.pin = 0x12;
12409 spec->int_mic.mux_idx = 6;
12410 spec->auto_mic = 1;
12413 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
12415 alc268_aspire_one_speaker_automute(codec);
12416 alc_mic_automute(codec);
12419 static struct snd_kcontrol_new alc268_dell_mixer[] = {
12420 /* output mixer control */
12421 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12422 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12423 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12424 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12425 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12426 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12430 static struct hda_verb alc268_dell_verbs[] = {
12431 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12432 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12433 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12434 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12438 /* mute/unmute internal speaker according to the hp jack and mute state */
12439 static void alc268_dell_setup(struct hda_codec *codec)
12441 struct alc_spec *spec = codec->spec;
12443 spec->autocfg.hp_pins[0] = 0x15;
12444 spec->autocfg.speaker_pins[0] = 0x14;
12445 spec->ext_mic.pin = 0x18;
12446 spec->ext_mic.mux_idx = 0;
12447 spec->int_mic.pin = 0x19;
12448 spec->int_mic.mux_idx = 1;
12449 spec->auto_mic = 1;
12452 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
12453 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12454 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12455 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12456 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12457 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12458 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
12459 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
12460 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
12464 static struct hda_verb alc267_quanta_il1_verbs[] = {
12465 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12466 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12470 static void alc267_quanta_il1_setup(struct hda_codec *codec)
12472 struct alc_spec *spec = codec->spec;
12473 spec->autocfg.hp_pins[0] = 0x15;
12474 spec->autocfg.speaker_pins[0] = 0x14;
12475 spec->ext_mic.pin = 0x18;
12476 spec->ext_mic.mux_idx = 0;
12477 spec->int_mic.pin = 0x19;
12478 spec->int_mic.mux_idx = 1;
12479 spec->auto_mic = 1;
12483 * generic initialization of ADC, input mixers and output mixers
12485 static struct hda_verb alc268_base_init_verbs[] = {
12486 /* Unmute DAC0-1 and set vol = 0 */
12487 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12488 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12491 * Set up output mixers (0x0c - 0x0e)
12493 /* set vol=0 to output mixers */
12494 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12495 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
12497 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12498 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12500 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12501 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
12502 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12503 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12504 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12505 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12506 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12507 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12509 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12510 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12511 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12512 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12513 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12515 /* set PCBEEP vol = 0, mute connections */
12516 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12517 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12518 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12520 /* Unmute Selector 23h,24h and set the default input to mic-in */
12522 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
12523 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12524 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
12525 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12531 * generic initialization of ADC, input mixers and output mixers
12533 static struct hda_verb alc268_volume_init_verbs[] = {
12534 /* set output DAC */
12535 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12536 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12538 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12539 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12540 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12541 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12542 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12544 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12545 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12546 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12548 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12549 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12551 /* set PCBEEP vol = 0, mute connections */
12552 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12553 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12554 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12559 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
12560 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12561 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12565 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
12566 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12567 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12572 static struct snd_kcontrol_new alc268_capture_mixer[] = {
12573 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12574 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12575 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
12576 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
12581 static struct hda_input_mux alc268_capture_source = {
12585 { "Front Mic", 0x1 },
12591 static struct hda_input_mux alc268_acer_capture_source = {
12595 { "Internal Mic", 0x1 },
12600 static struct hda_input_mux alc268_acer_dmic_capture_source = {
12604 { "Internal Mic", 0x6 },
12609 #ifdef CONFIG_SND_DEBUG
12610 static struct snd_kcontrol_new alc268_test_mixer[] = {
12611 /* Volume widgets */
12612 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12613 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12614 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12615 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
12616 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
12617 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
12618 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
12619 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
12620 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
12621 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
12622 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
12623 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
12624 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
12625 /* The below appears problematic on some hardwares */
12626 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
12627 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12628 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
12629 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
12630 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
12632 /* Modes for retasking pin widgets */
12633 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
12634 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
12635 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
12636 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
12638 /* Controls for GPIO pins, assuming they are configured as outputs */
12639 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
12640 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
12641 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
12642 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
12644 /* Switches to allow the digital SPDIF output pin to be enabled.
12645 * The ALC268 does not have an SPDIF input.
12647 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
12649 /* A switch allowing EAPD to be enabled. Some laptops seem to use
12650 * this output to turn on an external amplifier.
12652 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
12653 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
12659 /* create input playback/capture controls for the given pin */
12660 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12661 const char *ctlname, int idx)
12678 if (spec->multiout.dac_nids[0] != dac &&
12679 spec->multiout.dac_nids[1] != dac) {
12680 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
12681 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
12685 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
12689 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12690 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
12692 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12693 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
12699 /* add playback controls from the parsed DAC table */
12700 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
12701 const struct auto_pin_cfg *cfg)
12706 spec->multiout.dac_nids = spec->private_dac_nids;
12708 nid = cfg->line_out_pins[0];
12711 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
12715 err = alc268_new_analog_output(spec, nid, name, 0);
12720 nid = cfg->speaker_pins[0];
12722 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
12723 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
12727 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
12731 nid = cfg->hp_pins[0];
12733 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
12738 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
12740 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
12741 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
12748 /* create playback/capture controls for input pins */
12749 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
12750 const struct auto_pin_cfg *cfg)
12752 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
12755 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
12756 hda_nid_t nid, int pin_type)
12760 alc_set_pin_output(codec, nid, pin_type);
12761 if (nid == 0x14 || nid == 0x16)
12765 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
12768 static void alc268_auto_init_multi_out(struct hda_codec *codec)
12770 struct alc_spec *spec = codec->spec;
12771 hda_nid_t nid = spec->autocfg.line_out_pins[0];
12773 int pin_type = get_pin_type(spec->autocfg.line_out_type);
12774 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
12778 static void alc268_auto_init_hp_out(struct hda_codec *codec)
12780 struct alc_spec *spec = codec->spec;
12783 pin = spec->autocfg.hp_pins[0];
12785 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
12786 pin = spec->autocfg.speaker_pins[0];
12788 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
12791 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
12793 struct alc_spec *spec = codec->spec;
12794 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
12795 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
12796 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
12797 unsigned int dac_vol1, dac_vol2;
12799 if (line_nid == 0x1d || speaker_nid == 0x1d) {
12800 snd_hda_codec_write(codec, speaker_nid, 0,
12801 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
12802 /* mute mixer inputs from 0x1d */
12803 snd_hda_codec_write(codec, 0x0f, 0,
12804 AC_VERB_SET_AMP_GAIN_MUTE,
12806 snd_hda_codec_write(codec, 0x10, 0,
12807 AC_VERB_SET_AMP_GAIN_MUTE,
12810 /* unmute mixer inputs from 0x1d */
12811 snd_hda_codec_write(codec, 0x0f, 0,
12812 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12813 snd_hda_codec_write(codec, 0x10, 0,
12814 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12817 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
12818 if (line_nid == 0x14)
12819 dac_vol2 = AMP_OUT_ZERO;
12820 else if (line_nid == 0x15)
12821 dac_vol1 = AMP_OUT_ZERO;
12822 if (hp_nid == 0x14)
12823 dac_vol2 = AMP_OUT_ZERO;
12824 else if (hp_nid == 0x15)
12825 dac_vol1 = AMP_OUT_ZERO;
12826 if (line_nid != 0x16 || hp_nid != 0x16 ||
12827 spec->autocfg.line_out_pins[1] != 0x16 ||
12828 spec->autocfg.line_out_pins[2] != 0x16)
12829 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
12831 snd_hda_codec_write(codec, 0x02, 0,
12832 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
12833 snd_hda_codec_write(codec, 0x03, 0,
12834 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
12837 /* pcm configuration: identical with ALC880 */
12838 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
12839 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
12840 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
12841 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
12844 * BIOS auto configuration
12846 static int alc268_parse_auto_config(struct hda_codec *codec)
12848 struct alc_spec *spec = codec->spec;
12850 static hda_nid_t alc268_ignore[] = { 0 };
12852 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12856 if (!spec->autocfg.line_outs) {
12857 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12858 spec->multiout.max_channels = 2;
12859 spec->no_analog = 1;
12862 return 0; /* can't find valid BIOS pin config */
12864 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
12867 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
12871 spec->multiout.max_channels = 2;
12874 /* digital only support output */
12875 if (spec->autocfg.dig_outs) {
12876 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
12877 spec->dig_out_type = spec->autocfg.dig_out_type[0];
12879 if (spec->kctls.list)
12880 add_mixer(spec, spec->kctls.list);
12882 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
12883 add_mixer(spec, alc268_beep_mixer);
12885 add_verb(spec, alc268_volume_init_verbs);
12886 spec->num_mux_defs = 2;
12887 spec->input_mux = &spec->private_imux[0];
12889 err = alc_auto_add_mic_boost(codec);
12893 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
12898 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
12900 /* init callback for auto-configuration model -- overriding the default init */
12901 static void alc268_auto_init(struct hda_codec *codec)
12903 struct alc_spec *spec = codec->spec;
12904 alc268_auto_init_multi_out(codec);
12905 alc268_auto_init_hp_out(codec);
12906 alc268_auto_init_mono_speaker_out(codec);
12907 alc268_auto_init_analog_input(codec);
12908 if (spec->unsol_event)
12909 alc_inithook(codec);
12913 * configuration and preset
12915 static const char *alc268_models[ALC268_MODEL_LAST] = {
12916 [ALC267_QUANTA_IL1] = "quanta-il1",
12917 [ALC268_3ST] = "3stack",
12918 [ALC268_TOSHIBA] = "toshiba",
12919 [ALC268_ACER] = "acer",
12920 [ALC268_ACER_DMIC] = "acer-dmic",
12921 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
12922 [ALC268_DELL] = "dell",
12923 [ALC268_ZEPTO] = "zepto",
12924 #ifdef CONFIG_SND_DEBUG
12925 [ALC268_TEST] = "test",
12927 [ALC268_AUTO] = "auto",
12930 static struct snd_pci_quirk alc268_cfg_tbl[] = {
12931 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
12932 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
12933 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
12934 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
12935 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
12936 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
12937 ALC268_ACER_ASPIRE_ONE),
12938 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
12939 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
12940 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
12941 /* almost compatible with toshiba but with optional digital outs;
12942 * auto-probing seems working fine
12944 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
12946 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
12947 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
12948 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
12949 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
12950 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
12951 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
12955 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
12956 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
12957 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
12958 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
12959 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
12964 static struct alc_config_preset alc268_presets[] = {
12965 [ALC267_QUANTA_IL1] = {
12966 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
12967 alc268_capture_nosrc_mixer },
12968 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12969 alc267_quanta_il1_verbs },
12970 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12971 .dac_nids = alc268_dac_nids,
12972 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12973 .adc_nids = alc268_adc_nids_alt,
12975 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12976 .channel_mode = alc268_modes,
12977 .unsol_event = alc_sku_unsol_event,
12978 .setup = alc267_quanta_il1_setup,
12979 .init_hook = alc_inithook,
12982 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12983 alc268_beep_mixer },
12984 .init_verbs = { alc268_base_init_verbs },
12985 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12986 .dac_nids = alc268_dac_nids,
12987 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12988 .adc_nids = alc268_adc_nids_alt,
12989 .capsrc_nids = alc268_capsrc_nids,
12991 .dig_out_nid = ALC268_DIGOUT_NID,
12992 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12993 .channel_mode = alc268_modes,
12994 .input_mux = &alc268_capture_source,
12996 [ALC268_TOSHIBA] = {
12997 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
12998 alc268_beep_mixer },
12999 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13000 alc268_toshiba_verbs },
13001 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13002 .dac_nids = alc268_dac_nids,
13003 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13004 .adc_nids = alc268_adc_nids_alt,
13005 .capsrc_nids = alc268_capsrc_nids,
13007 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13008 .channel_mode = alc268_modes,
13009 .input_mux = &alc268_capture_source,
13010 .unsol_event = alc268_toshiba_unsol_event,
13011 .setup = alc268_toshiba_setup,
13012 .init_hook = alc268_toshiba_automute,
13015 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
13016 alc268_beep_mixer },
13017 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13018 alc268_acer_verbs },
13019 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13020 .dac_nids = alc268_dac_nids,
13021 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13022 .adc_nids = alc268_adc_nids_alt,
13023 .capsrc_nids = alc268_capsrc_nids,
13025 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13026 .channel_mode = alc268_modes,
13027 .input_mux = &alc268_acer_capture_source,
13028 .unsol_event = alc268_acer_unsol_event,
13029 .init_hook = alc268_acer_init_hook,
13031 [ALC268_ACER_DMIC] = {
13032 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
13033 alc268_beep_mixer },
13034 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13035 alc268_acer_verbs },
13036 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13037 .dac_nids = alc268_dac_nids,
13038 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13039 .adc_nids = alc268_adc_nids_alt,
13040 .capsrc_nids = alc268_capsrc_nids,
13042 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13043 .channel_mode = alc268_modes,
13044 .input_mux = &alc268_acer_dmic_capture_source,
13045 .unsol_event = alc268_acer_unsol_event,
13046 .init_hook = alc268_acer_init_hook,
13048 [ALC268_ACER_ASPIRE_ONE] = {
13049 .mixers = { alc268_acer_aspire_one_mixer,
13051 alc268_capture_nosrc_mixer },
13052 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13053 alc268_acer_aspire_one_verbs },
13054 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13055 .dac_nids = alc268_dac_nids,
13056 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13057 .adc_nids = alc268_adc_nids_alt,
13058 .capsrc_nids = alc268_capsrc_nids,
13060 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13061 .channel_mode = alc268_modes,
13062 .unsol_event = alc268_acer_lc_unsol_event,
13063 .setup = alc268_acer_lc_setup,
13064 .init_hook = alc268_acer_lc_init_hook,
13067 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
13068 alc268_capture_nosrc_mixer },
13069 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13070 alc268_dell_verbs },
13071 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13072 .dac_nids = alc268_dac_nids,
13073 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13074 .adc_nids = alc268_adc_nids_alt,
13075 .capsrc_nids = alc268_capsrc_nids,
13077 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13078 .channel_mode = alc268_modes,
13079 .unsol_event = alc_sku_unsol_event,
13080 .setup = alc268_dell_setup,
13081 .init_hook = alc_inithook,
13084 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13085 alc268_beep_mixer },
13086 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13087 alc268_toshiba_verbs },
13088 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13089 .dac_nids = alc268_dac_nids,
13090 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13091 .adc_nids = alc268_adc_nids_alt,
13092 .capsrc_nids = alc268_capsrc_nids,
13094 .dig_out_nid = ALC268_DIGOUT_NID,
13095 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13096 .channel_mode = alc268_modes,
13097 .input_mux = &alc268_capture_source,
13098 .setup = alc268_toshiba_setup,
13099 .init_hook = alc268_toshiba_automute,
13101 #ifdef CONFIG_SND_DEBUG
13103 .mixers = { alc268_test_mixer, alc268_capture_mixer },
13104 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13105 alc268_volume_init_verbs },
13106 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13107 .dac_nids = alc268_dac_nids,
13108 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13109 .adc_nids = alc268_adc_nids_alt,
13110 .capsrc_nids = alc268_capsrc_nids,
13112 .dig_out_nid = ALC268_DIGOUT_NID,
13113 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13114 .channel_mode = alc268_modes,
13115 .input_mux = &alc268_capture_source,
13120 static int patch_alc268(struct hda_codec *codec)
13122 struct alc_spec *spec;
13124 int i, has_beep, err;
13126 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13130 codec->spec = spec;
13132 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
13136 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
13137 board_config = snd_hda_check_board_codec_sid_config(codec,
13138 ALC882_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
13140 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
13141 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13143 board_config = ALC268_AUTO;
13146 if (board_config == ALC268_AUTO) {
13147 /* automatic parse from the BIOS config */
13148 err = alc268_parse_auto_config(codec);
13154 "hda_codec: Cannot set up configuration "
13155 "from BIOS. Using base mode...\n");
13156 board_config = ALC268_3ST;
13160 if (board_config != ALC268_AUTO)
13161 setup_preset(codec, &alc268_presets[board_config]);
13163 spec->stream_analog_playback = &alc268_pcm_analog_playback;
13164 spec->stream_analog_capture = &alc268_pcm_analog_capture;
13165 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
13167 spec->stream_digital_playback = &alc268_pcm_digital_playback;
13170 for (i = 0; i < spec->num_mixers; i++) {
13171 if (spec->mixers[i] == alc268_beep_mixer) {
13178 err = snd_hda_attach_beep_device(codec, 0x1);
13183 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
13184 /* override the amp caps for beep generator */
13185 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
13186 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
13187 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
13188 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
13189 (0 << AC_AMPCAP_MUTE_SHIFT));
13192 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
13193 /* check whether NID 0x07 is valid */
13194 unsigned int wcap = get_wcaps(codec, 0x07);
13197 spec->capsrc_nids = alc268_capsrc_nids;
13199 wcap = get_wcaps_type(wcap);
13200 if (spec->auto_mic ||
13201 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
13202 spec->adc_nids = alc268_adc_nids_alt;
13203 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
13204 if (spec->auto_mic)
13205 fixup_automic_adc(codec);
13206 if (spec->auto_mic || spec->input_mux->num_items == 1)
13207 add_mixer(spec, alc268_capture_nosrc_mixer);
13209 add_mixer(spec, alc268_capture_alt_mixer);
13211 spec->adc_nids = alc268_adc_nids;
13212 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
13213 add_mixer(spec, alc268_capture_mixer);
13215 /* set default input source */
13216 for (i = 0; i < spec->num_adc_nids; i++)
13217 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
13218 0, AC_VERB_SET_CONNECT_SEL,
13219 i < spec->num_mux_defs ?
13220 spec->input_mux[i].items[0].index :
13221 spec->input_mux->items[0].index);
13224 spec->vmaster_nid = 0x02;
13226 codec->patch_ops = alc_patch_ops;
13227 if (board_config == ALC268_AUTO)
13228 spec->init_hook = alc268_auto_init;
13234 * ALC269 channel source setting (2 channel)
13236 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
13238 #define alc269_dac_nids alc260_dac_nids
13240 static hda_nid_t alc269_adc_nids[1] = {
13245 static hda_nid_t alc269_capsrc_nids[1] = {
13249 static hda_nid_t alc269vb_adc_nids[1] = {
13254 static hda_nid_t alc269vb_capsrc_nids[1] = {
13258 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
13262 #define alc269_modes alc260_modes
13263 #define alc269_capture_source alc880_lg_lw_capture_source
13265 static struct snd_kcontrol_new alc269_base_mixer[] = {
13266 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13267 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13268 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13269 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13270 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13271 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13272 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13273 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13274 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13275 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13276 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13277 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
13281 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
13282 /* output mixer control */
13283 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13285 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13286 .name = "Master Playback Switch",
13287 .subdevice = HDA_SUBDEV_AMP_FLAG,
13288 .info = snd_hda_mixer_amp_switch_info,
13289 .get = snd_hda_mixer_amp_switch_get,
13290 .put = alc268_acer_master_sw_put,
13291 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13293 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13294 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13295 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13296 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13297 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13298 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13302 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
13303 /* output mixer control */
13304 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13306 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13307 .name = "Master Playback Switch",
13308 .subdevice = HDA_SUBDEV_AMP_FLAG,
13309 .info = snd_hda_mixer_amp_switch_info,
13310 .get = snd_hda_mixer_amp_switch_get,
13311 .put = alc268_acer_master_sw_put,
13312 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13314 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13315 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13316 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13317 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13318 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13319 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13320 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
13321 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
13322 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
13326 static struct snd_kcontrol_new alc269_laptop_mixer[] = {
13327 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13328 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13329 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13330 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13334 static struct snd_kcontrol_new alc269vb_laptop_mixer[] = {
13335 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13336 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13337 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
13338 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13342 /* capture mixer elements */
13343 static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = {
13344 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13345 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13346 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13347 HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT),
13351 static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = {
13352 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13353 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13354 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13358 static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = {
13359 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13360 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13361 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13362 HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT),
13366 static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = {
13367 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13368 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13369 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13374 #define alc269_fujitsu_mixer alc269_laptop_mixer
13376 static struct hda_verb alc269_quanta_fl1_verbs[] = {
13377 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13378 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13379 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13380 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13381 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13382 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13386 static struct hda_verb alc269_lifebook_verbs[] = {
13387 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13388 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
13389 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13390 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13391 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13392 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13393 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13394 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13395 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13396 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13400 /* toggle speaker-output according to the hp-jack state */
13401 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
13403 unsigned int present;
13404 unsigned char bits;
13406 present = snd_hda_jack_detect(codec, 0x15);
13407 bits = present ? AMP_IN_MUTE(0) : 0;
13408 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13409 AMP_IN_MUTE(0), bits);
13410 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13411 AMP_IN_MUTE(0), bits);
13413 snd_hda_codec_write(codec, 0x20, 0,
13414 AC_VERB_SET_COEF_INDEX, 0x0c);
13415 snd_hda_codec_write(codec, 0x20, 0,
13416 AC_VERB_SET_PROC_COEF, 0x680);
13418 snd_hda_codec_write(codec, 0x20, 0,
13419 AC_VERB_SET_COEF_INDEX, 0x0c);
13420 snd_hda_codec_write(codec, 0x20, 0,
13421 AC_VERB_SET_PROC_COEF, 0x480);
13424 /* toggle speaker-output according to the hp-jacks state */
13425 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
13427 unsigned int present;
13428 unsigned char bits;
13430 /* Check laptop headphone socket */
13431 present = snd_hda_jack_detect(codec, 0x15);
13433 /* Check port replicator headphone socket */
13434 present |= snd_hda_jack_detect(codec, 0x1a);
13436 bits = present ? AMP_IN_MUTE(0) : 0;
13437 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13438 AMP_IN_MUTE(0), bits);
13439 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13440 AMP_IN_MUTE(0), bits);
13442 snd_hda_codec_write(codec, 0x20, 0,
13443 AC_VERB_SET_COEF_INDEX, 0x0c);
13444 snd_hda_codec_write(codec, 0x20, 0,
13445 AC_VERB_SET_PROC_COEF, 0x680);
13447 snd_hda_codec_write(codec, 0x20, 0,
13448 AC_VERB_SET_COEF_INDEX, 0x0c);
13449 snd_hda_codec_write(codec, 0x20, 0,
13450 AC_VERB_SET_PROC_COEF, 0x480);
13453 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
13455 unsigned int present_laptop;
13456 unsigned int present_dock;
13458 present_laptop = snd_hda_jack_detect(codec, 0x18);
13459 present_dock = snd_hda_jack_detect(codec, 0x1b);
13461 /* Laptop mic port overrides dock mic port, design decision */
13463 snd_hda_codec_write(codec, 0x23, 0,
13464 AC_VERB_SET_CONNECT_SEL, 0x3);
13465 if (present_laptop)
13466 snd_hda_codec_write(codec, 0x23, 0,
13467 AC_VERB_SET_CONNECT_SEL, 0x0);
13468 if (!present_dock && !present_laptop)
13469 snd_hda_codec_write(codec, 0x23, 0,
13470 AC_VERB_SET_CONNECT_SEL, 0x1);
13473 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
13476 switch (res >> 26) {
13477 case ALC880_HP_EVENT:
13478 alc269_quanta_fl1_speaker_automute(codec);
13480 case ALC880_MIC_EVENT:
13481 alc_mic_automute(codec);
13486 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
13489 if ((res >> 26) == ALC880_HP_EVENT)
13490 alc269_lifebook_speaker_automute(codec);
13491 if ((res >> 26) == ALC880_MIC_EVENT)
13492 alc269_lifebook_mic_autoswitch(codec);
13495 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
13497 struct alc_spec *spec = codec->spec;
13498 spec->ext_mic.pin = 0x18;
13499 spec->ext_mic.mux_idx = 0;
13500 spec->int_mic.pin = 0x19;
13501 spec->int_mic.mux_idx = 1;
13502 spec->auto_mic = 1;
13505 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
13507 alc269_quanta_fl1_speaker_automute(codec);
13508 alc_mic_automute(codec);
13511 static void alc269_lifebook_init_hook(struct hda_codec *codec)
13513 alc269_lifebook_speaker_automute(codec);
13514 alc269_lifebook_mic_autoswitch(codec);
13517 static struct hda_verb alc269_laptop_dmic_init_verbs[] = {
13518 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13519 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
13520 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13521 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13522 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13523 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13524 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13528 static struct hda_verb alc269_laptop_amic_init_verbs[] = {
13529 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13530 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
13531 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13532 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
13533 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13534 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13538 static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = {
13539 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
13540 {0x22, AC_VERB_SET_CONNECT_SEL, 0x06},
13541 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13542 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13543 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13544 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13545 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13549 static struct hda_verb alc269vb_laptop_amic_init_verbs[] = {
13550 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
13551 {0x22, AC_VERB_SET_CONNECT_SEL, 0x01},
13552 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13553 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13554 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13555 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13556 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13560 /* toggle speaker-output according to the hp-jack state */
13561 static void alc269_speaker_automute(struct hda_codec *codec)
13563 struct alc_spec *spec = codec->spec;
13564 unsigned int nid = spec->autocfg.hp_pins[0];
13565 unsigned int present;
13566 unsigned char bits;
13568 present = snd_hda_jack_detect(codec, nid);
13569 bits = present ? AMP_IN_MUTE(0) : 0;
13570 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13571 AMP_IN_MUTE(0), bits);
13572 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13573 AMP_IN_MUTE(0), bits);
13576 /* unsolicited event for HP jack sensing */
13577 static void alc269_laptop_unsol_event(struct hda_codec *codec,
13580 switch (res >> 26) {
13581 case ALC880_HP_EVENT:
13582 alc269_speaker_automute(codec);
13584 case ALC880_MIC_EVENT:
13585 alc_mic_automute(codec);
13590 static void alc269_laptop_dmic_setup(struct hda_codec *codec)
13592 struct alc_spec *spec = codec->spec;
13593 spec->ext_mic.pin = 0x18;
13594 spec->ext_mic.mux_idx = 0;
13595 spec->int_mic.pin = 0x12;
13596 spec->int_mic.mux_idx = 5;
13597 spec->auto_mic = 1;
13600 static void alc269vb_laptop_dmic_setup(struct hda_codec *codec)
13602 struct alc_spec *spec = codec->spec;
13603 spec->ext_mic.pin = 0x18;
13604 spec->ext_mic.mux_idx = 0;
13605 spec->int_mic.pin = 0x12;
13606 spec->int_mic.mux_idx = 6;
13607 spec->auto_mic = 1;
13610 static void alc269_laptop_amic_setup(struct hda_codec *codec)
13612 struct alc_spec *spec = codec->spec;
13613 spec->ext_mic.pin = 0x18;
13614 spec->ext_mic.mux_idx = 0;
13615 spec->int_mic.pin = 0x19;
13616 spec->int_mic.mux_idx = 1;
13617 spec->auto_mic = 1;
13620 static void alc269_laptop_inithook(struct hda_codec *codec)
13622 alc269_speaker_automute(codec);
13623 alc_mic_automute(codec);
13627 * generic initialization of ADC, input mixers and output mixers
13629 static struct hda_verb alc269_init_verbs[] = {
13631 * Unmute ADC0 and set the default input to mic-in
13633 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13636 * Set up output mixers (0x02 - 0x03)
13638 /* set vol=0 to output mixers */
13639 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13640 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13642 /* set up input amps for analog loopback */
13643 /* Amp Indices: DAC = 0, mixer = 1 */
13644 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13645 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13646 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13647 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13648 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13649 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13651 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13652 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13653 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13654 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13655 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13656 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13657 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13659 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13660 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13662 /* FIXME: use Mux-type input source selection */
13663 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13664 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13665 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
13668 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13672 static struct hda_verb alc269vb_init_verbs[] = {
13674 * Unmute ADC0 and set the default input to mic-in
13676 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13679 * Set up output mixers (0x02 - 0x03)
13681 /* set vol=0 to output mixers */
13682 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13683 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13685 /* set up input amps for analog loopback */
13686 /* Amp Indices: DAC = 0, mixer = 1 */
13687 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13688 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13689 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13690 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13691 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13692 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13694 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13695 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13696 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13697 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13698 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13699 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13700 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13702 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13703 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13705 /* FIXME: use Mux-type input source selection */
13706 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13707 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13708 {0x22, AC_VERB_SET_CONNECT_SEL, 0x00},
13711 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13715 #define alc269_auto_create_multi_out_ctls \
13716 alc268_auto_create_multi_out_ctls
13717 #define alc269_auto_create_input_ctls \
13718 alc268_auto_create_input_ctls
13720 #ifdef CONFIG_SND_HDA_POWER_SAVE
13721 #define alc269_loopbacks alc880_loopbacks
13724 /* pcm configuration: identical with ALC880 */
13725 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
13726 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
13727 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
13728 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
13730 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
13734 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13735 /* NID is set in alc_build_pcms */
13737 .open = alc880_playback_pcm_open,
13738 .prepare = alc880_playback_pcm_prepare,
13739 .cleanup = alc880_playback_pcm_cleanup
13743 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
13747 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13748 /* NID is set in alc_build_pcms */
13752 * BIOS auto configuration
13754 static int alc269_parse_auto_config(struct hda_codec *codec)
13756 struct alc_spec *spec = codec->spec;
13758 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
13759 hda_nid_t real_capsrc_nids;
13761 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13766 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
13769 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
13773 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13775 if (spec->autocfg.dig_outs)
13776 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
13778 if (spec->kctls.list)
13779 add_mixer(spec, spec->kctls.list);
13781 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010) {
13782 add_verb(spec, alc269vb_init_verbs);
13783 real_capsrc_nids = alc269vb_capsrc_nids[0];
13784 alc_ssid_check(codec, 0x21, 0x1b, 0x14);
13786 add_verb(spec, alc269_init_verbs);
13787 real_capsrc_nids = alc269_capsrc_nids[0];
13788 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
13791 spec->num_mux_defs = 1;
13792 spec->input_mux = &spec->private_imux[0];
13793 /* set default input source */
13794 snd_hda_codec_write_cache(codec, real_capsrc_nids,
13795 0, AC_VERB_SET_CONNECT_SEL,
13796 spec->input_mux->items[0].index);
13798 err = alc_auto_add_mic_boost(codec);
13802 if (!spec->cap_mixer && !spec->no_analog)
13803 set_capture_mixer(codec);
13808 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
13809 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
13810 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
13813 /* init callback for auto-configuration model -- overriding the default init */
13814 static void alc269_auto_init(struct hda_codec *codec)
13816 struct alc_spec *spec = codec->spec;
13817 alc269_auto_init_multi_out(codec);
13818 alc269_auto_init_hp_out(codec);
13819 alc269_auto_init_analog_input(codec);
13820 if (spec->unsol_event)
13821 alc_inithook(codec);
13825 * configuration and preset
13827 static const char *alc269_models[ALC269_MODEL_LAST] = {
13828 [ALC269_BASIC] = "basic",
13829 [ALC269_QUANTA_FL1] = "quanta",
13830 [ALC269_AMIC] = "laptop-amic",
13831 [ALC269_DMIC] = "laptop-dmic",
13832 [ALC269_FUJITSU] = "fujitsu",
13833 [ALC269_LIFEBOOK] = "lifebook",
13834 [ALC269_AUTO] = "auto",
13837 static struct snd_pci_quirk alc269_cfg_tbl[] = {
13838 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
13839 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
13841 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC),
13842 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC),
13843 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC),
13844 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC),
13845 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC),
13846 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC),
13847 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC),
13848 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC),
13849 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC),
13850 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC),
13851 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC),
13852 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC),
13853 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC),
13854 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC),
13855 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC),
13856 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC),
13857 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC),
13858 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC),
13859 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC),
13860 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC),
13861 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC),
13862 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC),
13863 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC),
13864 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC),
13865 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC),
13866 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC),
13867 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC),
13868 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC),
13869 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC),
13870 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC),
13871 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC),
13872 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC),
13873 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC),
13874 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC),
13875 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC),
13876 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC),
13877 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
13879 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
13881 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC),
13882 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC),
13883 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
13884 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
13888 static struct alc_config_preset alc269_presets[] = {
13890 .mixers = { alc269_base_mixer },
13891 .init_verbs = { alc269_init_verbs },
13892 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13893 .dac_nids = alc269_dac_nids,
13895 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13896 .channel_mode = alc269_modes,
13897 .input_mux = &alc269_capture_source,
13899 [ALC269_QUANTA_FL1] = {
13900 .mixers = { alc269_quanta_fl1_mixer },
13901 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
13902 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13903 .dac_nids = alc269_dac_nids,
13905 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13906 .channel_mode = alc269_modes,
13907 .input_mux = &alc269_capture_source,
13908 .unsol_event = alc269_quanta_fl1_unsol_event,
13909 .setup = alc269_quanta_fl1_setup,
13910 .init_hook = alc269_quanta_fl1_init_hook,
13913 .mixers = { alc269_laptop_mixer },
13914 .cap_mixer = alc269_laptop_analog_capture_mixer,
13915 .init_verbs = { alc269_init_verbs,
13916 alc269_laptop_amic_init_verbs },
13917 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13918 .dac_nids = alc269_dac_nids,
13920 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13921 .channel_mode = alc269_modes,
13922 .unsol_event = alc269_laptop_unsol_event,
13923 .setup = alc269_laptop_amic_setup,
13924 .init_hook = alc269_laptop_inithook,
13927 .mixers = { alc269_laptop_mixer },
13928 .cap_mixer = alc269_laptop_digital_capture_mixer,
13929 .init_verbs = { alc269_init_verbs,
13930 alc269_laptop_dmic_init_verbs },
13931 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13932 .dac_nids = alc269_dac_nids,
13934 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13935 .channel_mode = alc269_modes,
13936 .unsol_event = alc269_laptop_unsol_event,
13937 .setup = alc269_laptop_dmic_setup,
13938 .init_hook = alc269_laptop_inithook,
13940 [ALC269VB_AMIC] = {
13941 .mixers = { alc269vb_laptop_mixer },
13942 .cap_mixer = alc269vb_laptop_analog_capture_mixer,
13943 .init_verbs = { alc269vb_init_verbs,
13944 alc269vb_laptop_amic_init_verbs },
13945 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13946 .dac_nids = alc269_dac_nids,
13948 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13949 .channel_mode = alc269_modes,
13950 .unsol_event = alc269_laptop_unsol_event,
13951 .setup = alc269_laptop_amic_setup,
13952 .init_hook = alc269_laptop_inithook,
13954 [ALC269VB_DMIC] = {
13955 .mixers = { alc269vb_laptop_mixer },
13956 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
13957 .init_verbs = { alc269vb_init_verbs,
13958 alc269vb_laptop_dmic_init_verbs },
13959 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13960 .dac_nids = alc269_dac_nids,
13962 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13963 .channel_mode = alc269_modes,
13964 .unsol_event = alc269_laptop_unsol_event,
13965 .setup = alc269vb_laptop_dmic_setup,
13966 .init_hook = alc269_laptop_inithook,
13968 [ALC269_FUJITSU] = {
13969 .mixers = { alc269_fujitsu_mixer },
13970 .cap_mixer = alc269_laptop_digital_capture_mixer,
13971 .init_verbs = { alc269_init_verbs,
13972 alc269_laptop_dmic_init_verbs },
13973 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13974 .dac_nids = alc269_dac_nids,
13976 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13977 .channel_mode = alc269_modes,
13978 .unsol_event = alc269_laptop_unsol_event,
13979 .setup = alc269_laptop_dmic_setup,
13980 .init_hook = alc269_laptop_inithook,
13982 [ALC269_LIFEBOOK] = {
13983 .mixers = { alc269_lifebook_mixer },
13984 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
13985 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13986 .dac_nids = alc269_dac_nids,
13988 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13989 .channel_mode = alc269_modes,
13990 .input_mux = &alc269_capture_source,
13991 .unsol_event = alc269_lifebook_unsol_event,
13992 .init_hook = alc269_lifebook_init_hook,
13996 static int patch_alc269(struct hda_codec *codec)
13998 struct alc_spec *spec;
14001 int is_alc269vb = 0;
14003 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14007 codec->spec = spec;
14009 alc_fix_pll_init(codec, 0x20, 0x04, 15);
14011 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){
14012 kfree(codec->chip_name);
14013 codec->chip_name = kstrdup("ALC259", GFP_KERNEL);
14014 if (!codec->chip_name) {
14021 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
14025 if (board_config < 0) {
14026 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14028 board_config = ALC269_AUTO;
14031 if (board_config == ALC269_AUTO) {
14032 /* automatic parse from the BIOS config */
14033 err = alc269_parse_auto_config(codec);
14039 "hda_codec: Cannot set up configuration "
14040 "from BIOS. Using base mode...\n");
14041 board_config = ALC269_BASIC;
14045 err = snd_hda_attach_beep_device(codec, 0x1);
14051 if (board_config != ALC269_AUTO)
14052 setup_preset(codec, &alc269_presets[board_config]);
14054 if (board_config == ALC269_QUANTA_FL1) {
14055 /* Due to a hardware problem on Lenovo Ideadpad, we need to
14056 * fix the sample rate of analog I/O to 44.1kHz
14058 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
14059 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
14061 spec->stream_analog_playback = &alc269_pcm_analog_playback;
14062 spec->stream_analog_capture = &alc269_pcm_analog_capture;
14064 spec->stream_digital_playback = &alc269_pcm_digital_playback;
14065 spec->stream_digital_capture = &alc269_pcm_digital_capture;
14067 if (!is_alc269vb) {
14068 spec->adc_nids = alc269_adc_nids;
14069 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
14070 spec->capsrc_nids = alc269_capsrc_nids;
14072 spec->adc_nids = alc269vb_adc_nids;
14073 spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids);
14074 spec->capsrc_nids = alc269vb_capsrc_nids;
14077 if (!spec->cap_mixer)
14078 set_capture_mixer(codec);
14079 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
14081 spec->vmaster_nid = 0x02;
14083 codec->patch_ops = alc_patch_ops;
14084 if (board_config == ALC269_AUTO)
14085 spec->init_hook = alc269_auto_init;
14086 #ifdef CONFIG_SND_HDA_POWER_SAVE
14087 if (!spec->loopback.amplist)
14088 spec->loopback.amplist = alc269_loopbacks;
14095 * ALC861 channel source setting (2/6 channel selection for 3-stack)
14099 * set the path ways for 2 channel output
14100 * need to set the codec line out and mic 1 pin widgets to inputs
14102 static struct hda_verb alc861_threestack_ch2_init[] = {
14103 /* set pin widget 1Ah (line in) for input */
14104 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14105 /* set pin widget 18h (mic1/2) for input, for mic also enable
14108 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14110 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
14112 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14113 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
14119 * need to set the codec line out and mic 1 pin widgets to outputs
14121 static struct hda_verb alc861_threestack_ch6_init[] = {
14122 /* set pin widget 1Ah (line in) for output (Back Surround)*/
14123 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14124 /* set pin widget 18h (mic1) for output (CLFE)*/
14125 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14127 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
14128 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
14130 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
14132 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14133 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
14138 static struct hda_channel_mode alc861_threestack_modes[2] = {
14139 { 2, alc861_threestack_ch2_init },
14140 { 6, alc861_threestack_ch6_init },
14142 /* Set mic1 as input and unmute the mixer */
14143 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
14144 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14145 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14148 /* Set mic1 as output and mute mixer */
14149 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
14150 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14151 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14155 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
14156 { 2, alc861_uniwill_m31_ch2_init },
14157 { 4, alc861_uniwill_m31_ch4_init },
14160 /* Set mic1 and line-in as input and unmute the mixer */
14161 static struct hda_verb alc861_asus_ch2_init[] = {
14162 /* set pin widget 1Ah (line in) for input */
14163 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14164 /* set pin widget 18h (mic1/2) for input, for mic also enable
14167 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14169 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
14171 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14172 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
14176 /* Set mic1 nad line-in as output and mute mixer */
14177 static struct hda_verb alc861_asus_ch6_init[] = {
14178 /* set pin widget 1Ah (line in) for output (Back Surround)*/
14179 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14180 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
14181 /* set pin widget 18h (mic1) for output (CLFE)*/
14182 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14183 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
14184 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
14185 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
14187 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
14189 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14190 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
14195 static struct hda_channel_mode alc861_asus_modes[2] = {
14196 { 2, alc861_asus_ch2_init },
14197 { 6, alc861_asus_ch6_init },
14202 static struct snd_kcontrol_new alc861_base_mixer[] = {
14203 /* output mixer control */
14204 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14205 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14206 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14207 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14208 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
14210 /*Input mixer control */
14211 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14212 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14213 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14214 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14215 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14216 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14217 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14218 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14219 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14220 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14225 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
14226 /* output mixer control */
14227 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14228 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14229 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14230 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14231 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
14233 /* Input mixer control */
14234 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14235 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14236 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14237 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14238 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14239 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14240 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14241 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14242 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14243 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14246 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14247 .name = "Channel Mode",
14248 .info = alc_ch_mode_info,
14249 .get = alc_ch_mode_get,
14250 .put = alc_ch_mode_put,
14251 .private_value = ARRAY_SIZE(alc861_threestack_modes),
14256 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
14257 /* output mixer control */
14258 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14259 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14260 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14265 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
14266 /* output mixer control */
14267 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14268 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14269 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14270 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14271 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
14273 /* Input mixer control */
14274 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14275 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14276 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14277 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14278 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14279 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14280 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14281 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14282 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14283 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14286 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14287 .name = "Channel Mode",
14288 .info = alc_ch_mode_info,
14289 .get = alc_ch_mode_get,
14290 .put = alc_ch_mode_put,
14291 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
14296 static struct snd_kcontrol_new alc861_asus_mixer[] = {
14297 /* output mixer control */
14298 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14299 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14300 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14301 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14302 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
14304 /* Input mixer control */
14305 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14306 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14307 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14308 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14309 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14310 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14311 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14312 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14313 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14314 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
14317 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14318 .name = "Channel Mode",
14319 .info = alc_ch_mode_info,
14320 .get = alc_ch_mode_get,
14321 .put = alc_ch_mode_put,
14322 .private_value = ARRAY_SIZE(alc861_asus_modes),
14327 /* additional mixer */
14328 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
14329 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14330 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14335 * generic initialization of ADC, input mixers and output mixers
14337 static struct hda_verb alc861_base_init_verbs[] = {
14339 * Unmute ADC0 and set the default input to mic-in
14341 /* port-A for surround (rear panel) */
14342 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14343 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
14344 /* port-B for mic-in (rear panel) with vref */
14345 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14346 /* port-C for line-in (rear panel) */
14347 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14348 /* port-D for Front */
14349 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14350 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14351 /* port-E for HP out (front panel) */
14352 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14353 /* route front PCM to HP */
14354 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14355 /* port-F for mic-in (front panel) with vref */
14356 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14357 /* port-G for CLFE (rear panel) */
14358 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14359 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14360 /* port-H for side (rear panel) */
14361 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14362 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
14364 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14365 /* route front mic to ADC1*/
14366 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14367 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14369 /* Unmute DAC0~3 & spdif out*/
14370 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14371 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14372 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14373 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14374 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14376 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14377 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14378 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14379 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14380 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14382 /* Unmute Stereo Mixer 15 */
14383 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14384 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14385 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14386 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14388 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14389 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14390 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14391 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14392 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14393 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14394 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14395 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14396 /* hp used DAC 3 (Front) */
14397 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14398 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14403 static struct hda_verb alc861_threestack_init_verbs[] = {
14405 * Unmute ADC0 and set the default input to mic-in
14407 /* port-A for surround (rear panel) */
14408 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14409 /* port-B for mic-in (rear panel) with vref */
14410 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14411 /* port-C for line-in (rear panel) */
14412 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14413 /* port-D for Front */
14414 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14415 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14416 /* port-E for HP out (front panel) */
14417 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14418 /* route front PCM to HP */
14419 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14420 /* port-F for mic-in (front panel) with vref */
14421 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14422 /* port-G for CLFE (rear panel) */
14423 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14424 /* port-H for side (rear panel) */
14425 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14427 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14428 /* route front mic to ADC1*/
14429 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14430 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14431 /* Unmute DAC0~3 & spdif out*/
14432 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14433 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14434 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14435 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14436 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14438 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14439 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14440 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14441 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14442 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14444 /* Unmute Stereo Mixer 15 */
14445 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14446 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14447 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14448 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14450 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14451 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14452 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14453 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14454 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14455 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14456 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14457 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14458 /* hp used DAC 3 (Front) */
14459 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14460 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14464 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
14466 * Unmute ADC0 and set the default input to mic-in
14468 /* port-A for surround (rear panel) */
14469 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14470 /* port-B for mic-in (rear panel) with vref */
14471 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14472 /* port-C for line-in (rear panel) */
14473 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14474 /* port-D for Front */
14475 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14476 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14477 /* port-E for HP out (front panel) */
14478 /* this has to be set to VREF80 */
14479 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14480 /* route front PCM to HP */
14481 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14482 /* port-F for mic-in (front panel) with vref */
14483 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14484 /* port-G for CLFE (rear panel) */
14485 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14486 /* port-H for side (rear panel) */
14487 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14489 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14490 /* route front mic to ADC1*/
14491 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14492 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14493 /* Unmute DAC0~3 & spdif out*/
14494 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14495 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14496 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14497 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14498 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14500 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14501 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14502 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14503 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14504 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14506 /* Unmute Stereo Mixer 15 */
14507 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14508 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14509 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14510 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14512 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14513 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14514 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14515 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14516 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14517 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14518 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14519 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14520 /* hp used DAC 3 (Front) */
14521 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14522 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14526 static struct hda_verb alc861_asus_init_verbs[] = {
14528 * Unmute ADC0 and set the default input to mic-in
14530 /* port-A for surround (rear panel)
14531 * according to codec#0 this is the HP jack
14533 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
14534 /* route front PCM to HP */
14535 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
14536 /* port-B for mic-in (rear panel) with vref */
14537 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14538 /* port-C for line-in (rear panel) */
14539 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14540 /* port-D for Front */
14541 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14542 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14543 /* port-E for HP out (front panel) */
14544 /* this has to be set to VREF80 */
14545 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14546 /* route front PCM to HP */
14547 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14548 /* port-F for mic-in (front panel) with vref */
14549 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14550 /* port-G for CLFE (rear panel) */
14551 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14552 /* port-H for side (rear panel) */
14553 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14555 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14556 /* route front mic to ADC1*/
14557 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14558 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14559 /* Unmute DAC0~3 & spdif out*/
14560 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14561 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14562 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14563 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14564 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14565 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14566 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14567 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14568 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14569 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14571 /* Unmute Stereo Mixer 15 */
14572 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14573 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14574 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14575 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14577 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14578 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14579 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14580 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14581 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14582 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14583 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14584 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14585 /* hp used DAC 3 (Front) */
14586 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14587 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14591 /* additional init verbs for ASUS laptops */
14592 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
14593 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
14594 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
14599 * generic initialization of ADC, input mixers and output mixers
14601 static struct hda_verb alc861_auto_init_verbs[] = {
14603 * Unmute ADC0 and set the default input to mic-in
14605 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
14606 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14608 /* Unmute DAC0~3 & spdif out*/
14609 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14610 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14611 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14612 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14613 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14615 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14616 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14617 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14618 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14619 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14621 /* Unmute Stereo Mixer 15 */
14622 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14623 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14624 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14625 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
14627 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14628 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14629 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14630 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14631 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14632 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14633 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14634 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14636 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14637 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14638 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14639 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14640 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14641 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14642 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14643 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14645 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
14650 static struct hda_verb alc861_toshiba_init_verbs[] = {
14651 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14656 /* toggle speaker-output according to the hp-jack state */
14657 static void alc861_toshiba_automute(struct hda_codec *codec)
14659 unsigned int present = snd_hda_jack_detect(codec, 0x0f);
14661 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
14662 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14663 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
14664 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
14667 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
14670 if ((res >> 26) == ALC880_HP_EVENT)
14671 alc861_toshiba_automute(codec);
14674 /* pcm configuration: identical with ALC880 */
14675 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
14676 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
14677 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
14678 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
14681 #define ALC861_DIGOUT_NID 0x07
14683 static struct hda_channel_mode alc861_8ch_modes[1] = {
14687 static hda_nid_t alc861_dac_nids[4] = {
14688 /* front, surround, clfe, side */
14689 0x03, 0x06, 0x05, 0x04
14692 static hda_nid_t alc660_dac_nids[3] = {
14693 /* front, clfe, surround */
14697 static hda_nid_t alc861_adc_nids[1] = {
14702 static struct hda_input_mux alc861_capture_source = {
14706 { "Front Mic", 0x3 },
14713 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
14715 struct alc_spec *spec = codec->spec;
14716 hda_nid_t mix, srcs[5];
14719 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
14721 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14724 for (i = 0; i < num; i++) {
14726 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
14727 if (type != AC_WID_AUD_OUT)
14729 for (j = 0; j < spec->multiout.num_dacs; j++)
14730 if (spec->multiout.dac_nids[j] == srcs[i])
14732 if (j >= spec->multiout.num_dacs)
14738 /* fill in the dac_nids table from the parsed pin configuration */
14739 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
14740 const struct auto_pin_cfg *cfg)
14742 struct alc_spec *spec = codec->spec;
14744 hda_nid_t nid, dac;
14746 spec->multiout.dac_nids = spec->private_dac_nids;
14747 for (i = 0; i < cfg->line_outs; i++) {
14748 nid = cfg->line_out_pins[i];
14749 dac = alc861_look_for_dac(codec, nid);
14752 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
14757 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
14758 hda_nid_t nid, unsigned int chs)
14760 return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx,
14761 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
14764 /* add playback controls from the parsed DAC table */
14765 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
14766 const struct auto_pin_cfg *cfg)
14768 struct alc_spec *spec = codec->spec;
14769 static const char *chname[4] = {
14770 "Front", "Surround", NULL /*CLFE*/, "Side"
14775 if (cfg->line_outs == 1) {
14776 const char *pfx = NULL;
14779 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
14782 nid = spec->multiout.dac_nids[0];
14783 return alc861_create_out_sw(codec, pfx, nid, 3);
14787 for (i = 0; i < cfg->line_outs; i++) {
14788 nid = spec->multiout.dac_nids[i];
14793 err = alc861_create_out_sw(codec, "Center", nid, 1);
14796 err = alc861_create_out_sw(codec, "LFE", nid, 2);
14800 err = alc861_create_out_sw(codec, chname[i], nid, 3);
14808 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
14810 struct alc_spec *spec = codec->spec;
14817 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
14818 nid = alc861_look_for_dac(codec, pin);
14820 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
14823 spec->multiout.hp_nid = nid;
14829 /* create playback/capture controls for input pins */
14830 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
14831 const struct auto_pin_cfg *cfg)
14833 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
14836 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
14838 int pin_type, hda_nid_t dac)
14840 hda_nid_t mix, srcs[5];
14843 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
14845 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14847 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
14849 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14852 for (i = 0; i < num; i++) {
14854 if (srcs[i] == dac || srcs[i] == 0x15)
14855 mute = AMP_IN_UNMUTE(i);
14857 mute = AMP_IN_MUTE(i);
14858 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14863 static void alc861_auto_init_multi_out(struct hda_codec *codec)
14865 struct alc_spec *spec = codec->spec;
14868 for (i = 0; i < spec->autocfg.line_outs; i++) {
14869 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14870 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14872 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
14873 spec->multiout.dac_nids[i]);
14877 static void alc861_auto_init_hp_out(struct hda_codec *codec)
14879 struct alc_spec *spec = codec->spec;
14881 if (spec->autocfg.hp_outs)
14882 alc861_auto_set_output_and_unmute(codec,
14883 spec->autocfg.hp_pins[0],
14885 spec->multiout.hp_nid);
14886 if (spec->autocfg.speaker_outs)
14887 alc861_auto_set_output_and_unmute(codec,
14888 spec->autocfg.speaker_pins[0],
14890 spec->multiout.dac_nids[0]);
14893 static void alc861_auto_init_analog_input(struct hda_codec *codec)
14895 struct alc_spec *spec = codec->spec;
14898 for (i = 0; i < AUTO_PIN_LAST; i++) {
14899 hda_nid_t nid = spec->autocfg.input_pins[i];
14900 if (nid >= 0x0c && nid <= 0x11)
14901 alc_set_input_pin(codec, nid, i);
14905 /* parse the BIOS configuration and set up the alc_spec */
14906 /* return 1 if successful, 0 if the proper config is not found,
14907 * or a negative error code
14909 static int alc861_parse_auto_config(struct hda_codec *codec)
14911 struct alc_spec *spec = codec->spec;
14913 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
14915 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14919 if (!spec->autocfg.line_outs)
14920 return 0; /* can't find valid BIOS pin config */
14922 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
14925 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
14928 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
14931 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
14935 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14937 if (spec->autocfg.dig_outs)
14938 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
14940 if (spec->kctls.list)
14941 add_mixer(spec, spec->kctls.list);
14943 add_verb(spec, alc861_auto_init_verbs);
14945 spec->num_mux_defs = 1;
14946 spec->input_mux = &spec->private_imux[0];
14948 spec->adc_nids = alc861_adc_nids;
14949 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
14950 set_capture_mixer(codec);
14952 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b);
14957 /* additional initialization for auto-configuration model */
14958 static void alc861_auto_init(struct hda_codec *codec)
14960 struct alc_spec *spec = codec->spec;
14961 alc861_auto_init_multi_out(codec);
14962 alc861_auto_init_hp_out(codec);
14963 alc861_auto_init_analog_input(codec);
14964 if (spec->unsol_event)
14965 alc_inithook(codec);
14968 #ifdef CONFIG_SND_HDA_POWER_SAVE
14969 static struct hda_amp_list alc861_loopbacks[] = {
14970 { 0x15, HDA_INPUT, 0 },
14971 { 0x15, HDA_INPUT, 1 },
14972 { 0x15, HDA_INPUT, 2 },
14973 { 0x15, HDA_INPUT, 3 },
14980 * configuration and preset
14982 static const char *alc861_models[ALC861_MODEL_LAST] = {
14983 [ALC861_3ST] = "3stack",
14984 [ALC660_3ST] = "3stack-660",
14985 [ALC861_3ST_DIG] = "3stack-dig",
14986 [ALC861_6ST_DIG] = "6stack-dig",
14987 [ALC861_UNIWILL_M31] = "uniwill-m31",
14988 [ALC861_TOSHIBA] = "toshiba",
14989 [ALC861_ASUS] = "asus",
14990 [ALC861_ASUS_LAPTOP] = "asus-laptop",
14991 [ALC861_AUTO] = "auto",
14994 static struct snd_pci_quirk alc861_cfg_tbl[] = {
14995 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
14996 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14997 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14998 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
14999 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
15000 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
15001 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
15002 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
15003 * Any other models that need this preset?
15005 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
15006 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
15007 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
15008 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
15009 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
15010 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
15011 /* FIXME: the below seems conflict */
15012 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
15013 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
15014 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
15018 static struct alc_config_preset alc861_presets[] = {
15020 .mixers = { alc861_3ST_mixer },
15021 .init_verbs = { alc861_threestack_init_verbs },
15022 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15023 .dac_nids = alc861_dac_nids,
15024 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15025 .channel_mode = alc861_threestack_modes,
15027 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15028 .adc_nids = alc861_adc_nids,
15029 .input_mux = &alc861_capture_source,
15031 [ALC861_3ST_DIG] = {
15032 .mixers = { alc861_base_mixer },
15033 .init_verbs = { alc861_threestack_init_verbs },
15034 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15035 .dac_nids = alc861_dac_nids,
15036 .dig_out_nid = ALC861_DIGOUT_NID,
15037 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15038 .channel_mode = alc861_threestack_modes,
15040 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15041 .adc_nids = alc861_adc_nids,
15042 .input_mux = &alc861_capture_source,
15044 [ALC861_6ST_DIG] = {
15045 .mixers = { alc861_base_mixer },
15046 .init_verbs = { alc861_base_init_verbs },
15047 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15048 .dac_nids = alc861_dac_nids,
15049 .dig_out_nid = ALC861_DIGOUT_NID,
15050 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
15051 .channel_mode = alc861_8ch_modes,
15052 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15053 .adc_nids = alc861_adc_nids,
15054 .input_mux = &alc861_capture_source,
15057 .mixers = { alc861_3ST_mixer },
15058 .init_verbs = { alc861_threestack_init_verbs },
15059 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
15060 .dac_nids = alc660_dac_nids,
15061 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15062 .channel_mode = alc861_threestack_modes,
15064 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15065 .adc_nids = alc861_adc_nids,
15066 .input_mux = &alc861_capture_source,
15068 [ALC861_UNIWILL_M31] = {
15069 .mixers = { alc861_uniwill_m31_mixer },
15070 .init_verbs = { alc861_uniwill_m31_init_verbs },
15071 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15072 .dac_nids = alc861_dac_nids,
15073 .dig_out_nid = ALC861_DIGOUT_NID,
15074 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
15075 .channel_mode = alc861_uniwill_m31_modes,
15077 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15078 .adc_nids = alc861_adc_nids,
15079 .input_mux = &alc861_capture_source,
15081 [ALC861_TOSHIBA] = {
15082 .mixers = { alc861_toshiba_mixer },
15083 .init_verbs = { alc861_base_init_verbs,
15084 alc861_toshiba_init_verbs },
15085 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15086 .dac_nids = alc861_dac_nids,
15087 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
15088 .channel_mode = alc883_3ST_2ch_modes,
15089 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15090 .adc_nids = alc861_adc_nids,
15091 .input_mux = &alc861_capture_source,
15092 .unsol_event = alc861_toshiba_unsol_event,
15093 .init_hook = alc861_toshiba_automute,
15096 .mixers = { alc861_asus_mixer },
15097 .init_verbs = { alc861_asus_init_verbs },
15098 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15099 .dac_nids = alc861_dac_nids,
15100 .dig_out_nid = ALC861_DIGOUT_NID,
15101 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
15102 .channel_mode = alc861_asus_modes,
15105 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15106 .adc_nids = alc861_adc_nids,
15107 .input_mux = &alc861_capture_source,
15109 [ALC861_ASUS_LAPTOP] = {
15110 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
15111 .init_verbs = { alc861_asus_init_verbs,
15112 alc861_asus_laptop_init_verbs },
15113 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15114 .dac_nids = alc861_dac_nids,
15115 .dig_out_nid = ALC861_DIGOUT_NID,
15116 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
15117 .channel_mode = alc883_3ST_2ch_modes,
15119 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15120 .adc_nids = alc861_adc_nids,
15121 .input_mux = &alc861_capture_source,
15125 /* Pin config fixes */
15127 PINFIX_FSC_AMILO_PI1505,
15130 static struct alc_pincfg alc861_fsc_amilo_pi1505_pinfix[] = {
15131 { 0x0b, 0x0221101f }, /* HP */
15132 { 0x0f, 0x90170310 }, /* speaker */
15136 static const struct alc_fixup alc861_fixups[] = {
15137 [PINFIX_FSC_AMILO_PI1505] = {
15138 .pins = alc861_fsc_amilo_pi1505_pinfix
15142 static struct snd_pci_quirk alc861_fixup_tbl[] = {
15143 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
15147 static int patch_alc861(struct hda_codec *codec)
15149 struct alc_spec *spec;
15153 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15157 codec->spec = spec;
15159 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
15163 if (board_config < 0) {
15164 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15166 board_config = ALC861_AUTO;
15169 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups);
15171 if (board_config == ALC861_AUTO) {
15172 /* automatic parse from the BIOS config */
15173 err = alc861_parse_auto_config(codec);
15179 "hda_codec: Cannot set up configuration "
15180 "from BIOS. Using base mode...\n");
15181 board_config = ALC861_3ST_DIG;
15185 err = snd_hda_attach_beep_device(codec, 0x23);
15191 if (board_config != ALC861_AUTO)
15192 setup_preset(codec, &alc861_presets[board_config]);
15194 spec->stream_analog_playback = &alc861_pcm_analog_playback;
15195 spec->stream_analog_capture = &alc861_pcm_analog_capture;
15197 spec->stream_digital_playback = &alc861_pcm_digital_playback;
15198 spec->stream_digital_capture = &alc861_pcm_digital_capture;
15200 if (!spec->cap_mixer)
15201 set_capture_mixer(codec);
15202 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
15204 spec->vmaster_nid = 0x03;
15206 codec->patch_ops = alc_patch_ops;
15207 if (board_config == ALC861_AUTO) {
15208 spec->init_hook = alc861_auto_init;
15209 #ifdef CONFIG_SND_HDA_POWER_SAVE
15210 spec->power_hook = alc_power_eapd;
15213 #ifdef CONFIG_SND_HDA_POWER_SAVE
15214 if (!spec->loopback.amplist)
15215 spec->loopback.amplist = alc861_loopbacks;
15222 * ALC861-VD support
15226 * In addition, an independent DAC
15228 #define ALC861VD_DIGOUT_NID 0x06
15230 static hda_nid_t alc861vd_dac_nids[4] = {
15231 /* front, surr, clfe, side surr */
15232 0x02, 0x03, 0x04, 0x05
15235 /* dac_nids for ALC660vd are in a different order - according to
15236 * Realtek's driver.
15237 * This should probably result in a different mixer for 6stack models
15238 * of ALC660vd codecs, but for now there is only 3stack mixer
15239 * - and it is the same as in 861vd.
15240 * adc_nids in ALC660vd are (is) the same as in 861vd
15242 static hda_nid_t alc660vd_dac_nids[3] = {
15243 /* front, rear, clfe, rear_surr */
15247 static hda_nid_t alc861vd_adc_nids[1] = {
15252 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
15255 /* FIXME: should be a matrix-type input source selection */
15256 static struct hda_input_mux alc861vd_capture_source = {
15260 { "Front Mic", 0x1 },
15266 static struct hda_input_mux alc861vd_dallas_capture_source = {
15269 { "Ext Mic", 0x0 },
15270 { "Int Mic", 0x1 },
15274 static struct hda_input_mux alc861vd_hp_capture_source = {
15277 { "Front Mic", 0x0 },
15278 { "ATAPI Mic", 0x1 },
15285 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
15292 static struct hda_verb alc861vd_6stack_ch6_init[] = {
15293 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15294 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15295 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15296 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15303 static struct hda_verb alc861vd_6stack_ch8_init[] = {
15304 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15305 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15306 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15307 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15311 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
15312 { 6, alc861vd_6stack_ch6_init },
15313 { 8, alc861vd_6stack_ch8_init },
15316 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
15318 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15319 .name = "Channel Mode",
15320 .info = alc_ch_mode_info,
15321 .get = alc_ch_mode_get,
15322 .put = alc_ch_mode_put,
15327 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15328 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15330 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
15331 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15332 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15334 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15335 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
15337 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
15339 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
15341 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
15342 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
15344 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
15345 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
15347 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15349 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15350 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15351 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15353 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15354 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15355 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15357 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15358 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15360 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15361 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15366 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
15367 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15368 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15370 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15372 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15373 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15374 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15376 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15377 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15378 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15380 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15381 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15383 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15384 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15389 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
15390 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15391 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
15392 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15394 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15396 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15397 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15398 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15400 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15401 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15402 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15404 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15405 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15410 /* Pin assignment: Speaker=0x14, HP = 0x15,
15411 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
15413 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
15414 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15415 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
15416 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15417 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15418 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
15419 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15420 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15421 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
15422 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15423 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15427 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
15428 * Front Mic=0x18, ATAPI Mic = 0x19,
15430 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
15431 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15432 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15433 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15434 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15435 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15436 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15437 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15438 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15444 * generic initialization of ADC, input mixers and output mixers
15446 static struct hda_verb alc861vd_volume_init_verbs[] = {
15448 * Unmute ADC0 and set the default input to mic-in
15450 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15451 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15453 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
15454 * the analog-loopback mixer widget
15456 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15457 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15458 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15459 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15460 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15461 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15463 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
15464 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15465 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15466 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15467 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15470 * Set up output mixers (0x02 - 0x05)
15472 /* set vol=0 to output mixers */
15473 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15474 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15475 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15476 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15478 /* set up input amps for analog loopback */
15479 /* Amp Indices: DAC = 0, mixer = 1 */
15480 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15481 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15482 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15483 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15484 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15485 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15486 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15487 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15493 * 3-stack pin configuration:
15494 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
15496 static struct hda_verb alc861vd_3stack_init_verbs[] = {
15498 * Set pin mode and muting
15500 /* set front pin widgets 0x14 for output */
15501 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15502 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15503 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15505 /* Mic (rear) pin: input vref at 80% */
15506 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15507 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15508 /* Front Mic pin: input vref at 80% */
15509 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15510 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15511 /* Line In pin: input */
15512 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15513 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15514 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15515 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15516 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15517 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15518 /* CD pin widget for input */
15519 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15525 * 6-stack pin configuration:
15527 static struct hda_verb alc861vd_6stack_init_verbs[] = {
15529 * Set pin mode and muting
15531 /* set front pin widgets 0x14 for output */
15532 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15533 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15534 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15536 /* Rear Pin: output 1 (0x0d) */
15537 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15538 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15539 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
15540 /* CLFE Pin: output 2 (0x0e) */
15541 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15542 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15543 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
15544 /* Side Pin: output 3 (0x0f) */
15545 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15546 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15547 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
15549 /* Mic (rear) pin: input vref at 80% */
15550 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15551 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15552 /* Front Mic pin: input vref at 80% */
15553 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15554 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15555 /* Line In pin: input */
15556 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15557 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15558 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15559 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15560 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15561 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15562 /* CD pin widget for input */
15563 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15568 static struct hda_verb alc861vd_eapd_verbs[] = {
15569 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15573 static struct hda_verb alc660vd_eapd_verbs[] = {
15574 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15575 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15579 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
15580 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15581 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15582 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
15583 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15584 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15588 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
15590 unsigned int present;
15591 unsigned char bits;
15593 present = snd_hda_jack_detect(codec, 0x18);
15594 bits = present ? HDA_AMP_MUTE : 0;
15596 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
15597 HDA_AMP_MUTE, bits);
15600 static void alc861vd_lenovo_setup(struct hda_codec *codec)
15602 struct alc_spec *spec = codec->spec;
15603 spec->autocfg.hp_pins[0] = 0x1b;
15604 spec->autocfg.speaker_pins[0] = 0x14;
15607 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
15609 alc_automute_amp(codec);
15610 alc861vd_lenovo_mic_automute(codec);
15613 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
15616 switch (res >> 26) {
15617 case ALC880_MIC_EVENT:
15618 alc861vd_lenovo_mic_automute(codec);
15621 alc_automute_amp_unsol_event(codec, res);
15626 static struct hda_verb alc861vd_dallas_verbs[] = {
15627 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15628 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15629 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15630 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15632 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15633 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15634 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15635 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15636 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15637 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15638 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15639 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15641 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15642 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15643 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15644 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15645 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15646 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15647 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15648 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15650 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15651 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15652 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15653 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15654 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15655 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15656 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15657 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15659 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15660 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15661 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15662 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15664 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15665 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15666 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15671 /* toggle speaker-output according to the hp-jack state */
15672 static void alc861vd_dallas_setup(struct hda_codec *codec)
15674 struct alc_spec *spec = codec->spec;
15676 spec->autocfg.hp_pins[0] = 0x15;
15677 spec->autocfg.speaker_pins[0] = 0x14;
15680 #ifdef CONFIG_SND_HDA_POWER_SAVE
15681 #define alc861vd_loopbacks alc880_loopbacks
15684 /* pcm configuration: identical with ALC880 */
15685 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
15686 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
15687 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
15688 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
15691 * configuration and preset
15693 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
15694 [ALC660VD_3ST] = "3stack-660",
15695 [ALC660VD_3ST_DIG] = "3stack-660-digout",
15696 [ALC660VD_ASUS_V1S] = "asus-v1s",
15697 [ALC861VD_3ST] = "3stack",
15698 [ALC861VD_3ST_DIG] = "3stack-digout",
15699 [ALC861VD_6ST_DIG] = "6stack-digout",
15700 [ALC861VD_LENOVO] = "lenovo",
15701 [ALC861VD_DALLAS] = "dallas",
15702 [ALC861VD_HP] = "hp",
15703 [ALC861VD_AUTO] = "auto",
15706 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
15707 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
15708 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
15709 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
15710 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
15711 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
15712 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
15713 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
15714 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
15715 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
15716 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
15717 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
15718 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
15719 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
15720 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
15721 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
15725 static struct alc_config_preset alc861vd_presets[] = {
15727 .mixers = { alc861vd_3st_mixer },
15728 .init_verbs = { alc861vd_volume_init_verbs,
15729 alc861vd_3stack_init_verbs },
15730 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15731 .dac_nids = alc660vd_dac_nids,
15732 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15733 .channel_mode = alc861vd_3stack_2ch_modes,
15734 .input_mux = &alc861vd_capture_source,
15736 [ALC660VD_3ST_DIG] = {
15737 .mixers = { alc861vd_3st_mixer },
15738 .init_verbs = { alc861vd_volume_init_verbs,
15739 alc861vd_3stack_init_verbs },
15740 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15741 .dac_nids = alc660vd_dac_nids,
15742 .dig_out_nid = ALC861VD_DIGOUT_NID,
15743 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15744 .channel_mode = alc861vd_3stack_2ch_modes,
15745 .input_mux = &alc861vd_capture_source,
15748 .mixers = { alc861vd_3st_mixer },
15749 .init_verbs = { alc861vd_volume_init_verbs,
15750 alc861vd_3stack_init_verbs },
15751 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15752 .dac_nids = alc861vd_dac_nids,
15753 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15754 .channel_mode = alc861vd_3stack_2ch_modes,
15755 .input_mux = &alc861vd_capture_source,
15757 [ALC861VD_3ST_DIG] = {
15758 .mixers = { alc861vd_3st_mixer },
15759 .init_verbs = { alc861vd_volume_init_verbs,
15760 alc861vd_3stack_init_verbs },
15761 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15762 .dac_nids = alc861vd_dac_nids,
15763 .dig_out_nid = ALC861VD_DIGOUT_NID,
15764 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15765 .channel_mode = alc861vd_3stack_2ch_modes,
15766 .input_mux = &alc861vd_capture_source,
15768 [ALC861VD_6ST_DIG] = {
15769 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
15770 .init_verbs = { alc861vd_volume_init_verbs,
15771 alc861vd_6stack_init_verbs },
15772 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15773 .dac_nids = alc861vd_dac_nids,
15774 .dig_out_nid = ALC861VD_DIGOUT_NID,
15775 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
15776 .channel_mode = alc861vd_6stack_modes,
15777 .input_mux = &alc861vd_capture_source,
15779 [ALC861VD_LENOVO] = {
15780 .mixers = { alc861vd_lenovo_mixer },
15781 .init_verbs = { alc861vd_volume_init_verbs,
15782 alc861vd_3stack_init_verbs,
15783 alc861vd_eapd_verbs,
15784 alc861vd_lenovo_unsol_verbs },
15785 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15786 .dac_nids = alc660vd_dac_nids,
15787 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15788 .channel_mode = alc861vd_3stack_2ch_modes,
15789 .input_mux = &alc861vd_capture_source,
15790 .unsol_event = alc861vd_lenovo_unsol_event,
15791 .setup = alc861vd_lenovo_setup,
15792 .init_hook = alc861vd_lenovo_init_hook,
15794 [ALC861VD_DALLAS] = {
15795 .mixers = { alc861vd_dallas_mixer },
15796 .init_verbs = { alc861vd_dallas_verbs },
15797 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15798 .dac_nids = alc861vd_dac_nids,
15799 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15800 .channel_mode = alc861vd_3stack_2ch_modes,
15801 .input_mux = &alc861vd_dallas_capture_source,
15802 .unsol_event = alc_automute_amp_unsol_event,
15803 .setup = alc861vd_dallas_setup,
15804 .init_hook = alc_automute_amp,
15807 .mixers = { alc861vd_hp_mixer },
15808 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
15809 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15810 .dac_nids = alc861vd_dac_nids,
15811 .dig_out_nid = ALC861VD_DIGOUT_NID,
15812 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15813 .channel_mode = alc861vd_3stack_2ch_modes,
15814 .input_mux = &alc861vd_hp_capture_source,
15815 .unsol_event = alc_automute_amp_unsol_event,
15816 .setup = alc861vd_dallas_setup,
15817 .init_hook = alc_automute_amp,
15819 [ALC660VD_ASUS_V1S] = {
15820 .mixers = { alc861vd_lenovo_mixer },
15821 .init_verbs = { alc861vd_volume_init_verbs,
15822 alc861vd_3stack_init_verbs,
15823 alc861vd_eapd_verbs,
15824 alc861vd_lenovo_unsol_verbs },
15825 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15826 .dac_nids = alc660vd_dac_nids,
15827 .dig_out_nid = ALC861VD_DIGOUT_NID,
15828 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15829 .channel_mode = alc861vd_3stack_2ch_modes,
15830 .input_mux = &alc861vd_capture_source,
15831 .unsol_event = alc861vd_lenovo_unsol_event,
15832 .setup = alc861vd_lenovo_setup,
15833 .init_hook = alc861vd_lenovo_init_hook,
15838 * BIOS auto configuration
15840 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
15841 const struct auto_pin_cfg *cfg)
15843 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x22, 0);
15847 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
15848 hda_nid_t nid, int pin_type, int dac_idx)
15850 alc_set_pin_output(codec, nid, pin_type);
15853 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
15855 struct alc_spec *spec = codec->spec;
15858 for (i = 0; i <= HDA_SIDE; i++) {
15859 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15860 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15862 alc861vd_auto_set_output_and_unmute(codec, nid,
15868 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
15870 struct alc_spec *spec = codec->spec;
15873 pin = spec->autocfg.hp_pins[0];
15874 if (pin) /* connect to front and use dac 0 */
15875 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
15876 pin = spec->autocfg.speaker_pins[0];
15878 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
15881 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
15883 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
15885 struct alc_spec *spec = codec->spec;
15888 for (i = 0; i < AUTO_PIN_LAST; i++) {
15889 hda_nid_t nid = spec->autocfg.input_pins[i];
15890 if (alc_is_input_pin(codec, nid)) {
15891 alc_set_input_pin(codec, nid, i);
15892 if (nid != ALC861VD_PIN_CD_NID &&
15893 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
15894 snd_hda_codec_write(codec, nid, 0,
15895 AC_VERB_SET_AMP_GAIN_MUTE,
15901 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
15903 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
15904 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
15906 /* add playback controls from the parsed DAC table */
15907 /* Based on ALC880 version. But ALC861VD has separate,
15908 * different NIDs for mute/unmute switch and volume control */
15909 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
15910 const struct auto_pin_cfg *cfg)
15912 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
15913 hda_nid_t nid_v, nid_s;
15916 for (i = 0; i < cfg->line_outs; i++) {
15917 if (!spec->multiout.dac_nids[i])
15919 nid_v = alc861vd_idx_to_mixer_vol(
15921 spec->multiout.dac_nids[i]));
15922 nid_s = alc861vd_idx_to_mixer_switch(
15924 spec->multiout.dac_nids[i]));
15928 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
15930 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
15934 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
15936 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
15940 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
15942 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
15946 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
15948 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
15954 if (cfg->line_outs == 1 &&
15955 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
15962 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
15963 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
15967 if (cfg->line_outs == 1 &&
15968 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
15970 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
15971 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
15980 /* add playback controls for speaker and HP outputs */
15981 /* Based on ALC880 version. But ALC861VD has separate,
15982 * different NIDs for mute/unmute switch and volume control */
15983 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
15984 hda_nid_t pin, const char *pfx)
15986 hda_nid_t nid_v, nid_s;
15992 if (alc880_is_fixed_pin(pin)) {
15993 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
15994 /* specify the DAC as the extra output */
15995 if (!spec->multiout.hp_nid)
15996 spec->multiout.hp_nid = nid_v;
15998 spec->multiout.extra_out_nid[0] = nid_v;
15999 /* control HP volume/switch on the output mixer amp */
16000 nid_v = alc861vd_idx_to_mixer_vol(
16001 alc880_fixed_pin_idx(pin));
16002 nid_s = alc861vd_idx_to_mixer_switch(
16003 alc880_fixed_pin_idx(pin));
16005 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
16006 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
16009 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
16010 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
16013 } else if (alc880_is_multi_pin(pin)) {
16014 /* set manual connection */
16015 /* we have only a switch on HP-out PIN */
16016 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
16017 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
16024 /* parse the BIOS configuration and set up the alc_spec
16025 * return 1 if successful, 0 if the proper config is not found,
16026 * or a negative error code
16027 * Based on ALC880 version - had to change it to override
16028 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
16029 static int alc861vd_parse_auto_config(struct hda_codec *codec)
16031 struct alc_spec *spec = codec->spec;
16033 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
16035 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16039 if (!spec->autocfg.line_outs)
16040 return 0; /* can't find valid BIOS pin config */
16042 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
16045 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
16048 err = alc861vd_auto_create_extra_out(spec,
16049 spec->autocfg.speaker_pins[0],
16053 err = alc861vd_auto_create_extra_out(spec,
16054 spec->autocfg.hp_pins[0],
16058 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
16062 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16064 if (spec->autocfg.dig_outs)
16065 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
16067 if (spec->kctls.list)
16068 add_mixer(spec, spec->kctls.list);
16070 add_verb(spec, alc861vd_volume_init_verbs);
16072 spec->num_mux_defs = 1;
16073 spec->input_mux = &spec->private_imux[0];
16075 err = alc_auto_add_mic_boost(codec);
16079 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
16084 /* additional initialization for auto-configuration model */
16085 static void alc861vd_auto_init(struct hda_codec *codec)
16087 struct alc_spec *spec = codec->spec;
16088 alc861vd_auto_init_multi_out(codec);
16089 alc861vd_auto_init_hp_out(codec);
16090 alc861vd_auto_init_analog_input(codec);
16091 alc861vd_auto_init_input_src(codec);
16092 if (spec->unsol_event)
16093 alc_inithook(codec);
16097 ALC660VD_FIX_ASUS_GPIO1
16101 static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = {
16102 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
16103 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
16104 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
16108 static const struct alc_fixup alc861vd_fixups[] = {
16109 [ALC660VD_FIX_ASUS_GPIO1] = {
16110 .verbs = alc660vd_fix_asus_gpio1_verbs,
16114 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
16115 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
16119 static int patch_alc861vd(struct hda_codec *codec)
16121 struct alc_spec *spec;
16122 int err, board_config;
16124 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16128 codec->spec = spec;
16130 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
16134 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
16135 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
16137 board_config = ALC861VD_AUTO;
16140 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups);
16142 if (board_config == ALC861VD_AUTO) {
16143 /* automatic parse from the BIOS config */
16144 err = alc861vd_parse_auto_config(codec);
16150 "hda_codec: Cannot set up configuration "
16151 "from BIOS. Using base mode...\n");
16152 board_config = ALC861VD_3ST;
16156 err = snd_hda_attach_beep_device(codec, 0x23);
16162 if (board_config != ALC861VD_AUTO)
16163 setup_preset(codec, &alc861vd_presets[board_config]);
16165 if (codec->vendor_id == 0x10ec0660) {
16166 /* always turn on EAPD */
16167 add_verb(spec, alc660vd_eapd_verbs);
16170 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
16171 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
16173 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
16174 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
16176 if (!spec->adc_nids) {
16177 spec->adc_nids = alc861vd_adc_nids;
16178 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
16180 if (!spec->capsrc_nids)
16181 spec->capsrc_nids = alc861vd_capsrc_nids;
16183 set_capture_mixer(codec);
16184 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
16186 spec->vmaster_nid = 0x02;
16188 codec->patch_ops = alc_patch_ops;
16190 if (board_config == ALC861VD_AUTO)
16191 spec->init_hook = alc861vd_auto_init;
16192 #ifdef CONFIG_SND_HDA_POWER_SAVE
16193 if (!spec->loopback.amplist)
16194 spec->loopback.amplist = alc861vd_loopbacks;
16203 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
16204 * configuration. Each pin widget can choose any input DACs and a mixer.
16205 * Each ADC is connected from a mixer of all inputs. This makes possible
16206 * 6-channel independent captures.
16208 * In addition, an independent DAC for the multi-playback (not used in this
16211 #define ALC662_DIGOUT_NID 0x06
16212 #define ALC662_DIGIN_NID 0x0a
16214 static hda_nid_t alc662_dac_nids[4] = {
16215 /* front, rear, clfe, rear_surr */
16219 static hda_nid_t alc272_dac_nids[2] = {
16223 static hda_nid_t alc662_adc_nids[2] = {
16228 static hda_nid_t alc272_adc_nids[1] = {
16233 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
16234 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
16238 /* FIXME: should be a matrix-type input source selection */
16239 static struct hda_input_mux alc662_capture_source = {
16243 { "Front Mic", 0x1 },
16249 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
16257 static struct hda_input_mux alc663_capture_source = {
16261 { "Front Mic", 0x1 },
16266 #if 0 /* set to 1 for testing other input sources below */
16267 static struct hda_input_mux alc272_nc10_capture_source = {
16270 { "Autoselect Mic", 0x0 },
16271 { "Internal Mic", 0x1 },
16272 { "In-0x02", 0x2 },
16273 { "In-0x03", 0x3 },
16274 { "In-0x04", 0x4 },
16275 { "In-0x05", 0x5 },
16276 { "In-0x06", 0x6 },
16277 { "In-0x07", 0x7 },
16278 { "In-0x08", 0x8 },
16279 { "In-0x09", 0x9 },
16280 { "In-0x0a", 0x0a },
16281 { "In-0x0b", 0x0b },
16282 { "In-0x0c", 0x0c },
16283 { "In-0x0d", 0x0d },
16284 { "In-0x0e", 0x0e },
16285 { "In-0x0f", 0x0f },
16293 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
16300 static struct hda_verb alc662_3ST_ch2_init[] = {
16301 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
16302 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
16303 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
16304 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
16311 static struct hda_verb alc662_3ST_ch6_init[] = {
16312 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16313 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
16314 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
16315 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16316 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
16317 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
16321 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
16322 { 2, alc662_3ST_ch2_init },
16323 { 6, alc662_3ST_ch6_init },
16329 static struct hda_verb alc662_sixstack_ch6_init[] = {
16330 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16331 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16332 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16339 static struct hda_verb alc662_sixstack_ch8_init[] = {
16340 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16341 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16342 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16346 static struct hda_channel_mode alc662_5stack_modes[2] = {
16347 { 2, alc662_sixstack_ch6_init },
16348 { 6, alc662_sixstack_ch8_init },
16351 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16352 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16355 static struct snd_kcontrol_new alc662_base_mixer[] = {
16356 /* output mixer control */
16357 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
16358 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16359 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
16360 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16361 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16362 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16363 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16364 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16365 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16367 /*Input mixer control */
16368 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
16369 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
16370 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
16371 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
16372 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
16373 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
16374 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
16375 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
16379 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
16380 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16381 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16382 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16383 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16384 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16385 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16386 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16387 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16388 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16389 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16390 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16394 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
16395 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16396 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16397 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16398 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16399 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16400 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16401 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16402 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16403 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16404 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16405 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16406 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16407 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16408 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16409 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16410 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16411 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16415 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
16416 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16417 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
16418 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16419 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
16420 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16421 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16422 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16423 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16424 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16428 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
16429 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16430 ALC262_HIPPO_MASTER_SWITCH,
16432 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
16433 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16434 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16436 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16437 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16438 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16442 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
16443 ALC262_HIPPO_MASTER_SWITCH,
16444 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16445 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16446 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16447 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16448 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
16449 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16450 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16451 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16452 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16456 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
16457 .ops = &snd_hda_bind_vol,
16459 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16460 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
16465 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
16466 .ops = &snd_hda_bind_sw,
16468 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16469 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16474 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
16475 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16476 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
16477 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16478 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16482 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
16483 .ops = &snd_hda_bind_sw,
16485 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16486 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16487 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16492 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
16493 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16494 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
16495 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16496 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16497 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16498 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16503 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
16504 .ops = &snd_hda_bind_sw,
16506 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16507 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16508 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16513 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
16514 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16515 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
16516 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16517 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16518 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16519 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16523 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
16524 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16525 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16526 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16527 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16528 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16529 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16530 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16534 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
16535 .ops = &snd_hda_bind_vol,
16537 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16538 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
16543 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
16544 .ops = &snd_hda_bind_sw,
16546 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16547 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
16552 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
16553 HDA_BIND_VOL("Master Playback Volume",
16554 &alc663_asus_two_bind_master_vol),
16555 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16556 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16557 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16558 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16559 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16563 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
16564 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16565 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16566 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16567 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16568 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16569 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16573 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
16574 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16575 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16576 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16577 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16578 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16580 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16581 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16582 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16583 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16587 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
16588 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16589 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16590 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16592 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16593 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16594 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16595 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16596 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16597 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16601 static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
16602 .ops = &snd_hda_bind_sw,
16604 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16605 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16606 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16607 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16608 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16613 static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
16614 .ops = &snd_hda_bind_sw,
16616 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16617 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16622 static struct snd_kcontrol_new alc663_mode7_mixer[] = {
16623 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16624 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16625 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16626 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16627 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16628 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16629 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16630 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16631 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16635 static struct snd_kcontrol_new alc663_mode8_mixer[] = {
16636 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16637 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16638 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16639 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16640 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16641 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16642 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16647 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
16649 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16650 .name = "Channel Mode",
16651 .info = alc_ch_mode_info,
16652 .get = alc_ch_mode_get,
16653 .put = alc_ch_mode_put,
16658 static struct hda_verb alc662_init_verbs[] = {
16659 /* ADC: mute amp left and right */
16660 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16661 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16663 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16664 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16665 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16666 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16667 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16668 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16670 /* Front Pin: output 0 (0x0c) */
16671 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16672 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16674 /* Rear Pin: output 1 (0x0d) */
16675 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16676 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16678 /* CLFE Pin: output 2 (0x0e) */
16679 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16680 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16682 /* Mic (rear) pin: input vref at 80% */
16683 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16684 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16685 /* Front Mic pin: input vref at 80% */
16686 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16687 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16688 /* Line In pin: input */
16689 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16690 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16691 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16692 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16693 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16694 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16695 /* CD pin widget for input */
16696 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16698 /* FIXME: use matrix-type input source selection */
16699 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16701 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16702 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16704 /* always trun on EAPD */
16705 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16706 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16711 static struct hda_verb alc663_init_verbs[] = {
16712 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16713 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16714 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16715 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16716 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16717 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16721 static struct hda_verb alc272_init_verbs[] = {
16722 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16723 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16724 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16725 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16726 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16727 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16728 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16729 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16733 static struct hda_verb alc662_sue_init_verbs[] = {
16734 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16735 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16739 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
16740 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16741 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16745 /* Set Unsolicited Event*/
16746 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
16747 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16748 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16752 static struct hda_verb alc663_m51va_init_verbs[] = {
16753 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16754 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16755 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16756 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16757 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16758 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16759 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16760 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16761 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16765 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
16766 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16767 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16768 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16769 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16770 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16771 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16772 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16776 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
16777 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16778 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16779 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16780 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16781 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16782 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16783 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16784 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16788 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
16789 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16790 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16791 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16792 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16793 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16794 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16795 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16799 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
16800 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16801 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16802 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16803 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16804 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16805 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16806 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16807 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16808 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16809 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16810 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16811 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16815 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
16816 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16817 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16818 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16819 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16820 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16821 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16822 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16823 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16824 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16825 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16826 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16827 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16831 static struct hda_verb alc663_g71v_init_verbs[] = {
16832 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16833 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
16834 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
16836 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16837 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16838 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16840 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16841 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
16842 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16846 static struct hda_verb alc663_g50v_init_verbs[] = {
16847 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16848 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16849 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16851 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16852 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16856 static struct hda_verb alc662_ecs_init_verbs[] = {
16857 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
16858 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16859 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16860 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16864 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
16865 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16866 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16867 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16868 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16869 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16870 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16871 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16872 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16873 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16874 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16875 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16879 static struct hda_verb alc272_dell_init_verbs[] = {
16880 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16881 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16882 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16883 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16884 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16885 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16886 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16887 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16888 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16889 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16890 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16894 static struct hda_verb alc663_mode7_init_verbs[] = {
16895 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16896 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16897 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16898 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16899 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16900 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16901 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
16902 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16903 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16904 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16905 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16906 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16907 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16908 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16909 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16913 static struct hda_verb alc663_mode8_init_verbs[] = {
16914 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16915 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16916 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16917 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
16918 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16919 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16920 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16921 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16922 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16923 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16924 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16925 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16926 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16927 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16928 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16929 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16933 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
16934 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
16935 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
16939 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
16940 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
16941 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
16945 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
16947 unsigned int present;
16948 unsigned char bits;
16950 present = snd_hda_jack_detect(codec, 0x14);
16951 bits = present ? HDA_AMP_MUTE : 0;
16953 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16954 HDA_AMP_MUTE, bits);
16957 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
16959 unsigned int present;
16960 unsigned char bits;
16962 present = snd_hda_jack_detect(codec, 0x1b);
16963 bits = present ? HDA_AMP_MUTE : 0;
16965 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16966 HDA_AMP_MUTE, bits);
16967 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16968 HDA_AMP_MUTE, bits);
16971 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
16974 if ((res >> 26) == ALC880_HP_EVENT)
16975 alc662_lenovo_101e_all_automute(codec);
16976 if ((res >> 26) == ALC880_FRONT_EVENT)
16977 alc662_lenovo_101e_ispeaker_automute(codec);
16980 /* unsolicited event for HP jack sensing */
16981 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
16984 if ((res >> 26) == ALC880_MIC_EVENT)
16985 alc_mic_automute(codec);
16987 alc262_hippo_unsol_event(codec, res);
16990 static void alc662_eeepc_setup(struct hda_codec *codec)
16992 struct alc_spec *spec = codec->spec;
16994 alc262_hippo1_setup(codec);
16995 spec->ext_mic.pin = 0x18;
16996 spec->ext_mic.mux_idx = 0;
16997 spec->int_mic.pin = 0x19;
16998 spec->int_mic.mux_idx = 1;
16999 spec->auto_mic = 1;
17002 static void alc662_eeepc_inithook(struct hda_codec *codec)
17004 alc262_hippo_automute(codec);
17005 alc_mic_automute(codec);
17008 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
17010 struct alc_spec *spec = codec->spec;
17012 spec->autocfg.hp_pins[0] = 0x14;
17013 spec->autocfg.speaker_pins[0] = 0x1b;
17016 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
17018 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
17020 unsigned int present;
17021 unsigned char bits;
17023 present = snd_hda_jack_detect(codec, 0x21);
17024 bits = present ? HDA_AMP_MUTE : 0;
17025 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17026 AMP_IN_MUTE(0), bits);
17027 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17028 AMP_IN_MUTE(0), bits);
17031 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
17033 unsigned int present;
17034 unsigned char bits;
17036 present = snd_hda_jack_detect(codec, 0x21);
17037 bits = present ? HDA_AMP_MUTE : 0;
17038 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17039 AMP_IN_MUTE(0), bits);
17040 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17041 AMP_IN_MUTE(0), bits);
17042 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
17043 AMP_IN_MUTE(0), bits);
17044 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
17045 AMP_IN_MUTE(0), bits);
17048 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
17050 unsigned int present;
17051 unsigned char bits;
17053 present = snd_hda_jack_detect(codec, 0x15);
17054 bits = present ? HDA_AMP_MUTE : 0;
17055 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17056 AMP_IN_MUTE(0), bits);
17057 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17058 AMP_IN_MUTE(0), bits);
17059 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
17060 AMP_IN_MUTE(0), bits);
17061 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
17062 AMP_IN_MUTE(0), bits);
17065 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
17067 unsigned int present;
17068 unsigned char bits;
17070 present = snd_hda_jack_detect(codec, 0x1b);
17071 bits = present ? 0 : PIN_OUT;
17072 snd_hda_codec_write(codec, 0x14, 0,
17073 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
17076 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
17078 unsigned int present1, present2;
17080 present1 = snd_hda_jack_detect(codec, 0x21);
17081 present2 = snd_hda_jack_detect(codec, 0x15);
17083 if (present1 || present2) {
17084 snd_hda_codec_write_cache(codec, 0x14, 0,
17085 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17087 snd_hda_codec_write_cache(codec, 0x14, 0,
17088 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17092 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
17094 unsigned int present1, present2;
17096 present1 = snd_hda_jack_detect(codec, 0x1b);
17097 present2 = snd_hda_jack_detect(codec, 0x15);
17099 if (present1 || present2) {
17100 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17101 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
17102 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17103 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
17105 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17106 AMP_IN_MUTE(0), 0);
17107 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17108 AMP_IN_MUTE(0), 0);
17112 static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
17114 unsigned int present1, present2;
17116 present1 = snd_hda_codec_read(codec, 0x1b, 0,
17117 AC_VERB_GET_PIN_SENSE, 0)
17118 & AC_PINSENSE_PRESENCE;
17119 present2 = snd_hda_codec_read(codec, 0x21, 0,
17120 AC_VERB_GET_PIN_SENSE, 0)
17121 & AC_PINSENSE_PRESENCE;
17123 if (present1 || present2) {
17124 snd_hda_codec_write_cache(codec, 0x14, 0,
17125 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17126 snd_hda_codec_write_cache(codec, 0x17, 0,
17127 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17129 snd_hda_codec_write_cache(codec, 0x14, 0,
17130 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17131 snd_hda_codec_write_cache(codec, 0x17, 0,
17132 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17136 static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
17138 unsigned int present1, present2;
17140 present1 = snd_hda_codec_read(codec, 0x21, 0,
17141 AC_VERB_GET_PIN_SENSE, 0)
17142 & AC_PINSENSE_PRESENCE;
17143 present2 = snd_hda_codec_read(codec, 0x15, 0,
17144 AC_VERB_GET_PIN_SENSE, 0)
17145 & AC_PINSENSE_PRESENCE;
17147 if (present1 || present2) {
17148 snd_hda_codec_write_cache(codec, 0x14, 0,
17149 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17150 snd_hda_codec_write_cache(codec, 0x17, 0,
17151 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17153 snd_hda_codec_write_cache(codec, 0x14, 0,
17154 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17155 snd_hda_codec_write_cache(codec, 0x17, 0,
17156 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17160 static void alc663_m51va_unsol_event(struct hda_codec *codec,
17163 switch (res >> 26) {
17164 case ALC880_HP_EVENT:
17165 alc663_m51va_speaker_automute(codec);
17167 case ALC880_MIC_EVENT:
17168 alc_mic_automute(codec);
17173 static void alc663_m51va_setup(struct hda_codec *codec)
17175 struct alc_spec *spec = codec->spec;
17176 spec->ext_mic.pin = 0x18;
17177 spec->ext_mic.mux_idx = 0;
17178 spec->int_mic.pin = 0x12;
17179 spec->int_mic.mux_idx = 9;
17180 spec->auto_mic = 1;
17183 static void alc663_m51va_inithook(struct hda_codec *codec)
17185 alc663_m51va_speaker_automute(codec);
17186 alc_mic_automute(codec);
17189 /* ***************** Mode1 ******************************/
17190 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
17192 static void alc663_mode1_setup(struct hda_codec *codec)
17194 struct alc_spec *spec = codec->spec;
17195 spec->ext_mic.pin = 0x18;
17196 spec->ext_mic.mux_idx = 0;
17197 spec->int_mic.pin = 0x19;
17198 spec->int_mic.mux_idx = 1;
17199 spec->auto_mic = 1;
17202 #define alc663_mode1_inithook alc663_m51va_inithook
17204 /* ***************** Mode2 ******************************/
17205 static void alc662_mode2_unsol_event(struct hda_codec *codec,
17208 switch (res >> 26) {
17209 case ALC880_HP_EVENT:
17210 alc662_f5z_speaker_automute(codec);
17212 case ALC880_MIC_EVENT:
17213 alc_mic_automute(codec);
17218 #define alc662_mode2_setup alc663_mode1_setup
17220 static void alc662_mode2_inithook(struct hda_codec *codec)
17222 alc662_f5z_speaker_automute(codec);
17223 alc_mic_automute(codec);
17225 /* ***************** Mode3 ******************************/
17226 static void alc663_mode3_unsol_event(struct hda_codec *codec,
17229 switch (res >> 26) {
17230 case ALC880_HP_EVENT:
17231 alc663_two_hp_m1_speaker_automute(codec);
17233 case ALC880_MIC_EVENT:
17234 alc_mic_automute(codec);
17239 #define alc663_mode3_setup alc663_mode1_setup
17241 static void alc663_mode3_inithook(struct hda_codec *codec)
17243 alc663_two_hp_m1_speaker_automute(codec);
17244 alc_mic_automute(codec);
17246 /* ***************** Mode4 ******************************/
17247 static void alc663_mode4_unsol_event(struct hda_codec *codec,
17250 switch (res >> 26) {
17251 case ALC880_HP_EVENT:
17252 alc663_21jd_two_speaker_automute(codec);
17254 case ALC880_MIC_EVENT:
17255 alc_mic_automute(codec);
17260 #define alc663_mode4_setup alc663_mode1_setup
17262 static void alc663_mode4_inithook(struct hda_codec *codec)
17264 alc663_21jd_two_speaker_automute(codec);
17265 alc_mic_automute(codec);
17267 /* ***************** Mode5 ******************************/
17268 static void alc663_mode5_unsol_event(struct hda_codec *codec,
17271 switch (res >> 26) {
17272 case ALC880_HP_EVENT:
17273 alc663_15jd_two_speaker_automute(codec);
17275 case ALC880_MIC_EVENT:
17276 alc_mic_automute(codec);
17281 #define alc663_mode5_setup alc663_mode1_setup
17283 static void alc663_mode5_inithook(struct hda_codec *codec)
17285 alc663_15jd_two_speaker_automute(codec);
17286 alc_mic_automute(codec);
17288 /* ***************** Mode6 ******************************/
17289 static void alc663_mode6_unsol_event(struct hda_codec *codec,
17292 switch (res >> 26) {
17293 case ALC880_HP_EVENT:
17294 alc663_two_hp_m2_speaker_automute(codec);
17296 case ALC880_MIC_EVENT:
17297 alc_mic_automute(codec);
17302 #define alc663_mode6_setup alc663_mode1_setup
17304 static void alc663_mode6_inithook(struct hda_codec *codec)
17306 alc663_two_hp_m2_speaker_automute(codec);
17307 alc_mic_automute(codec);
17310 /* ***************** Mode7 ******************************/
17311 static void alc663_mode7_unsol_event(struct hda_codec *codec,
17314 switch (res >> 26) {
17315 case ALC880_HP_EVENT:
17316 alc663_two_hp_m7_speaker_automute(codec);
17318 case ALC880_MIC_EVENT:
17319 alc_mic_automute(codec);
17324 #define alc663_mode7_setup alc663_mode1_setup
17326 static void alc663_mode7_inithook(struct hda_codec *codec)
17328 alc663_two_hp_m7_speaker_automute(codec);
17329 alc_mic_automute(codec);
17332 /* ***************** Mode8 ******************************/
17333 static void alc663_mode8_unsol_event(struct hda_codec *codec,
17336 switch (res >> 26) {
17337 case ALC880_HP_EVENT:
17338 alc663_two_hp_m8_speaker_automute(codec);
17340 case ALC880_MIC_EVENT:
17341 alc_mic_automute(codec);
17346 #define alc663_mode8_setup alc663_m51va_setup
17348 static void alc663_mode8_inithook(struct hda_codec *codec)
17350 alc663_two_hp_m8_speaker_automute(codec);
17351 alc_mic_automute(codec);
17354 static void alc663_g71v_hp_automute(struct hda_codec *codec)
17356 unsigned int present;
17357 unsigned char bits;
17359 present = snd_hda_jack_detect(codec, 0x21);
17360 bits = present ? HDA_AMP_MUTE : 0;
17361 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17362 HDA_AMP_MUTE, bits);
17363 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17364 HDA_AMP_MUTE, bits);
17367 static void alc663_g71v_front_automute(struct hda_codec *codec)
17369 unsigned int present;
17370 unsigned char bits;
17372 present = snd_hda_jack_detect(codec, 0x15);
17373 bits = present ? HDA_AMP_MUTE : 0;
17374 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17375 HDA_AMP_MUTE, bits);
17378 static void alc663_g71v_unsol_event(struct hda_codec *codec,
17381 switch (res >> 26) {
17382 case ALC880_HP_EVENT:
17383 alc663_g71v_hp_automute(codec);
17385 case ALC880_FRONT_EVENT:
17386 alc663_g71v_front_automute(codec);
17388 case ALC880_MIC_EVENT:
17389 alc_mic_automute(codec);
17394 #define alc663_g71v_setup alc663_m51va_setup
17396 static void alc663_g71v_inithook(struct hda_codec *codec)
17398 alc663_g71v_front_automute(codec);
17399 alc663_g71v_hp_automute(codec);
17400 alc_mic_automute(codec);
17403 static void alc663_g50v_unsol_event(struct hda_codec *codec,
17406 switch (res >> 26) {
17407 case ALC880_HP_EVENT:
17408 alc663_m51va_speaker_automute(codec);
17410 case ALC880_MIC_EVENT:
17411 alc_mic_automute(codec);
17416 #define alc663_g50v_setup alc663_m51va_setup
17418 static void alc663_g50v_inithook(struct hda_codec *codec)
17420 alc663_m51va_speaker_automute(codec);
17421 alc_mic_automute(codec);
17424 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
17425 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17426 ALC262_HIPPO_MASTER_SWITCH,
17428 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
17429 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
17430 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
17432 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
17433 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17434 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17438 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
17439 /* Master Playback automatically created from Speaker and Headphone */
17440 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17441 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17442 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17443 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17445 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17446 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17447 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
17449 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17450 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17451 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
17455 #ifdef CONFIG_SND_HDA_POWER_SAVE
17456 #define alc662_loopbacks alc880_loopbacks
17460 /* pcm configuration: identical with ALC880 */
17461 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
17462 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
17463 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
17464 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
17467 * configuration and preset
17469 static const char *alc662_models[ALC662_MODEL_LAST] = {
17470 [ALC662_3ST_2ch_DIG] = "3stack-dig",
17471 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
17472 [ALC662_3ST_6ch] = "3stack-6ch",
17473 [ALC662_5ST_DIG] = "6stack-dig",
17474 [ALC662_LENOVO_101E] = "lenovo-101e",
17475 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
17476 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
17477 [ALC662_ECS] = "ecs",
17478 [ALC663_ASUS_M51VA] = "m51va",
17479 [ALC663_ASUS_G71V] = "g71v",
17480 [ALC663_ASUS_H13] = "h13",
17481 [ALC663_ASUS_G50V] = "g50v",
17482 [ALC663_ASUS_MODE1] = "asus-mode1",
17483 [ALC662_ASUS_MODE2] = "asus-mode2",
17484 [ALC663_ASUS_MODE3] = "asus-mode3",
17485 [ALC663_ASUS_MODE4] = "asus-mode4",
17486 [ALC663_ASUS_MODE5] = "asus-mode5",
17487 [ALC663_ASUS_MODE6] = "asus-mode6",
17488 [ALC663_ASUS_MODE7] = "asus-mode7",
17489 [ALC663_ASUS_MODE8] = "asus-mode8",
17490 [ALC272_DELL] = "dell",
17491 [ALC272_DELL_ZM1] = "dell-zm1",
17492 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
17493 [ALC662_AUTO] = "auto",
17496 static struct snd_pci_quirk alc662_cfg_tbl[] = {
17497 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
17498 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
17499 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
17500 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
17501 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
17502 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1),
17503 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
17504 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
17505 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
17506 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
17507 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
17508 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
17509 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
17510 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
17511 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
17512 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
17513 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
17514 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
17515 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
17516 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
17517 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
17518 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
17519 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
17520 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
17521 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
17522 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
17523 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
17524 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
17525 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
17526 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
17527 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
17528 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
17529 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
17530 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
17531 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
17532 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
17533 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
17534 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
17535 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
17536 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
17537 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
17538 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1),
17539 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
17540 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
17541 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
17542 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
17543 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
17544 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
17545 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
17546 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
17547 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
17548 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
17549 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
17550 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
17551 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
17552 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
17553 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
17554 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
17555 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
17556 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
17557 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
17558 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
17559 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
17560 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
17561 ALC662_3ST_6ch_DIG),
17562 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO),
17563 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
17564 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
17565 ALC662_3ST_6ch_DIG),
17566 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
17567 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
17568 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
17569 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
17570 ALC662_3ST_6ch_DIG),
17571 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
17573 SND_PCI_QUIRK(0x8086, 0xd604, "Intel mobo", ALC662_3ST_2ch_DIG),
17577 static struct alc_config_preset alc662_presets[] = {
17578 [ALC662_3ST_2ch_DIG] = {
17579 .mixers = { alc662_3ST_2ch_mixer },
17580 .init_verbs = { alc662_init_verbs },
17581 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17582 .dac_nids = alc662_dac_nids,
17583 .dig_out_nid = ALC662_DIGOUT_NID,
17584 .dig_in_nid = ALC662_DIGIN_NID,
17585 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17586 .channel_mode = alc662_3ST_2ch_modes,
17587 .input_mux = &alc662_capture_source,
17589 [ALC662_3ST_6ch_DIG] = {
17590 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17591 .init_verbs = { alc662_init_verbs },
17592 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17593 .dac_nids = alc662_dac_nids,
17594 .dig_out_nid = ALC662_DIGOUT_NID,
17595 .dig_in_nid = ALC662_DIGIN_NID,
17596 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17597 .channel_mode = alc662_3ST_6ch_modes,
17599 .input_mux = &alc662_capture_source,
17601 [ALC662_3ST_6ch] = {
17602 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17603 .init_verbs = { alc662_init_verbs },
17604 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17605 .dac_nids = alc662_dac_nids,
17606 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17607 .channel_mode = alc662_3ST_6ch_modes,
17609 .input_mux = &alc662_capture_source,
17611 [ALC662_5ST_DIG] = {
17612 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
17613 .init_verbs = { alc662_init_verbs },
17614 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17615 .dac_nids = alc662_dac_nids,
17616 .dig_out_nid = ALC662_DIGOUT_NID,
17617 .dig_in_nid = ALC662_DIGIN_NID,
17618 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
17619 .channel_mode = alc662_5stack_modes,
17620 .input_mux = &alc662_capture_source,
17622 [ALC662_LENOVO_101E] = {
17623 .mixers = { alc662_lenovo_101e_mixer },
17624 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
17625 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17626 .dac_nids = alc662_dac_nids,
17627 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17628 .channel_mode = alc662_3ST_2ch_modes,
17629 .input_mux = &alc662_lenovo_101e_capture_source,
17630 .unsol_event = alc662_lenovo_101e_unsol_event,
17631 .init_hook = alc662_lenovo_101e_all_automute,
17633 [ALC662_ASUS_EEEPC_P701] = {
17634 .mixers = { alc662_eeepc_p701_mixer },
17635 .init_verbs = { alc662_init_verbs,
17636 alc662_eeepc_sue_init_verbs },
17637 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17638 .dac_nids = alc662_dac_nids,
17639 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17640 .channel_mode = alc662_3ST_2ch_modes,
17641 .unsol_event = alc662_eeepc_unsol_event,
17642 .setup = alc662_eeepc_setup,
17643 .init_hook = alc662_eeepc_inithook,
17645 [ALC662_ASUS_EEEPC_EP20] = {
17646 .mixers = { alc662_eeepc_ep20_mixer,
17647 alc662_chmode_mixer },
17648 .init_verbs = { alc662_init_verbs,
17649 alc662_eeepc_ep20_sue_init_verbs },
17650 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17651 .dac_nids = alc662_dac_nids,
17652 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17653 .channel_mode = alc662_3ST_6ch_modes,
17654 .input_mux = &alc662_lenovo_101e_capture_source,
17655 .unsol_event = alc662_eeepc_unsol_event,
17656 .setup = alc662_eeepc_ep20_setup,
17657 .init_hook = alc662_eeepc_ep20_inithook,
17660 .mixers = { alc662_ecs_mixer },
17661 .init_verbs = { alc662_init_verbs,
17662 alc662_ecs_init_verbs },
17663 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17664 .dac_nids = alc662_dac_nids,
17665 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17666 .channel_mode = alc662_3ST_2ch_modes,
17667 .unsol_event = alc662_eeepc_unsol_event,
17668 .setup = alc662_eeepc_setup,
17669 .init_hook = alc662_eeepc_inithook,
17671 [ALC663_ASUS_M51VA] = {
17672 .mixers = { alc663_m51va_mixer },
17673 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17674 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17675 .dac_nids = alc662_dac_nids,
17676 .dig_out_nid = ALC662_DIGOUT_NID,
17677 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17678 .channel_mode = alc662_3ST_2ch_modes,
17679 .unsol_event = alc663_m51va_unsol_event,
17680 .setup = alc663_m51va_setup,
17681 .init_hook = alc663_m51va_inithook,
17683 [ALC663_ASUS_G71V] = {
17684 .mixers = { alc663_g71v_mixer },
17685 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
17686 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17687 .dac_nids = alc662_dac_nids,
17688 .dig_out_nid = ALC662_DIGOUT_NID,
17689 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17690 .channel_mode = alc662_3ST_2ch_modes,
17691 .unsol_event = alc663_g71v_unsol_event,
17692 .setup = alc663_g71v_setup,
17693 .init_hook = alc663_g71v_inithook,
17695 [ALC663_ASUS_H13] = {
17696 .mixers = { alc663_m51va_mixer },
17697 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17698 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17699 .dac_nids = alc662_dac_nids,
17700 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17701 .channel_mode = alc662_3ST_2ch_modes,
17702 .unsol_event = alc663_m51va_unsol_event,
17703 .init_hook = alc663_m51va_inithook,
17705 [ALC663_ASUS_G50V] = {
17706 .mixers = { alc663_g50v_mixer },
17707 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
17708 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17709 .dac_nids = alc662_dac_nids,
17710 .dig_out_nid = ALC662_DIGOUT_NID,
17711 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17712 .channel_mode = alc662_3ST_6ch_modes,
17713 .input_mux = &alc663_capture_source,
17714 .unsol_event = alc663_g50v_unsol_event,
17715 .setup = alc663_g50v_setup,
17716 .init_hook = alc663_g50v_inithook,
17718 [ALC663_ASUS_MODE1] = {
17719 .mixers = { alc663_m51va_mixer },
17720 .cap_mixer = alc662_auto_capture_mixer,
17721 .init_verbs = { alc662_init_verbs,
17722 alc663_21jd_amic_init_verbs },
17723 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17725 .dac_nids = alc662_dac_nids,
17726 .dig_out_nid = ALC662_DIGOUT_NID,
17727 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17728 .channel_mode = alc662_3ST_2ch_modes,
17729 .unsol_event = alc663_mode1_unsol_event,
17730 .setup = alc663_mode1_setup,
17731 .init_hook = alc663_mode1_inithook,
17733 [ALC662_ASUS_MODE2] = {
17734 .mixers = { alc662_1bjd_mixer },
17735 .cap_mixer = alc662_auto_capture_mixer,
17736 .init_verbs = { alc662_init_verbs,
17737 alc662_1bjd_amic_init_verbs },
17738 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17739 .dac_nids = alc662_dac_nids,
17740 .dig_out_nid = ALC662_DIGOUT_NID,
17741 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17742 .channel_mode = alc662_3ST_2ch_modes,
17743 .unsol_event = alc662_mode2_unsol_event,
17744 .setup = alc662_mode2_setup,
17745 .init_hook = alc662_mode2_inithook,
17747 [ALC663_ASUS_MODE3] = {
17748 .mixers = { alc663_two_hp_m1_mixer },
17749 .cap_mixer = alc662_auto_capture_mixer,
17750 .init_verbs = { alc662_init_verbs,
17751 alc663_two_hp_amic_m1_init_verbs },
17752 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17754 .dac_nids = alc662_dac_nids,
17755 .dig_out_nid = ALC662_DIGOUT_NID,
17756 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17757 .channel_mode = alc662_3ST_2ch_modes,
17758 .unsol_event = alc663_mode3_unsol_event,
17759 .setup = alc663_mode3_setup,
17760 .init_hook = alc663_mode3_inithook,
17762 [ALC663_ASUS_MODE4] = {
17763 .mixers = { alc663_asus_21jd_clfe_mixer },
17764 .cap_mixer = alc662_auto_capture_mixer,
17765 .init_verbs = { alc662_init_verbs,
17766 alc663_21jd_amic_init_verbs},
17767 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17769 .dac_nids = alc662_dac_nids,
17770 .dig_out_nid = ALC662_DIGOUT_NID,
17771 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17772 .channel_mode = alc662_3ST_2ch_modes,
17773 .unsol_event = alc663_mode4_unsol_event,
17774 .setup = alc663_mode4_setup,
17775 .init_hook = alc663_mode4_inithook,
17777 [ALC663_ASUS_MODE5] = {
17778 .mixers = { alc663_asus_15jd_clfe_mixer },
17779 .cap_mixer = alc662_auto_capture_mixer,
17780 .init_verbs = { alc662_init_verbs,
17781 alc663_15jd_amic_init_verbs },
17782 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17784 .dac_nids = alc662_dac_nids,
17785 .dig_out_nid = ALC662_DIGOUT_NID,
17786 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17787 .channel_mode = alc662_3ST_2ch_modes,
17788 .unsol_event = alc663_mode5_unsol_event,
17789 .setup = alc663_mode5_setup,
17790 .init_hook = alc663_mode5_inithook,
17792 [ALC663_ASUS_MODE6] = {
17793 .mixers = { alc663_two_hp_m2_mixer },
17794 .cap_mixer = alc662_auto_capture_mixer,
17795 .init_verbs = { alc662_init_verbs,
17796 alc663_two_hp_amic_m2_init_verbs },
17797 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17799 .dac_nids = alc662_dac_nids,
17800 .dig_out_nid = ALC662_DIGOUT_NID,
17801 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17802 .channel_mode = alc662_3ST_2ch_modes,
17803 .unsol_event = alc663_mode6_unsol_event,
17804 .setup = alc663_mode6_setup,
17805 .init_hook = alc663_mode6_inithook,
17807 [ALC663_ASUS_MODE7] = {
17808 .mixers = { alc663_mode7_mixer },
17809 .cap_mixer = alc662_auto_capture_mixer,
17810 .init_verbs = { alc662_init_verbs,
17811 alc663_mode7_init_verbs },
17812 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17814 .dac_nids = alc662_dac_nids,
17815 .dig_out_nid = ALC662_DIGOUT_NID,
17816 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17817 .channel_mode = alc662_3ST_2ch_modes,
17818 .unsol_event = alc663_mode7_unsol_event,
17819 .setup = alc663_mode7_setup,
17820 .init_hook = alc663_mode7_inithook,
17822 [ALC663_ASUS_MODE8] = {
17823 .mixers = { alc663_mode8_mixer },
17824 .cap_mixer = alc662_auto_capture_mixer,
17825 .init_verbs = { alc662_init_verbs,
17826 alc663_mode8_init_verbs },
17827 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17829 .dac_nids = alc662_dac_nids,
17830 .dig_out_nid = ALC662_DIGOUT_NID,
17831 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17832 .channel_mode = alc662_3ST_2ch_modes,
17833 .unsol_event = alc663_mode8_unsol_event,
17834 .setup = alc663_mode8_setup,
17835 .init_hook = alc663_mode8_inithook,
17838 .mixers = { alc663_m51va_mixer },
17839 .cap_mixer = alc272_auto_capture_mixer,
17840 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
17841 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17842 .dac_nids = alc662_dac_nids,
17843 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17844 .adc_nids = alc272_adc_nids,
17845 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
17846 .capsrc_nids = alc272_capsrc_nids,
17847 .channel_mode = alc662_3ST_2ch_modes,
17848 .unsol_event = alc663_m51va_unsol_event,
17849 .setup = alc663_m51va_setup,
17850 .init_hook = alc663_m51va_inithook,
17852 [ALC272_DELL_ZM1] = {
17853 .mixers = { alc663_m51va_mixer },
17854 .cap_mixer = alc662_auto_capture_mixer,
17855 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
17856 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17857 .dac_nids = alc662_dac_nids,
17858 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17859 .adc_nids = alc662_adc_nids,
17861 .capsrc_nids = alc662_capsrc_nids,
17862 .channel_mode = alc662_3ST_2ch_modes,
17863 .unsol_event = alc663_m51va_unsol_event,
17864 .setup = alc663_m51va_setup,
17865 .init_hook = alc663_m51va_inithook,
17867 [ALC272_SAMSUNG_NC10] = {
17868 .mixers = { alc272_nc10_mixer },
17869 .init_verbs = { alc662_init_verbs,
17870 alc663_21jd_amic_init_verbs },
17871 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17872 .dac_nids = alc272_dac_nids,
17873 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17874 .channel_mode = alc662_3ST_2ch_modes,
17875 /*.input_mux = &alc272_nc10_capture_source,*/
17876 .unsol_event = alc663_mode4_unsol_event,
17877 .setup = alc663_mode4_setup,
17878 .init_hook = alc663_mode4_inithook,
17884 * BIOS auto configuration
17887 /* convert from MIX nid to DAC */
17888 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
17892 else if (nid >= 0x0c && nid <= 0x0e)
17893 return nid - 0x0c + 0x02;
17898 /* get MIX nid connected to the given pin targeted to DAC */
17899 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
17905 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
17906 for (i = 0; i < num; i++) {
17907 if (alc662_mix_to_dac(mix[i]) == dac)
17913 /* look for an empty DAC slot */
17914 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
17916 struct alc_spec *spec = codec->spec;
17920 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
17923 for (i = 0; i < num; i++) {
17924 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
17927 for (j = 0; j < spec->multiout.num_dacs; j++)
17928 if (spec->multiout.dac_nids[j] == nid)
17930 if (j >= spec->multiout.num_dacs)
17936 /* fill in the dac_nids table from the parsed pin configuration */
17937 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
17938 const struct auto_pin_cfg *cfg)
17940 struct alc_spec *spec = codec->spec;
17944 spec->multiout.dac_nids = spec->private_dac_nids;
17945 for (i = 0; i < cfg->line_outs; i++) {
17946 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
17949 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
17954 static inline int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
17955 hda_nid_t nid, unsigned int chs)
17957 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
17958 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
17961 static inline int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
17962 hda_nid_t nid, unsigned int chs)
17964 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17965 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
17968 #define alc662_add_stereo_vol(spec, pfx, nid) \
17969 alc662_add_vol_ctl(spec, pfx, nid, 3)
17970 #define alc662_add_stereo_sw(spec, pfx, nid) \
17971 alc662_add_sw_ctl(spec, pfx, nid, 3)
17973 /* add playback controls from the parsed DAC table */
17974 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
17975 const struct auto_pin_cfg *cfg)
17977 struct alc_spec *spec = codec->spec;
17978 static const char *chname[4] = {
17979 "Front", "Surround", NULL /*CLFE*/, "Side"
17981 hda_nid_t nid, mix;
17984 for (i = 0; i < cfg->line_outs; i++) {
17985 nid = spec->multiout.dac_nids[i];
17988 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
17993 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
17996 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
17999 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
18002 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
18007 if (cfg->line_outs == 1 &&
18008 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
18015 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
18018 if (cfg->line_outs == 1 &&
18019 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
18021 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
18029 /* add playback controls for speaker and HP outputs */
18030 /* return DAC nid if any new DAC is assigned */
18031 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
18034 struct alc_spec *spec = codec->spec;
18035 hda_nid_t nid, mix;
18040 nid = alc662_look_for_dac(codec, pin);
18042 /* the corresponding DAC is already occupied */
18043 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
18044 return 0; /* no way */
18045 /* create a switch only */
18046 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
18047 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
18050 mix = alc662_dac_to_mix(codec, pin, nid);
18053 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
18056 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
18062 /* create playback/capture controls for input pins */
18063 #define alc662_auto_create_input_ctls \
18064 alc882_auto_create_input_ctls
18066 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
18067 hda_nid_t nid, int pin_type,
18073 alc_set_pin_output(codec, nid, pin_type);
18074 /* need the manual connection? */
18075 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
18078 for (i = 0; i < num; i++) {
18079 if (alc662_mix_to_dac(srcs[i]) != dac)
18081 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
18086 static void alc662_auto_init_multi_out(struct hda_codec *codec)
18088 struct alc_spec *spec = codec->spec;
18089 int pin_type = get_pin_type(spec->autocfg.line_out_type);
18092 for (i = 0; i <= HDA_SIDE; i++) {
18093 hda_nid_t nid = spec->autocfg.line_out_pins[i];
18095 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
18096 spec->multiout.dac_nids[i]);
18100 static void alc662_auto_init_hp_out(struct hda_codec *codec)
18102 struct alc_spec *spec = codec->spec;
18105 pin = spec->autocfg.hp_pins[0];
18107 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
18108 spec->multiout.hp_nid);
18109 pin = spec->autocfg.speaker_pins[0];
18111 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
18112 spec->multiout.extra_out_nid[0]);
18115 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
18117 static void alc662_auto_init_analog_input(struct hda_codec *codec)
18119 struct alc_spec *spec = codec->spec;
18122 for (i = 0; i < AUTO_PIN_LAST; i++) {
18123 hda_nid_t nid = spec->autocfg.input_pins[i];
18124 if (alc_is_input_pin(codec, nid)) {
18125 alc_set_input_pin(codec, nid, i);
18126 if (nid != ALC662_PIN_CD_NID &&
18127 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
18128 snd_hda_codec_write(codec, nid, 0,
18129 AC_VERB_SET_AMP_GAIN_MUTE,
18135 #define alc662_auto_init_input_src alc882_auto_init_input_src
18137 static int alc662_parse_auto_config(struct hda_codec *codec)
18139 struct alc_spec *spec = codec->spec;
18141 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
18143 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
18147 if (!spec->autocfg.line_outs)
18148 return 0; /* can't find valid BIOS pin config */
18150 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
18153 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
18156 err = alc662_auto_create_extra_out(codec,
18157 spec->autocfg.speaker_pins[0],
18162 spec->multiout.extra_out_nid[0] = err;
18163 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
18168 spec->multiout.hp_nid = err;
18169 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
18173 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
18175 if (spec->autocfg.dig_outs)
18176 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
18178 if (spec->kctls.list)
18179 add_mixer(spec, spec->kctls.list);
18181 spec->num_mux_defs = 1;
18182 spec->input_mux = &spec->private_imux[0];
18184 add_verb(spec, alc662_init_verbs);
18185 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
18186 codec->vendor_id == 0x10ec0665)
18187 add_verb(spec, alc663_init_verbs);
18189 if (codec->vendor_id == 0x10ec0272)
18190 add_verb(spec, alc272_init_verbs);
18192 err = alc_auto_add_mic_boost(codec);
18196 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
18201 /* additional initialization for auto-configuration model */
18202 static void alc662_auto_init(struct hda_codec *codec)
18204 struct alc_spec *spec = codec->spec;
18205 alc662_auto_init_multi_out(codec);
18206 alc662_auto_init_hp_out(codec);
18207 alc662_auto_init_analog_input(codec);
18208 alc662_auto_init_input_src(codec);
18209 if (spec->unsol_event)
18210 alc_inithook(codec);
18213 static int patch_alc662(struct hda_codec *codec)
18215 struct alc_spec *spec;
18216 int err, board_config;
18218 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
18222 codec->spec = spec;
18224 alc_fix_pll_init(codec, 0x20, 0x04, 15);
18226 if (alc_read_coef_idx(codec, 0)==0x8020){
18227 kfree(codec->chip_name);
18228 codec->chip_name = kstrdup("ALC661", GFP_KERNEL);
18229 if (!codec->chip_name) {
18235 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
18238 if (board_config < 0) {
18239 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
18241 board_config = ALC662_AUTO;
18244 if (board_config == ALC662_AUTO) {
18245 /* automatic parse from the BIOS config */
18246 err = alc662_parse_auto_config(codec);
18252 "hda_codec: Cannot set up configuration "
18253 "from BIOS. Using base mode...\n");
18254 board_config = ALC662_3ST_2ch_DIG;
18258 err = snd_hda_attach_beep_device(codec, 0x1);
18264 if (board_config != ALC662_AUTO)
18265 setup_preset(codec, &alc662_presets[board_config]);
18267 spec->stream_analog_playback = &alc662_pcm_analog_playback;
18268 spec->stream_analog_capture = &alc662_pcm_analog_capture;
18270 spec->stream_digital_playback = &alc662_pcm_digital_playback;
18271 spec->stream_digital_capture = &alc662_pcm_digital_capture;
18273 if (!spec->adc_nids) {
18274 spec->adc_nids = alc662_adc_nids;
18275 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
18277 if (!spec->capsrc_nids)
18278 spec->capsrc_nids = alc662_capsrc_nids;
18280 if (!spec->cap_mixer)
18281 set_capture_mixer(codec);
18283 switch (codec->vendor_id) {
18285 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
18290 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
18293 set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
18296 spec->vmaster_nid = 0x02;
18298 codec->patch_ops = alc_patch_ops;
18299 if (board_config == ALC662_AUTO)
18300 spec->init_hook = alc662_auto_init;
18301 #ifdef CONFIG_SND_HDA_POWER_SAVE
18302 if (!spec->loopback.amplist)
18303 spec->loopback.amplist = alc662_loopbacks;
18309 static int patch_alc888(struct hda_codec *codec)
18311 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
18312 kfree(codec->chip_name);
18313 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
18314 if (!codec->chip_name) {
18318 return patch_alc662(codec);
18320 return patch_alc882(codec);
18326 static struct hda_codec_preset snd_hda_preset_realtek[] = {
18327 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
18328 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
18329 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
18330 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
18331 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
18332 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
18333 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
18334 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
18335 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
18336 .patch = patch_alc861 },
18337 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
18338 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
18339 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
18340 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
18341 .patch = patch_alc882 },
18342 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
18343 .patch = patch_alc662 },
18344 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
18345 { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
18346 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
18347 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
18348 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
18349 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
18350 .patch = patch_alc882 },
18351 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
18352 .patch = patch_alc882 },
18353 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
18354 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
18355 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
18356 .patch = patch_alc882 },
18357 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
18358 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
18359 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
18360 {} /* terminator */
18363 MODULE_ALIAS("snd-hda-codec-id:10ec*");
18365 MODULE_LICENSE("GPL");
18366 MODULE_DESCRIPTION("Realtek HD-audio codec");
18368 static struct hda_codec_preset_list realtek_list = {
18369 .preset = snd_hda_preset_realtek,
18370 .owner = THIS_MODULE,
18373 static int __init patch_realtek_init(void)
18375 return snd_hda_add_codec_preset(&realtek_list);
18378 static void __exit patch_realtek_exit(void)
18380 snd_hda_delete_codec_preset(&realtek_list);
18383 module_init(patch_realtek_init)
18384 module_exit(patch_realtek_exit)