2 * Universal Interface for Intel High Definition Audio Codec
4 * HD audio interface patch for ALC 260/880/882 codecs
6 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
7 * PeiSen Hou <pshou@realtek.com.tw>
8 * Takashi Iwai <tiwai@suse.de>
9 * Jonathan Woithe <jwoithe@physics.adelaide.edu.au>
11 * This driver is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This driver is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include <linux/init.h>
27 #include <linux/delay.h>
28 #include <linux/slab.h>
29 #include <linux/pci.h>
30 #include <sound/core.h>
31 #include "hda_codec.h"
32 #include "hda_local.h"
35 #define ALC880_FRONT_EVENT 0x01
36 #define ALC880_DCVOL_EVENT 0x02
37 #define ALC880_HP_EVENT 0x04
38 #define ALC880_MIC_EVENT 0x08
40 /* ALC880 board config type */
64 #ifdef CONFIG_SND_DEBUG
68 ALC880_MODEL_LAST /* last tag */
82 #ifdef CONFIG_SND_DEBUG
86 ALC260_MODEL_LAST /* last tag */
96 ALC262_HP_BPC_D7000_WL,
97 ALC262_HP_BPC_D7000_WF,
110 ALC262_MODEL_LAST /* last tag */
120 ALC268_ACER_ASPIRE_ONE,
123 #ifdef CONFIG_SND_DEBUG
127 ALC268_MODEL_LAST /* last tag */
141 ALC269_MODEL_LAST /* last tag */
158 /* ALC861-VD models */
180 ALC662_ASUS_EEEPC_P701,
181 ALC662_ASUS_EEEPC_EP20,
223 ALC883_TARGA_2ch_DIG,
224 ALC883_TARGA_8ch_DIG,
227 ALC888_ACER_ASPIRE_4930G,
228 ALC888_ACER_ASPIRE_6530G,
229 ALC888_ACER_ASPIRE_8930G,
230 ALC888_ACER_ASPIRE_7730G,
233 ALC883_MEDION_WIM2160,
235 ALC883_LENOVO_101E_2ch,
236 ALC883_LENOVO_NB0763,
237 ALC888_LENOVO_MS7195_DIG,
245 ALC883_FUJITSU_PI2515,
246 ALC888_FUJITSU_XA3530,
247 ALC883_3ST_6ch_INTEL,
260 #define GPIO_MASK 0x03
262 /* extra amp-initialization sequence types */
271 struct alc_mic_route {
273 unsigned char mux_idx;
274 unsigned char amix_idx;
277 #define MUX_IDX_UNDEF ((unsigned char)-1)
279 struct alc_customize_define {
280 unsigned int sku_cfg;
281 unsigned char port_connectivity;
282 unsigned char check_sum;
283 unsigned char customization;
284 unsigned char external_amp;
285 unsigned int enable_pcbeep:1;
286 unsigned int platform_type:1;
288 unsigned int override:1;
292 /* codec parameterization */
293 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
294 unsigned int num_mixers;
295 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
296 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
298 const struct hda_verb *init_verbs[10]; /* initialization verbs
302 unsigned int num_init_verbs;
304 char stream_name_analog[32]; /* analog PCM stream */
305 struct hda_pcm_stream *stream_analog_playback;
306 struct hda_pcm_stream *stream_analog_capture;
307 struct hda_pcm_stream *stream_analog_alt_playback;
308 struct hda_pcm_stream *stream_analog_alt_capture;
310 char stream_name_digital[32]; /* digital PCM stream */
311 struct hda_pcm_stream *stream_digital_playback;
312 struct hda_pcm_stream *stream_digital_capture;
315 struct hda_multi_out multiout; /* playback set-up
316 * max_channels, dacs must be set
317 * dig_out_nid and hp_nid are optional
319 hda_nid_t alt_dac_nid;
320 hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */
324 unsigned int num_adc_nids;
326 hda_nid_t *capsrc_nids;
327 hda_nid_t dig_in_nid; /* digital-in NID; optional */
330 unsigned int num_mux_defs;
331 const struct hda_input_mux *input_mux;
332 unsigned int cur_mux[3];
333 struct alc_mic_route ext_mic;
334 struct alc_mic_route int_mic;
337 const struct hda_channel_mode *channel_mode;
338 int num_channel_mode;
340 int const_channel_count;
341 int ext_channel_count;
343 /* PCM information */
344 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
346 /* dynamic controls, init_verbs and input_mux */
347 struct auto_pin_cfg autocfg;
348 struct alc_customize_define cdefine;
349 struct snd_array kctls;
350 struct hda_input_mux private_imux[3];
351 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
352 hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS];
353 hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS];
356 void (*init_hook)(struct hda_codec *codec);
357 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
358 #ifdef CONFIG_SND_HDA_POWER_SAVE
359 void (*power_hook)(struct hda_codec *codec);
362 /* for pin sensing */
363 unsigned int sense_updated: 1;
364 unsigned int jack_present: 1;
365 unsigned int master_sw: 1;
366 unsigned int auto_mic:1;
369 unsigned int no_analog :1; /* digital I/O only */
372 /* for virtual master */
373 hda_nid_t vmaster_nid;
374 #ifdef CONFIG_SND_HDA_POWER_SAVE
375 struct hda_loopback_check loopback;
380 unsigned int pll_coef_idx, pll_coef_bit;
384 * configuration template - to be copied to the spec instance
386 struct alc_config_preset {
387 struct snd_kcontrol_new *mixers[5]; /* should be identical size
390 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
391 const struct hda_verb *init_verbs[5];
392 unsigned int num_dacs;
394 hda_nid_t dig_out_nid; /* optional */
395 hda_nid_t hp_nid; /* optional */
396 hda_nid_t *slave_dig_outs;
397 unsigned int num_adc_nids;
399 hda_nid_t *capsrc_nids;
400 hda_nid_t dig_in_nid;
401 unsigned int num_channel_mode;
402 const struct hda_channel_mode *channel_mode;
404 int const_channel_count;
405 unsigned int num_mux_defs;
406 const struct hda_input_mux *input_mux;
407 void (*unsol_event)(struct hda_codec *, unsigned int);
408 void (*setup)(struct hda_codec *);
409 void (*init_hook)(struct hda_codec *);
410 #ifdef CONFIG_SND_HDA_POWER_SAVE
411 struct hda_amp_list *loopbacks;
412 void (*power_hook)(struct hda_codec *codec);
420 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
421 struct snd_ctl_elem_info *uinfo)
423 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
424 struct alc_spec *spec = codec->spec;
425 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
426 if (mux_idx >= spec->num_mux_defs)
428 if (!spec->input_mux[mux_idx].num_items && mux_idx > 0)
430 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
433 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
434 struct snd_ctl_elem_value *ucontrol)
436 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
437 struct alc_spec *spec = codec->spec;
438 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
440 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
444 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
445 struct snd_ctl_elem_value *ucontrol)
447 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
448 struct alc_spec *spec = codec->spec;
449 const struct hda_input_mux *imux;
450 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
451 unsigned int mux_idx;
452 hda_nid_t nid = spec->capsrc_nids ?
453 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
456 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
457 imux = &spec->input_mux[mux_idx];
458 if (!imux->num_items && mux_idx > 0)
459 imux = &spec->input_mux[0];
461 type = get_wcaps_type(get_wcaps(codec, nid));
462 if (type == AC_WID_AUD_MIX) {
463 /* Matrix-mixer style (e.g. ALC882) */
464 unsigned int *cur_val = &spec->cur_mux[adc_idx];
467 idx = ucontrol->value.enumerated.item[0];
468 if (idx >= imux->num_items)
469 idx = imux->num_items - 1;
472 for (i = 0; i < imux->num_items; i++) {
473 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
474 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
475 imux->items[i].index,
481 /* MUX style (e.g. ALC880) */
482 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
483 &spec->cur_mux[adc_idx]);
488 * channel mode setting
490 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
491 struct snd_ctl_elem_info *uinfo)
493 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
494 struct alc_spec *spec = codec->spec;
495 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
496 spec->num_channel_mode);
499 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
500 struct snd_ctl_elem_value *ucontrol)
502 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
503 struct alc_spec *spec = codec->spec;
504 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
505 spec->num_channel_mode,
506 spec->ext_channel_count);
509 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
510 struct snd_ctl_elem_value *ucontrol)
512 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
513 struct alc_spec *spec = codec->spec;
514 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
515 spec->num_channel_mode,
516 &spec->ext_channel_count);
517 if (err >= 0 && !spec->const_channel_count) {
518 spec->multiout.max_channels = spec->ext_channel_count;
519 if (spec->need_dac_fix)
520 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
526 * Control the mode of pin widget settings via the mixer. "pc" is used
527 * instead of "%" to avoid consequences of accidently treating the % as
528 * being part of a format specifier. Maximum allowed length of a value is
529 * 63 characters plus NULL terminator.
531 * Note: some retasking pin complexes seem to ignore requests for input
532 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
533 * are requested. Therefore order this list so that this behaviour will not
534 * cause problems when mixer clients move through the enum sequentially.
535 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
538 static char *alc_pin_mode_names[] = {
539 "Mic 50pc bias", "Mic 80pc bias",
540 "Line in", "Line out", "Headphone out",
542 static unsigned char alc_pin_mode_values[] = {
543 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
545 /* The control can present all 5 options, or it can limit the options based
546 * in the pin being assumed to be exclusively an input or an output pin. In
547 * addition, "input" pins may or may not process the mic bias option
548 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
549 * accept requests for bias as of chip versions up to March 2006) and/or
550 * wiring in the computer.
552 #define ALC_PIN_DIR_IN 0x00
553 #define ALC_PIN_DIR_OUT 0x01
554 #define ALC_PIN_DIR_INOUT 0x02
555 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
556 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
558 /* Info about the pin modes supported by the different pin direction modes.
559 * For each direction the minimum and maximum values are given.
561 static signed char alc_pin_mode_dir_info[5][2] = {
562 { 0, 2 }, /* ALC_PIN_DIR_IN */
563 { 3, 4 }, /* ALC_PIN_DIR_OUT */
564 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
565 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
566 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
568 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
569 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
570 #define alc_pin_mode_n_items(_dir) \
571 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
573 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
574 struct snd_ctl_elem_info *uinfo)
576 unsigned int item_num = uinfo->value.enumerated.item;
577 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
579 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
581 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
583 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
584 item_num = alc_pin_mode_min(dir);
585 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
589 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
590 struct snd_ctl_elem_value *ucontrol)
593 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
594 hda_nid_t nid = kcontrol->private_value & 0xffff;
595 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
596 long *valp = ucontrol->value.integer.value;
597 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
598 AC_VERB_GET_PIN_WIDGET_CONTROL,
601 /* Find enumerated value for current pinctl setting */
602 i = alc_pin_mode_min(dir);
603 while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl)
605 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
609 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
610 struct snd_ctl_elem_value *ucontrol)
613 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
614 hda_nid_t nid = kcontrol->private_value & 0xffff;
615 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
616 long val = *ucontrol->value.integer.value;
617 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
618 AC_VERB_GET_PIN_WIDGET_CONTROL,
621 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
622 val = alc_pin_mode_min(dir);
624 change = pinctl != alc_pin_mode_values[val];
626 /* Set pin mode to that requested */
627 snd_hda_codec_write_cache(codec, nid, 0,
628 AC_VERB_SET_PIN_WIDGET_CONTROL,
629 alc_pin_mode_values[val]);
631 /* Also enable the retasking pin's input/output as required
632 * for the requested pin mode. Enum values of 2 or less are
635 * Dynamically switching the input/output buffers probably
636 * reduces noise slightly (particularly on input) so we'll
637 * do it. However, having both input and output buffers
638 * enabled simultaneously doesn't seem to be problematic if
639 * this turns out to be necessary in the future.
642 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
643 HDA_AMP_MUTE, HDA_AMP_MUTE);
644 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
647 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
648 HDA_AMP_MUTE, HDA_AMP_MUTE);
649 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
656 #define ALC_PIN_MODE(xname, nid, dir) \
657 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
658 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
659 .info = alc_pin_mode_info, \
660 .get = alc_pin_mode_get, \
661 .put = alc_pin_mode_put, \
662 .private_value = nid | (dir<<16) }
664 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
665 * together using a mask with more than one bit set. This control is
666 * currently used only by the ALC260 test model. At this stage they are not
667 * needed for any "production" models.
669 #ifdef CONFIG_SND_DEBUG
670 #define alc_gpio_data_info snd_ctl_boolean_mono_info
672 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
673 struct snd_ctl_elem_value *ucontrol)
675 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
676 hda_nid_t nid = kcontrol->private_value & 0xffff;
677 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
678 long *valp = ucontrol->value.integer.value;
679 unsigned int val = snd_hda_codec_read(codec, nid, 0,
680 AC_VERB_GET_GPIO_DATA, 0x00);
682 *valp = (val & mask) != 0;
685 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
686 struct snd_ctl_elem_value *ucontrol)
689 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
690 hda_nid_t nid = kcontrol->private_value & 0xffff;
691 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
692 long val = *ucontrol->value.integer.value;
693 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
694 AC_VERB_GET_GPIO_DATA,
697 /* Set/unset the masked GPIO bit(s) as needed */
698 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
703 snd_hda_codec_write_cache(codec, nid, 0,
704 AC_VERB_SET_GPIO_DATA, gpio_data);
708 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
709 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
710 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
711 .info = alc_gpio_data_info, \
712 .get = alc_gpio_data_get, \
713 .put = alc_gpio_data_put, \
714 .private_value = nid | (mask<<16) }
715 #endif /* CONFIG_SND_DEBUG */
717 /* A switch control to allow the enabling of the digital IO pins on the
718 * ALC260. This is incredibly simplistic; the intention of this control is
719 * to provide something in the test model allowing digital outputs to be
720 * identified if present. If models are found which can utilise these
721 * outputs a more complete mixer control can be devised for those models if
724 #ifdef CONFIG_SND_DEBUG
725 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
727 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
728 struct snd_ctl_elem_value *ucontrol)
730 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
731 hda_nid_t nid = kcontrol->private_value & 0xffff;
732 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
733 long *valp = ucontrol->value.integer.value;
734 unsigned int val = snd_hda_codec_read(codec, nid, 0,
735 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
737 *valp = (val & mask) != 0;
740 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
741 struct snd_ctl_elem_value *ucontrol)
744 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
745 hda_nid_t nid = kcontrol->private_value & 0xffff;
746 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
747 long val = *ucontrol->value.integer.value;
748 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
749 AC_VERB_GET_DIGI_CONVERT_1,
752 /* Set/unset the masked control bit(s) as needed */
753 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
758 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
763 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
764 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
765 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
766 .info = alc_spdif_ctrl_info, \
767 .get = alc_spdif_ctrl_get, \
768 .put = alc_spdif_ctrl_put, \
769 .private_value = nid | (mask<<16) }
770 #endif /* CONFIG_SND_DEBUG */
772 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
773 * Again, this is only used in the ALC26x test models to help identify when
774 * the EAPD line must be asserted for features to work.
776 #ifdef CONFIG_SND_DEBUG
777 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
779 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
780 struct snd_ctl_elem_value *ucontrol)
782 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
783 hda_nid_t nid = kcontrol->private_value & 0xffff;
784 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
785 long *valp = ucontrol->value.integer.value;
786 unsigned int val = snd_hda_codec_read(codec, nid, 0,
787 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
789 *valp = (val & mask) != 0;
793 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
794 struct snd_ctl_elem_value *ucontrol)
797 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
798 hda_nid_t nid = kcontrol->private_value & 0xffff;
799 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
800 long val = *ucontrol->value.integer.value;
801 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
802 AC_VERB_GET_EAPD_BTLENABLE,
805 /* Set/unset the masked control bit(s) as needed */
806 change = (!val ? 0 : mask) != (ctrl_data & mask);
811 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
817 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
818 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
819 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
820 .info = alc_eapd_ctrl_info, \
821 .get = alc_eapd_ctrl_get, \
822 .put = alc_eapd_ctrl_put, \
823 .private_value = nid | (mask<<16) }
824 #endif /* CONFIG_SND_DEBUG */
827 * set up the input pin config (depending on the given auto-pin type)
829 static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
832 unsigned int val = PIN_IN;
834 if (auto_pin_type <= AUTO_PIN_FRONT_MIC) {
836 pincap = snd_hda_query_pin_caps(codec, nid);
837 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
838 if (pincap & AC_PINCAP_VREF_80)
840 else if (pincap & AC_PINCAP_VREF_50)
842 else if (pincap & AC_PINCAP_VREF_100)
844 else if (pincap & AC_PINCAP_VREF_GRD)
847 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val);
852 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
854 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
856 spec->mixers[spec->num_mixers++] = mix;
859 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
861 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
863 spec->init_verbs[spec->num_init_verbs++] = verb;
867 * set up from the preset table
869 static void setup_preset(struct hda_codec *codec,
870 const struct alc_config_preset *preset)
872 struct alc_spec *spec = codec->spec;
875 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
876 add_mixer(spec, preset->mixers[i]);
877 spec->cap_mixer = preset->cap_mixer;
878 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
880 add_verb(spec, preset->init_verbs[i]);
882 spec->channel_mode = preset->channel_mode;
883 spec->num_channel_mode = preset->num_channel_mode;
884 spec->need_dac_fix = preset->need_dac_fix;
885 spec->const_channel_count = preset->const_channel_count;
887 if (preset->const_channel_count)
888 spec->multiout.max_channels = preset->const_channel_count;
890 spec->multiout.max_channels = spec->channel_mode[0].channels;
891 spec->ext_channel_count = spec->channel_mode[0].channels;
893 spec->multiout.num_dacs = preset->num_dacs;
894 spec->multiout.dac_nids = preset->dac_nids;
895 spec->multiout.dig_out_nid = preset->dig_out_nid;
896 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
897 spec->multiout.hp_nid = preset->hp_nid;
899 spec->num_mux_defs = preset->num_mux_defs;
900 if (!spec->num_mux_defs)
901 spec->num_mux_defs = 1;
902 spec->input_mux = preset->input_mux;
904 spec->num_adc_nids = preset->num_adc_nids;
905 spec->adc_nids = preset->adc_nids;
906 spec->capsrc_nids = preset->capsrc_nids;
907 spec->dig_in_nid = preset->dig_in_nid;
909 spec->unsol_event = preset->unsol_event;
910 spec->init_hook = preset->init_hook;
911 #ifdef CONFIG_SND_HDA_POWER_SAVE
912 spec->power_hook = preset->power_hook;
913 spec->loopback.amplist = preset->loopbacks;
917 preset->setup(codec);
920 /* Enable GPIO mask and set output */
921 static struct hda_verb alc_gpio1_init_verbs[] = {
922 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
923 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
924 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
928 static struct hda_verb alc_gpio2_init_verbs[] = {
929 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
930 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
931 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
935 static struct hda_verb alc_gpio3_init_verbs[] = {
936 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
937 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
938 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
943 * Fix hardware PLL issue
944 * On some codecs, the analog PLL gating control must be off while
945 * the default value is 1.
947 static void alc_fix_pll(struct hda_codec *codec)
949 struct alc_spec *spec = codec->spec;
954 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
956 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
957 AC_VERB_GET_PROC_COEF, 0);
958 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
960 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
961 val & ~(1 << spec->pll_coef_bit));
964 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
965 unsigned int coef_idx, unsigned int coef_bit)
967 struct alc_spec *spec = codec->spec;
969 spec->pll_coef_idx = coef_idx;
970 spec->pll_coef_bit = coef_bit;
974 static void alc_automute_pin(struct hda_codec *codec)
976 struct alc_spec *spec = codec->spec;
977 unsigned int nid = spec->autocfg.hp_pins[0];
982 spec->jack_present = snd_hda_jack_detect(codec, nid);
983 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
984 nid = spec->autocfg.speaker_pins[i];
987 snd_hda_codec_write(codec, nid, 0,
988 AC_VERB_SET_PIN_WIDGET_CONTROL,
989 spec->jack_present ? 0 : PIN_OUT);
993 static int get_connection_index(struct hda_codec *codec, hda_nid_t mux,
996 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
999 nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn));
1000 for (i = 0; i < nums; i++)
1006 static void alc_mic_automute(struct hda_codec *codec)
1008 struct alc_spec *spec = codec->spec;
1009 struct alc_mic_route *dead, *alive;
1010 unsigned int present, type;
1013 if (!spec->auto_mic)
1015 if (!spec->int_mic.pin || !spec->ext_mic.pin)
1017 if (snd_BUG_ON(!spec->adc_nids))
1020 cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0];
1022 present = snd_hda_jack_detect(codec, spec->ext_mic.pin);
1024 alive = &spec->ext_mic;
1025 dead = &spec->int_mic;
1027 alive = &spec->int_mic;
1028 dead = &spec->ext_mic;
1031 type = get_wcaps_type(get_wcaps(codec, cap_nid));
1032 if (type == AC_WID_AUD_MIX) {
1033 /* Matrix-mixer style (e.g. ALC882) */
1034 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1037 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1039 HDA_AMP_MUTE, HDA_AMP_MUTE);
1041 /* MUX style (e.g. ALC880) */
1042 snd_hda_codec_write_cache(codec, cap_nid, 0,
1043 AC_VERB_SET_CONNECT_SEL,
1047 /* FIXME: analog mixer */
1050 /* unsolicited event for HP jack sensing */
1051 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
1053 if (codec->vendor_id == 0x10ec0880)
1058 case ALC880_HP_EVENT:
1059 alc_automute_pin(codec);
1061 case ALC880_MIC_EVENT:
1062 alc_mic_automute(codec);
1067 static void alc_inithook(struct hda_codec *codec)
1069 alc_automute_pin(codec);
1070 alc_mic_automute(codec);
1073 /* additional initialization for ALC888 variants */
1074 static void alc888_coef_init(struct hda_codec *codec)
1078 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
1079 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1080 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1081 if ((tmp & 0xf0) == 0x20)
1083 snd_hda_codec_read(codec, 0x20, 0,
1084 AC_VERB_SET_PROC_COEF, 0x830);
1087 snd_hda_codec_read(codec, 0x20, 0,
1088 AC_VERB_SET_PROC_COEF, 0x3030);
1091 static void alc889_coef_init(struct hda_codec *codec)
1095 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1096 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1097 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1098 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010);
1101 /* turn on/off EAPD control (only if available) */
1102 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
1104 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
1106 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
1107 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
1111 static void alc_auto_init_amp(struct hda_codec *codec, int type)
1116 case ALC_INIT_GPIO1:
1117 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1119 case ALC_INIT_GPIO2:
1120 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1122 case ALC_INIT_GPIO3:
1123 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1125 case ALC_INIT_DEFAULT:
1126 switch (codec->vendor_id) {
1128 set_eapd(codec, 0x0f, 1);
1129 set_eapd(codec, 0x10, 1);
1142 set_eapd(codec, 0x14, 1);
1143 set_eapd(codec, 0x15, 1);
1146 switch (codec->vendor_id) {
1148 snd_hda_codec_write(codec, 0x1a, 0,
1149 AC_VERB_SET_COEF_INDEX, 7);
1150 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1151 AC_VERB_GET_PROC_COEF, 0);
1152 snd_hda_codec_write(codec, 0x1a, 0,
1153 AC_VERB_SET_COEF_INDEX, 7);
1154 snd_hda_codec_write(codec, 0x1a, 0,
1155 AC_VERB_SET_PROC_COEF,
1165 alc889_coef_init(codec);
1168 alc888_coef_init(codec);
1170 #if 0 /* XXX: This may cause the silent output on speaker on some machines */
1173 snd_hda_codec_write(codec, 0x20, 0,
1174 AC_VERB_SET_COEF_INDEX, 7);
1175 tmp = snd_hda_codec_read(codec, 0x20, 0,
1176 AC_VERB_GET_PROC_COEF, 0);
1177 snd_hda_codec_write(codec, 0x20, 0,
1178 AC_VERB_SET_COEF_INDEX, 7);
1179 snd_hda_codec_write(codec, 0x20, 0,
1180 AC_VERB_SET_PROC_COEF,
1189 static void alc_init_auto_hp(struct hda_codec *codec)
1191 struct alc_spec *spec = codec->spec;
1193 if (!spec->autocfg.hp_pins[0])
1196 if (!spec->autocfg.speaker_pins[0]) {
1197 if (spec->autocfg.line_out_pins[0] &&
1198 spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT)
1199 spec->autocfg.speaker_pins[0] =
1200 spec->autocfg.line_out_pins[0];
1205 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1206 spec->autocfg.hp_pins[0]);
1207 snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0,
1208 AC_VERB_SET_UNSOLICITED_ENABLE,
1209 AC_USRSP_EN | ALC880_HP_EVENT);
1210 spec->unsol_event = alc_sku_unsol_event;
1213 static void alc_init_auto_mic(struct hda_codec *codec)
1215 struct alc_spec *spec = codec->spec;
1216 struct auto_pin_cfg *cfg = &spec->autocfg;
1217 hda_nid_t fixed, ext;
1220 /* there must be only two mic inputs exclusively */
1221 for (i = AUTO_PIN_LINE; i < AUTO_PIN_LAST; i++)
1222 if (cfg->input_pins[i])
1226 for (i = AUTO_PIN_MIC; i <= AUTO_PIN_FRONT_MIC; i++) {
1227 hda_nid_t nid = cfg->input_pins[i];
1228 unsigned int defcfg;
1231 defcfg = snd_hda_codec_get_pincfg(codec, nid);
1232 switch (get_defcfg_connect(defcfg)) {
1233 case AC_JACK_PORT_FIXED:
1235 return; /* already occupied */
1238 case AC_JACK_PORT_COMPLEX:
1240 return; /* already occupied */
1244 return; /* invalid entry */
1249 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP))
1250 return; /* no unsol support */
1251 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n",
1253 spec->ext_mic.pin = ext;
1254 spec->int_mic.pin = fixed;
1255 spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1256 spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1258 snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0,
1259 AC_VERB_SET_UNSOLICITED_ENABLE,
1260 AC_USRSP_EN | ALC880_MIC_EVENT);
1261 spec->unsol_event = alc_sku_unsol_event;
1264 static int alc_auto_parse_customize_define(struct hda_codec *codec)
1266 unsigned int ass, tmp, i;
1268 struct alc_spec *spec = codec->spec;
1270 ass = codec->subsystem_id & 0xffff;
1271 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
1275 if (codec->vendor_id == 0x10ec0260)
1277 ass = snd_hda_codec_get_pincfg(codec, nid);
1280 printk(KERN_INFO "hda_codec: %s: SKU not ready 0x%08x\n",
1281 codec->chip_name, ass);
1287 for (i = 1; i < 16; i++) {
1291 if (((ass >> 16) & 0xf) != tmp)
1294 spec->cdefine.port_connectivity = ass >> 30;
1295 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
1296 spec->cdefine.check_sum = (ass >> 16) & 0xf;
1297 spec->cdefine.customization = ass >> 8;
1299 spec->cdefine.sku_cfg = ass;
1300 spec->cdefine.external_amp = (ass & 0x38) >> 3;
1301 spec->cdefine.platform_type = (ass & 0x4) >> 2;
1302 spec->cdefine.swap = (ass & 0x2) >> 1;
1303 spec->cdefine.override = ass & 0x1;
1305 snd_printd("SKU: Nid=0x%x sku_cfg=0x%08x\n",
1306 nid, spec->cdefine.sku_cfg);
1307 snd_printd("SKU: port_connectivity=0x%x\n",
1308 spec->cdefine.port_connectivity);
1309 snd_printd("SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
1310 snd_printd("SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
1311 snd_printd("SKU: customization=0x%08x\n", spec->cdefine.customization);
1312 snd_printd("SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
1313 snd_printd("SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
1314 snd_printd("SKU: swap=0x%x\n", spec->cdefine.swap);
1315 snd_printd("SKU: override=0x%x\n", spec->cdefine.override);
1320 /* check subsystem ID and set up device-specific initialization;
1321 * return 1 if initialized, 0 if invalid SSID
1323 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1324 * 31 ~ 16 : Manufacture ID
1326 * 7 ~ 0 : Assembly ID
1327 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1329 static int alc_subsystem_id(struct hda_codec *codec,
1330 hda_nid_t porta, hda_nid_t porte,
1331 hda_nid_t portd, hda_nid_t porti)
1333 unsigned int ass, tmp, i;
1335 struct alc_spec *spec = codec->spec;
1337 ass = codec->subsystem_id & 0xffff;
1338 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1341 /* invalid SSID, check the special NID pin defcfg instead */
1343 * 31~30 : port connectivity
1346 * 19~16 : Check sum (15:1)
1351 if (codec->vendor_id == 0x10ec0260)
1353 ass = snd_hda_codec_get_pincfg(codec, nid);
1354 snd_printd("realtek: No valid SSID, "
1355 "checking pincfg 0x%08x for NID 0x%x\n",
1359 if ((ass >> 30) != 1) /* no physical connection */
1364 for (i = 1; i < 16; i++) {
1368 if (((ass >> 16) & 0xf) != tmp)
1371 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1372 ass & 0xffff, codec->vendor_id);
1376 * 2 : 0 --> Desktop, 1 --> Laptop
1377 * 3~5 : External Amplifier control
1380 tmp = (ass & 0x38) >> 3; /* external Amp control */
1383 spec->init_amp = ALC_INIT_GPIO1;
1386 spec->init_amp = ALC_INIT_GPIO2;
1389 spec->init_amp = ALC_INIT_GPIO3;
1392 spec->init_amp = ALC_INIT_DEFAULT;
1396 /* is laptop or Desktop and enable the function "Mute internal speaker
1397 * when the external headphone out jack is plugged"
1399 if (!(ass & 0x8000))
1402 * 10~8 : Jack location
1403 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1405 * 15 : 1 --> enable the function "Mute internal speaker
1406 * when the external headphone out jack is plugged"
1408 if (!spec->autocfg.hp_pins[0]) {
1410 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1421 for (i = 0; i < spec->autocfg.line_outs; i++)
1422 if (spec->autocfg.line_out_pins[i] == nid)
1424 spec->autocfg.hp_pins[0] = nid;
1427 alc_init_auto_hp(codec);
1428 alc_init_auto_mic(codec);
1432 static void alc_ssid_check(struct hda_codec *codec,
1433 hda_nid_t porta, hda_nid_t porte,
1434 hda_nid_t portd, hda_nid_t porti)
1436 if (!alc_subsystem_id(codec, porta, porte, portd, porti)) {
1437 struct alc_spec *spec = codec->spec;
1438 snd_printd("realtek: "
1439 "Enable default setup for auto mode as fallback\n");
1440 spec->init_amp = ALC_INIT_DEFAULT;
1441 alc_init_auto_hp(codec);
1442 alc_init_auto_mic(codec);
1447 * Fix-up pin default configurations and add default verbs
1456 const struct alc_pincfg *pins;
1457 const struct hda_verb *verbs;
1460 static void alc_pick_fixup(struct hda_codec *codec,
1461 const struct snd_pci_quirk *quirk,
1462 const struct alc_fixup *fix,
1465 const struct alc_pincfg *cfg;
1467 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1470 fix += quirk->value;
1472 if (pre_init && cfg) {
1473 #ifdef CONFIG_SND_DEBUG_VERBOSE
1474 snd_printdd(KERN_INFO "hda_codec: %s: Apply pincfg for %s\n",
1475 codec->chip_name, quirk->name);
1477 for (; cfg->nid; cfg++)
1478 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1480 if (!pre_init && fix->verbs) {
1481 #ifdef CONFIG_SND_DEBUG_VERBOSE
1482 snd_printdd(KERN_INFO "hda_codec: %s: Apply fix-verbs for %s\n",
1483 codec->chip_name, quirk->name);
1485 add_verb(codec->spec, fix->verbs);
1489 static int alc_read_coef_idx(struct hda_codec *codec,
1490 unsigned int coef_idx)
1493 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX,
1495 val = snd_hda_codec_read(codec, 0x20, 0,
1496 AC_VERB_GET_PROC_COEF, 0);
1507 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1508 /* Mic-in jack as mic in */
1509 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1510 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1511 /* Line-in jack as Line in */
1512 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1513 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1514 /* Line-Out as Front */
1515 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1522 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1523 /* Mic-in jack as mic in */
1524 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1525 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1526 /* Line-in jack as Surround */
1527 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1528 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1529 /* Line-Out as Front */
1530 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1537 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1538 /* Mic-in jack as CLFE */
1539 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1540 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1541 /* Line-in jack as Surround */
1542 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1543 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1544 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1545 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1552 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1553 /* Mic-in jack as CLFE */
1554 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1555 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1556 /* Line-in jack as Surround */
1557 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1558 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1559 /* Line-Out as Side */
1560 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1564 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1565 { 2, alc888_4ST_ch2_intel_init },
1566 { 4, alc888_4ST_ch4_intel_init },
1567 { 6, alc888_4ST_ch6_intel_init },
1568 { 8, alc888_4ST_ch8_intel_init },
1572 * ALC888 Fujitsu Siemens Amillo xa3530
1575 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1576 /* Front Mic: set to PIN_IN (empty by default) */
1577 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1578 /* Connect Internal HP to Front */
1579 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1580 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1581 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1582 /* Connect Bass HP to Front */
1583 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1584 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1585 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1586 /* Connect Line-Out side jack (SPDIF) to Side */
1587 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1588 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1589 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1590 /* Connect Mic jack to CLFE */
1591 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1592 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1593 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1594 /* Connect Line-in jack to Surround */
1595 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1596 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1597 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1598 /* Connect HP out jack to Front */
1599 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1600 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1601 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1602 /* Enable unsolicited event for HP jack and Line-out jack */
1603 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1604 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1608 static void alc_automute_amp(struct hda_codec *codec)
1610 struct alc_spec *spec = codec->spec;
1615 spec->jack_present = 0;
1616 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
1617 nid = spec->autocfg.hp_pins[i];
1620 if (snd_hda_jack_detect(codec, nid)) {
1621 spec->jack_present = 1;
1626 mute = spec->jack_present ? HDA_AMP_MUTE : 0;
1627 /* Toggle internal speakers muting */
1628 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1629 nid = spec->autocfg.speaker_pins[i];
1632 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1633 HDA_AMP_MUTE, mute);
1637 static void alc_automute_amp_unsol_event(struct hda_codec *codec,
1640 if (codec->vendor_id == 0x10ec0880)
1644 if (res == ALC880_HP_EVENT)
1645 alc_automute_amp(codec);
1648 static void alc889_automute_setup(struct hda_codec *codec)
1650 struct alc_spec *spec = codec->spec;
1652 spec->autocfg.hp_pins[0] = 0x15;
1653 spec->autocfg.speaker_pins[0] = 0x14;
1654 spec->autocfg.speaker_pins[1] = 0x16;
1655 spec->autocfg.speaker_pins[2] = 0x17;
1656 spec->autocfg.speaker_pins[3] = 0x19;
1657 spec->autocfg.speaker_pins[4] = 0x1a;
1660 static void alc889_intel_init_hook(struct hda_codec *codec)
1662 alc889_coef_init(codec);
1663 alc_automute_amp(codec);
1666 static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec)
1668 struct alc_spec *spec = codec->spec;
1670 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
1671 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
1672 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
1673 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
1677 * ALC888 Acer Aspire 4930G model
1680 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1681 /* Front Mic: set to PIN_IN (empty by default) */
1682 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1683 /* Unselect Front Mic by default in input mixer 3 */
1684 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1685 /* Enable unsolicited event for HP jack */
1686 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1687 /* Connect Internal HP to front */
1688 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1689 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1690 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1691 /* Connect HP out to front */
1692 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1693 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1694 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1699 * ALC888 Acer Aspire 6530G model
1702 static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
1703 /* Route to built-in subwoofer as well as speakers */
1704 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1705 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1706 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1707 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1708 /* Bias voltage on for external mic port */
1709 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
1710 /* Front Mic: set to PIN_IN (empty by default) */
1711 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1712 /* Unselect Front Mic by default in input mixer 3 */
1713 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1714 /* Enable unsolicited event for HP jack */
1715 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1716 /* Enable speaker output */
1717 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1718 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1719 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
1720 /* Enable headphone output */
1721 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1722 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1723 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1724 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
1729 * ALC889 Acer Aspire 8930G model
1732 static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
1733 /* Front Mic: set to PIN_IN (empty by default) */
1734 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1735 /* Unselect Front Mic by default in input mixer 3 */
1736 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1737 /* Enable unsolicited event for HP jack */
1738 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1739 /* Connect Internal Front to Front */
1740 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1741 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1742 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1743 /* Connect Internal Rear to Rear */
1744 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1745 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1746 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
1747 /* Connect Internal CLFE to CLFE */
1748 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1749 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1750 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
1751 /* Connect HP out to Front */
1752 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1753 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1754 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1755 /* Enable all DACs */
1756 /* DAC DISABLE/MUTE 1? */
1757 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
1758 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
1759 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1760 /* DAC DISABLE/MUTE 2? */
1761 /* some bit here disables the other DACs. Init=0x4900 */
1762 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
1763 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1765 * This laptop has a stereo digital microphone. The mics are only 1cm apart
1766 * which makes the stereo useless. However, either the mic or the ALC889
1767 * makes the signal become a difference/sum signal instead of standard
1768 * stereo, which is annoying. So instead we flip this bit which makes the
1769 * codec replicate the sum signal to both channels, turning it into a
1772 /* DMIC_CONTROL? Init value = 0x0001 */
1773 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
1774 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
1778 static struct hda_input_mux alc888_2_capture_sources[2] = {
1779 /* Front mic only available on one ADC */
1786 { "Front Mic", 0xb },
1799 static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
1800 /* Interal mic only available on one ADC */
1807 { "Input Mix", 0xa },
1817 { "Input Mix", 0xa },
1822 static struct hda_input_mux alc889_capture_sources[3] = {
1823 /* Digital mic only available on first "ADC" */
1830 { "Front Mic", 0xb },
1831 { "Input Mix", 0xa },
1840 { "Input Mix", 0xa },
1849 { "Input Mix", 0xa },
1854 static struct snd_kcontrol_new alc888_base_mixer[] = {
1855 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1856 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1857 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1858 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1859 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1861 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1862 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1863 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1864 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1865 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1866 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1867 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1868 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1869 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1870 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1871 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1872 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1876 static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = {
1877 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1878 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1879 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1880 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1881 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1883 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1884 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1885 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1886 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1887 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1888 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1889 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1890 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1895 static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
1897 struct alc_spec *spec = codec->spec;
1899 spec->autocfg.hp_pins[0] = 0x15;
1900 spec->autocfg.speaker_pins[0] = 0x14;
1901 spec->autocfg.speaker_pins[1] = 0x16;
1902 spec->autocfg.speaker_pins[2] = 0x17;
1905 static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
1907 struct alc_spec *spec = codec->spec;
1909 spec->autocfg.hp_pins[0] = 0x15;
1910 spec->autocfg.speaker_pins[0] = 0x14;
1911 spec->autocfg.speaker_pins[1] = 0x16;
1912 spec->autocfg.speaker_pins[2] = 0x17;
1915 static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
1917 struct alc_spec *spec = codec->spec;
1919 spec->autocfg.hp_pins[0] = 0x15;
1920 spec->autocfg.speaker_pins[0] = 0x14;
1921 spec->autocfg.speaker_pins[1] = 0x16;
1922 spec->autocfg.speaker_pins[2] = 0x1b;
1926 * ALC880 3-stack model
1928 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1929 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1930 * F-Mic = 0x1b, HP = 0x19
1933 static hda_nid_t alc880_dac_nids[4] = {
1934 /* front, rear, clfe, rear_surr */
1935 0x02, 0x05, 0x04, 0x03
1938 static hda_nid_t alc880_adc_nids[3] = {
1943 /* The datasheet says the node 0x07 is connected from inputs,
1944 * but it shows zero connection in the real implementation on some devices.
1945 * Note: this is a 915GAV bug, fixed on 915GLV
1947 static hda_nid_t alc880_adc_nids_alt[2] = {
1952 #define ALC880_DIGOUT_NID 0x06
1953 #define ALC880_DIGIN_NID 0x0a
1955 static struct hda_input_mux alc880_capture_source = {
1959 { "Front Mic", 0x3 },
1965 /* channel source setting (2/6 channel selection for 3-stack) */
1967 static struct hda_verb alc880_threestack_ch2_init[] = {
1968 /* set line-in to input, mute it */
1969 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1970 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1971 /* set mic-in to input vref 80%, mute it */
1972 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1973 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1978 static struct hda_verb alc880_threestack_ch6_init[] = {
1979 /* set line-in to output, unmute it */
1980 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1981 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1982 /* set mic-in to output, unmute it */
1983 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1984 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1988 static struct hda_channel_mode alc880_threestack_modes[2] = {
1989 { 2, alc880_threestack_ch2_init },
1990 { 6, alc880_threestack_ch6_init },
1993 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1994 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1995 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1996 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1997 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1998 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1999 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2000 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2001 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2002 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2003 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2004 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2005 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2006 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2007 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2008 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
2009 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
2010 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
2012 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2013 .name = "Channel Mode",
2014 .info = alc_ch_mode_info,
2015 .get = alc_ch_mode_get,
2016 .put = alc_ch_mode_put,
2021 /* capture mixer elements */
2022 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
2023 struct snd_ctl_elem_info *uinfo)
2025 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2026 struct alc_spec *spec = codec->spec;
2029 mutex_lock(&codec->control_mutex);
2030 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
2032 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
2033 mutex_unlock(&codec->control_mutex);
2037 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
2038 unsigned int size, unsigned int __user *tlv)
2040 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2041 struct alc_spec *spec = codec->spec;
2044 mutex_lock(&codec->control_mutex);
2045 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
2047 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
2048 mutex_unlock(&codec->control_mutex);
2052 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
2053 struct snd_ctl_elem_value *ucontrol);
2055 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
2056 struct snd_ctl_elem_value *ucontrol,
2059 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2060 struct alc_spec *spec = codec->spec;
2061 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
2064 mutex_lock(&codec->control_mutex);
2065 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
2067 err = func(kcontrol, ucontrol);
2068 mutex_unlock(&codec->control_mutex);
2072 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
2073 struct snd_ctl_elem_value *ucontrol)
2075 return alc_cap_getput_caller(kcontrol, ucontrol,
2076 snd_hda_mixer_amp_volume_get);
2079 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
2080 struct snd_ctl_elem_value *ucontrol)
2082 return alc_cap_getput_caller(kcontrol, ucontrol,
2083 snd_hda_mixer_amp_volume_put);
2086 /* capture mixer elements */
2087 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
2089 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
2090 struct snd_ctl_elem_value *ucontrol)
2092 return alc_cap_getput_caller(kcontrol, ucontrol,
2093 snd_hda_mixer_amp_switch_get);
2096 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
2097 struct snd_ctl_elem_value *ucontrol)
2099 return alc_cap_getput_caller(kcontrol, ucontrol,
2100 snd_hda_mixer_amp_switch_put);
2103 #define _DEFINE_CAPMIX(num) \
2105 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2106 .name = "Capture Switch", \
2107 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
2109 .info = alc_cap_sw_info, \
2110 .get = alc_cap_sw_get, \
2111 .put = alc_cap_sw_put, \
2114 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2115 .name = "Capture Volume", \
2116 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
2117 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
2118 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
2120 .info = alc_cap_vol_info, \
2121 .get = alc_cap_vol_get, \
2122 .put = alc_cap_vol_put, \
2123 .tlv = { .c = alc_cap_vol_tlv }, \
2126 #define _DEFINE_CAPSRC(num) \
2128 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2129 /* .name = "Capture Source", */ \
2130 .name = "Input Source", \
2132 .info = alc_mux_enum_info, \
2133 .get = alc_mux_enum_get, \
2134 .put = alc_mux_enum_put, \
2137 #define DEFINE_CAPMIX(num) \
2138 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2139 _DEFINE_CAPMIX(num), \
2140 _DEFINE_CAPSRC(num), \
2144 #define DEFINE_CAPMIX_NOSRC(num) \
2145 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2146 _DEFINE_CAPMIX(num), \
2150 /* up to three ADCs */
2154 DEFINE_CAPMIX_NOSRC(1);
2155 DEFINE_CAPMIX_NOSRC(2);
2156 DEFINE_CAPMIX_NOSRC(3);
2159 * ALC880 5-stack model
2161 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2163 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2164 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2167 /* additional mixers to alc880_three_stack_mixer */
2168 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2169 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2170 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2174 /* channel source setting (6/8 channel selection for 5-stack) */
2176 static struct hda_verb alc880_fivestack_ch6_init[] = {
2177 /* set line-in to input, mute it */
2178 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2179 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2184 static struct hda_verb alc880_fivestack_ch8_init[] = {
2185 /* set line-in to output, unmute it */
2186 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2187 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2191 static struct hda_channel_mode alc880_fivestack_modes[2] = {
2192 { 6, alc880_fivestack_ch6_init },
2193 { 8, alc880_fivestack_ch8_init },
2198 * ALC880 6-stack model
2200 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2201 * Side = 0x05 (0x0f)
2202 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2203 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2206 static hda_nid_t alc880_6st_dac_nids[4] = {
2207 /* front, rear, clfe, rear_surr */
2208 0x02, 0x03, 0x04, 0x05
2211 static struct hda_input_mux alc880_6stack_capture_source = {
2215 { "Front Mic", 0x1 },
2221 /* fixed 8-channels */
2222 static struct hda_channel_mode alc880_sixstack_modes[1] = {
2226 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2227 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2228 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2229 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2230 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2231 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2232 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2233 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2234 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2235 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2236 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2237 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2238 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2239 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2240 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2241 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2242 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2243 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2244 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2246 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2247 .name = "Channel Mode",
2248 .info = alc_ch_mode_info,
2249 .get = alc_ch_mode_get,
2250 .put = alc_ch_mode_put,
2259 * W810 has rear IO for:
2262 * Center/LFE (DAC 04)
2265 * The system also has a pair of internal speakers, and a headphone jack.
2266 * These are both connected to Line2 on the codec, hence to DAC 02.
2268 * There is a variable resistor to control the speaker or headphone
2269 * volume. This is a hardware-only device without a software API.
2271 * Plugging headphones in will disable the internal speakers. This is
2272 * implemented in hardware, not via the driver using jack sense. In
2273 * a similar fashion, plugging into the rear socket marked "front" will
2274 * disable both the speakers and headphones.
2276 * For input, there's a microphone jack, and an "audio in" jack.
2277 * These may not do anything useful with this driver yet, because I
2278 * haven't setup any initialization verbs for these yet...
2281 static hda_nid_t alc880_w810_dac_nids[3] = {
2282 /* front, rear/surround, clfe */
2286 /* fixed 6 channels */
2287 static struct hda_channel_mode alc880_w810_modes[1] = {
2291 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2292 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2293 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2294 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2295 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2296 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2297 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2298 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2299 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2300 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2301 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2309 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2310 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2314 static hda_nid_t alc880_z71v_dac_nids[1] = {
2317 #define ALC880_Z71V_HP_DAC 0x03
2319 /* fixed 2 channels */
2320 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2324 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2325 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2326 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2327 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2328 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2329 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2330 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2331 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2332 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2338 * ALC880 F1734 model
2340 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2341 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2344 static hda_nid_t alc880_f1734_dac_nids[1] = {
2347 #define ALC880_F1734_HP_DAC 0x02
2349 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2350 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2351 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2352 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2353 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2354 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2355 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2356 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2357 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2361 static struct hda_input_mux alc880_f1734_capture_source = {
2373 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2374 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2375 * Mic = 0x18, Line = 0x1a
2378 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2379 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2381 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2382 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2383 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2384 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2385 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2386 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2387 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2388 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2389 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2390 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2391 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2392 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2393 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2394 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2395 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2397 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2398 .name = "Channel Mode",
2399 .info = alc_ch_mode_info,
2400 .get = alc_ch_mode_get,
2401 .put = alc_ch_mode_put,
2407 * ALC880 ASUS W1V model
2409 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2410 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2411 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2414 /* additional mixers to alc880_asus_mixer */
2415 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2416 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2417 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2422 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2423 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2424 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2425 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2426 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2427 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2428 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2429 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2430 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2431 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2436 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2437 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2438 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2439 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2440 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2441 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2442 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2443 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2444 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2445 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2446 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2447 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2448 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2449 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2450 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2451 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2452 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2454 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2455 .name = "Channel Mode",
2456 .info = alc_ch_mode_info,
2457 .get = alc_ch_mode_get,
2458 .put = alc_ch_mode_put,
2463 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2464 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2465 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2466 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2467 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2468 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2469 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2470 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2471 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2472 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2473 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2477 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2478 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2479 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2480 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2481 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2482 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2483 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2488 * virtual master controls
2492 * slave controls for virtual master
2494 static const char *alc_slave_vols[] = {
2495 "Front Playback Volume",
2496 "Surround Playback Volume",
2497 "Center Playback Volume",
2498 "LFE Playback Volume",
2499 "Side Playback Volume",
2500 "Headphone Playback Volume",
2501 "Speaker Playback Volume",
2502 "Mono Playback Volume",
2503 "Line-Out Playback Volume",
2504 "PCM Playback Volume",
2508 static const char *alc_slave_sws[] = {
2509 "Front Playback Switch",
2510 "Surround Playback Switch",
2511 "Center Playback Switch",
2512 "LFE Playback Switch",
2513 "Side Playback Switch",
2514 "Headphone Playback Switch",
2515 "Speaker Playback Switch",
2516 "Mono Playback Switch",
2517 "IEC958 Playback Switch",
2518 "Line-Out Playback Switch",
2519 "PCM Playback Switch",
2524 * build control elements
2527 #define NID_MAPPING (-1)
2529 #define SUBDEV_SPEAKER_ (0 << 6)
2530 #define SUBDEV_HP_ (1 << 6)
2531 #define SUBDEV_LINE_ (2 << 6)
2532 #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f))
2533 #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f))
2534 #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f))
2536 static void alc_free_kctls(struct hda_codec *codec);
2538 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2539 /* additional beep mixers; the actual parameters are overwritten at build */
2540 static struct snd_kcontrol_new alc_beep_mixer[] = {
2541 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2542 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
2547 static int alc_build_controls(struct hda_codec *codec)
2549 struct alc_spec *spec = codec->spec;
2550 struct snd_kcontrol *kctl;
2551 struct snd_kcontrol_new *knew;
2556 for (i = 0; i < spec->num_mixers; i++) {
2557 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2561 if (spec->cap_mixer) {
2562 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2566 if (spec->multiout.dig_out_nid) {
2567 err = snd_hda_create_spdif_out_ctls(codec,
2568 spec->multiout.dig_out_nid);
2571 if (!spec->no_analog) {
2572 err = snd_hda_create_spdif_share_sw(codec,
2576 spec->multiout.share_spdif = 1;
2579 if (spec->dig_in_nid) {
2580 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2585 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2586 /* create beep controls if needed */
2587 if (spec->beep_amp) {
2588 struct snd_kcontrol_new *knew;
2589 for (knew = alc_beep_mixer; knew->name; knew++) {
2590 struct snd_kcontrol *kctl;
2591 kctl = snd_ctl_new1(knew, codec);
2594 kctl->private_value = spec->beep_amp;
2595 err = snd_hda_ctl_add(codec, 0, kctl);
2602 /* if we have no master control, let's create it */
2603 if (!spec->no_analog &&
2604 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2605 unsigned int vmaster_tlv[4];
2606 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2607 HDA_OUTPUT, vmaster_tlv);
2608 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2609 vmaster_tlv, alc_slave_vols);
2613 if (!spec->no_analog &&
2614 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2615 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2616 NULL, alc_slave_sws);
2621 /* assign Capture Source enums to NID */
2622 kctl = snd_hda_find_mixer_ctl(codec, "Capture Source");
2624 kctl = snd_hda_find_mixer_ctl(codec, "Input Source");
2625 for (i = 0; kctl && i < kctl->count; i++) {
2626 hda_nid_t *nids = spec->capsrc_nids;
2628 nids = spec->adc_nids;
2629 err = snd_hda_add_nid(codec, kctl, i, nids[i]);
2633 if (spec->cap_mixer) {
2634 const char *kname = kctl ? kctl->id.name : NULL;
2635 for (knew = spec->cap_mixer; knew->name; knew++) {
2636 if (kname && strcmp(knew->name, kname) == 0)
2638 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2639 for (i = 0; kctl && i < kctl->count; i++) {
2640 err = snd_hda_add_nid(codec, kctl, i,
2648 /* other nid->control mapping */
2649 for (i = 0; i < spec->num_mixers; i++) {
2650 for (knew = spec->mixers[i]; knew->name; knew++) {
2651 if (knew->iface != NID_MAPPING)
2653 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2656 u = knew->subdevice;
2657 for (j = 0; j < 4; j++, u >>= 8) {
2662 case SUBDEV_SPEAKER_:
2663 nid = spec->autocfg.speaker_pins[nid];
2666 nid = spec->autocfg.line_out_pins[nid];
2669 nid = spec->autocfg.hp_pins[nid];
2674 err = snd_hda_add_nid(codec, kctl, 0, nid);
2678 u = knew->private_value;
2679 for (j = 0; j < 4; j++, u >>= 8) {
2683 err = snd_hda_add_nid(codec, kctl, 0, nid);
2690 alc_free_kctls(codec); /* no longer needed */
2697 * initialize the codec volumes, etc
2701 * generic initialization of ADC, input mixers and output mixers
2703 static struct hda_verb alc880_volume_init_verbs[] = {
2705 * Unmute ADC0-2 and set the default input to mic-in
2707 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2708 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2709 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2710 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2711 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2712 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2714 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2716 * Note: PASD motherboards uses the Line In 2 as the input for front
2719 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2720 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2721 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2722 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2723 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2724 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2725 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2726 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2729 * Set up output mixers (0x0c - 0x0f)
2731 /* set vol=0 to output mixers */
2732 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2733 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2734 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2735 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2736 /* set up input amps for analog loopback */
2737 /* Amp Indices: DAC = 0, mixer = 1 */
2738 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2739 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2740 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2741 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2742 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2743 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2744 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2745 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2751 * 3-stack pin configuration:
2752 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2754 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2756 * preset connection lists of input pins
2757 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2759 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2760 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2761 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2764 * Set pin mode and muting
2766 /* set front pin widgets 0x14 for output */
2767 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2768 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2769 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2770 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2771 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2772 /* Mic2 (as headphone out) for HP output */
2773 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2774 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2775 /* Line In pin widget for input */
2776 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2777 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2778 /* Line2 (as front mic) pin widget for input and vref at 80% */
2779 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2780 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2781 /* CD pin widget for input */
2782 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2788 * 5-stack pin configuration:
2789 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2790 * line-in/side = 0x1a, f-mic = 0x1b
2792 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2794 * preset connection lists of input pins
2795 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2797 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2798 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2801 * Set pin mode and muting
2803 /* set pin widgets 0x14-0x17 for output */
2804 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2805 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2806 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2807 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2808 /* unmute pins for output (no gain on this amp) */
2809 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2810 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2811 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2812 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2814 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2815 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2816 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2817 /* Mic2 (as headphone out) for HP output */
2818 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2819 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2820 /* Line In pin widget for input */
2821 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2822 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2823 /* Line2 (as front mic) pin widget for input and vref at 80% */
2824 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2825 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2826 /* CD pin widget for input */
2827 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2833 * W810 pin configuration:
2834 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2836 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2837 /* hphone/speaker input selector: front DAC */
2838 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2840 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2841 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2842 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2843 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2844 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2845 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2847 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2848 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2854 * Z71V pin configuration:
2855 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2857 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2858 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2859 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2860 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2861 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2863 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2864 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2865 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2866 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2872 * 6-stack pin configuration:
2873 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2874 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2876 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2877 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2879 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2880 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2881 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2882 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2883 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2884 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2885 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2886 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2888 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2889 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2890 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2891 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2892 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2893 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2894 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2895 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2896 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2902 * Uniwill pin configuration:
2903 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2906 static struct hda_verb alc880_uniwill_init_verbs[] = {
2907 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2909 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2910 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2911 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2912 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2913 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2914 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2915 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2916 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2917 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2918 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2919 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2920 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2921 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2922 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2924 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2925 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2926 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2927 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2928 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2929 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2930 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2931 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2932 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2934 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2935 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2942 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2944 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2945 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2947 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2948 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2949 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2950 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2951 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2952 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2953 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2954 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2955 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2956 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2957 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2958 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2960 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2961 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2962 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2963 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2964 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2965 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2967 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2968 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2973 static struct hda_verb alc880_beep_init_verbs[] = {
2974 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2978 /* auto-toggle front mic */
2979 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2981 unsigned int present;
2984 present = snd_hda_jack_detect(codec, 0x18);
2985 bits = present ? HDA_AMP_MUTE : 0;
2986 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2989 static void alc880_uniwill_setup(struct hda_codec *codec)
2991 struct alc_spec *spec = codec->spec;
2993 spec->autocfg.hp_pins[0] = 0x14;
2994 spec->autocfg.speaker_pins[0] = 0x15;
2995 spec->autocfg.speaker_pins[0] = 0x16;
2998 static void alc880_uniwill_init_hook(struct hda_codec *codec)
3000 alc_automute_amp(codec);
3001 alc880_uniwill_mic_automute(codec);
3004 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
3007 /* Looks like the unsol event is incompatible with the standard
3008 * definition. 4bit tag is placed at 28 bit!
3010 switch (res >> 28) {
3011 case ALC880_MIC_EVENT:
3012 alc880_uniwill_mic_automute(codec);
3015 alc_automute_amp_unsol_event(codec, res);
3020 static void alc880_uniwill_p53_setup(struct hda_codec *codec)
3022 struct alc_spec *spec = codec->spec;
3024 spec->autocfg.hp_pins[0] = 0x14;
3025 spec->autocfg.speaker_pins[0] = 0x15;
3028 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
3030 unsigned int present;
3032 present = snd_hda_codec_read(codec, 0x21, 0,
3033 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
3034 present &= HDA_AMP_VOLMASK;
3035 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
3036 HDA_AMP_VOLMASK, present);
3037 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
3038 HDA_AMP_VOLMASK, present);
3041 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
3044 /* Looks like the unsol event is incompatible with the standard
3045 * definition. 4bit tag is placed at 28 bit!
3047 if ((res >> 28) == ALC880_DCVOL_EVENT)
3048 alc880_uniwill_p53_dcvol_automute(codec);
3050 alc_automute_amp_unsol_event(codec, res);
3054 * F1734 pin configuration:
3055 * HP = 0x14, speaker-out = 0x15, mic = 0x18
3057 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
3058 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
3059 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3060 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3061 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3062 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3064 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3065 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3066 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3067 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3069 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3070 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3071 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
3072 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3073 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3074 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3075 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3076 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3077 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3079 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
3080 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
3086 * ASUS pin configuration:
3087 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
3089 static struct hda_verb alc880_pin_asus_init_verbs[] = {
3090 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3091 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3092 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3093 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3095 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3096 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3097 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3098 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3099 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3100 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3101 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3102 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3104 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3105 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3106 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3107 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3108 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3109 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3110 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3111 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3112 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3117 /* Enable GPIO mask and set output */
3118 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
3119 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
3120 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
3122 /* Clevo m520g init */
3123 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
3124 /* headphone output */
3125 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3127 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3128 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3130 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3131 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3133 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3134 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3135 /* Mic1 (rear panel) */
3136 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3137 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3138 /* Mic2 (front panel) */
3139 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3140 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3142 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3143 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3144 /* change to EAPD mode */
3145 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3146 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3151 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
3152 /* change to EAPD mode */
3153 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3154 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3156 /* Headphone output */
3157 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3159 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3160 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
3162 /* Line In pin widget for input */
3163 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3164 /* CD pin widget for input */
3165 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3166 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3167 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3169 /* change to EAPD mode */
3170 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3171 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
3177 * LG m1 express dual
3180 * Rear Line-In/Out (blue): 0x14
3181 * Build-in Mic-In: 0x15
3183 * HP-Out (green): 0x1b
3184 * Mic-In/Out (red): 0x19
3188 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
3189 static hda_nid_t alc880_lg_dac_nids[3] = {
3193 /* seems analog CD is not working */
3194 static struct hda_input_mux alc880_lg_capture_source = {
3199 { "Internal Mic", 0x6 },
3203 /* 2,4,6 channel modes */
3204 static struct hda_verb alc880_lg_ch2_init[] = {
3205 /* set line-in and mic-in to input */
3206 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
3207 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3211 static struct hda_verb alc880_lg_ch4_init[] = {
3212 /* set line-in to out and mic-in to input */
3213 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3214 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3218 static struct hda_verb alc880_lg_ch6_init[] = {
3219 /* set line-in and mic-in to output */
3220 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3221 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3225 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
3226 { 2, alc880_lg_ch2_init },
3227 { 4, alc880_lg_ch4_init },
3228 { 6, alc880_lg_ch6_init },
3231 static struct snd_kcontrol_new alc880_lg_mixer[] = {
3232 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3233 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3234 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3235 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3236 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3237 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3238 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3239 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3240 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3241 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3242 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3243 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3244 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3245 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3247 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3248 .name = "Channel Mode",
3249 .info = alc_ch_mode_info,
3250 .get = alc_ch_mode_get,
3251 .put = alc_ch_mode_put,
3256 static struct hda_verb alc880_lg_init_verbs[] = {
3257 /* set capture source to mic-in */
3258 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3259 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3260 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3261 /* mute all amp mixer inputs */
3262 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3263 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3264 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3265 /* line-in to input */
3266 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3267 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3269 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3270 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3272 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3273 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3274 /* mic-in to input */
3275 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3276 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3277 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3279 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3280 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3281 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3283 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3287 /* toggle speaker-output according to the hp-jack state */
3288 static void alc880_lg_setup(struct hda_codec *codec)
3290 struct alc_spec *spec = codec->spec;
3292 spec->autocfg.hp_pins[0] = 0x1b;
3293 spec->autocfg.speaker_pins[0] = 0x17;
3302 * Built-in Mic-In: 0x19
3308 static struct hda_input_mux alc880_lg_lw_capture_source = {
3312 { "Internal Mic", 0x1 },
3317 #define alc880_lg_lw_modes alc880_threestack_modes
3319 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3320 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3321 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3322 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3323 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3324 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3325 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3326 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3327 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3328 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3329 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3330 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3331 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3332 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
3333 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
3335 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3336 .name = "Channel Mode",
3337 .info = alc_ch_mode_info,
3338 .get = alc_ch_mode_get,
3339 .put = alc_ch_mode_put,
3344 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3345 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3346 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3347 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3349 /* set capture source to mic-in */
3350 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3351 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3352 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3353 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3355 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3356 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3358 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3359 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3360 /* mic-in to input */
3361 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3362 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3364 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3365 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3367 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3371 /* toggle speaker-output according to the hp-jack state */
3372 static void alc880_lg_lw_setup(struct hda_codec *codec)
3374 struct alc_spec *spec = codec->spec;
3376 spec->autocfg.hp_pins[0] = 0x1b;
3377 spec->autocfg.speaker_pins[0] = 0x14;
3380 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3381 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3382 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3383 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3384 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3385 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3386 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3390 static struct hda_input_mux alc880_medion_rim_capture_source = {
3394 { "Internal Mic", 0x1 },
3398 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3399 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3401 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3402 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3404 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3405 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3406 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3407 /* Mic2 (as headphone out) for HP output */
3408 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3409 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3410 /* Internal Speaker */
3411 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3412 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3414 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3415 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3417 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3421 /* toggle speaker-output according to the hp-jack state */
3422 static void alc880_medion_rim_automute(struct hda_codec *codec)
3424 struct alc_spec *spec = codec->spec;
3425 alc_automute_amp(codec);
3427 if (spec->jack_present)
3428 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3430 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3433 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3436 /* Looks like the unsol event is incompatible with the standard
3437 * definition. 4bit tag is placed at 28 bit!
3439 if ((res >> 28) == ALC880_HP_EVENT)
3440 alc880_medion_rim_automute(codec);
3443 static void alc880_medion_rim_setup(struct hda_codec *codec)
3445 struct alc_spec *spec = codec->spec;
3447 spec->autocfg.hp_pins[0] = 0x14;
3448 spec->autocfg.speaker_pins[0] = 0x1b;
3451 #ifdef CONFIG_SND_HDA_POWER_SAVE
3452 static struct hda_amp_list alc880_loopbacks[] = {
3453 { 0x0b, HDA_INPUT, 0 },
3454 { 0x0b, HDA_INPUT, 1 },
3455 { 0x0b, HDA_INPUT, 2 },
3456 { 0x0b, HDA_INPUT, 3 },
3457 { 0x0b, HDA_INPUT, 4 },
3461 static struct hda_amp_list alc880_lg_loopbacks[] = {
3462 { 0x0b, HDA_INPUT, 1 },
3463 { 0x0b, HDA_INPUT, 6 },
3464 { 0x0b, HDA_INPUT, 7 },
3473 static int alc_init(struct hda_codec *codec)
3475 struct alc_spec *spec = codec->spec;
3479 alc_auto_init_amp(codec, spec->init_amp);
3481 for (i = 0; i < spec->num_init_verbs; i++)
3482 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3484 if (spec->init_hook)
3485 spec->init_hook(codec);
3487 #ifdef CONFIG_SND_HDA_POWER_SAVE
3488 if (codec->patch_ops.check_power_status)
3489 codec->patch_ops.check_power_status(codec, 0x01);
3494 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3496 struct alc_spec *spec = codec->spec;
3498 if (spec->unsol_event)
3499 spec->unsol_event(codec, res);
3502 #ifdef CONFIG_SND_HDA_POWER_SAVE
3503 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3505 struct alc_spec *spec = codec->spec;
3506 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3511 * Analog playback callbacks
3513 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3514 struct hda_codec *codec,
3515 struct snd_pcm_substream *substream)
3517 struct alc_spec *spec = codec->spec;
3518 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3522 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3523 struct hda_codec *codec,
3524 unsigned int stream_tag,
3525 unsigned int format,
3526 struct snd_pcm_substream *substream)
3528 struct alc_spec *spec = codec->spec;
3529 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3530 stream_tag, format, substream);
3533 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3534 struct hda_codec *codec,
3535 struct snd_pcm_substream *substream)
3537 struct alc_spec *spec = codec->spec;
3538 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3544 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3545 struct hda_codec *codec,
3546 struct snd_pcm_substream *substream)
3548 struct alc_spec *spec = codec->spec;
3549 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3552 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3553 struct hda_codec *codec,
3554 unsigned int stream_tag,
3555 unsigned int format,
3556 struct snd_pcm_substream *substream)
3558 struct alc_spec *spec = codec->spec;
3559 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3560 stream_tag, format, substream);
3563 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3564 struct hda_codec *codec,
3565 struct snd_pcm_substream *substream)
3567 struct alc_spec *spec = codec->spec;
3568 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3571 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3572 struct hda_codec *codec,
3573 struct snd_pcm_substream *substream)
3575 struct alc_spec *spec = codec->spec;
3576 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3582 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3583 struct hda_codec *codec,
3584 unsigned int stream_tag,
3585 unsigned int format,
3586 struct snd_pcm_substream *substream)
3588 struct alc_spec *spec = codec->spec;
3590 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3591 stream_tag, 0, format);
3595 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3596 struct hda_codec *codec,
3597 struct snd_pcm_substream *substream)
3599 struct alc_spec *spec = codec->spec;
3601 snd_hda_codec_cleanup_stream(codec,
3602 spec->adc_nids[substream->number + 1]);
3609 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3613 /* NID is set in alc_build_pcms */
3615 .open = alc880_playback_pcm_open,
3616 .prepare = alc880_playback_pcm_prepare,
3617 .cleanup = alc880_playback_pcm_cleanup
3621 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3625 /* NID is set in alc_build_pcms */
3628 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3632 /* NID is set in alc_build_pcms */
3635 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3636 .substreams = 2, /* can be overridden */
3639 /* NID is set in alc_build_pcms */
3641 .prepare = alc880_alt_capture_pcm_prepare,
3642 .cleanup = alc880_alt_capture_pcm_cleanup
3646 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3650 /* NID is set in alc_build_pcms */
3652 .open = alc880_dig_playback_pcm_open,
3653 .close = alc880_dig_playback_pcm_close,
3654 .prepare = alc880_dig_playback_pcm_prepare,
3655 .cleanup = alc880_dig_playback_pcm_cleanup
3659 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3663 /* NID is set in alc_build_pcms */
3666 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3667 static struct hda_pcm_stream alc_pcm_null_stream = {
3673 static int alc_build_pcms(struct hda_codec *codec)
3675 struct alc_spec *spec = codec->spec;
3676 struct hda_pcm *info = spec->pcm_rec;
3679 codec->num_pcms = 1;
3680 codec->pcm_info = info;
3682 if (spec->no_analog)
3685 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
3686 "%s Analog", codec->chip_name);
3687 info->name = spec->stream_name_analog;
3689 if (spec->stream_analog_playback) {
3690 if (snd_BUG_ON(!spec->multiout.dac_nids))
3692 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3693 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3695 if (spec->stream_analog_capture) {
3696 if (snd_BUG_ON(!spec->adc_nids))
3698 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3699 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3702 if (spec->channel_mode) {
3703 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3704 for (i = 0; i < spec->num_channel_mode; i++) {
3705 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3706 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3712 /* SPDIF for stream index #1 */
3713 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3714 snprintf(spec->stream_name_digital,
3715 sizeof(spec->stream_name_digital),
3716 "%s Digital", codec->chip_name);
3717 codec->num_pcms = 2;
3718 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3719 info = spec->pcm_rec + 1;
3720 info->name = spec->stream_name_digital;
3721 if (spec->dig_out_type)
3722 info->pcm_type = spec->dig_out_type;
3724 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3725 if (spec->multiout.dig_out_nid &&
3726 spec->stream_digital_playback) {
3727 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3728 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3730 if (spec->dig_in_nid &&
3731 spec->stream_digital_capture) {
3732 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3733 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3735 /* FIXME: do we need this for all Realtek codec models? */
3736 codec->spdif_status_reset = 1;
3739 if (spec->no_analog)
3742 /* If the use of more than one ADC is requested for the current
3743 * model, configure a second analog capture-only PCM.
3745 /* Additional Analaog capture for index #2 */
3746 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3747 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3748 codec->num_pcms = 3;
3749 info = spec->pcm_rec + 2;
3750 info->name = spec->stream_name_analog;
3751 if (spec->alt_dac_nid) {
3752 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3753 *spec->stream_analog_alt_playback;
3754 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3757 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3758 alc_pcm_null_stream;
3759 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3761 if (spec->num_adc_nids > 1) {
3762 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3763 *spec->stream_analog_alt_capture;
3764 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3766 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3767 spec->num_adc_nids - 1;
3769 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3770 alc_pcm_null_stream;
3771 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3778 static inline void alc_shutup(struct hda_codec *codec)
3780 snd_hda_shutup_pins(codec);
3783 static void alc_free_kctls(struct hda_codec *codec)
3785 struct alc_spec *spec = codec->spec;
3787 if (spec->kctls.list) {
3788 struct snd_kcontrol_new *kctl = spec->kctls.list;
3790 for (i = 0; i < spec->kctls.used; i++)
3791 kfree(kctl[i].name);
3793 snd_array_free(&spec->kctls);
3796 static void alc_free(struct hda_codec *codec)
3798 struct alc_spec *spec = codec->spec;
3804 alc_free_kctls(codec);
3806 snd_hda_detach_beep_device(codec);
3809 #ifdef CONFIG_SND_HDA_POWER_SAVE
3810 static void alc_power_eapd(struct hda_codec *codec)
3812 /* We currently only handle front, HP */
3813 switch (codec->vendor_id) {
3815 set_eapd(codec, 0x0f, 0);
3816 set_eapd(codec, 0x10, 0);
3829 set_eapd(codec, 0x14, 0);
3830 set_eapd(codec, 0x15, 0);
3835 static int alc_suspend(struct hda_codec *codec, pm_message_t state)
3837 struct alc_spec *spec = codec->spec;
3839 if (spec && spec->power_hook)
3840 spec->power_hook(codec);
3845 #ifdef SND_HDA_NEEDS_RESUME
3846 static int alc_resume(struct hda_codec *codec)
3848 codec->patch_ops.init(codec);
3849 snd_hda_codec_resume_amp(codec);
3850 snd_hda_codec_resume_cache(codec);
3851 #ifdef CONFIG_SND_HDA_POWER_SAVE
3852 if (codec->patch_ops.check_power_status)
3853 codec->patch_ops.check_power_status(codec, 0x01);
3861 static struct hda_codec_ops alc_patch_ops = {
3862 .build_controls = alc_build_controls,
3863 .build_pcms = alc_build_pcms,
3866 .unsol_event = alc_unsol_event,
3867 #ifdef SND_HDA_NEEDS_RESUME
3868 .resume = alc_resume,
3870 #ifdef CONFIG_SND_HDA_POWER_SAVE
3871 .suspend = alc_suspend,
3872 .check_power_status = alc_check_power_status,
3874 .reboot_notify = alc_shutup,
3877 /* replace the codec chip_name with the given string */
3878 static int alc_codec_rename(struct hda_codec *codec, const char *name)
3880 kfree(codec->chip_name);
3881 codec->chip_name = kstrdup(name, GFP_KERNEL);
3882 if (!codec->chip_name) {
3890 * Test configuration for debugging
3892 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3895 #ifdef CONFIG_SND_DEBUG
3896 static hda_nid_t alc880_test_dac_nids[4] = {
3897 0x02, 0x03, 0x04, 0x05
3900 static struct hda_input_mux alc880_test_capture_source = {
3909 { "Surround", 0x6 },
3913 static struct hda_channel_mode alc880_test_modes[4] = {
3920 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3921 struct snd_ctl_elem_info *uinfo)
3923 static char *texts[] = {
3924 "N/A", "Line Out", "HP Out",
3925 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3927 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3929 uinfo->value.enumerated.items = 8;
3930 if (uinfo->value.enumerated.item >= 8)
3931 uinfo->value.enumerated.item = 7;
3932 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3936 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3937 struct snd_ctl_elem_value *ucontrol)
3939 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3940 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3941 unsigned int pin_ctl, item = 0;
3943 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3944 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3945 if (pin_ctl & AC_PINCTL_OUT_EN) {
3946 if (pin_ctl & AC_PINCTL_HP_EN)
3950 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3951 switch (pin_ctl & AC_PINCTL_VREFEN) {
3952 case AC_PINCTL_VREF_HIZ: item = 3; break;
3953 case AC_PINCTL_VREF_50: item = 4; break;
3954 case AC_PINCTL_VREF_GRD: item = 5; break;
3955 case AC_PINCTL_VREF_80: item = 6; break;
3956 case AC_PINCTL_VREF_100: item = 7; break;
3959 ucontrol->value.enumerated.item[0] = item;
3963 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3964 struct snd_ctl_elem_value *ucontrol)
3966 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3967 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3968 static unsigned int ctls[] = {
3969 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3970 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3971 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3972 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3973 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3974 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3976 unsigned int old_ctl, new_ctl;
3978 old_ctl = snd_hda_codec_read(codec, nid, 0,
3979 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3980 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3981 if (old_ctl != new_ctl) {
3983 snd_hda_codec_write_cache(codec, nid, 0,
3984 AC_VERB_SET_PIN_WIDGET_CONTROL,
3986 val = ucontrol->value.enumerated.item[0] >= 3 ?
3988 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3995 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3996 struct snd_ctl_elem_info *uinfo)
3998 static char *texts[] = {
3999 "Front", "Surround", "CLFE", "Side"
4001 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
4003 uinfo->value.enumerated.items = 4;
4004 if (uinfo->value.enumerated.item >= 4)
4005 uinfo->value.enumerated.item = 3;
4006 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
4010 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
4011 struct snd_ctl_elem_value *ucontrol)
4013 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4014 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4017 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
4018 ucontrol->value.enumerated.item[0] = sel & 3;
4022 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
4023 struct snd_ctl_elem_value *ucontrol)
4025 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4026 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4029 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
4030 if (ucontrol->value.enumerated.item[0] != sel) {
4031 sel = ucontrol->value.enumerated.item[0] & 3;
4032 snd_hda_codec_write_cache(codec, nid, 0,
4033 AC_VERB_SET_CONNECT_SEL, sel);
4039 #define PIN_CTL_TEST(xname,nid) { \
4040 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4042 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4043 .info = alc_test_pin_ctl_info, \
4044 .get = alc_test_pin_ctl_get, \
4045 .put = alc_test_pin_ctl_put, \
4046 .private_value = nid \
4049 #define PIN_SRC_TEST(xname,nid) { \
4050 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4052 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4053 .info = alc_test_pin_src_info, \
4054 .get = alc_test_pin_src_get, \
4055 .put = alc_test_pin_src_put, \
4056 .private_value = nid \
4059 static struct snd_kcontrol_new alc880_test_mixer[] = {
4060 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
4061 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
4062 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
4063 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
4064 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
4065 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
4066 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
4067 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
4068 PIN_CTL_TEST("Front Pin Mode", 0x14),
4069 PIN_CTL_TEST("Surround Pin Mode", 0x15),
4070 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
4071 PIN_CTL_TEST("Side Pin Mode", 0x17),
4072 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
4073 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
4074 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
4075 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
4076 PIN_SRC_TEST("In-1 Pin Source", 0x18),
4077 PIN_SRC_TEST("In-2 Pin Source", 0x19),
4078 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
4079 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
4080 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
4081 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
4082 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
4083 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
4084 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
4085 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
4086 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
4087 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
4088 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
4089 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
4091 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4092 .name = "Channel Mode",
4093 .info = alc_ch_mode_info,
4094 .get = alc_ch_mode_get,
4095 .put = alc_ch_mode_put,
4100 static struct hda_verb alc880_test_init_verbs[] = {
4101 /* Unmute inputs of 0x0c - 0x0f */
4102 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4103 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4104 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4105 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4106 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4107 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4108 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4109 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4110 /* Vol output for 0x0c-0x0f */
4111 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4112 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4113 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4114 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4115 /* Set output pins 0x14-0x17 */
4116 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4117 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4118 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4119 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4120 /* Unmute output pins 0x14-0x17 */
4121 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4122 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4123 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4124 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4125 /* Set input pins 0x18-0x1c */
4126 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4127 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4128 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4129 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4130 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4131 /* Mute input pins 0x18-0x1b */
4132 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4133 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4134 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4135 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4137 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4138 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
4139 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4140 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
4141 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4142 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
4143 /* Analog input/passthru */
4144 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4145 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4146 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4147 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4148 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4156 static const char *alc880_models[ALC880_MODEL_LAST] = {
4157 [ALC880_3ST] = "3stack",
4158 [ALC880_TCL_S700] = "tcl",
4159 [ALC880_3ST_DIG] = "3stack-digout",
4160 [ALC880_CLEVO] = "clevo",
4161 [ALC880_5ST] = "5stack",
4162 [ALC880_5ST_DIG] = "5stack-digout",
4163 [ALC880_W810] = "w810",
4164 [ALC880_Z71V] = "z71v",
4165 [ALC880_6ST] = "6stack",
4166 [ALC880_6ST_DIG] = "6stack-digout",
4167 [ALC880_ASUS] = "asus",
4168 [ALC880_ASUS_W1V] = "asus-w1v",
4169 [ALC880_ASUS_DIG] = "asus-dig",
4170 [ALC880_ASUS_DIG2] = "asus-dig2",
4171 [ALC880_UNIWILL_DIG] = "uniwill",
4172 [ALC880_UNIWILL_P53] = "uniwill-p53",
4173 [ALC880_FUJITSU] = "fujitsu",
4174 [ALC880_F1734] = "F1734",
4176 [ALC880_LG_LW] = "lg-lw",
4177 [ALC880_MEDION_RIM] = "medion",
4178 #ifdef CONFIG_SND_DEBUG
4179 [ALC880_TEST] = "test",
4181 [ALC880_AUTO] = "auto",
4184 static struct snd_pci_quirk alc880_cfg_tbl[] = {
4185 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
4186 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
4187 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
4188 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
4189 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
4190 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
4191 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
4192 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
4193 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
4194 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
4195 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
4196 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
4197 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
4198 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
4199 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
4200 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
4201 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
4202 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
4203 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
4204 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
4205 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
4206 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
4207 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
4208 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
4209 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
4210 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
4211 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
4212 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
4213 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
4214 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
4215 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
4216 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
4217 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
4218 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
4219 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
4220 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
4221 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
4222 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
4223 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
4224 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
4225 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
4226 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
4227 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
4228 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
4229 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
4230 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
4231 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
4232 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
4233 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
4234 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
4235 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
4236 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
4237 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
4238 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
4239 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
4240 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
4241 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
4242 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
4243 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
4244 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
4245 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
4246 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
4247 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
4248 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
4249 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
4250 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
4251 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
4252 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
4254 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
4255 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
4256 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
4261 * ALC880 codec presets
4263 static struct alc_config_preset alc880_presets[] = {
4265 .mixers = { alc880_three_stack_mixer },
4266 .init_verbs = { alc880_volume_init_verbs,
4267 alc880_pin_3stack_init_verbs },
4268 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4269 .dac_nids = alc880_dac_nids,
4270 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4271 .channel_mode = alc880_threestack_modes,
4273 .input_mux = &alc880_capture_source,
4275 [ALC880_3ST_DIG] = {
4276 .mixers = { alc880_three_stack_mixer },
4277 .init_verbs = { alc880_volume_init_verbs,
4278 alc880_pin_3stack_init_verbs },
4279 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4280 .dac_nids = alc880_dac_nids,
4281 .dig_out_nid = ALC880_DIGOUT_NID,
4282 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4283 .channel_mode = alc880_threestack_modes,
4285 .input_mux = &alc880_capture_source,
4287 [ALC880_TCL_S700] = {
4288 .mixers = { alc880_tcl_s700_mixer },
4289 .init_verbs = { alc880_volume_init_verbs,
4290 alc880_pin_tcl_S700_init_verbs,
4291 alc880_gpio2_init_verbs },
4292 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4293 .dac_nids = alc880_dac_nids,
4294 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4295 .num_adc_nids = 1, /* single ADC */
4297 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4298 .channel_mode = alc880_2_jack_modes,
4299 .input_mux = &alc880_capture_source,
4302 .mixers = { alc880_three_stack_mixer,
4303 alc880_five_stack_mixer},
4304 .init_verbs = { alc880_volume_init_verbs,
4305 alc880_pin_5stack_init_verbs },
4306 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4307 .dac_nids = alc880_dac_nids,
4308 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4309 .channel_mode = alc880_fivestack_modes,
4310 .input_mux = &alc880_capture_source,
4312 [ALC880_5ST_DIG] = {
4313 .mixers = { alc880_three_stack_mixer,
4314 alc880_five_stack_mixer },
4315 .init_verbs = { alc880_volume_init_verbs,
4316 alc880_pin_5stack_init_verbs },
4317 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4318 .dac_nids = alc880_dac_nids,
4319 .dig_out_nid = ALC880_DIGOUT_NID,
4320 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4321 .channel_mode = alc880_fivestack_modes,
4322 .input_mux = &alc880_capture_source,
4325 .mixers = { alc880_six_stack_mixer },
4326 .init_verbs = { alc880_volume_init_verbs,
4327 alc880_pin_6stack_init_verbs },
4328 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4329 .dac_nids = alc880_6st_dac_nids,
4330 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4331 .channel_mode = alc880_sixstack_modes,
4332 .input_mux = &alc880_6stack_capture_source,
4334 [ALC880_6ST_DIG] = {
4335 .mixers = { alc880_six_stack_mixer },
4336 .init_verbs = { alc880_volume_init_verbs,
4337 alc880_pin_6stack_init_verbs },
4338 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4339 .dac_nids = alc880_6st_dac_nids,
4340 .dig_out_nid = ALC880_DIGOUT_NID,
4341 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4342 .channel_mode = alc880_sixstack_modes,
4343 .input_mux = &alc880_6stack_capture_source,
4346 .mixers = { alc880_w810_base_mixer },
4347 .init_verbs = { alc880_volume_init_verbs,
4348 alc880_pin_w810_init_verbs,
4349 alc880_gpio2_init_verbs },
4350 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
4351 .dac_nids = alc880_w810_dac_nids,
4352 .dig_out_nid = ALC880_DIGOUT_NID,
4353 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4354 .channel_mode = alc880_w810_modes,
4355 .input_mux = &alc880_capture_source,
4358 .mixers = { alc880_z71v_mixer },
4359 .init_verbs = { alc880_volume_init_verbs,
4360 alc880_pin_z71v_init_verbs },
4361 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
4362 .dac_nids = alc880_z71v_dac_nids,
4363 .dig_out_nid = ALC880_DIGOUT_NID,
4365 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4366 .channel_mode = alc880_2_jack_modes,
4367 .input_mux = &alc880_capture_source,
4370 .mixers = { alc880_f1734_mixer },
4371 .init_verbs = { alc880_volume_init_verbs,
4372 alc880_pin_f1734_init_verbs },
4373 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
4374 .dac_nids = alc880_f1734_dac_nids,
4376 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4377 .channel_mode = alc880_2_jack_modes,
4378 .input_mux = &alc880_f1734_capture_source,
4379 .unsol_event = alc880_uniwill_p53_unsol_event,
4380 .setup = alc880_uniwill_p53_setup,
4381 .init_hook = alc_automute_amp,
4384 .mixers = { alc880_asus_mixer },
4385 .init_verbs = { alc880_volume_init_verbs,
4386 alc880_pin_asus_init_verbs,
4387 alc880_gpio1_init_verbs },
4388 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4389 .dac_nids = alc880_asus_dac_nids,
4390 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4391 .channel_mode = alc880_asus_modes,
4393 .input_mux = &alc880_capture_source,
4395 [ALC880_ASUS_DIG] = {
4396 .mixers = { alc880_asus_mixer },
4397 .init_verbs = { alc880_volume_init_verbs,
4398 alc880_pin_asus_init_verbs,
4399 alc880_gpio1_init_verbs },
4400 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4401 .dac_nids = alc880_asus_dac_nids,
4402 .dig_out_nid = ALC880_DIGOUT_NID,
4403 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4404 .channel_mode = alc880_asus_modes,
4406 .input_mux = &alc880_capture_source,
4408 [ALC880_ASUS_DIG2] = {
4409 .mixers = { alc880_asus_mixer },
4410 .init_verbs = { alc880_volume_init_verbs,
4411 alc880_pin_asus_init_verbs,
4412 alc880_gpio2_init_verbs }, /* use GPIO2 */
4413 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4414 .dac_nids = alc880_asus_dac_nids,
4415 .dig_out_nid = ALC880_DIGOUT_NID,
4416 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4417 .channel_mode = alc880_asus_modes,
4419 .input_mux = &alc880_capture_source,
4421 [ALC880_ASUS_W1V] = {
4422 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4423 .init_verbs = { alc880_volume_init_verbs,
4424 alc880_pin_asus_init_verbs,
4425 alc880_gpio1_init_verbs },
4426 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4427 .dac_nids = alc880_asus_dac_nids,
4428 .dig_out_nid = ALC880_DIGOUT_NID,
4429 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4430 .channel_mode = alc880_asus_modes,
4432 .input_mux = &alc880_capture_source,
4434 [ALC880_UNIWILL_DIG] = {
4435 .mixers = { alc880_asus_mixer },
4436 .init_verbs = { alc880_volume_init_verbs,
4437 alc880_pin_asus_init_verbs },
4438 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4439 .dac_nids = alc880_asus_dac_nids,
4440 .dig_out_nid = ALC880_DIGOUT_NID,
4441 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4442 .channel_mode = alc880_asus_modes,
4444 .input_mux = &alc880_capture_source,
4446 [ALC880_UNIWILL] = {
4447 .mixers = { alc880_uniwill_mixer },
4448 .init_verbs = { alc880_volume_init_verbs,
4449 alc880_uniwill_init_verbs },
4450 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4451 .dac_nids = alc880_asus_dac_nids,
4452 .dig_out_nid = ALC880_DIGOUT_NID,
4453 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4454 .channel_mode = alc880_threestack_modes,
4456 .input_mux = &alc880_capture_source,
4457 .unsol_event = alc880_uniwill_unsol_event,
4458 .setup = alc880_uniwill_setup,
4459 .init_hook = alc880_uniwill_init_hook,
4461 [ALC880_UNIWILL_P53] = {
4462 .mixers = { alc880_uniwill_p53_mixer },
4463 .init_verbs = { alc880_volume_init_verbs,
4464 alc880_uniwill_p53_init_verbs },
4465 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4466 .dac_nids = alc880_asus_dac_nids,
4467 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4468 .channel_mode = alc880_threestack_modes,
4469 .input_mux = &alc880_capture_source,
4470 .unsol_event = alc880_uniwill_p53_unsol_event,
4471 .setup = alc880_uniwill_p53_setup,
4472 .init_hook = alc_automute_amp,
4474 [ALC880_FUJITSU] = {
4475 .mixers = { alc880_fujitsu_mixer },
4476 .init_verbs = { alc880_volume_init_verbs,
4477 alc880_uniwill_p53_init_verbs,
4478 alc880_beep_init_verbs },
4479 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4480 .dac_nids = alc880_dac_nids,
4481 .dig_out_nid = ALC880_DIGOUT_NID,
4482 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4483 .channel_mode = alc880_2_jack_modes,
4484 .input_mux = &alc880_capture_source,
4485 .unsol_event = alc880_uniwill_p53_unsol_event,
4486 .setup = alc880_uniwill_p53_setup,
4487 .init_hook = alc_automute_amp,
4490 .mixers = { alc880_three_stack_mixer },
4491 .init_verbs = { alc880_volume_init_verbs,
4492 alc880_pin_clevo_init_verbs },
4493 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4494 .dac_nids = alc880_dac_nids,
4496 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4497 .channel_mode = alc880_threestack_modes,
4499 .input_mux = &alc880_capture_source,
4502 .mixers = { alc880_lg_mixer },
4503 .init_verbs = { alc880_volume_init_verbs,
4504 alc880_lg_init_verbs },
4505 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4506 .dac_nids = alc880_lg_dac_nids,
4507 .dig_out_nid = ALC880_DIGOUT_NID,
4508 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4509 .channel_mode = alc880_lg_ch_modes,
4511 .input_mux = &alc880_lg_capture_source,
4512 .unsol_event = alc_automute_amp_unsol_event,
4513 .setup = alc880_lg_setup,
4514 .init_hook = alc_automute_amp,
4515 #ifdef CONFIG_SND_HDA_POWER_SAVE
4516 .loopbacks = alc880_lg_loopbacks,
4520 .mixers = { alc880_lg_lw_mixer },
4521 .init_verbs = { alc880_volume_init_verbs,
4522 alc880_lg_lw_init_verbs },
4523 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4524 .dac_nids = alc880_dac_nids,
4525 .dig_out_nid = ALC880_DIGOUT_NID,
4526 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4527 .channel_mode = alc880_lg_lw_modes,
4528 .input_mux = &alc880_lg_lw_capture_source,
4529 .unsol_event = alc_automute_amp_unsol_event,
4530 .setup = alc880_lg_lw_setup,
4531 .init_hook = alc_automute_amp,
4533 [ALC880_MEDION_RIM] = {
4534 .mixers = { alc880_medion_rim_mixer },
4535 .init_verbs = { alc880_volume_init_verbs,
4536 alc880_medion_rim_init_verbs,
4537 alc_gpio2_init_verbs },
4538 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4539 .dac_nids = alc880_dac_nids,
4540 .dig_out_nid = ALC880_DIGOUT_NID,
4541 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4542 .channel_mode = alc880_2_jack_modes,
4543 .input_mux = &alc880_medion_rim_capture_source,
4544 .unsol_event = alc880_medion_rim_unsol_event,
4545 .setup = alc880_medion_rim_setup,
4546 .init_hook = alc880_medion_rim_automute,
4548 #ifdef CONFIG_SND_DEBUG
4550 .mixers = { alc880_test_mixer },
4551 .init_verbs = { alc880_test_init_verbs },
4552 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4553 .dac_nids = alc880_test_dac_nids,
4554 .dig_out_nid = ALC880_DIGOUT_NID,
4555 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4556 .channel_mode = alc880_test_modes,
4557 .input_mux = &alc880_test_capture_source,
4563 * Automatic parse of I/O pins from the BIOS configuration
4568 ALC_CTL_WIDGET_MUTE,
4571 static struct snd_kcontrol_new alc880_control_templates[] = {
4572 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4573 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4574 HDA_BIND_MUTE(NULL, 0, 0, 0),
4577 /* add dynamic controls */
4578 static int add_control(struct alc_spec *spec, int type, const char *name,
4581 struct snd_kcontrol_new *knew;
4583 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4584 knew = snd_array_new(&spec->kctls);
4587 *knew = alc880_control_templates[type];
4588 knew->name = kstrdup(name, GFP_KERNEL);
4591 if (get_amp_nid_(val))
4592 knew->subdevice = HDA_SUBDEV_AMP_FLAG;
4593 knew->private_value = val;
4597 static int add_control_with_pfx(struct alc_spec *spec, int type,
4598 const char *pfx, const char *dir,
4599 const char *sfx, unsigned long val)
4602 snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx);
4603 return add_control(spec, type, name, val);
4606 #define add_pb_vol_ctrl(spec, type, pfx, val) \
4607 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", val)
4608 #define add_pb_sw_ctrl(spec, type, pfx, val) \
4609 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", val)
4611 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4612 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4613 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4614 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4615 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4616 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4617 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4618 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4619 #define ALC880_PIN_CD_NID 0x1c
4621 /* fill in the dac_nids table from the parsed pin configuration */
4622 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4623 const struct auto_pin_cfg *cfg)
4629 memset(assigned, 0, sizeof(assigned));
4630 spec->multiout.dac_nids = spec->private_dac_nids;
4632 /* check the pins hardwired to audio widget */
4633 for (i = 0; i < cfg->line_outs; i++) {
4634 nid = cfg->line_out_pins[i];
4635 if (alc880_is_fixed_pin(nid)) {
4636 int idx = alc880_fixed_pin_idx(nid);
4637 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4641 /* left pins can be connect to any audio widget */
4642 for (i = 0; i < cfg->line_outs; i++) {
4643 nid = cfg->line_out_pins[i];
4644 if (alc880_is_fixed_pin(nid))
4646 /* search for an empty channel */
4647 for (j = 0; j < cfg->line_outs; j++) {
4649 spec->multiout.dac_nids[i] =
4650 alc880_idx_to_dac(j);
4656 spec->multiout.num_dacs = cfg->line_outs;
4660 /* add playback controls from the parsed DAC table */
4661 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4662 const struct auto_pin_cfg *cfg)
4664 static const char *chname[4] = {
4665 "Front", "Surround", NULL /*CLFE*/, "Side"
4670 for (i = 0; i < cfg->line_outs; i++) {
4671 if (!spec->multiout.dac_nids[i])
4673 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4676 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4678 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4682 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4684 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4688 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4690 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4694 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4696 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4702 if (cfg->line_outs == 1 &&
4703 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
4707 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4708 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4712 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4713 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4722 /* add playback controls for speaker and HP outputs */
4723 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4732 if (alc880_is_fixed_pin(pin)) {
4733 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4734 /* specify the DAC as the extra output */
4735 if (!spec->multiout.hp_nid)
4736 spec->multiout.hp_nid = nid;
4738 spec->multiout.extra_out_nid[0] = nid;
4739 /* control HP volume/switch on the output mixer amp */
4740 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4741 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4742 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4745 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4746 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4749 } else if (alc880_is_multi_pin(pin)) {
4750 /* set manual connection */
4751 /* we have only a switch on HP-out PIN */
4752 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
4753 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4760 /* create input playback/capture controls for the given pin */
4761 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4762 const char *ctlname,
4763 int idx, hda_nid_t mix_nid)
4767 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
4768 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4771 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
4772 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4778 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
4780 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
4781 return (pincap & AC_PINCAP_IN) != 0;
4784 /* create playback/capture controls for input pins */
4785 static int alc_auto_create_input_ctls(struct hda_codec *codec,
4786 const struct auto_pin_cfg *cfg,
4788 hda_nid_t cap1, hda_nid_t cap2)
4790 struct alc_spec *spec = codec->spec;
4791 struct hda_input_mux *imux = &spec->private_imux[0];
4794 for (i = 0; i < AUTO_PIN_LAST; i++) {
4797 pin = cfg->input_pins[i];
4798 if (!alc_is_input_pin(codec, pin))
4802 idx = get_connection_index(codec, mixer, pin);
4804 err = new_analog_input(spec, pin,
4805 auto_pin_cfg_labels[i],
4814 idx = get_connection_index(codec, cap1, pin);
4815 if (idx < 0 && cap2)
4816 idx = get_connection_index(codec, cap2, pin);
4818 imux->items[imux->num_items].label =
4819 auto_pin_cfg_labels[i];
4820 imux->items[imux->num_items].index = idx;
4827 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
4828 const struct auto_pin_cfg *cfg)
4830 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
4833 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4834 unsigned int pin_type)
4836 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4839 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4843 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4844 hda_nid_t nid, int pin_type,
4847 alc_set_pin_output(codec, nid, pin_type);
4848 /* need the manual connection? */
4849 if (alc880_is_multi_pin(nid)) {
4850 struct alc_spec *spec = codec->spec;
4851 int idx = alc880_multi_pin_idx(nid);
4852 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4853 AC_VERB_SET_CONNECT_SEL,
4854 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4858 static int get_pin_type(int line_out_type)
4860 if (line_out_type == AUTO_PIN_HP_OUT)
4866 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4868 struct alc_spec *spec = codec->spec;
4871 for (i = 0; i < spec->autocfg.line_outs; i++) {
4872 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4873 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4874 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4878 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4880 struct alc_spec *spec = codec->spec;
4883 pin = spec->autocfg.speaker_pins[0];
4884 if (pin) /* connect to front */
4885 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4886 pin = spec->autocfg.hp_pins[0];
4887 if (pin) /* connect to front */
4888 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4891 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4893 struct alc_spec *spec = codec->spec;
4896 for (i = 0; i < AUTO_PIN_LAST; i++) {
4897 hda_nid_t nid = spec->autocfg.input_pins[i];
4898 if (alc_is_input_pin(codec, nid)) {
4899 alc_set_input_pin(codec, nid, i);
4900 if (nid != ALC880_PIN_CD_NID &&
4901 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
4902 snd_hda_codec_write(codec, nid, 0,
4903 AC_VERB_SET_AMP_GAIN_MUTE,
4909 static void alc880_auto_init_input_src(struct hda_codec *codec)
4911 struct alc_spec *spec = codec->spec;
4914 for (c = 0; c < spec->num_adc_nids; c++) {
4915 unsigned int mux_idx;
4916 const struct hda_input_mux *imux;
4917 mux_idx = c >= spec->num_mux_defs ? 0 : c;
4918 imux = &spec->input_mux[mux_idx];
4919 if (!imux->num_items && mux_idx > 0)
4920 imux = &spec->input_mux[0];
4922 snd_hda_codec_write(codec, spec->adc_nids[c], 0,
4923 AC_VERB_SET_CONNECT_SEL,
4924 imux->items[0].index);
4928 /* parse the BIOS configuration and set up the alc_spec */
4929 /* return 1 if successful, 0 if the proper config is not found,
4930 * or a negative error code
4932 static int alc880_parse_auto_config(struct hda_codec *codec)
4934 struct alc_spec *spec = codec->spec;
4936 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4938 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4942 if (!spec->autocfg.line_outs)
4943 return 0; /* can't find valid BIOS pin config */
4945 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4948 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4951 err = alc880_auto_create_extra_out(spec,
4952 spec->autocfg.speaker_pins[0],
4956 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4960 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
4964 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4966 /* check multiple SPDIF-out (for recent codecs) */
4967 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4969 err = snd_hda_get_connections(codec,
4970 spec->autocfg.dig_out_pins[i],
4975 spec->multiout.dig_out_nid = dig_nid;
4977 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4978 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
4980 spec->slave_dig_outs[i - 1] = dig_nid;
4983 if (spec->autocfg.dig_in_pin)
4984 spec->dig_in_nid = ALC880_DIGIN_NID;
4986 if (spec->kctls.list)
4987 add_mixer(spec, spec->kctls.list);
4989 add_verb(spec, alc880_volume_init_verbs);
4991 spec->num_mux_defs = 1;
4992 spec->input_mux = &spec->private_imux[0];
4994 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
4999 /* additional initialization for auto-configuration model */
5000 static void alc880_auto_init(struct hda_codec *codec)
5002 struct alc_spec *spec = codec->spec;
5003 alc880_auto_init_multi_out(codec);
5004 alc880_auto_init_extra_out(codec);
5005 alc880_auto_init_analog_input(codec);
5006 alc880_auto_init_input_src(codec);
5007 if (spec->unsol_event)
5008 alc_inithook(codec);
5011 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
5012 * one of two digital mic pins, e.g. on ALC272
5014 static void fixup_automic_adc(struct hda_codec *codec)
5016 struct alc_spec *spec = codec->spec;
5019 for (i = 0; i < spec->num_adc_nids; i++) {
5020 hda_nid_t cap = spec->capsrc_nids ?
5021 spec->capsrc_nids[i] : spec->adc_nids[i];
5024 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
5027 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
5030 spec->int_mic.mux_idx = iidx;
5031 spec->ext_mic.mux_idx = eidx;
5032 if (spec->capsrc_nids)
5033 spec->capsrc_nids += i;
5034 spec->adc_nids += i;
5035 spec->num_adc_nids = 1;
5038 snd_printd(KERN_INFO "hda_codec: %s: "
5039 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
5040 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
5041 spec->auto_mic = 0; /* disable auto-mic to be sure */
5044 /* choose the ADC/MUX containing the input pin and initialize the setup */
5045 static void fixup_single_adc(struct hda_codec *codec)
5047 struct alc_spec *spec = codec->spec;
5051 /* search for the input pin; there must be only one */
5052 for (i = 0; i < AUTO_PIN_LAST; i++) {
5053 if (spec->autocfg.input_pins[i]) {
5054 pin = spec->autocfg.input_pins[i];
5061 /* set the default connection to that pin */
5062 for (i = 0; i < spec->num_adc_nids; i++) {
5063 hda_nid_t cap = spec->capsrc_nids ?
5064 spec->capsrc_nids[i] : spec->adc_nids[i];
5067 idx = get_connection_index(codec, cap, pin);
5070 /* use only this ADC */
5071 if (spec->capsrc_nids)
5072 spec->capsrc_nids += i;
5073 spec->adc_nids += i;
5074 spec->num_adc_nids = 1;
5075 /* select or unmute this route */
5076 if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) {
5077 snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx,
5080 snd_hda_codec_write_cache(codec, cap, 0,
5081 AC_VERB_SET_CONNECT_SEL, idx);
5087 static void set_capture_mixer(struct hda_codec *codec)
5089 struct alc_spec *spec = codec->spec;
5090 static struct snd_kcontrol_new *caps[2][3] = {
5091 { alc_capture_mixer_nosrc1,
5092 alc_capture_mixer_nosrc2,
5093 alc_capture_mixer_nosrc3 },
5094 { alc_capture_mixer1,
5096 alc_capture_mixer3 },
5098 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
5101 fixup_automic_adc(codec);
5102 else if (spec->input_mux) {
5103 if (spec->input_mux->num_items > 1)
5105 else if (spec->input_mux->num_items == 1)
5106 fixup_single_adc(codec);
5108 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
5112 /* fill adc_nids (and capsrc_nids) containing all active input pins */
5113 static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids,
5116 struct alc_spec *spec = codec->spec;
5118 hda_nid_t fallback_adc = 0, fallback_cap = 0;
5120 for (n = 0; n < num_nids; n++) {
5122 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
5126 if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN)
5129 nconns = snd_hda_get_connections(codec, cap, conn,
5133 nconns = snd_hda_get_connections(codec, cap, conn,
5138 if (!fallback_adc) {
5142 for (i = 0; i < AUTO_PIN_LAST; i++) {
5143 hda_nid_t nid = spec->autocfg.input_pins[i];
5146 for (j = 0; j < nconns; j++) {
5153 if (i >= AUTO_PIN_LAST) {
5154 int num_adcs = spec->num_adc_nids;
5155 spec->private_adc_nids[num_adcs] = adc;
5156 spec->private_capsrc_nids[num_adcs] = cap;
5157 spec->num_adc_nids++;
5158 spec->adc_nids = spec->private_adc_nids;
5160 spec->capsrc_nids = spec->private_capsrc_nids;
5163 if (!spec->num_adc_nids) {
5164 printk(KERN_WARNING "hda_codec: %s: no valid ADC found;"
5165 " using fallback 0x%x\n",
5166 codec->chip_name, fallback_adc);
5167 spec->private_adc_nids[0] = fallback_adc;
5168 spec->adc_nids = spec->private_adc_nids;
5169 if (fallback_adc != fallback_cap) {
5170 spec->private_capsrc_nids[0] = fallback_cap;
5171 spec->capsrc_nids = spec->private_adc_nids;
5176 #ifdef CONFIG_SND_HDA_INPUT_BEEP
5177 #define set_beep_amp(spec, nid, idx, dir) \
5178 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
5180 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
5184 * OK, here we have finally the patch for ALC880
5187 static int patch_alc880(struct hda_codec *codec)
5189 struct alc_spec *spec;
5193 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5199 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
5202 if (board_config < 0) {
5203 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
5205 board_config = ALC880_AUTO;
5208 if (board_config == ALC880_AUTO) {
5209 /* automatic parse from the BIOS config */
5210 err = alc880_parse_auto_config(codec);
5216 "hda_codec: Cannot set up configuration "
5217 "from BIOS. Using 3-stack mode...\n");
5218 board_config = ALC880_3ST;
5222 err = snd_hda_attach_beep_device(codec, 0x1);
5228 if (board_config != ALC880_AUTO)
5229 setup_preset(codec, &alc880_presets[board_config]);
5231 spec->stream_analog_playback = &alc880_pcm_analog_playback;
5232 spec->stream_analog_capture = &alc880_pcm_analog_capture;
5233 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
5235 spec->stream_digital_playback = &alc880_pcm_digital_playback;
5236 spec->stream_digital_capture = &alc880_pcm_digital_capture;
5238 if (!spec->adc_nids && spec->input_mux) {
5239 /* check whether NID 0x07 is valid */
5240 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
5242 wcap = get_wcaps_type(wcap);
5243 if (wcap != AC_WID_AUD_IN) {
5244 spec->adc_nids = alc880_adc_nids_alt;
5245 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
5247 spec->adc_nids = alc880_adc_nids;
5248 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
5251 set_capture_mixer(codec);
5252 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
5254 spec->vmaster_nid = 0x0c;
5256 codec->patch_ops = alc_patch_ops;
5257 if (board_config == ALC880_AUTO)
5258 spec->init_hook = alc880_auto_init;
5259 #ifdef CONFIG_SND_HDA_POWER_SAVE
5260 if (!spec->loopback.amplist)
5261 spec->loopback.amplist = alc880_loopbacks;
5272 static hda_nid_t alc260_dac_nids[1] = {
5277 static hda_nid_t alc260_adc_nids[1] = {
5282 static hda_nid_t alc260_adc_nids_alt[1] = {
5287 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
5288 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
5290 static hda_nid_t alc260_dual_adc_nids[2] = {
5295 #define ALC260_DIGOUT_NID 0x03
5296 #define ALC260_DIGIN_NID 0x06
5298 static struct hda_input_mux alc260_capture_source = {
5302 { "Front Mic", 0x1 },
5308 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
5309 * headphone jack and the internal CD lines since these are the only pins at
5310 * which audio can appear. For flexibility, also allow the option of
5311 * recording the mixer output on the second ADC (ADC0 doesn't have a
5312 * connection to the mixer output).
5314 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
5318 { "Mic/Line", 0x0 },
5320 { "Headphone", 0x2 },
5326 { "Mic/Line", 0x0 },
5328 { "Headphone", 0x2 },
5335 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
5336 * the Fujitsu S702x, but jacks are marked differently.
5338 static struct hda_input_mux alc260_acer_capture_sources[2] = {
5345 { "Headphone", 0x5 },
5354 { "Headphone", 0x6 },
5360 /* Maxdata Favorit 100XS */
5361 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
5365 { "Line/Mic", 0x0 },
5372 { "Line/Mic", 0x0 },
5380 * This is just place-holder, so there's something for alc_build_pcms to look
5381 * at when it calculates the maximum number of channels. ALC260 has no mixer
5382 * element which allows changing the channel mode, so the verb list is
5385 static struct hda_channel_mode alc260_modes[1] = {
5390 /* Mixer combinations
5392 * basic: base_output + input + pc_beep + capture
5393 * HP: base_output + input + capture_alt
5394 * HP_3013: hp_3013 + input + capture
5395 * fujitsu: fujitsu + capture
5396 * acer: acer + capture
5399 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
5400 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5401 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5402 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5403 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5404 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5405 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5409 static struct snd_kcontrol_new alc260_input_mixer[] = {
5410 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5411 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5412 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5413 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5414 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5415 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5416 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
5417 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
5421 /* update HP, line and mono out pins according to the master switch */
5422 static void alc260_hp_master_update(struct hda_codec *codec,
5423 hda_nid_t hp, hda_nid_t line,
5426 struct alc_spec *spec = codec->spec;
5427 unsigned int val = spec->master_sw ? PIN_HP : 0;
5428 /* change HP and line-out pins */
5429 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5431 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5433 /* mono (speaker) depending on the HP jack sense */
5434 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5435 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5439 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5440 struct snd_ctl_elem_value *ucontrol)
5442 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5443 struct alc_spec *spec = codec->spec;
5444 *ucontrol->value.integer.value = spec->master_sw;
5448 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
5449 struct snd_ctl_elem_value *ucontrol)
5451 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5452 struct alc_spec *spec = codec->spec;
5453 int val = !!*ucontrol->value.integer.value;
5454 hda_nid_t hp, line, mono;
5456 if (val == spec->master_sw)
5458 spec->master_sw = val;
5459 hp = (kcontrol->private_value >> 16) & 0xff;
5460 line = (kcontrol->private_value >> 8) & 0xff;
5461 mono = kcontrol->private_value & 0xff;
5462 alc260_hp_master_update(codec, hp, line, mono);
5466 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5468 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5469 .name = "Master Playback Switch",
5470 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5471 .info = snd_ctl_boolean_mono_info,
5472 .get = alc260_hp_master_sw_get,
5473 .put = alc260_hp_master_sw_put,
5474 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5476 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5477 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5478 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5479 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5480 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5482 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5486 static struct hda_verb alc260_hp_unsol_verbs[] = {
5487 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5491 static void alc260_hp_automute(struct hda_codec *codec)
5493 struct alc_spec *spec = codec->spec;
5495 spec->jack_present = snd_hda_jack_detect(codec, 0x10);
5496 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5499 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5501 if ((res >> 26) == ALC880_HP_EVENT)
5502 alc260_hp_automute(codec);
5505 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5507 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5508 .name = "Master Playback Switch",
5509 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5510 .info = snd_ctl_boolean_mono_info,
5511 .get = alc260_hp_master_sw_get,
5512 .put = alc260_hp_master_sw_put,
5513 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5515 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5516 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5517 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
5518 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
5519 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5520 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5521 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5522 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
5526 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
5527 .ops = &snd_hda_bind_vol,
5529 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
5530 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
5531 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
5536 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
5537 .ops = &snd_hda_bind_sw,
5539 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
5540 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
5545 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
5546 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
5547 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
5548 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
5549 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5553 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
5554 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5558 static void alc260_hp_3013_automute(struct hda_codec *codec)
5560 struct alc_spec *spec = codec->spec;
5562 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
5563 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
5566 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
5569 if ((res >> 26) == ALC880_HP_EVENT)
5570 alc260_hp_3013_automute(codec);
5573 static void alc260_hp_3012_automute(struct hda_codec *codec)
5575 unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT;
5577 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5579 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5581 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5585 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
5588 if ((res >> 26) == ALC880_HP_EVENT)
5589 alc260_hp_3012_automute(codec);
5592 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
5593 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
5595 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
5596 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5597 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
5598 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5599 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5600 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5601 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
5602 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
5603 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
5604 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5605 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
5609 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
5610 * versions of the ALC260 don't act on requests to enable mic bias from NID
5611 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5612 * datasheet doesn't mention this restriction. At this stage it's not clear
5613 * whether this behaviour is intentional or is a hardware bug in chip
5614 * revisions available in early 2006. Therefore for now allow the
5615 * "Headphone Jack Mode" control to span all choices, but if it turns out
5616 * that the lack of mic bias for this NID is intentional we could change the
5617 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5619 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5620 * don't appear to make the mic bias available from the "line" jack, even
5621 * though the NID used for this jack (0x14) can supply it. The theory is
5622 * that perhaps Acer have included blocking capacitors between the ALC260
5623 * and the output jack. If this turns out to be the case for all such
5624 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5625 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5627 * The C20x Tablet series have a mono internal speaker which is controlled
5628 * via the chip's Mono sum widget and pin complex, so include the necessary
5629 * controls for such models. On models without a "mono speaker" the control
5630 * won't do anything.
5632 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5633 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5634 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5635 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5636 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5638 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5640 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5641 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5642 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5643 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5644 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5645 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5646 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5647 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5651 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5653 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
5654 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5655 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5656 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5657 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5658 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5659 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5663 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5664 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5666 static struct snd_kcontrol_new alc260_will_mixer[] = {
5667 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5668 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5669 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5670 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5671 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5672 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5673 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5674 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5675 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5676 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5680 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5681 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5683 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5684 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5685 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5686 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5687 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5688 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5689 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
5690 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
5691 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5692 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5693 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5698 * initialization verbs
5700 static struct hda_verb alc260_init_verbs[] = {
5701 /* Line In pin widget for input */
5702 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5703 /* CD pin widget for input */
5704 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5705 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5706 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5707 /* Mic2 (front panel) pin widget for input and vref at 80% */
5708 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5709 /* LINE-2 is used for line-out in rear */
5710 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5711 /* select line-out */
5712 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
5714 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5716 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5718 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5719 /* mute capture amp left and right */
5720 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5721 /* set connection select to line in (default select for this ADC) */
5722 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5723 /* mute capture amp left and right */
5724 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5725 /* set connection select to line in (default select for this ADC) */
5726 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
5727 /* set vol=0 Line-Out mixer amp left and right */
5728 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5729 /* unmute pin widget amp left and right (no gain on this amp) */
5730 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5731 /* set vol=0 HP mixer amp left and right */
5732 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5733 /* unmute pin widget amp left and right (no gain on this amp) */
5734 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5735 /* set vol=0 Mono mixer amp left and right */
5736 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5737 /* unmute pin widget amp left and right (no gain on this amp) */
5738 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5739 /* unmute LINE-2 out pin */
5740 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5741 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5744 /* mute analog inputs */
5745 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5746 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5747 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5748 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5749 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5750 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5751 /* mute Front out path */
5752 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5753 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5754 /* mute Headphone out path */
5755 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5756 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5757 /* mute Mono out path */
5758 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5759 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5763 #if 0 /* should be identical with alc260_init_verbs? */
5764 static struct hda_verb alc260_hp_init_verbs[] = {
5765 /* Headphone and output */
5766 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5768 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5769 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5770 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5771 /* Mic2 (front panel) pin widget for input and vref at 80% */
5772 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5773 /* Line In pin widget for input */
5774 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5775 /* Line-2 pin widget for output */
5776 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5777 /* CD pin widget for input */
5778 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5779 /* unmute amp left and right */
5780 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5781 /* set connection select to line in (default select for this ADC) */
5782 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5783 /* unmute Line-Out mixer amp left and right (volume = 0) */
5784 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5785 /* mute pin widget amp left and right (no gain on this amp) */
5786 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5787 /* unmute HP mixer amp left and right (volume = 0) */
5788 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5789 /* mute pin widget amp left and right (no gain on this amp) */
5790 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5791 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5794 /* mute analog inputs */
5795 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5796 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5797 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5798 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5799 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5800 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5801 /* Unmute Front out path */
5802 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5803 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5804 /* Unmute Headphone out path */
5805 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5806 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5807 /* Unmute Mono out path */
5808 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5809 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5814 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5815 /* Line out and output */
5816 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5818 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5819 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5820 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5821 /* Mic2 (front panel) pin widget for input and vref at 80% */
5822 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5823 /* Line In pin widget for input */
5824 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5825 /* Headphone pin widget for output */
5826 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5827 /* CD pin widget for input */
5828 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5829 /* unmute amp left and right */
5830 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5831 /* set connection select to line in (default select for this ADC) */
5832 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5833 /* unmute Line-Out mixer amp left and right (volume = 0) */
5834 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5835 /* mute pin widget amp left and right (no gain on this amp) */
5836 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5837 /* unmute HP mixer amp left and right (volume = 0) */
5838 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5839 /* mute pin widget amp left and right (no gain on this amp) */
5840 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5841 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5844 /* mute analog inputs */
5845 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5846 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5847 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5848 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5849 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5850 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5851 /* Unmute Front out path */
5852 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5853 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5854 /* Unmute Headphone out path */
5855 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5856 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5857 /* Unmute Mono out path */
5858 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5859 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5863 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5864 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5865 * audio = 0x16, internal speaker = 0x10.
5867 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5868 /* Disable all GPIOs */
5869 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5870 /* Internal speaker is connected to headphone pin */
5871 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5872 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5873 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5874 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5875 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5876 /* Ensure all other unused pins are disabled and muted. */
5877 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5878 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5879 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5880 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5881 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5882 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5883 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5884 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5886 /* Disable digital (SPDIF) pins */
5887 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5888 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5890 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5891 * when acting as an output.
5893 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5895 /* Start with output sum widgets muted and their output gains at min */
5896 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5897 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5898 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5899 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5900 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5901 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5902 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5903 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5904 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5906 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5907 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5908 /* Unmute Line1 pin widget output buffer since it starts as an output.
5909 * If the pin mode is changed by the user the pin mode control will
5910 * take care of enabling the pin's input/output buffers as needed.
5911 * Therefore there's no need to enable the input buffer at this
5914 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5915 /* Unmute input buffer of pin widget used for Line-in (no equiv
5918 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5920 /* Mute capture amp left and right */
5921 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5922 /* Set ADC connection select to match default mixer setting - line
5925 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5927 /* Do the same for the second ADC: mute capture input amp and
5928 * set ADC connection to line in (on mic1 pin)
5930 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5931 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5933 /* Mute all inputs to mixer widget (even unconnected ones) */
5934 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5935 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5936 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5937 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5938 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5939 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5940 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5941 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5946 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5947 * similar laptops (adapted from Fujitsu init verbs).
5949 static struct hda_verb alc260_acer_init_verbs[] = {
5950 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5951 * the headphone jack. Turn this on and rely on the standard mute
5952 * methods whenever the user wants to turn these outputs off.
5954 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5955 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5956 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5957 /* Internal speaker/Headphone jack is connected to Line-out pin */
5958 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5959 /* Internal microphone/Mic jack is connected to Mic1 pin */
5960 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5961 /* Line In jack is connected to Line1 pin */
5962 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5963 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5964 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5965 /* Ensure all other unused pins are disabled and muted. */
5966 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5967 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5968 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5969 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5970 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5971 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5972 /* Disable digital (SPDIF) pins */
5973 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5974 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5976 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5977 * bus when acting as outputs.
5979 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5980 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5982 /* Start with output sum widgets muted and their output gains at min */
5983 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5984 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5985 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5986 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5987 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5988 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5989 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5990 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5991 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5993 /* Unmute Line-out pin widget amp left and right
5994 * (no equiv mixer ctrl)
5996 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5997 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5998 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5999 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6000 * inputs. If the pin mode is changed by the user the pin mode control
6001 * will take care of enabling the pin's input/output buffers as needed.
6002 * Therefore there's no need to enable the input buffer at this
6005 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6006 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6008 /* Mute capture amp left and right */
6009 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6010 /* Set ADC connection select to match default mixer setting - mic
6013 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6015 /* Do similar with the second ADC: mute capture input amp and
6016 * set ADC connection to mic to match ALSA's default state.
6018 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6019 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6021 /* Mute all inputs to mixer widget (even unconnected ones) */
6022 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6023 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6024 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6025 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6026 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6027 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6028 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6029 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6034 /* Initialisation sequence for Maxdata Favorit 100XS
6035 * (adapted from Acer init verbs).
6037 static struct hda_verb alc260_favorit100_init_verbs[] = {
6038 /* GPIO 0 enables the output jack.
6039 * Turn this on and rely on the standard mute
6040 * methods whenever the user wants to turn these outputs off.
6042 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6043 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6044 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
6045 /* Line/Mic input jack is connected to Mic1 pin */
6046 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
6047 /* Ensure all other unused pins are disabled and muted. */
6048 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6049 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6050 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6051 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6052 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6053 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6054 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6055 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6056 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6057 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6058 /* Disable digital (SPDIF) pins */
6059 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6060 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6062 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6063 * bus when acting as outputs.
6065 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6066 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6068 /* Start with output sum widgets muted and their output gains at min */
6069 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6070 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6071 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6072 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6073 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6074 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6075 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6076 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6077 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6079 /* Unmute Line-out pin widget amp left and right
6080 * (no equiv mixer ctrl)
6082 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6083 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6084 * inputs. If the pin mode is changed by the user the pin mode control
6085 * will take care of enabling the pin's input/output buffers as needed.
6086 * Therefore there's no need to enable the input buffer at this
6089 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6091 /* Mute capture amp left and right */
6092 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6093 /* Set ADC connection select to match default mixer setting - mic
6096 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6098 /* Do similar with the second ADC: mute capture input amp and
6099 * set ADC connection to mic to match ALSA's default state.
6101 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6102 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6104 /* Mute all inputs to mixer widget (even unconnected ones) */
6105 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6106 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6107 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6108 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6109 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6110 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6111 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6112 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6117 static struct hda_verb alc260_will_verbs[] = {
6118 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6119 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
6120 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
6121 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6122 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6123 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
6127 static struct hda_verb alc260_replacer_672v_verbs[] = {
6128 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6129 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6130 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
6132 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6133 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6134 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6136 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6140 /* toggle speaker-output according to the hp-jack state */
6141 static void alc260_replacer_672v_automute(struct hda_codec *codec)
6143 unsigned int present;
6145 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
6146 present = snd_hda_jack_detect(codec, 0x0f);
6148 snd_hda_codec_write_cache(codec, 0x01, 0,
6149 AC_VERB_SET_GPIO_DATA, 1);
6150 snd_hda_codec_write_cache(codec, 0x0f, 0,
6151 AC_VERB_SET_PIN_WIDGET_CONTROL,
6154 snd_hda_codec_write_cache(codec, 0x01, 0,
6155 AC_VERB_SET_GPIO_DATA, 0);
6156 snd_hda_codec_write_cache(codec, 0x0f, 0,
6157 AC_VERB_SET_PIN_WIDGET_CONTROL,
6162 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
6165 if ((res >> 26) == ALC880_HP_EVENT)
6166 alc260_replacer_672v_automute(codec);
6169 static struct hda_verb alc260_hp_dc7600_verbs[] = {
6170 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
6171 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6172 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6173 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6174 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6175 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6176 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6177 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6178 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6179 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6183 /* Test configuration for debugging, modelled after the ALC880 test
6186 #ifdef CONFIG_SND_DEBUG
6187 static hda_nid_t alc260_test_dac_nids[1] = {
6190 static hda_nid_t alc260_test_adc_nids[2] = {
6193 /* For testing the ALC260, each input MUX needs its own definition since
6194 * the signal assignments are different. This assumes that the first ADC
6197 static struct hda_input_mux alc260_test_capture_sources[2] = {
6201 { "MIC1 pin", 0x0 },
6202 { "MIC2 pin", 0x1 },
6203 { "LINE1 pin", 0x2 },
6204 { "LINE2 pin", 0x3 },
6206 { "LINE-OUT pin", 0x5 },
6207 { "HP-OUT pin", 0x6 },
6213 { "MIC1 pin", 0x0 },
6214 { "MIC2 pin", 0x1 },
6215 { "LINE1 pin", 0x2 },
6216 { "LINE2 pin", 0x3 },
6219 { "LINE-OUT pin", 0x6 },
6220 { "HP-OUT pin", 0x7 },
6224 static struct snd_kcontrol_new alc260_test_mixer[] = {
6225 /* Output driver widgets */
6226 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
6227 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
6228 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6229 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
6230 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6231 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
6233 /* Modes for retasking pin widgets
6234 * Note: the ALC260 doesn't seem to act on requests to enable mic
6235 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
6236 * mention this restriction. At this stage it's not clear whether
6237 * this behaviour is intentional or is a hardware bug in chip
6238 * revisions available at least up until early 2006. Therefore for
6239 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
6240 * choices, but if it turns out that the lack of mic bias for these
6241 * NIDs is intentional we could change their modes from
6242 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6244 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
6245 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
6246 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
6247 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
6248 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
6249 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
6251 /* Loopback mixer controls */
6252 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
6253 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
6254 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
6255 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
6256 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
6257 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
6258 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
6259 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
6260 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6261 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6262 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
6263 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
6264 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
6265 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
6267 /* Controls for GPIO pins, assuming they are configured as outputs */
6268 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
6269 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
6270 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
6271 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
6273 /* Switches to allow the digital IO pins to be enabled. The datasheet
6274 * is ambigious as to which NID is which; testing on laptops which
6275 * make this output available should provide clarification.
6277 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
6278 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
6280 /* A switch allowing EAPD to be enabled. Some laptops seem to use
6281 * this output to turn on an external amplifier.
6283 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
6284 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
6288 static struct hda_verb alc260_test_init_verbs[] = {
6289 /* Enable all GPIOs as outputs with an initial value of 0 */
6290 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
6291 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6292 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
6294 /* Enable retasking pins as output, initially without power amp */
6295 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6296 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6297 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6298 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6299 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6300 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6302 /* Disable digital (SPDIF) pins initially, but users can enable
6303 * them via a mixer switch. In the case of SPDIF-out, this initverb
6304 * payload also sets the generation to 0, output to be in "consumer"
6305 * PCM format, copyright asserted, no pre-emphasis and no validity
6308 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6309 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6311 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
6312 * OUT1 sum bus when acting as an output.
6314 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6315 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
6316 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6317 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
6319 /* Start with output sum widgets muted and their output gains at min */
6320 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6321 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6322 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6323 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6324 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6325 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6326 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6327 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6328 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6330 /* Unmute retasking pin widget output buffers since the default
6331 * state appears to be output. As the pin mode is changed by the
6332 * user the pin mode control will take care of enabling the pin's
6333 * input/output buffers as needed.
6335 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6336 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6337 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6338 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6339 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6340 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6341 /* Also unmute the mono-out pin widget */
6342 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6344 /* Mute capture amp left and right */
6345 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6346 /* Set ADC connection select to match default mixer setting (mic1
6349 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6351 /* Do the same for the second ADC: mute capture input amp and
6352 * set ADC connection to mic1 pin
6354 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6355 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6357 /* Mute all inputs to mixer widget (even unconnected ones) */
6358 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6359 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6360 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6361 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6362 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6363 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6364 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6365 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6371 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
6372 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
6374 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
6375 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
6378 * for BIOS auto-configuration
6381 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
6382 const char *pfx, int *vol_bits)
6385 unsigned long vol_val, sw_val;
6388 if (nid >= 0x0f && nid < 0x11) {
6389 nid_vol = nid - 0x7;
6390 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6391 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6392 } else if (nid == 0x11) {
6393 nid_vol = nid - 0x7;
6394 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
6395 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
6396 } else if (nid >= 0x12 && nid <= 0x15) {
6398 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6399 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6403 if (!(*vol_bits & (1 << nid_vol))) {
6404 /* first control for the volume widget */
6405 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val);
6408 *vol_bits |= (1 << nid_vol);
6410 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val);
6416 /* add playback controls from the parsed DAC table */
6417 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6418 const struct auto_pin_cfg *cfg)
6424 spec->multiout.num_dacs = 1;
6425 spec->multiout.dac_nids = spec->private_dac_nids;
6426 spec->multiout.dac_nids[0] = 0x02;
6428 nid = cfg->line_out_pins[0];
6431 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6433 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6437 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6442 nid = cfg->speaker_pins[0];
6444 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6449 nid = cfg->hp_pins[0];
6451 err = alc260_add_playback_controls(spec, nid, "Headphone",
6459 /* create playback/capture controls for input pins */
6460 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6461 const struct auto_pin_cfg *cfg)
6463 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
6466 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6467 hda_nid_t nid, int pin_type,
6470 alc_set_pin_output(codec, nid, pin_type);
6471 /* need the manual connection? */
6473 int idx = nid - 0x12;
6474 snd_hda_codec_write(codec, idx + 0x0b, 0,
6475 AC_VERB_SET_CONNECT_SEL, sel_idx);
6479 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6481 struct alc_spec *spec = codec->spec;
6484 nid = spec->autocfg.line_out_pins[0];
6486 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6487 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6490 nid = spec->autocfg.speaker_pins[0];
6492 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6494 nid = spec->autocfg.hp_pins[0];
6496 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6499 #define ALC260_PIN_CD_NID 0x16
6500 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6502 struct alc_spec *spec = codec->spec;
6505 for (i = 0; i < AUTO_PIN_LAST; i++) {
6506 hda_nid_t nid = spec->autocfg.input_pins[i];
6508 alc_set_input_pin(codec, nid, i);
6509 if (nid != ALC260_PIN_CD_NID &&
6510 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6511 snd_hda_codec_write(codec, nid, 0,
6512 AC_VERB_SET_AMP_GAIN_MUTE,
6518 #define alc260_auto_init_input_src alc880_auto_init_input_src
6521 * generic initialization of ADC, input mixers and output mixers
6523 static struct hda_verb alc260_volume_init_verbs[] = {
6525 * Unmute ADC0-1 and set the default input to mic-in
6527 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6528 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6529 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6530 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6532 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6534 * Note: PASD motherboards uses the Line In 2 as the input for
6535 * front panel mic (mic 2)
6537 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6538 /* mute analog inputs */
6539 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6540 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6541 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6542 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6543 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6546 * Set up output mixers (0x08 - 0x0a)
6548 /* set vol=0 to output mixers */
6549 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6550 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6551 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6552 /* set up input amps for analog loopback */
6553 /* Amp Indices: DAC = 0, mixer = 1 */
6554 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6555 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6556 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6557 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6558 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6559 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6564 static int alc260_parse_auto_config(struct hda_codec *codec)
6566 struct alc_spec *spec = codec->spec;
6568 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
6570 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
6574 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
6577 if (!spec->kctls.list)
6578 return 0; /* can't find valid BIOS pin config */
6579 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
6583 spec->multiout.max_channels = 2;
6585 if (spec->autocfg.dig_outs)
6586 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6587 if (spec->kctls.list)
6588 add_mixer(spec, spec->kctls.list);
6590 add_verb(spec, alc260_volume_init_verbs);
6592 spec->num_mux_defs = 1;
6593 spec->input_mux = &spec->private_imux[0];
6595 alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0);
6600 /* additional initialization for auto-configuration model */
6601 static void alc260_auto_init(struct hda_codec *codec)
6603 struct alc_spec *spec = codec->spec;
6604 alc260_auto_init_multi_out(codec);
6605 alc260_auto_init_analog_input(codec);
6606 alc260_auto_init_input_src(codec);
6607 if (spec->unsol_event)
6608 alc_inithook(codec);
6611 #ifdef CONFIG_SND_HDA_POWER_SAVE
6612 static struct hda_amp_list alc260_loopbacks[] = {
6613 { 0x07, HDA_INPUT, 0 },
6614 { 0x07, HDA_INPUT, 1 },
6615 { 0x07, HDA_INPUT, 2 },
6616 { 0x07, HDA_INPUT, 3 },
6617 { 0x07, HDA_INPUT, 4 },
6623 * ALC260 configurations
6625 static const char *alc260_models[ALC260_MODEL_LAST] = {
6626 [ALC260_BASIC] = "basic",
6628 [ALC260_HP_3013] = "hp-3013",
6629 [ALC260_HP_DC7600] = "hp-dc7600",
6630 [ALC260_FUJITSU_S702X] = "fujitsu",
6631 [ALC260_ACER] = "acer",
6632 [ALC260_WILL] = "will",
6633 [ALC260_REPLACER_672V] = "replacer",
6634 [ALC260_FAVORIT100] = "favorit100",
6635 #ifdef CONFIG_SND_DEBUG
6636 [ALC260_TEST] = "test",
6638 [ALC260_AUTO] = "auto",
6641 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6642 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6643 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
6644 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6645 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6646 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6647 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */
6648 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6649 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6650 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6651 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6652 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6653 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6654 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6655 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6656 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6657 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6658 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6659 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6660 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6661 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6665 static struct alc_config_preset alc260_presets[] = {
6667 .mixers = { alc260_base_output_mixer,
6668 alc260_input_mixer },
6669 .init_verbs = { alc260_init_verbs },
6670 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6671 .dac_nids = alc260_dac_nids,
6672 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6673 .adc_nids = alc260_dual_adc_nids,
6674 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6675 .channel_mode = alc260_modes,
6676 .input_mux = &alc260_capture_source,
6679 .mixers = { alc260_hp_output_mixer,
6680 alc260_input_mixer },
6681 .init_verbs = { alc260_init_verbs,
6682 alc260_hp_unsol_verbs },
6683 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6684 .dac_nids = alc260_dac_nids,
6685 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6686 .adc_nids = alc260_adc_nids_alt,
6687 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6688 .channel_mode = alc260_modes,
6689 .input_mux = &alc260_capture_source,
6690 .unsol_event = alc260_hp_unsol_event,
6691 .init_hook = alc260_hp_automute,
6693 [ALC260_HP_DC7600] = {
6694 .mixers = { alc260_hp_dc7600_mixer,
6695 alc260_input_mixer },
6696 .init_verbs = { alc260_init_verbs,
6697 alc260_hp_dc7600_verbs },
6698 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6699 .dac_nids = alc260_dac_nids,
6700 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6701 .adc_nids = alc260_adc_nids_alt,
6702 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6703 .channel_mode = alc260_modes,
6704 .input_mux = &alc260_capture_source,
6705 .unsol_event = alc260_hp_3012_unsol_event,
6706 .init_hook = alc260_hp_3012_automute,
6708 [ALC260_HP_3013] = {
6709 .mixers = { alc260_hp_3013_mixer,
6710 alc260_input_mixer },
6711 .init_verbs = { alc260_hp_3013_init_verbs,
6712 alc260_hp_3013_unsol_verbs },
6713 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6714 .dac_nids = alc260_dac_nids,
6715 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6716 .adc_nids = alc260_adc_nids_alt,
6717 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6718 .channel_mode = alc260_modes,
6719 .input_mux = &alc260_capture_source,
6720 .unsol_event = alc260_hp_3013_unsol_event,
6721 .init_hook = alc260_hp_3013_automute,
6723 [ALC260_FUJITSU_S702X] = {
6724 .mixers = { alc260_fujitsu_mixer },
6725 .init_verbs = { alc260_fujitsu_init_verbs },
6726 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6727 .dac_nids = alc260_dac_nids,
6728 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6729 .adc_nids = alc260_dual_adc_nids,
6730 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6731 .channel_mode = alc260_modes,
6732 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
6733 .input_mux = alc260_fujitsu_capture_sources,
6736 .mixers = { alc260_acer_mixer },
6737 .init_verbs = { alc260_acer_init_verbs },
6738 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6739 .dac_nids = alc260_dac_nids,
6740 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6741 .adc_nids = alc260_dual_adc_nids,
6742 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6743 .channel_mode = alc260_modes,
6744 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
6745 .input_mux = alc260_acer_capture_sources,
6747 [ALC260_FAVORIT100] = {
6748 .mixers = { alc260_favorit100_mixer },
6749 .init_verbs = { alc260_favorit100_init_verbs },
6750 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6751 .dac_nids = alc260_dac_nids,
6752 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6753 .adc_nids = alc260_dual_adc_nids,
6754 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6755 .channel_mode = alc260_modes,
6756 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
6757 .input_mux = alc260_favorit100_capture_sources,
6760 .mixers = { alc260_will_mixer },
6761 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6762 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6763 .dac_nids = alc260_dac_nids,
6764 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6765 .adc_nids = alc260_adc_nids,
6766 .dig_out_nid = ALC260_DIGOUT_NID,
6767 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6768 .channel_mode = alc260_modes,
6769 .input_mux = &alc260_capture_source,
6771 [ALC260_REPLACER_672V] = {
6772 .mixers = { alc260_replacer_672v_mixer },
6773 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6774 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6775 .dac_nids = alc260_dac_nids,
6776 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6777 .adc_nids = alc260_adc_nids,
6778 .dig_out_nid = ALC260_DIGOUT_NID,
6779 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6780 .channel_mode = alc260_modes,
6781 .input_mux = &alc260_capture_source,
6782 .unsol_event = alc260_replacer_672v_unsol_event,
6783 .init_hook = alc260_replacer_672v_automute,
6785 #ifdef CONFIG_SND_DEBUG
6787 .mixers = { alc260_test_mixer },
6788 .init_verbs = { alc260_test_init_verbs },
6789 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6790 .dac_nids = alc260_test_dac_nids,
6791 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6792 .adc_nids = alc260_test_adc_nids,
6793 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6794 .channel_mode = alc260_modes,
6795 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6796 .input_mux = alc260_test_capture_sources,
6801 static int patch_alc260(struct hda_codec *codec)
6803 struct alc_spec *spec;
6804 int err, board_config;
6806 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6812 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6815 if (board_config < 0) {
6816 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6818 board_config = ALC260_AUTO;
6821 if (board_config == ALC260_AUTO) {
6822 /* automatic parse from the BIOS config */
6823 err = alc260_parse_auto_config(codec);
6829 "hda_codec: Cannot set up configuration "
6830 "from BIOS. Using base mode...\n");
6831 board_config = ALC260_BASIC;
6835 err = snd_hda_attach_beep_device(codec, 0x1);
6841 if (board_config != ALC260_AUTO)
6842 setup_preset(codec, &alc260_presets[board_config]);
6844 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6845 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6847 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6848 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6850 if (!spec->adc_nids && spec->input_mux) {
6851 /* check whether NID 0x04 is valid */
6852 unsigned int wcap = get_wcaps(codec, 0x04);
6853 wcap = get_wcaps_type(wcap);
6855 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6856 spec->adc_nids = alc260_adc_nids_alt;
6857 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6859 spec->adc_nids = alc260_adc_nids;
6860 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6863 set_capture_mixer(codec);
6864 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6866 spec->vmaster_nid = 0x08;
6868 codec->patch_ops = alc_patch_ops;
6869 if (board_config == ALC260_AUTO)
6870 spec->init_hook = alc260_auto_init;
6871 #ifdef CONFIG_SND_HDA_POWER_SAVE
6872 if (!spec->loopback.amplist)
6873 spec->loopback.amplist = alc260_loopbacks;
6881 * ALC882/883/885/888/889 support
6883 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6884 * configuration. Each pin widget can choose any input DACs and a mixer.
6885 * Each ADC is connected from a mixer of all inputs. This makes possible
6886 * 6-channel independent captures.
6888 * In addition, an independent DAC for the multi-playback (not used in this
6891 #define ALC882_DIGOUT_NID 0x06
6892 #define ALC882_DIGIN_NID 0x0a
6893 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
6894 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
6895 #define ALC1200_DIGOUT_NID 0x10
6898 static struct hda_channel_mode alc882_ch_modes[1] = {
6903 static hda_nid_t alc882_dac_nids[4] = {
6904 /* front, rear, clfe, rear_surr */
6905 0x02, 0x03, 0x04, 0x05
6907 #define alc883_dac_nids alc882_dac_nids
6910 #define alc882_adc_nids alc880_adc_nids
6911 #define alc882_adc_nids_alt alc880_adc_nids_alt
6912 #define alc883_adc_nids alc882_adc_nids_alt
6913 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
6914 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
6915 #define alc889_adc_nids alc880_adc_nids
6917 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6918 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6919 #define alc883_capsrc_nids alc882_capsrc_nids_alt
6920 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
6921 #define alc889_capsrc_nids alc882_capsrc_nids
6924 /* FIXME: should be a matrix-type input source selection */
6926 static struct hda_input_mux alc882_capture_source = {
6930 { "Front Mic", 0x1 },
6936 #define alc883_capture_source alc882_capture_source
6938 static struct hda_input_mux alc889_capture_source = {
6941 { "Front Mic", 0x0 },
6947 static struct hda_input_mux mb5_capture_source = {
6956 static struct hda_input_mux macmini3_capture_source = {
6964 static struct hda_input_mux alc883_3stack_6ch_intel = {
6968 { "Front Mic", 0x0 },
6974 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6982 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6992 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
7000 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
7004 { "Front Mic", 0x1 },
7009 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
7017 static struct hda_input_mux alc889A_mb31_capture_source = {
7021 /* Front Mic (0x01) unused */
7023 /* Line 2 (0x03) unused */
7024 /* CD (0x04) unused? */
7031 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
7038 static struct hda_verb alc882_3ST_ch2_init[] = {
7039 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7040 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7041 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7042 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7049 static struct hda_verb alc882_3ST_ch4_init[] = {
7050 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7051 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7052 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7053 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7054 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7061 static struct hda_verb alc882_3ST_ch6_init[] = {
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 alc882_3ST_6ch_modes[3] = {
7072 { 2, alc882_3ST_ch2_init },
7073 { 4, alc882_3ST_ch4_init },
7074 { 6, alc882_3ST_ch6_init },
7077 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
7082 static struct hda_verb alc883_3ST_ch2_clevo_init[] = {
7083 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
7084 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7085 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7086 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7087 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7094 static struct hda_verb alc883_3ST_ch4_clevo_init[] = {
7095 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7096 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7097 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7098 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7099 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7100 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7107 static struct hda_verb alc883_3ST_ch6_clevo_init[] = {
7108 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7109 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7110 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7111 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7112 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7113 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7114 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7118 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
7119 { 2, alc883_3ST_ch2_clevo_init },
7120 { 4, alc883_3ST_ch4_clevo_init },
7121 { 6, alc883_3ST_ch6_clevo_init },
7128 static struct hda_verb alc882_sixstack_ch6_init[] = {
7129 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7130 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7131 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7132 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7139 static struct hda_verb alc882_sixstack_ch8_init[] = {
7140 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7141 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7142 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7143 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7147 static struct hda_channel_mode alc882_sixstack_modes[2] = {
7148 { 6, alc882_sixstack_ch6_init },
7149 { 8, alc882_sixstack_ch8_init },
7153 /* Macbook Air 2,1 */
7155 static struct hda_channel_mode alc885_mba21_ch_modes[1] = {
7160 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
7166 static struct hda_verb alc885_mbp_ch2_init[] = {
7167 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7168 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7169 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7176 static struct hda_verb alc885_mbp_ch4_init[] = {
7177 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7178 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7179 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7180 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7181 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7185 static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
7186 { 2, alc885_mbp_ch2_init },
7187 { 4, alc885_mbp_ch4_init },
7192 * Speakers/Woofer/HP = Front
7195 static struct hda_verb alc885_mb5_ch2_init[] = {
7196 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7197 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7203 * Speakers/HP = Front
7207 static struct hda_verb alc885_mb5_ch6_init[] = {
7208 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7209 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7210 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7214 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
7215 { 2, alc885_mb5_ch2_init },
7216 { 6, alc885_mb5_ch6_init },
7219 #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes
7224 static struct hda_verb alc883_4ST_ch2_init[] = {
7225 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7226 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7227 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7228 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7229 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7230 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7237 static struct hda_verb alc883_4ST_ch4_init[] = {
7238 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7239 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7240 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7241 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7242 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7243 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7244 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7251 static struct hda_verb alc883_4ST_ch6_init[] = {
7252 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7253 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7254 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7255 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7256 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7257 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7258 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7259 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7266 static struct hda_verb alc883_4ST_ch8_init[] = {
7267 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7268 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7269 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7270 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7271 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7272 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7273 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7274 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7275 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7279 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
7280 { 2, alc883_4ST_ch2_init },
7281 { 4, alc883_4ST_ch4_init },
7282 { 6, alc883_4ST_ch6_init },
7283 { 8, alc883_4ST_ch8_init },
7290 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7291 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7292 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7293 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7294 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7301 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7302 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7303 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7304 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7305 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7306 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7313 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7314 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7315 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7316 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7317 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7318 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7319 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7323 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7324 { 2, alc883_3ST_ch2_intel_init },
7325 { 4, alc883_3ST_ch4_intel_init },
7326 { 6, alc883_3ST_ch6_intel_init },
7332 static struct hda_verb alc889_ch2_intel_init[] = {
7333 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7334 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
7335 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
7336 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
7337 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7338 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7345 static struct hda_verb alc889_ch6_intel_init[] = {
7346 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7347 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7348 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7349 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7350 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7351 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7358 static struct hda_verb alc889_ch8_intel_init[] = {
7359 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7360 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7361 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7362 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7363 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
7364 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7365 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7369 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
7370 { 2, alc889_ch2_intel_init },
7371 { 6, alc889_ch6_intel_init },
7372 { 8, alc889_ch8_intel_init },
7378 static struct hda_verb alc883_sixstack_ch6_init[] = {
7379 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7380 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7381 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7382 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7389 static struct hda_verb alc883_sixstack_ch8_init[] = {
7390 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7391 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7392 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7393 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7397 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7398 { 6, alc883_sixstack_ch6_init },
7399 { 8, alc883_sixstack_ch8_init },
7403 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7404 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7406 static struct snd_kcontrol_new alc882_base_mixer[] = {
7407 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7408 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7409 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7410 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7411 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7412 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7413 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7414 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7415 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7416 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7417 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7418 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7419 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7420 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7421 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7422 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7423 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7424 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7425 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7426 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7427 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7431 /* Macbook Air 2,1 same control for HP and internal Speaker */
7433 static struct snd_kcontrol_new alc885_mba21_mixer[] = {
7434 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7435 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT),
7440 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
7441 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7442 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7443 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7444 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
7445 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7446 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7447 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7448 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7449 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7450 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
7451 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7455 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7456 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7457 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7458 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7459 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7460 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7461 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7462 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7463 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7464 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7465 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7466 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7467 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7468 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7469 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
7473 static struct snd_kcontrol_new alc885_macmini3_mixer[] = {
7474 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7475 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7476 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7477 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7478 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7479 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7480 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7481 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7482 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
7483 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
7484 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7488 static struct snd_kcontrol_new alc885_imac91_mixer[] = {
7489 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7490 HDA_BIND_MUTE ("Line-Out Playback Switch", 0x0c, 0x02, HDA_INPUT),
7491 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
7492 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7493 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7494 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7495 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7496 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7497 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7502 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
7503 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7504 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7505 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7506 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7507 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7508 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7509 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7510 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7511 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7515 static struct snd_kcontrol_new alc882_targa_mixer[] = {
7516 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7517 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7518 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7519 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7520 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7521 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7522 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7523 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7524 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7525 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7526 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7527 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7528 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7532 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
7533 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
7535 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
7536 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7537 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7538 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7539 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
7540 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7541 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7542 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7543 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7544 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
7545 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
7546 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7547 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7548 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7552 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
7553 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7554 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7555 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7556 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7557 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7558 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7559 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7560 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7561 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7562 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7566 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
7568 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7569 .name = "Channel Mode",
7570 .info = alc_ch_mode_info,
7571 .get = alc_ch_mode_get,
7572 .put = alc_ch_mode_put,
7577 static struct hda_verb alc882_base_init_verbs[] = {
7578 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7579 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7580 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7582 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7583 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7585 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7586 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7588 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7589 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7591 /* Front Pin: output 0 (0x0c) */
7592 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7593 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7594 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7595 /* Rear Pin: output 1 (0x0d) */
7596 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7597 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7598 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7599 /* CLFE Pin: output 2 (0x0e) */
7600 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7601 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7602 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7603 /* Side Pin: output 3 (0x0f) */
7604 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7605 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7606 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7607 /* Mic (rear) pin: input vref at 80% */
7608 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7609 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7610 /* Front Mic pin: input vref at 80% */
7611 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7612 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7613 /* Line In pin: input */
7614 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7615 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7616 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7617 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7618 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7619 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7620 /* CD pin widget for input */
7621 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7623 /* FIXME: use matrix-type input source selection */
7624 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7626 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7628 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7629 /* ADC2: mute amp left and right */
7630 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7631 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7632 /* ADC3: mute amp left and right */
7633 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7634 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7639 static struct hda_verb alc882_adc1_init_verbs[] = {
7640 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7641 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7642 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7643 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7644 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7645 /* ADC1: mute amp left and right */
7646 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7647 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7651 static struct hda_verb alc882_eapd_verbs[] = {
7652 /* change to EAPD mode */
7653 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7654 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
7658 static struct hda_verb alc889_eapd_verbs[] = {
7659 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
7660 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
7664 static struct hda_verb alc_hp15_unsol_verbs[] = {
7665 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7666 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7670 static struct hda_verb alc885_init_verbs[] = {
7671 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7672 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7673 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7675 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7676 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7678 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7679 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7681 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7682 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7684 /* Front HP Pin: output 0 (0x0c) */
7685 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7686 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7687 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7688 /* Front Pin: output 0 (0x0c) */
7689 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7690 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7691 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7692 /* Rear Pin: output 1 (0x0d) */
7693 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7694 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7695 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
7696 /* CLFE Pin: output 2 (0x0e) */
7697 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7698 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7699 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7700 /* Side Pin: output 3 (0x0f) */
7701 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7702 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7703 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7704 /* Mic (rear) pin: input vref at 80% */
7705 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7706 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7707 /* Front Mic pin: input vref at 80% */
7708 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7709 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7710 /* Line In pin: input */
7711 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7712 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7714 /* Mixer elements: 0x18, , 0x1a, 0x1b */
7716 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7718 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7720 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7721 /* ADC2: mute amp left and right */
7722 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7723 /* ADC3: mute amp left and right */
7724 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7729 static struct hda_verb alc885_init_input_verbs[] = {
7730 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7731 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7732 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7737 /* Unmute Selector 24h and set the default input to front mic */
7738 static struct hda_verb alc889_init_input_verbs[] = {
7739 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
7740 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7745 #define alc883_init_verbs alc882_base_init_verbs
7748 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
7749 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7750 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7751 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
7752 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7753 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7754 /* FIXME: this looks suspicious...
7755 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
7756 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
7761 static struct hda_verb alc882_macpro_init_verbs[] = {
7762 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7763 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7764 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7765 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7766 /* Front Pin: output 0 (0x0c) */
7767 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7768 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7769 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7770 /* Front Mic pin: input vref at 80% */
7771 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7772 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7773 /* Speaker: output */
7774 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7775 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7776 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
7777 /* Headphone output (output 0 - 0x0c) */
7778 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7779 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7780 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7782 /* FIXME: use matrix-type input source selection */
7783 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7784 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7785 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7786 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7787 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7788 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7790 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7791 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7792 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7793 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7795 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7796 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7797 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7798 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7799 /* ADC1: mute amp left and right */
7800 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7801 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7802 /* ADC2: mute amp left and right */
7803 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7804 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7805 /* ADC3: mute amp left and right */
7806 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7807 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7813 static struct hda_verb alc885_mb5_init_verbs[] = {
7815 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7816 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7817 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7818 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7820 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7821 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7822 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7823 /* Surround mixer */
7824 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7825 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7826 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7828 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7829 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7830 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7832 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7833 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7834 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7835 /* Front Pin (0x0c) */
7836 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7837 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7838 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7839 /* LFE Pin (0x0e) */
7840 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7841 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7842 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7844 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7845 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7846 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7847 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7848 /* Front Mic pin: input vref at 80% */
7849 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7850 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7852 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7853 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7855 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7856 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7857 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7858 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7863 static struct hda_verb alc885_macmini3_init_verbs[] = {
7865 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7866 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7867 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7868 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7870 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7871 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7872 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7873 /* Surround mixer */
7874 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7875 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7876 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7878 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7879 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7880 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7882 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7883 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7884 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7885 /* Front Pin (0x0c) */
7886 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7887 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7888 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7889 /* LFE Pin (0x0e) */
7890 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7891 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7892 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7894 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7895 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7896 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7897 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7899 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7900 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7902 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7903 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7904 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7905 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7910 static struct hda_verb alc885_mba21_init_verbs[] = {
7911 /*Internal and HP Speaker Mixer*/
7912 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7913 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7914 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7915 /*Internal Speaker Pin (0x0c)*/
7916 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
7917 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7918 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7919 /* HP Pin: output 0 (0x0e) */
7920 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7921 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7922 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7923 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
7924 /* Line in (is hp when jack connected)*/
7925 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
7926 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7932 /* Macbook Pro rev3 */
7933 static struct hda_verb alc885_mbp3_init_verbs[] = {
7934 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7935 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7936 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7937 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7939 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7940 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7941 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7943 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7944 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7945 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7946 /* Front Pin: output 0 (0x0c) */
7947 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7948 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7949 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7950 /* HP Pin: output 0 (0x0e) */
7951 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7952 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7953 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
7954 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7955 /* Mic (rear) pin: input vref at 80% */
7956 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7957 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7958 /* Front Mic pin: input vref at 80% */
7959 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7960 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7961 /* Line In pin: use output 1 when in LineOut mode */
7962 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7963 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7964 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7966 /* FIXME: use matrix-type input source selection */
7967 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7968 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7969 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7970 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7971 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7972 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7974 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7975 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7976 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7977 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7979 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7980 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7981 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7982 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7983 /* ADC1: mute amp left and right */
7984 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7985 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7986 /* ADC2: mute amp left and right */
7987 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7988 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7989 /* ADC3: mute amp left and right */
7990 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7991 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7997 static struct hda_verb alc885_imac91_init_verbs[] = {
7998 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
7999 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8000 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8001 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8003 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8004 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8005 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8006 /* HP Pin: output 0 (0x0c) */
8007 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8008 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8009 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8010 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8011 /* Internal Speakers: output 0 (0x0d) */
8012 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8013 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8014 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8015 /* Mic (rear) pin: input vref at 80% */
8016 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8017 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8018 /* Front Mic pin: input vref at 80% */
8019 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8020 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8021 /* Line In pin: use output 1 when in LineOut mode */
8022 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8023 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8024 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8026 /* FIXME: use matrix-type input source selection */
8027 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8028 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8029 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8030 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8031 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8032 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8034 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8035 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8036 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8037 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8039 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8040 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8041 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8042 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8043 /* ADC1: mute amp left and right */
8044 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8045 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8046 /* ADC2: mute amp left and right */
8047 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8048 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8049 /* ADC3: mute amp left and right */
8050 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8051 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8056 /* iMac 24 mixer. */
8057 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
8058 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8059 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
8063 /* iMac 24 init verbs. */
8064 static struct hda_verb alc885_imac24_init_verbs[] = {
8065 /* Internal speakers: output 0 (0x0c) */
8066 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8067 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8068 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8069 /* Internal speakers: output 0 (0x0c) */
8070 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8071 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8072 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8073 /* Headphone: output 0 (0x0c) */
8074 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8075 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8076 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8077 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8078 /* Front Mic: input vref at 80% */
8079 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8080 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8084 /* Toggle speaker-output according to the hp-jack state */
8085 static void alc885_imac24_setup(struct hda_codec *codec)
8087 struct alc_spec *spec = codec->spec;
8089 spec->autocfg.hp_pins[0] = 0x14;
8090 spec->autocfg.speaker_pins[0] = 0x18;
8091 spec->autocfg.speaker_pins[1] = 0x1a;
8094 #define alc885_mb5_setup alc885_imac24_setup
8095 #define alc885_macmini3_setup alc885_imac24_setup
8097 /* Macbook Air 2,1 */
8098 static void alc885_mba21_setup(struct hda_codec *codec)
8100 struct alc_spec *spec = codec->spec;
8102 spec->autocfg.hp_pins[0] = 0x14;
8103 spec->autocfg.speaker_pins[0] = 0x18;
8108 static void alc885_mbp3_setup(struct hda_codec *codec)
8110 struct alc_spec *spec = codec->spec;
8112 spec->autocfg.hp_pins[0] = 0x15;
8113 spec->autocfg.speaker_pins[0] = 0x14;
8116 static void alc885_imac91_setup(struct hda_codec *codec)
8118 struct alc_spec *spec = codec->spec;
8120 spec->autocfg.hp_pins[0] = 0x14;
8121 spec->autocfg.speaker_pins[0] = 0x15;
8122 spec->autocfg.speaker_pins[1] = 0x1a;
8125 static struct hda_verb alc882_targa_verbs[] = {
8126 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8127 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8129 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8130 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8132 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8133 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8134 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8136 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8140 /* toggle speaker-output according to the hp-jack state */
8141 static void alc882_targa_automute(struct hda_codec *codec)
8143 struct alc_spec *spec = codec->spec;
8144 alc_automute_amp(codec);
8145 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
8146 spec->jack_present ? 1 : 3);
8149 static void alc882_targa_setup(struct hda_codec *codec)
8151 struct alc_spec *spec = codec->spec;
8153 spec->autocfg.hp_pins[0] = 0x14;
8154 spec->autocfg.speaker_pins[0] = 0x1b;
8157 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
8159 if ((res >> 26) == ALC880_HP_EVENT)
8160 alc882_targa_automute(codec);
8163 static struct hda_verb alc882_asus_a7j_verbs[] = {
8164 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8165 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8167 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8168 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8169 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8171 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8172 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8173 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8175 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8176 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8177 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8181 static struct hda_verb alc882_asus_a7m_verbs[] = {
8182 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8183 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8185 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8186 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8187 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8189 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8190 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8191 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8193 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8194 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8195 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8199 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
8201 unsigned int gpiostate, gpiomask, gpiodir;
8203 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
8204 AC_VERB_GET_GPIO_DATA, 0);
8207 gpiostate |= (1 << pin);
8209 gpiostate &= ~(1 << pin);
8211 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
8212 AC_VERB_GET_GPIO_MASK, 0);
8213 gpiomask |= (1 << pin);
8215 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
8216 AC_VERB_GET_GPIO_DIRECTION, 0);
8217 gpiodir |= (1 << pin);
8220 snd_hda_codec_write(codec, codec->afg, 0,
8221 AC_VERB_SET_GPIO_MASK, gpiomask);
8222 snd_hda_codec_write(codec, codec->afg, 0,
8223 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
8227 snd_hda_codec_write(codec, codec->afg, 0,
8228 AC_VERB_SET_GPIO_DATA, gpiostate);
8231 /* set up GPIO at initialization */
8232 static void alc885_macpro_init_hook(struct hda_codec *codec)
8234 alc882_gpio_mute(codec, 0, 0);
8235 alc882_gpio_mute(codec, 1, 0);
8238 /* set up GPIO and update auto-muting at initialization */
8239 static void alc885_imac24_init_hook(struct hda_codec *codec)
8241 alc885_macpro_init_hook(codec);
8242 alc_automute_amp(codec);
8246 * generic initialization of ADC, input mixers and output mixers
8248 static struct hda_verb alc883_auto_init_verbs[] = {
8250 * Unmute ADC0-2 and set the default input to mic-in
8252 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8253 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8254 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8255 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8258 * Set up output mixers (0x0c - 0x0f)
8260 /* set vol=0 to output mixers */
8261 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8262 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8263 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8264 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8265 /* set up input amps for analog loopback */
8266 /* Amp Indices: DAC = 0, mixer = 1 */
8267 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8268 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8269 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8270 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8271 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8272 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8273 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8274 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8275 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8276 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8278 /* FIXME: use matrix-type input source selection */
8279 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8281 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8283 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8287 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
8288 static struct hda_verb alc889A_mb31_ch2_init[] = {
8289 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8290 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8291 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8292 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8296 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
8297 static struct hda_verb alc889A_mb31_ch4_init[] = {
8298 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8299 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8300 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8301 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8305 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
8306 static struct hda_verb alc889A_mb31_ch5_init[] = {
8307 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
8308 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8309 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8310 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8314 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
8315 static struct hda_verb alc889A_mb31_ch6_init[] = {
8316 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
8317 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
8318 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8319 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8323 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
8324 { 2, alc889A_mb31_ch2_init },
8325 { 4, alc889A_mb31_ch4_init },
8326 { 5, alc889A_mb31_ch5_init },
8327 { 6, alc889A_mb31_ch6_init },
8330 static struct hda_verb alc883_medion_eapd_verbs[] = {
8331 /* eanable EAPD on medion laptop */
8332 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8333 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
8337 #define alc883_base_mixer alc882_base_mixer
8339 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
8340 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8341 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8342 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8343 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8344 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8345 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8346 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8347 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8348 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8349 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8350 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8351 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8352 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8356 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
8357 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8358 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8359 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8360 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8361 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8362 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8363 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8364 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8365 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8366 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8370 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
8371 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8372 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8373 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8374 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8375 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8376 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8377 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8378 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8379 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8380 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8384 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
8385 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8386 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8387 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8388 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8389 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8390 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8391 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8392 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8393 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8394 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8395 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8396 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8397 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8401 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
8402 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8403 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8404 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8405 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8406 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8407 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8408 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8409 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8410 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8411 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8412 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8413 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8414 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8415 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8416 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8417 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8418 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8419 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8420 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8424 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
8425 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8426 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8427 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8428 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8429 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8431 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8432 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8433 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8434 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8435 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8436 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8437 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8438 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8439 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8440 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8441 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8442 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8443 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8444 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8448 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
8449 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8450 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8451 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8452 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8453 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8455 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8456 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8457 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8458 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8459 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
8460 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8461 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8462 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8463 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
8464 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT),
8465 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
8466 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8467 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8468 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8472 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
8473 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8474 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8475 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8476 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8477 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8478 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8479 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8480 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8481 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8482 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8483 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8484 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8485 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8486 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8487 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8488 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8489 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8490 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8491 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8495 static struct snd_kcontrol_new alc883_targa_mixer[] = {
8496 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8497 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8498 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8499 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8500 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8501 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8502 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8503 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8504 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8505 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8506 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8507 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8508 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8509 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8510 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8511 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8512 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8516 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
8517 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8518 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8519 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8520 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8521 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8522 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8523 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8524 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8525 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8526 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8527 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8528 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8532 static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
8533 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8534 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8535 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8536 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8537 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8541 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
8542 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8543 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8544 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8545 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8546 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8547 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8548 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8549 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8553 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
8554 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8555 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
8556 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8557 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8558 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8559 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8560 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8561 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8562 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8566 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
8567 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8568 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8569 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8570 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8571 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8572 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8573 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8574 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8575 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8579 static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = {
8580 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8581 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8582 HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8583 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
8584 HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT),
8585 HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT),
8589 static struct hda_verb alc883_medion_wim2160_verbs[] = {
8590 /* Unmute front mixer */
8591 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8592 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8594 /* Set speaker pin to front mixer */
8595 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8597 /* Init headphone pin */
8598 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8599 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8600 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8601 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8606 /* toggle speaker-output according to the hp-jack state */
8607 static void alc883_medion_wim2160_setup(struct hda_codec *codec)
8609 struct alc_spec *spec = codec->spec;
8611 spec->autocfg.hp_pins[0] = 0x1a;
8612 spec->autocfg.speaker_pins[0] = 0x15;
8615 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
8616 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8617 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8618 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8619 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8620 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8621 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8622 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8623 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8627 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
8628 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8629 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8630 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8631 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8632 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8633 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8634 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8635 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8636 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8640 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
8641 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8642 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8643 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8644 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
8645 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
8646 0x0d, 1, 0x0, HDA_OUTPUT),
8647 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
8648 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
8649 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
8650 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8651 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8652 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8653 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8654 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8655 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8656 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8657 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8658 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8659 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8660 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8661 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8665 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
8667 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8668 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8669 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8670 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8671 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
8673 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
8674 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
8675 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
8676 /* Output switches */
8677 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
8678 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
8679 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
8681 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
8682 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
8684 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8685 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8686 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8687 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8691 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
8692 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8693 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8694 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8695 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8696 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8697 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8701 static struct hda_bind_ctls alc883_bind_cap_vol = {
8702 .ops = &snd_hda_bind_vol,
8704 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8705 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8710 static struct hda_bind_ctls alc883_bind_cap_switch = {
8711 .ops = &snd_hda_bind_sw,
8713 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8714 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8719 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
8720 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8721 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8722 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8723 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8724 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8725 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8726 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8727 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8731 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
8732 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
8733 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
8735 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8736 /* .name = "Capture Source", */
8737 .name = "Input Source",
8739 .info = alc_mux_enum_info,
8740 .get = alc_mux_enum_get,
8741 .put = alc_mux_enum_put,
8746 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
8748 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8749 .name = "Channel Mode",
8750 .info = alc_ch_mode_info,
8751 .get = alc_ch_mode_get,
8752 .put = alc_ch_mode_put,
8757 /* toggle speaker-output according to the hp-jack state */
8758 static void alc883_mitac_setup(struct hda_codec *codec)
8760 struct alc_spec *spec = codec->spec;
8762 spec->autocfg.hp_pins[0] = 0x15;
8763 spec->autocfg.speaker_pins[0] = 0x14;
8764 spec->autocfg.speaker_pins[1] = 0x17;
8767 /* auto-toggle front mic */
8769 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8771 unsigned char bits = snd_hda_jack_detect(codec, 0x18) ? HDA_AMP_MUTE : 0;
8773 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8777 static struct hda_verb alc883_mitac_verbs[] = {
8779 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8780 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8782 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8783 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8785 /* enable unsolicited event */
8786 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8787 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8792 static struct hda_verb alc883_clevo_m540r_verbs[] = {
8794 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8795 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8797 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
8799 /* enable unsolicited event */
8801 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8802 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8808 static struct hda_verb alc883_clevo_m720_verbs[] = {
8810 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8811 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8813 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
8814 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8816 /* enable unsolicited event */
8817 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8818 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8823 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8825 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8826 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8828 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8829 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8831 /* enable unsolicited event */
8832 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8837 static struct hda_verb alc883_targa_verbs[] = {
8838 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8839 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8841 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8842 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8844 /* Connect Line-Out side jack (SPDIF) to Side */
8845 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8846 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8847 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8848 /* Connect Mic jack to CLFE */
8849 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8850 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8851 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
8852 /* Connect Line-in jack to Surround */
8853 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8854 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8855 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8856 /* Connect HP out jack to Front */
8857 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8858 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8859 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8861 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8866 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8867 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8868 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8869 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8873 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8874 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8875 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8876 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8877 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8881 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8882 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8883 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8884 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8885 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8886 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8890 static struct hda_verb alc883_haier_w66_verbs[] = {
8891 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8892 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8894 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8896 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8897 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8898 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8899 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8903 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8904 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8905 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8906 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8907 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8908 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8909 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8910 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8911 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8915 static struct hda_verb alc888_6st_dell_verbs[] = {
8916 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8920 static struct hda_verb alc883_vaiott_verbs[] = {
8922 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8923 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8925 /* enable unsolicited event */
8926 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8931 static void alc888_3st_hp_setup(struct hda_codec *codec)
8933 struct alc_spec *spec = codec->spec;
8935 spec->autocfg.hp_pins[0] = 0x1b;
8936 spec->autocfg.speaker_pins[0] = 0x14;
8937 spec->autocfg.speaker_pins[1] = 0x16;
8938 spec->autocfg.speaker_pins[2] = 0x18;
8941 static struct hda_verb alc888_3st_hp_verbs[] = {
8942 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8943 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8944 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8945 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8952 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8953 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8954 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8955 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8956 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8963 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8964 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8965 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8966 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8967 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8968 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8975 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8976 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8977 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8978 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8979 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8980 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8981 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8985 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8986 { 2, alc888_3st_hp_2ch_init },
8987 { 4, alc888_3st_hp_4ch_init },
8988 { 6, alc888_3st_hp_6ch_init },
8991 /* toggle front-jack and RCA according to the hp-jack state */
8992 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8994 unsigned int present = snd_hda_jack_detect(codec, 0x1b);
8996 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8997 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8998 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8999 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9002 /* toggle RCA according to the front-jack state */
9003 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
9005 unsigned int present = snd_hda_jack_detect(codec, 0x14);
9007 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9008 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9011 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
9014 if ((res >> 26) == ALC880_HP_EVENT)
9015 alc888_lenovo_ms7195_front_automute(codec);
9016 if ((res >> 26) == ALC880_FRONT_EVENT)
9017 alc888_lenovo_ms7195_rca_automute(codec);
9020 static struct hda_verb alc883_medion_md2_verbs[] = {
9021 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9022 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9024 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9026 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9030 /* toggle speaker-output according to the hp-jack state */
9031 static void alc883_medion_md2_setup(struct hda_codec *codec)
9033 struct alc_spec *spec = codec->spec;
9035 spec->autocfg.hp_pins[0] = 0x14;
9036 spec->autocfg.speaker_pins[0] = 0x15;
9039 /* toggle speaker-output according to the hp-jack state */
9040 #define alc883_targa_init_hook alc882_targa_init_hook
9041 #define alc883_targa_unsol_event alc882_targa_unsol_event
9043 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
9045 unsigned int present;
9047 present = snd_hda_jack_detect(codec, 0x18);
9048 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
9049 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9052 static void alc883_clevo_m720_setup(struct hda_codec *codec)
9054 struct alc_spec *spec = codec->spec;
9056 spec->autocfg.hp_pins[0] = 0x15;
9057 spec->autocfg.speaker_pins[0] = 0x14;
9060 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
9062 alc_automute_amp(codec);
9063 alc883_clevo_m720_mic_automute(codec);
9066 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
9069 switch (res >> 26) {
9070 case ALC880_MIC_EVENT:
9071 alc883_clevo_m720_mic_automute(codec);
9074 alc_automute_amp_unsol_event(codec, res);
9079 /* toggle speaker-output according to the hp-jack state */
9080 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
9082 struct alc_spec *spec = codec->spec;
9084 spec->autocfg.hp_pins[0] = 0x14;
9085 spec->autocfg.speaker_pins[0] = 0x15;
9088 static void alc883_haier_w66_setup(struct hda_codec *codec)
9090 struct alc_spec *spec = codec->spec;
9092 spec->autocfg.hp_pins[0] = 0x1b;
9093 spec->autocfg.speaker_pins[0] = 0x14;
9096 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
9098 int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0;
9100 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9101 HDA_AMP_MUTE, bits);
9104 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
9106 int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0;
9108 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9109 HDA_AMP_MUTE, bits);
9110 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9111 HDA_AMP_MUTE, bits);
9114 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
9117 if ((res >> 26) == ALC880_HP_EVENT)
9118 alc883_lenovo_101e_all_automute(codec);
9119 if ((res >> 26) == ALC880_FRONT_EVENT)
9120 alc883_lenovo_101e_ispeaker_automute(codec);
9123 /* toggle speaker-output according to the hp-jack state */
9124 static void alc883_acer_aspire_setup(struct hda_codec *codec)
9126 struct alc_spec *spec = codec->spec;
9128 spec->autocfg.hp_pins[0] = 0x14;
9129 spec->autocfg.speaker_pins[0] = 0x15;
9130 spec->autocfg.speaker_pins[1] = 0x16;
9133 static struct hda_verb alc883_acer_eapd_verbs[] = {
9134 /* HP Pin: output 0 (0x0c) */
9135 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9136 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9137 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9138 /* Front Pin: output 0 (0x0c) */
9139 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9140 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9141 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9142 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
9143 /* eanable EAPD on medion laptop */
9144 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9145 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
9146 /* enable unsolicited event */
9147 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9151 static struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
9152 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9153 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
9154 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9158 static void alc888_6st_dell_setup(struct hda_codec *codec)
9160 struct alc_spec *spec = codec->spec;
9162 spec->autocfg.hp_pins[0] = 0x1b;
9163 spec->autocfg.speaker_pins[0] = 0x14;
9164 spec->autocfg.speaker_pins[1] = 0x15;
9165 spec->autocfg.speaker_pins[2] = 0x16;
9166 spec->autocfg.speaker_pins[3] = 0x17;
9169 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
9171 struct alc_spec *spec = codec->spec;
9173 spec->autocfg.hp_pins[0] = 0x1b;
9174 spec->autocfg.speaker_pins[0] = 0x14;
9175 spec->autocfg.speaker_pins[1] = 0x15;
9176 spec->autocfg.speaker_pins[2] = 0x16;
9177 spec->autocfg.speaker_pins[3] = 0x17;
9178 spec->autocfg.speaker_pins[4] = 0x1a;
9181 static void alc883_vaiott_setup(struct hda_codec *codec)
9183 struct alc_spec *spec = codec->spec;
9185 spec->autocfg.hp_pins[0] = 0x15;
9186 spec->autocfg.speaker_pins[0] = 0x14;
9187 spec->autocfg.speaker_pins[1] = 0x17;
9190 static struct hda_verb alc888_asus_m90v_verbs[] = {
9191 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9192 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9193 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9194 /* enable unsolicited event */
9195 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9196 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9200 static void alc883_mode2_setup(struct hda_codec *codec)
9202 struct alc_spec *spec = codec->spec;
9204 spec->autocfg.hp_pins[0] = 0x1b;
9205 spec->autocfg.speaker_pins[0] = 0x14;
9206 spec->autocfg.speaker_pins[1] = 0x15;
9207 spec->autocfg.speaker_pins[2] = 0x16;
9208 spec->ext_mic.pin = 0x18;
9209 spec->int_mic.pin = 0x19;
9210 spec->ext_mic.mux_idx = 0;
9211 spec->int_mic.mux_idx = 1;
9215 static struct hda_verb alc888_asus_eee1601_verbs[] = {
9216 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9217 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9218 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9219 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9220 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9221 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
9222 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
9223 /* enable unsolicited event */
9224 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9228 static void alc883_eee1601_inithook(struct hda_codec *codec)
9230 struct alc_spec *spec = codec->spec;
9232 spec->autocfg.hp_pins[0] = 0x14;
9233 spec->autocfg.speaker_pins[0] = 0x1b;
9234 alc_automute_pin(codec);
9237 static struct hda_verb alc889A_mb31_verbs[] = {
9238 /* Init rear pin (used as headphone output) */
9239 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
9240 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
9241 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9242 /* Init line pin (used as output in 4ch and 6ch mode) */
9243 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
9244 /* Init line 2 pin (used as headphone out by default) */
9245 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
9246 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
9250 /* Mute speakers according to the headphone jack state */
9251 static void alc889A_mb31_automute(struct hda_codec *codec)
9253 unsigned int present;
9255 /* Mute only in 2ch or 4ch mode */
9256 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
9258 present = snd_hda_jack_detect(codec, 0x15);
9259 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9260 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9261 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9262 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9266 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
9268 if ((res >> 26) == ALC880_HP_EVENT)
9269 alc889A_mb31_automute(codec);
9273 #ifdef CONFIG_SND_HDA_POWER_SAVE
9274 #define alc882_loopbacks alc880_loopbacks
9277 /* pcm configuration: identical with ALC880 */
9278 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
9279 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
9280 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
9281 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
9283 static hda_nid_t alc883_slave_dig_outs[] = {
9284 ALC1200_DIGOUT_NID, 0,
9287 static hda_nid_t alc1200_slave_dig_outs[] = {
9288 ALC883_DIGOUT_NID, 0,
9292 * configuration and preset
9294 static const char *alc882_models[ALC882_MODEL_LAST] = {
9295 [ALC882_3ST_DIG] = "3stack-dig",
9296 [ALC882_6ST_DIG] = "6stack-dig",
9297 [ALC882_ARIMA] = "arima",
9298 [ALC882_W2JC] = "w2jc",
9299 [ALC882_TARGA] = "targa",
9300 [ALC882_ASUS_A7J] = "asus-a7j",
9301 [ALC882_ASUS_A7M] = "asus-a7m",
9302 [ALC885_MACPRO] = "macpro",
9303 [ALC885_MB5] = "mb5",
9304 [ALC885_MACMINI3] = "macmini3",
9305 [ALC885_MBA21] = "mba21",
9306 [ALC885_MBP3] = "mbp3",
9307 [ALC885_IMAC24] = "imac24",
9308 [ALC885_IMAC91] = "imac91",
9309 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
9310 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
9311 [ALC883_3ST_6ch] = "3stack-6ch",
9312 [ALC883_6ST_DIG] = "alc883-6stack-dig",
9313 [ALC883_TARGA_DIG] = "targa-dig",
9314 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
9315 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
9316 [ALC883_ACER] = "acer",
9317 [ALC883_ACER_ASPIRE] = "acer-aspire",
9318 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
9319 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
9320 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
9321 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
9322 [ALC883_MEDION] = "medion",
9323 [ALC883_MEDION_MD2] = "medion-md2",
9324 [ALC883_MEDION_WIM2160] = "medion-wim2160",
9325 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
9326 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
9327 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
9328 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
9329 [ALC888_LENOVO_SKY] = "lenovo-sky",
9330 [ALC883_HAIER_W66] = "haier-w66",
9331 [ALC888_3ST_HP] = "3stack-hp",
9332 [ALC888_6ST_DELL] = "6stack-dell",
9333 [ALC883_MITAC] = "mitac",
9334 [ALC883_CLEVO_M540R] = "clevo-m540r",
9335 [ALC883_CLEVO_M720] = "clevo-m720",
9336 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
9337 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
9338 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
9339 [ALC889A_INTEL] = "intel-alc889a",
9340 [ALC889_INTEL] = "intel-x58",
9341 [ALC1200_ASUS_P5Q] = "asus-p5q",
9342 [ALC889A_MB31] = "mb31",
9343 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
9344 [ALC882_AUTO] = "auto",
9347 static struct snd_pci_quirk alc882_cfg_tbl[] = {
9348 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
9350 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
9351 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
9352 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
9353 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
9354 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
9355 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
9356 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
9357 ALC888_ACER_ASPIRE_4930G),
9358 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
9359 ALC888_ACER_ASPIRE_4930G),
9360 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
9361 ALC888_ACER_ASPIRE_8930G),
9362 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
9363 ALC888_ACER_ASPIRE_8930G),
9364 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
9365 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
9366 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
9367 ALC888_ACER_ASPIRE_6530G),
9368 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
9369 ALC888_ACER_ASPIRE_6530G),
9370 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
9371 ALC888_ACER_ASPIRE_7730G),
9372 /* default Acer -- disabled as it causes more problems.
9373 * model=auto should work fine now
9375 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
9377 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
9379 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
9380 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
9381 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
9382 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
9383 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
9384 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
9386 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
9387 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
9388 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
9389 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
9390 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
9391 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
9392 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
9393 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
9394 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
9395 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
9396 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
9398 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
9399 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
9400 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
9401 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
9402 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
9403 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
9404 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
9405 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
9406 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
9408 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
9409 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
9410 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
9411 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
9412 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
9413 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
9414 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
9415 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
9416 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
9417 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
9418 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
9419 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
9420 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
9421 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
9422 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
9423 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
9424 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
9425 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
9426 SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG),
9427 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
9428 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
9429 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
9430 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
9431 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
9432 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
9433 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
9434 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
9435 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
9436 SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG),
9437 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
9438 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
9440 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
9441 SND_PCI_QUIRK(0x1558, 0x0571, "Clevo laptop M570U", ALC883_3ST_6ch_DIG),
9442 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
9443 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
9444 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
9445 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
9446 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
9447 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
9448 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
9449 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9450 ALC883_FUJITSU_PI2515),
9451 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9452 ALC888_FUJITSU_XA3530),
9453 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
9454 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9455 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9456 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9457 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
9458 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
9459 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
9460 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
9461 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
9463 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
9464 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
9465 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
9466 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
9467 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
9468 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
9469 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG),
9474 /* codec SSID table for Intel Mac */
9475 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
9476 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
9477 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
9478 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
9479 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
9480 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
9481 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
9482 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
9483 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
9484 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
9485 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
9486 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
9487 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
9488 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
9489 * so apparently no perfect solution yet
9491 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
9492 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
9493 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3),
9497 static struct alc_config_preset alc882_presets[] = {
9498 [ALC882_3ST_DIG] = {
9499 .mixers = { alc882_base_mixer },
9500 .init_verbs = { alc882_base_init_verbs,
9501 alc882_adc1_init_verbs },
9502 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9503 .dac_nids = alc882_dac_nids,
9504 .dig_out_nid = ALC882_DIGOUT_NID,
9505 .dig_in_nid = ALC882_DIGIN_NID,
9506 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9507 .channel_mode = alc882_ch_modes,
9509 .input_mux = &alc882_capture_source,
9511 [ALC882_6ST_DIG] = {
9512 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9513 .init_verbs = { alc882_base_init_verbs,
9514 alc882_adc1_init_verbs },
9515 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9516 .dac_nids = alc882_dac_nids,
9517 .dig_out_nid = ALC882_DIGOUT_NID,
9518 .dig_in_nid = ALC882_DIGIN_NID,
9519 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9520 .channel_mode = alc882_sixstack_modes,
9521 .input_mux = &alc882_capture_source,
9524 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9525 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9526 alc882_eapd_verbs },
9527 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9528 .dac_nids = alc882_dac_nids,
9529 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9530 .channel_mode = alc882_sixstack_modes,
9531 .input_mux = &alc882_capture_source,
9534 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
9535 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9536 alc882_eapd_verbs, alc880_gpio1_init_verbs },
9537 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9538 .dac_nids = alc882_dac_nids,
9539 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9540 .channel_mode = alc880_threestack_modes,
9542 .input_mux = &alc882_capture_source,
9543 .dig_out_nid = ALC882_DIGOUT_NID,
9546 .mixers = { alc885_mba21_mixer },
9547 .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs },
9549 .dac_nids = alc882_dac_nids,
9550 .channel_mode = alc885_mba21_ch_modes,
9551 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
9552 .input_mux = &alc882_capture_source,
9553 .unsol_event = alc_automute_amp_unsol_event,
9554 .setup = alc885_mba21_setup,
9555 .init_hook = alc_automute_amp,
9558 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
9559 .init_verbs = { alc885_mbp3_init_verbs,
9560 alc880_gpio1_init_verbs },
9562 .dac_nids = alc882_dac_nids,
9564 .channel_mode = alc885_mbp_4ch_modes,
9565 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9566 .input_mux = &alc882_capture_source,
9567 .dig_out_nid = ALC882_DIGOUT_NID,
9568 .dig_in_nid = ALC882_DIGIN_NID,
9569 .unsol_event = alc_automute_amp_unsol_event,
9570 .setup = alc885_mbp3_setup,
9571 .init_hook = alc_automute_amp,
9574 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
9575 .init_verbs = { alc885_mb5_init_verbs,
9576 alc880_gpio1_init_verbs },
9577 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9578 .dac_nids = alc882_dac_nids,
9579 .channel_mode = alc885_mb5_6ch_modes,
9580 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
9581 .input_mux = &mb5_capture_source,
9582 .dig_out_nid = ALC882_DIGOUT_NID,
9583 .dig_in_nid = ALC882_DIGIN_NID,
9584 .unsol_event = alc_automute_amp_unsol_event,
9585 .setup = alc885_mb5_setup,
9586 .init_hook = alc_automute_amp,
9588 [ALC885_MACMINI3] = {
9589 .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer },
9590 .init_verbs = { alc885_macmini3_init_verbs,
9591 alc880_gpio1_init_verbs },
9592 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9593 .dac_nids = alc882_dac_nids,
9594 .channel_mode = alc885_macmini3_6ch_modes,
9595 .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes),
9596 .input_mux = &macmini3_capture_source,
9597 .dig_out_nid = ALC882_DIGOUT_NID,
9598 .dig_in_nid = ALC882_DIGIN_NID,
9599 .unsol_event = alc_automute_amp_unsol_event,
9600 .setup = alc885_macmini3_setup,
9601 .init_hook = alc_automute_amp,
9604 .mixers = { alc882_macpro_mixer },
9605 .init_verbs = { alc882_macpro_init_verbs },
9606 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9607 .dac_nids = alc882_dac_nids,
9608 .dig_out_nid = ALC882_DIGOUT_NID,
9609 .dig_in_nid = ALC882_DIGIN_NID,
9610 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9611 .channel_mode = alc882_ch_modes,
9612 .input_mux = &alc882_capture_source,
9613 .init_hook = alc885_macpro_init_hook,
9616 .mixers = { alc885_imac24_mixer },
9617 .init_verbs = { alc885_imac24_init_verbs },
9618 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9619 .dac_nids = alc882_dac_nids,
9620 .dig_out_nid = ALC882_DIGOUT_NID,
9621 .dig_in_nid = ALC882_DIGIN_NID,
9622 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9623 .channel_mode = alc882_ch_modes,
9624 .input_mux = &alc882_capture_source,
9625 .unsol_event = alc_automute_amp_unsol_event,
9626 .setup = alc885_imac24_setup,
9627 .init_hook = alc885_imac24_init_hook,
9630 .mixers = { alc885_imac91_mixer, alc882_chmode_mixer },
9631 .init_verbs = { alc885_imac91_init_verbs,
9632 alc880_gpio1_init_verbs },
9633 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9634 .dac_nids = alc882_dac_nids,
9635 .channel_mode = alc885_mbp_4ch_modes,
9636 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9637 .input_mux = &alc882_capture_source,
9638 .dig_out_nid = ALC882_DIGOUT_NID,
9639 .dig_in_nid = ALC882_DIGIN_NID,
9640 .unsol_event = alc_automute_amp_unsol_event,
9641 .setup = alc885_imac91_setup,
9642 .init_hook = alc_automute_amp,
9645 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
9646 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9647 alc880_gpio3_init_verbs, alc882_targa_verbs},
9648 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9649 .dac_nids = alc882_dac_nids,
9650 .dig_out_nid = ALC882_DIGOUT_NID,
9651 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9652 .adc_nids = alc882_adc_nids,
9653 .capsrc_nids = alc882_capsrc_nids,
9654 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9655 .channel_mode = alc882_3ST_6ch_modes,
9657 .input_mux = &alc882_capture_source,
9658 .unsol_event = alc882_targa_unsol_event,
9659 .setup = alc882_targa_setup,
9660 .init_hook = alc882_targa_automute,
9662 [ALC882_ASUS_A7J] = {
9663 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
9664 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9665 alc882_asus_a7j_verbs},
9666 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9667 .dac_nids = alc882_dac_nids,
9668 .dig_out_nid = ALC882_DIGOUT_NID,
9669 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9670 .adc_nids = alc882_adc_nids,
9671 .capsrc_nids = alc882_capsrc_nids,
9672 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9673 .channel_mode = alc882_3ST_6ch_modes,
9675 .input_mux = &alc882_capture_source,
9677 [ALC882_ASUS_A7M] = {
9678 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
9679 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9680 alc882_eapd_verbs, alc880_gpio1_init_verbs,
9681 alc882_asus_a7m_verbs },
9682 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9683 .dac_nids = alc882_dac_nids,
9684 .dig_out_nid = ALC882_DIGOUT_NID,
9685 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9686 .channel_mode = alc880_threestack_modes,
9688 .input_mux = &alc882_capture_source,
9690 [ALC883_3ST_2ch_DIG] = {
9691 .mixers = { alc883_3ST_2ch_mixer },
9692 .init_verbs = { alc883_init_verbs },
9693 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9694 .dac_nids = alc883_dac_nids,
9695 .dig_out_nid = ALC883_DIGOUT_NID,
9696 .dig_in_nid = ALC883_DIGIN_NID,
9697 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9698 .channel_mode = alc883_3ST_2ch_modes,
9699 .input_mux = &alc883_capture_source,
9701 [ALC883_3ST_6ch_DIG] = {
9702 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9703 .init_verbs = { alc883_init_verbs },
9704 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9705 .dac_nids = alc883_dac_nids,
9706 .dig_out_nid = ALC883_DIGOUT_NID,
9707 .dig_in_nid = ALC883_DIGIN_NID,
9708 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9709 .channel_mode = alc883_3ST_6ch_modes,
9711 .input_mux = &alc883_capture_source,
9713 [ALC883_3ST_6ch] = {
9714 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9715 .init_verbs = { alc883_init_verbs },
9716 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9717 .dac_nids = alc883_dac_nids,
9718 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9719 .channel_mode = alc883_3ST_6ch_modes,
9721 .input_mux = &alc883_capture_source,
9723 [ALC883_3ST_6ch_INTEL] = {
9724 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
9725 .init_verbs = { alc883_init_verbs },
9726 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9727 .dac_nids = alc883_dac_nids,
9728 .dig_out_nid = ALC883_DIGOUT_NID,
9729 .dig_in_nid = ALC883_DIGIN_NID,
9730 .slave_dig_outs = alc883_slave_dig_outs,
9731 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
9732 .channel_mode = alc883_3ST_6ch_intel_modes,
9734 .input_mux = &alc883_3stack_6ch_intel,
9737 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9738 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
9739 alc_hp15_unsol_verbs },
9740 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9741 .dac_nids = alc883_dac_nids,
9742 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9743 .adc_nids = alc889_adc_nids,
9744 .dig_out_nid = ALC883_DIGOUT_NID,
9745 .dig_in_nid = ALC883_DIGIN_NID,
9746 .slave_dig_outs = alc883_slave_dig_outs,
9747 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9748 .channel_mode = alc889_8ch_intel_modes,
9749 .capsrc_nids = alc889_capsrc_nids,
9750 .input_mux = &alc889_capture_source,
9751 .setup = alc889_automute_setup,
9752 .init_hook = alc_automute_amp,
9753 .unsol_event = alc_automute_amp_unsol_event,
9757 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9758 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
9759 alc889_eapd_verbs, alc_hp15_unsol_verbs},
9760 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9761 .dac_nids = alc883_dac_nids,
9762 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9763 .adc_nids = alc889_adc_nids,
9764 .dig_out_nid = ALC883_DIGOUT_NID,
9765 .dig_in_nid = ALC883_DIGIN_NID,
9766 .slave_dig_outs = alc883_slave_dig_outs,
9767 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9768 .channel_mode = alc889_8ch_intel_modes,
9769 .capsrc_nids = alc889_capsrc_nids,
9770 .input_mux = &alc889_capture_source,
9771 .setup = alc889_automute_setup,
9772 .init_hook = alc889_intel_init_hook,
9773 .unsol_event = alc_automute_amp_unsol_event,
9776 [ALC883_6ST_DIG] = {
9777 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9778 .init_verbs = { alc883_init_verbs },
9779 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9780 .dac_nids = alc883_dac_nids,
9781 .dig_out_nid = ALC883_DIGOUT_NID,
9782 .dig_in_nid = ALC883_DIGIN_NID,
9783 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9784 .channel_mode = alc883_sixstack_modes,
9785 .input_mux = &alc883_capture_source,
9787 [ALC883_TARGA_DIG] = {
9788 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
9789 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9790 alc883_targa_verbs},
9791 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9792 .dac_nids = alc883_dac_nids,
9793 .dig_out_nid = ALC883_DIGOUT_NID,
9794 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9795 .channel_mode = alc883_3ST_6ch_modes,
9797 .input_mux = &alc883_capture_source,
9798 .unsol_event = alc883_targa_unsol_event,
9799 .setup = alc882_targa_setup,
9800 .init_hook = alc882_targa_automute,
9802 [ALC883_TARGA_2ch_DIG] = {
9803 .mixers = { alc883_targa_2ch_mixer},
9804 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9805 alc883_targa_verbs},
9806 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9807 .dac_nids = alc883_dac_nids,
9808 .adc_nids = alc883_adc_nids_alt,
9809 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9810 .capsrc_nids = alc883_capsrc_nids,
9811 .dig_out_nid = ALC883_DIGOUT_NID,
9812 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9813 .channel_mode = alc883_3ST_2ch_modes,
9814 .input_mux = &alc883_capture_source,
9815 .unsol_event = alc883_targa_unsol_event,
9816 .setup = alc882_targa_setup,
9817 .init_hook = alc882_targa_automute,
9819 [ALC883_TARGA_8ch_DIG] = {
9820 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
9821 alc883_chmode_mixer },
9822 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9823 alc883_targa_verbs },
9824 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9825 .dac_nids = alc883_dac_nids,
9826 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9827 .adc_nids = alc883_adc_nids_rev,
9828 .capsrc_nids = alc883_capsrc_nids_rev,
9829 .dig_out_nid = ALC883_DIGOUT_NID,
9830 .dig_in_nid = ALC883_DIGIN_NID,
9831 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
9832 .channel_mode = alc883_4ST_8ch_modes,
9834 .input_mux = &alc883_capture_source,
9835 .unsol_event = alc883_targa_unsol_event,
9836 .setup = alc882_targa_setup,
9837 .init_hook = alc882_targa_automute,
9840 .mixers = { alc883_base_mixer },
9841 /* On TravelMate laptops, GPIO 0 enables the internal speaker
9842 * and the headphone jack. Turn this on and rely on the
9843 * standard mute methods whenever the user wants to turn
9844 * these outputs off.
9846 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
9847 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9848 .dac_nids = alc883_dac_nids,
9849 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9850 .channel_mode = alc883_3ST_2ch_modes,
9851 .input_mux = &alc883_capture_source,
9853 [ALC883_ACER_ASPIRE] = {
9854 .mixers = { alc883_acer_aspire_mixer },
9855 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
9856 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9857 .dac_nids = alc883_dac_nids,
9858 .dig_out_nid = ALC883_DIGOUT_NID,
9859 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9860 .channel_mode = alc883_3ST_2ch_modes,
9861 .input_mux = &alc883_capture_source,
9862 .unsol_event = alc_automute_amp_unsol_event,
9863 .setup = alc883_acer_aspire_setup,
9864 .init_hook = alc_automute_amp,
9866 [ALC888_ACER_ASPIRE_4930G] = {
9867 .mixers = { alc888_base_mixer,
9868 alc883_chmode_mixer },
9869 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9870 alc888_acer_aspire_4930g_verbs },
9871 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9872 .dac_nids = alc883_dac_nids,
9873 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9874 .adc_nids = alc883_adc_nids_rev,
9875 .capsrc_nids = alc883_capsrc_nids_rev,
9876 .dig_out_nid = ALC883_DIGOUT_NID,
9877 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9878 .channel_mode = alc883_3ST_6ch_modes,
9880 .const_channel_count = 6,
9882 ARRAY_SIZE(alc888_2_capture_sources),
9883 .input_mux = alc888_2_capture_sources,
9884 .unsol_event = alc_automute_amp_unsol_event,
9885 .setup = alc888_acer_aspire_4930g_setup,
9886 .init_hook = alc_automute_amp,
9888 [ALC888_ACER_ASPIRE_6530G] = {
9889 .mixers = { alc888_acer_aspire_6530_mixer },
9890 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9891 alc888_acer_aspire_6530g_verbs },
9892 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9893 .dac_nids = alc883_dac_nids,
9894 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9895 .adc_nids = alc883_adc_nids_rev,
9896 .capsrc_nids = alc883_capsrc_nids_rev,
9897 .dig_out_nid = ALC883_DIGOUT_NID,
9898 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9899 .channel_mode = alc883_3ST_2ch_modes,
9901 ARRAY_SIZE(alc888_2_capture_sources),
9902 .input_mux = alc888_acer_aspire_6530_sources,
9903 .unsol_event = alc_automute_amp_unsol_event,
9904 .setup = alc888_acer_aspire_6530g_setup,
9905 .init_hook = alc_automute_amp,
9907 [ALC888_ACER_ASPIRE_8930G] = {
9908 .mixers = { alc889_acer_aspire_8930g_mixer,
9909 alc883_chmode_mixer },
9910 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9911 alc889_acer_aspire_8930g_verbs,
9913 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9914 .dac_nids = alc883_dac_nids,
9915 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9916 .adc_nids = alc889_adc_nids,
9917 .capsrc_nids = alc889_capsrc_nids,
9918 .dig_out_nid = ALC883_DIGOUT_NID,
9919 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9920 .channel_mode = alc883_3ST_6ch_modes,
9922 .const_channel_count = 6,
9924 ARRAY_SIZE(alc889_capture_sources),
9925 .input_mux = alc889_capture_sources,
9926 .unsol_event = alc_automute_amp_unsol_event,
9927 .setup = alc889_acer_aspire_8930g_setup,
9928 .init_hook = alc_automute_amp,
9929 #ifdef CONFIG_SND_HDA_POWER_SAVE
9930 .power_hook = alc_power_eapd,
9933 [ALC888_ACER_ASPIRE_7730G] = {
9934 .mixers = { alc883_3ST_6ch_mixer,
9935 alc883_chmode_mixer },
9936 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9937 alc888_acer_aspire_7730G_verbs },
9938 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9939 .dac_nids = alc883_dac_nids,
9940 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9941 .adc_nids = alc883_adc_nids_rev,
9942 .capsrc_nids = alc883_capsrc_nids_rev,
9943 .dig_out_nid = ALC883_DIGOUT_NID,
9944 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9945 .channel_mode = alc883_3ST_6ch_modes,
9947 .const_channel_count = 6,
9948 .input_mux = &alc883_capture_source,
9949 .unsol_event = alc_automute_amp_unsol_event,
9950 .setup = alc888_acer_aspire_6530g_setup,
9951 .init_hook = alc_automute_amp,
9954 .mixers = { alc883_fivestack_mixer,
9955 alc883_chmode_mixer },
9956 .init_verbs = { alc883_init_verbs,
9957 alc883_medion_eapd_verbs },
9958 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9959 .dac_nids = alc883_dac_nids,
9960 .adc_nids = alc883_adc_nids_alt,
9961 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9962 .capsrc_nids = alc883_capsrc_nids,
9963 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9964 .channel_mode = alc883_sixstack_modes,
9965 .input_mux = &alc883_capture_source,
9967 [ALC883_MEDION_MD2] = {
9968 .mixers = { alc883_medion_md2_mixer},
9969 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
9970 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9971 .dac_nids = alc883_dac_nids,
9972 .dig_out_nid = ALC883_DIGOUT_NID,
9973 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9974 .channel_mode = alc883_3ST_2ch_modes,
9975 .input_mux = &alc883_capture_source,
9976 .unsol_event = alc_automute_amp_unsol_event,
9977 .setup = alc883_medion_md2_setup,
9978 .init_hook = alc_automute_amp,
9980 [ALC883_MEDION_WIM2160] = {
9981 .mixers = { alc883_medion_wim2160_mixer },
9982 .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs },
9983 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9984 .dac_nids = alc883_dac_nids,
9985 .dig_out_nid = ALC883_DIGOUT_NID,
9986 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
9987 .adc_nids = alc883_adc_nids,
9988 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9989 .channel_mode = alc883_3ST_2ch_modes,
9990 .input_mux = &alc883_capture_source,
9991 .unsol_event = alc_automute_amp_unsol_event,
9992 .setup = alc883_medion_wim2160_setup,
9993 .init_hook = alc_automute_amp,
9995 [ALC883_LAPTOP_EAPD] = {
9996 .mixers = { alc883_base_mixer },
9997 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
9998 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9999 .dac_nids = alc883_dac_nids,
10000 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10001 .channel_mode = alc883_3ST_2ch_modes,
10002 .input_mux = &alc883_capture_source,
10004 [ALC883_CLEVO_M540R] = {
10005 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10006 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
10007 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10008 .dac_nids = alc883_dac_nids,
10009 .dig_out_nid = ALC883_DIGOUT_NID,
10010 .dig_in_nid = ALC883_DIGIN_NID,
10011 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
10012 .channel_mode = alc883_3ST_6ch_clevo_modes,
10014 .input_mux = &alc883_capture_source,
10015 /* This machine has the hardware HP auto-muting, thus
10016 * we need no software mute via unsol event
10019 [ALC883_CLEVO_M720] = {
10020 .mixers = { alc883_clevo_m720_mixer },
10021 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
10022 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10023 .dac_nids = alc883_dac_nids,
10024 .dig_out_nid = ALC883_DIGOUT_NID,
10025 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10026 .channel_mode = alc883_3ST_2ch_modes,
10027 .input_mux = &alc883_capture_source,
10028 .unsol_event = alc883_clevo_m720_unsol_event,
10029 .setup = alc883_clevo_m720_setup,
10030 .init_hook = alc883_clevo_m720_init_hook,
10032 [ALC883_LENOVO_101E_2ch] = {
10033 .mixers = { alc883_lenovo_101e_2ch_mixer},
10034 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
10035 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10036 .dac_nids = alc883_dac_nids,
10037 .adc_nids = alc883_adc_nids_alt,
10038 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10039 .capsrc_nids = alc883_capsrc_nids,
10040 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10041 .channel_mode = alc883_3ST_2ch_modes,
10042 .input_mux = &alc883_lenovo_101e_capture_source,
10043 .unsol_event = alc883_lenovo_101e_unsol_event,
10044 .init_hook = alc883_lenovo_101e_all_automute,
10046 [ALC883_LENOVO_NB0763] = {
10047 .mixers = { alc883_lenovo_nb0763_mixer },
10048 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
10049 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10050 .dac_nids = alc883_dac_nids,
10051 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10052 .channel_mode = alc883_3ST_2ch_modes,
10054 .input_mux = &alc883_lenovo_nb0763_capture_source,
10055 .unsol_event = alc_automute_amp_unsol_event,
10056 .setup = alc883_medion_md2_setup,
10057 .init_hook = alc_automute_amp,
10059 [ALC888_LENOVO_MS7195_DIG] = {
10060 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10061 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
10062 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10063 .dac_nids = alc883_dac_nids,
10064 .dig_out_nid = ALC883_DIGOUT_NID,
10065 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10066 .channel_mode = alc883_3ST_6ch_modes,
10068 .input_mux = &alc883_capture_source,
10069 .unsol_event = alc883_lenovo_ms7195_unsol_event,
10070 .init_hook = alc888_lenovo_ms7195_front_automute,
10072 [ALC883_HAIER_W66] = {
10073 .mixers = { alc883_targa_2ch_mixer},
10074 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
10075 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10076 .dac_nids = alc883_dac_nids,
10077 .dig_out_nid = ALC883_DIGOUT_NID,
10078 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10079 .channel_mode = alc883_3ST_2ch_modes,
10080 .input_mux = &alc883_capture_source,
10081 .unsol_event = alc_automute_amp_unsol_event,
10082 .setup = alc883_haier_w66_setup,
10083 .init_hook = alc_automute_amp,
10085 [ALC888_3ST_HP] = {
10086 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10087 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
10088 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10089 .dac_nids = alc883_dac_nids,
10090 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
10091 .channel_mode = alc888_3st_hp_modes,
10093 .input_mux = &alc883_capture_source,
10094 .unsol_event = alc_automute_amp_unsol_event,
10095 .setup = alc888_3st_hp_setup,
10096 .init_hook = alc_automute_amp,
10098 [ALC888_6ST_DELL] = {
10099 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10100 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
10101 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10102 .dac_nids = alc883_dac_nids,
10103 .dig_out_nid = ALC883_DIGOUT_NID,
10104 .dig_in_nid = ALC883_DIGIN_NID,
10105 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10106 .channel_mode = alc883_sixstack_modes,
10107 .input_mux = &alc883_capture_source,
10108 .unsol_event = alc_automute_amp_unsol_event,
10109 .setup = alc888_6st_dell_setup,
10110 .init_hook = alc_automute_amp,
10113 .mixers = { alc883_mitac_mixer },
10114 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
10115 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10116 .dac_nids = alc883_dac_nids,
10117 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10118 .channel_mode = alc883_3ST_2ch_modes,
10119 .input_mux = &alc883_capture_source,
10120 .unsol_event = alc_automute_amp_unsol_event,
10121 .setup = alc883_mitac_setup,
10122 .init_hook = alc_automute_amp,
10124 [ALC883_FUJITSU_PI2515] = {
10125 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
10126 .init_verbs = { alc883_init_verbs,
10127 alc883_2ch_fujitsu_pi2515_verbs},
10128 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10129 .dac_nids = alc883_dac_nids,
10130 .dig_out_nid = ALC883_DIGOUT_NID,
10131 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10132 .channel_mode = alc883_3ST_2ch_modes,
10133 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10134 .unsol_event = alc_automute_amp_unsol_event,
10135 .setup = alc883_2ch_fujitsu_pi2515_setup,
10136 .init_hook = alc_automute_amp,
10138 [ALC888_FUJITSU_XA3530] = {
10139 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
10140 .init_verbs = { alc883_init_verbs,
10141 alc888_fujitsu_xa3530_verbs },
10142 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10143 .dac_nids = alc883_dac_nids,
10144 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10145 .adc_nids = alc883_adc_nids_rev,
10146 .capsrc_nids = alc883_capsrc_nids_rev,
10147 .dig_out_nid = ALC883_DIGOUT_NID,
10148 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
10149 .channel_mode = alc888_4ST_8ch_intel_modes,
10151 ARRAY_SIZE(alc888_2_capture_sources),
10152 .input_mux = alc888_2_capture_sources,
10153 .unsol_event = alc_automute_amp_unsol_event,
10154 .setup = alc888_fujitsu_xa3530_setup,
10155 .init_hook = alc_automute_amp,
10157 [ALC888_LENOVO_SKY] = {
10158 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
10159 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
10160 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10161 .dac_nids = alc883_dac_nids,
10162 .dig_out_nid = ALC883_DIGOUT_NID,
10163 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10164 .channel_mode = alc883_sixstack_modes,
10166 .input_mux = &alc883_lenovo_sky_capture_source,
10167 .unsol_event = alc_automute_amp_unsol_event,
10168 .setup = alc888_lenovo_sky_setup,
10169 .init_hook = alc_automute_amp,
10171 [ALC888_ASUS_M90V] = {
10172 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10173 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
10174 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10175 .dac_nids = alc883_dac_nids,
10176 .dig_out_nid = ALC883_DIGOUT_NID,
10177 .dig_in_nid = ALC883_DIGIN_NID,
10178 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10179 .channel_mode = alc883_3ST_6ch_modes,
10181 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10182 .unsol_event = alc_sku_unsol_event,
10183 .setup = alc883_mode2_setup,
10184 .init_hook = alc_inithook,
10186 [ALC888_ASUS_EEE1601] = {
10187 .mixers = { alc883_asus_eee1601_mixer },
10188 .cap_mixer = alc883_asus_eee1601_cap_mixer,
10189 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
10190 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10191 .dac_nids = alc883_dac_nids,
10192 .dig_out_nid = ALC883_DIGOUT_NID,
10193 .dig_in_nid = ALC883_DIGIN_NID,
10194 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10195 .channel_mode = alc883_3ST_2ch_modes,
10197 .input_mux = &alc883_asus_eee1601_capture_source,
10198 .unsol_event = alc_sku_unsol_event,
10199 .init_hook = alc883_eee1601_inithook,
10201 [ALC1200_ASUS_P5Q] = {
10202 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10203 .init_verbs = { alc883_init_verbs },
10204 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10205 .dac_nids = alc883_dac_nids,
10206 .dig_out_nid = ALC1200_DIGOUT_NID,
10207 .dig_in_nid = ALC883_DIGIN_NID,
10208 .slave_dig_outs = alc1200_slave_dig_outs,
10209 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10210 .channel_mode = alc883_sixstack_modes,
10211 .input_mux = &alc883_capture_source,
10214 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
10215 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
10216 alc880_gpio1_init_verbs },
10217 .adc_nids = alc883_adc_nids,
10218 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10219 .capsrc_nids = alc883_capsrc_nids,
10220 .dac_nids = alc883_dac_nids,
10221 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10222 .channel_mode = alc889A_mb31_6ch_modes,
10223 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
10224 .input_mux = &alc889A_mb31_capture_source,
10225 .dig_out_nid = ALC883_DIGOUT_NID,
10226 .unsol_event = alc889A_mb31_unsol_event,
10227 .init_hook = alc889A_mb31_automute,
10229 [ALC883_SONY_VAIO_TT] = {
10230 .mixers = { alc883_vaiott_mixer },
10231 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
10232 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10233 .dac_nids = alc883_dac_nids,
10234 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10235 .channel_mode = alc883_3ST_2ch_modes,
10236 .input_mux = &alc883_capture_source,
10237 .unsol_event = alc_automute_amp_unsol_event,
10238 .setup = alc883_vaiott_setup,
10239 .init_hook = alc_automute_amp,
10248 PINFIX_ABIT_AW9D_MAX
10251 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
10252 { 0x15, 0x01080104 }, /* side */
10253 { 0x16, 0x01011012 }, /* rear */
10254 { 0x17, 0x01016011 }, /* clfe */
10258 static const struct alc_fixup alc882_fixups[] = {
10259 [PINFIX_ABIT_AW9D_MAX] = {
10260 .pins = alc882_abit_aw9d_pinfix
10264 static struct snd_pci_quirk alc882_fixup_tbl[] = {
10265 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
10270 * BIOS auto configuration
10272 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
10273 const struct auto_pin_cfg *cfg)
10275 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
10278 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
10279 hda_nid_t nid, int pin_type,
10284 /* set as output */
10285 alc_set_pin_output(codec, nid, pin_type);
10289 else if (dac >= 0x02 && dac <= 0x05)
10293 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
10296 static void alc882_auto_init_multi_out(struct hda_codec *codec)
10298 struct alc_spec *spec = codec->spec;
10301 for (i = 0; i <= HDA_SIDE; i++) {
10302 hda_nid_t nid = spec->autocfg.line_out_pins[i];
10303 int pin_type = get_pin_type(spec->autocfg.line_out_type);
10305 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
10306 spec->multiout.dac_nids[i]);
10310 static void alc882_auto_init_hp_out(struct hda_codec *codec)
10312 struct alc_spec *spec = codec->spec;
10313 hda_nid_t pin, dac;
10315 pin = spec->autocfg.hp_pins[0];
10317 dac = spec->multiout.hp_nid;
10319 dac = spec->multiout.dac_nids[0]; /* to front */
10320 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac);
10322 pin = spec->autocfg.speaker_pins[0];
10324 dac = spec->multiout.extra_out_nid[0];
10326 dac = spec->multiout.dac_nids[0]; /* to front */
10327 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac);
10331 static void alc882_auto_init_analog_input(struct hda_codec *codec)
10333 struct alc_spec *spec = codec->spec;
10336 for (i = 0; i < AUTO_PIN_LAST; i++) {
10337 hda_nid_t nid = spec->autocfg.input_pins[i];
10340 alc_set_input_pin(codec, nid, i);
10341 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
10342 snd_hda_codec_write(codec, nid, 0,
10343 AC_VERB_SET_AMP_GAIN_MUTE,
10348 static void alc882_auto_init_input_src(struct hda_codec *codec)
10350 struct alc_spec *spec = codec->spec;
10353 for (c = 0; c < spec->num_adc_nids; c++) {
10354 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
10355 hda_nid_t nid = spec->capsrc_nids[c];
10356 unsigned int mux_idx;
10357 const struct hda_input_mux *imux;
10358 int conns, mute, idx, item;
10360 conns = snd_hda_get_connections(codec, nid, conn_list,
10361 ARRAY_SIZE(conn_list));
10364 mux_idx = c >= spec->num_mux_defs ? 0 : c;
10365 imux = &spec->input_mux[mux_idx];
10366 if (!imux->num_items && mux_idx > 0)
10367 imux = &spec->input_mux[0];
10368 for (idx = 0; idx < conns; idx++) {
10369 /* if the current connection is the selected one,
10370 * unmute it as default - otherwise mute it
10372 mute = AMP_IN_MUTE(idx);
10373 for (item = 0; item < imux->num_items; item++) {
10374 if (imux->items[item].index == idx) {
10375 if (spec->cur_mux[c] == item)
10376 mute = AMP_IN_UNMUTE(idx);
10380 /* check if we have a selector or mixer
10381 * we could check for the widget type instead, but
10382 * just check for Amp-In presence (in case of mixer
10383 * without amp-in there is something wrong, this
10384 * function shouldn't be used or capsrc nid is wrong)
10386 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
10387 snd_hda_codec_write(codec, nid, 0,
10388 AC_VERB_SET_AMP_GAIN_MUTE,
10390 else if (mute != AMP_IN_MUTE(idx))
10391 snd_hda_codec_write(codec, nid, 0,
10392 AC_VERB_SET_CONNECT_SEL,
10398 /* add mic boosts if needed */
10399 static int alc_auto_add_mic_boost(struct hda_codec *codec)
10401 struct alc_spec *spec = codec->spec;
10405 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
10406 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
10407 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10409 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10413 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
10414 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
10415 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10417 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10424 /* almost identical with ALC880 parser... */
10425 static int alc882_parse_auto_config(struct hda_codec *codec)
10427 struct alc_spec *spec = codec->spec;
10428 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
10431 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10435 if (!spec->autocfg.line_outs)
10436 return 0; /* can't find valid BIOS pin config */
10438 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
10441 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
10444 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
10448 err = alc880_auto_create_extra_out(spec,
10449 spec->autocfg.speaker_pins[0],
10453 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
10457 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10459 /* check multiple SPDIF-out (for recent codecs) */
10460 for (i = 0; i < spec->autocfg.dig_outs; i++) {
10462 err = snd_hda_get_connections(codec,
10463 spec->autocfg.dig_out_pins[i],
10468 spec->multiout.dig_out_nid = dig_nid;
10470 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
10471 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
10473 spec->slave_dig_outs[i - 1] = dig_nid;
10476 if (spec->autocfg.dig_in_pin)
10477 spec->dig_in_nid = ALC880_DIGIN_NID;
10479 if (spec->kctls.list)
10480 add_mixer(spec, spec->kctls.list);
10482 add_verb(spec, alc883_auto_init_verbs);
10483 /* if ADC 0x07 is available, initialize it, too */
10484 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
10485 add_verb(spec, alc882_adc1_init_verbs);
10487 spec->num_mux_defs = 1;
10488 spec->input_mux = &spec->private_imux[0];
10490 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
10492 err = alc_auto_add_mic_boost(codec);
10496 return 1; /* config found */
10499 /* additional initialization for auto-configuration model */
10500 static void alc882_auto_init(struct hda_codec *codec)
10502 struct alc_spec *spec = codec->spec;
10503 alc882_auto_init_multi_out(codec);
10504 alc882_auto_init_hp_out(codec);
10505 alc882_auto_init_analog_input(codec);
10506 alc882_auto_init_input_src(codec);
10507 if (spec->unsol_event)
10508 alc_inithook(codec);
10511 static int patch_alc882(struct hda_codec *codec)
10513 struct alc_spec *spec;
10514 int err, board_config;
10516 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10520 codec->spec = spec;
10522 alc_auto_parse_customize_define(codec);
10524 switch (codec->vendor_id) {
10529 /* ALC883 and variants */
10530 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10534 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
10538 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
10539 board_config = snd_hda_check_board_codec_sid_config(codec,
10540 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
10542 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
10543 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
10545 board_config = ALC882_AUTO;
10548 if (board_config == ALC882_AUTO)
10549 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 1);
10551 if (board_config == ALC882_AUTO) {
10552 /* automatic parse from the BIOS config */
10553 err = alc882_parse_auto_config(codec);
10559 "hda_codec: Cannot set up configuration "
10560 "from BIOS. Using base mode...\n");
10561 board_config = ALC882_3ST_DIG;
10565 err = snd_hda_attach_beep_device(codec, 0x1);
10571 if (board_config != ALC882_AUTO)
10572 setup_preset(codec, &alc882_presets[board_config]);
10574 spec->stream_analog_playback = &alc882_pcm_analog_playback;
10575 spec->stream_analog_capture = &alc882_pcm_analog_capture;
10576 /* FIXME: setup DAC5 */
10577 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
10578 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
10580 spec->stream_digital_playback = &alc882_pcm_digital_playback;
10581 spec->stream_digital_capture = &alc882_pcm_digital_capture;
10583 if (codec->vendor_id == 0x10ec0888)
10584 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
10586 if (!spec->adc_nids && spec->input_mux) {
10588 spec->num_adc_nids = 0;
10589 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
10590 const struct hda_input_mux *imux = spec->input_mux;
10592 hda_nid_t items[16];
10593 hda_nid_t nid = alc882_adc_nids[i];
10594 unsigned int wcap = get_wcaps(codec, nid);
10596 wcap = get_wcaps_type(wcap);
10597 if (wcap != AC_WID_AUD_IN)
10599 spec->private_adc_nids[spec->num_adc_nids] = nid;
10600 err = snd_hda_get_connections(codec, nid, &cap, 1);
10603 err = snd_hda_get_connections(codec, cap, items,
10604 ARRAY_SIZE(items));
10607 for (j = 0; j < imux->num_items; j++)
10608 if (imux->items[j].index >= err)
10610 if (j < imux->num_items)
10612 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
10613 spec->num_adc_nids++;
10615 spec->adc_nids = spec->private_adc_nids;
10616 spec->capsrc_nids = spec->private_capsrc_nids;
10619 set_capture_mixer(codec);
10621 if (spec->cdefine.enable_pcbeep)
10622 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10624 if (board_config == ALC882_AUTO)
10625 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 0);
10627 spec->vmaster_nid = 0x0c;
10629 codec->patch_ops = alc_patch_ops;
10630 if (board_config == ALC882_AUTO)
10631 spec->init_hook = alc882_auto_init;
10632 #ifdef CONFIG_SND_HDA_POWER_SAVE
10633 if (!spec->loopback.amplist)
10634 spec->loopback.amplist = alc882_loopbacks;
10645 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
10646 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
10648 #define alc262_dac_nids alc260_dac_nids
10649 #define alc262_adc_nids alc882_adc_nids
10650 #define alc262_adc_nids_alt alc882_adc_nids_alt
10651 #define alc262_capsrc_nids alc882_capsrc_nids
10652 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
10654 #define alc262_modes alc260_modes
10655 #define alc262_capture_source alc882_capture_source
10657 static hda_nid_t alc262_dmic_adc_nids[1] = {
10662 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
10664 static struct snd_kcontrol_new alc262_base_mixer[] = {
10665 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10666 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10667 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10668 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10669 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10670 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10671 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10672 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10673 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10674 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10675 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10676 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10677 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
10678 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10679 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
10680 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
10684 /* update HP, line and mono-out pins according to the master switch */
10685 static void alc262_hp_master_update(struct hda_codec *codec)
10687 struct alc_spec *spec = codec->spec;
10688 int val = spec->master_sw;
10690 /* HP & line-out */
10691 snd_hda_codec_write_cache(codec, 0x1b, 0,
10692 AC_VERB_SET_PIN_WIDGET_CONTROL,
10694 snd_hda_codec_write_cache(codec, 0x15, 0,
10695 AC_VERB_SET_PIN_WIDGET_CONTROL,
10697 /* mono (speaker) depending on the HP jack sense */
10698 val = val && !spec->jack_present;
10699 snd_hda_codec_write_cache(codec, 0x16, 0,
10700 AC_VERB_SET_PIN_WIDGET_CONTROL,
10701 val ? PIN_OUT : 0);
10704 static void alc262_hp_bpc_automute(struct hda_codec *codec)
10706 struct alc_spec *spec = codec->spec;
10708 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
10709 alc262_hp_master_update(codec);
10712 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
10714 if ((res >> 26) != ALC880_HP_EVENT)
10716 alc262_hp_bpc_automute(codec);
10719 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
10721 struct alc_spec *spec = codec->spec;
10723 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
10724 alc262_hp_master_update(codec);
10727 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
10730 if ((res >> 26) != ALC880_HP_EVENT)
10732 alc262_hp_wildwest_automute(codec);
10735 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
10737 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
10738 struct snd_ctl_elem_value *ucontrol)
10740 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10741 struct alc_spec *spec = codec->spec;
10742 int val = !!*ucontrol->value.integer.value;
10744 if (val == spec->master_sw)
10746 spec->master_sw = val;
10747 alc262_hp_master_update(codec);
10751 #define ALC262_HP_MASTER_SWITCH \
10753 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10754 .name = "Master Playback Switch", \
10755 .info = snd_ctl_boolean_mono_info, \
10756 .get = alc262_hp_master_sw_get, \
10757 .put = alc262_hp_master_sw_put, \
10760 .iface = NID_MAPPING, \
10761 .name = "Master Playback Switch", \
10762 .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \
10766 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
10767 ALC262_HP_MASTER_SWITCH,
10768 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10769 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10770 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10771 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10773 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10775 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10776 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10777 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10778 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10779 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10780 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10781 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10782 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10783 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10784 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10785 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
10786 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
10790 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
10791 ALC262_HP_MASTER_SWITCH,
10792 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10793 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10794 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10795 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10796 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10798 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10800 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
10801 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
10802 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
10803 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10804 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10805 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10806 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10810 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
10811 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10812 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10813 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
10817 /* mute/unmute internal speaker according to the hp jack and mute state */
10818 static void alc262_hp_t5735_setup(struct hda_codec *codec)
10820 struct alc_spec *spec = codec->spec;
10822 spec->autocfg.hp_pins[0] = 0x15;
10823 spec->autocfg.speaker_pins[0] = 0x14;
10826 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
10827 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10828 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10829 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10830 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10831 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10832 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10833 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10837 static struct hda_verb alc262_hp_t5735_verbs[] = {
10838 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10839 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10841 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10845 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
10846 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10847 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10848 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
10849 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
10850 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10851 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10855 static struct hda_verb alc262_hp_rp5700_verbs[] = {
10856 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10857 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10858 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10859 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10860 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10861 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10862 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10863 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10864 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10865 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10869 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
10876 /* bind hp and internal speaker mute (with plug check) as master switch */
10877 static void alc262_hippo_master_update(struct hda_codec *codec)
10879 struct alc_spec *spec = codec->spec;
10880 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10881 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10882 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10886 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
10887 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
10888 HDA_AMP_MUTE, mute);
10889 /* mute internal speaker per jack sense */
10890 if (spec->jack_present)
10891 mute = HDA_AMP_MUTE;
10893 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
10894 HDA_AMP_MUTE, mute);
10895 if (speaker_nid && speaker_nid != line_nid)
10896 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
10897 HDA_AMP_MUTE, mute);
10900 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
10902 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
10903 struct snd_ctl_elem_value *ucontrol)
10905 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10906 struct alc_spec *spec = codec->spec;
10907 int val = !!*ucontrol->value.integer.value;
10909 if (val == spec->master_sw)
10911 spec->master_sw = val;
10912 alc262_hippo_master_update(codec);
10916 #define ALC262_HIPPO_MASTER_SWITCH \
10918 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10919 .name = "Master Playback Switch", \
10920 .info = snd_ctl_boolean_mono_info, \
10921 .get = alc262_hippo_master_sw_get, \
10922 .put = alc262_hippo_master_sw_put, \
10925 .iface = NID_MAPPING, \
10926 .name = "Master Playback Switch", \
10927 .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \
10928 (SUBDEV_SPEAKER(0) << 16), \
10931 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
10932 ALC262_HIPPO_MASTER_SWITCH,
10933 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10934 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10935 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10936 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10937 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10938 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10939 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10940 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10941 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10942 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10943 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10944 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10948 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
10949 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10950 ALC262_HIPPO_MASTER_SWITCH,
10951 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10952 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10953 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10954 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10955 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10956 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10957 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10958 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10959 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10960 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10964 /* mute/unmute internal speaker according to the hp jack and mute state */
10965 static void alc262_hippo_automute(struct hda_codec *codec)
10967 struct alc_spec *spec = codec->spec;
10968 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10970 spec->jack_present = snd_hda_jack_detect(codec, hp_nid);
10971 alc262_hippo_master_update(codec);
10974 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
10976 if ((res >> 26) != ALC880_HP_EVENT)
10978 alc262_hippo_automute(codec);
10981 static void alc262_hippo_setup(struct hda_codec *codec)
10983 struct alc_spec *spec = codec->spec;
10985 spec->autocfg.hp_pins[0] = 0x15;
10986 spec->autocfg.speaker_pins[0] = 0x14;
10989 static void alc262_hippo1_setup(struct hda_codec *codec)
10991 struct alc_spec *spec = codec->spec;
10993 spec->autocfg.hp_pins[0] = 0x1b;
10994 spec->autocfg.speaker_pins[0] = 0x14;
10998 static struct snd_kcontrol_new alc262_sony_mixer[] = {
10999 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11000 ALC262_HIPPO_MASTER_SWITCH,
11001 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11002 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11003 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11004 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11008 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
11009 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11010 ALC262_HIPPO_MASTER_SWITCH,
11011 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11012 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11013 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11014 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11015 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11019 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
11020 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11021 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11022 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
11023 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
11024 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11025 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11026 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11027 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11028 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11029 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11030 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11031 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11035 static struct hda_verb alc262_tyan_verbs[] = {
11036 /* Headphone automute */
11037 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11038 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11039 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11041 /* P11 AUX_IN, white 4-pin connector */
11042 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11043 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
11044 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
11045 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
11050 /* unsolicited event for HP jack sensing */
11051 static void alc262_tyan_setup(struct hda_codec *codec)
11053 struct alc_spec *spec = codec->spec;
11055 spec->autocfg.hp_pins[0] = 0x1b;
11056 spec->autocfg.speaker_pins[0] = 0x15;
11060 #define alc262_capture_mixer alc882_capture_mixer
11061 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
11064 * generic initialization of ADC, input mixers and output mixers
11066 static struct hda_verb alc262_init_verbs[] = {
11068 * Unmute ADC0-2 and set the default input to mic-in
11070 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11071 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11072 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11073 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11074 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11075 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11077 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11079 * Note: PASD motherboards uses the Line In 2 as the input for
11080 * front panel mic (mic 2)
11082 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11083 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11084 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11085 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11086 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11087 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11090 * Set up output mixers (0x0c - 0x0e)
11092 /* set vol=0 to output mixers */
11093 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11094 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11095 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11096 /* set up input amps for analog loopback */
11097 /* Amp Indices: DAC = 0, mixer = 1 */
11098 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11099 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11100 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11101 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11102 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11103 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11105 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11106 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11107 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11108 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11109 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11110 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11112 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11113 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11114 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11115 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11116 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11118 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11119 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11121 /* FIXME: use matrix-type input source selection */
11122 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11123 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11124 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11125 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11126 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11127 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11129 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11130 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11131 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11132 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11134 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11135 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11136 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11137 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11142 static struct hda_verb alc262_eapd_verbs[] = {
11143 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11144 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11148 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
11149 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11150 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11151 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11153 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11154 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11158 static struct hda_verb alc262_sony_unsol_verbs[] = {
11159 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11160 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11161 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
11163 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11164 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11168 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
11169 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11170 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11171 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11172 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11173 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11177 static struct hda_verb alc262_toshiba_s06_verbs[] = {
11178 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11179 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11180 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11181 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11182 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
11183 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11184 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11185 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11189 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
11191 struct alc_spec *spec = codec->spec;
11193 spec->autocfg.hp_pins[0] = 0x15;
11194 spec->autocfg.speaker_pins[0] = 0x14;
11195 spec->ext_mic.pin = 0x18;
11196 spec->ext_mic.mux_idx = 0;
11197 spec->int_mic.pin = 0x12;
11198 spec->int_mic.mux_idx = 9;
11199 spec->auto_mic = 1;
11205 * 0x16 = internal speaker
11206 * 0x18 = external mic
11209 static struct snd_kcontrol_new alc262_nec_mixer[] = {
11210 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
11211 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
11213 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11214 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11215 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11217 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11218 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11222 static struct hda_verb alc262_nec_verbs[] = {
11223 /* Unmute Speaker */
11224 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11227 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11228 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11230 /* External mic to headphone */
11231 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11232 /* External mic to speaker */
11233 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11239 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
11240 * 0x1b = port replicator headphone out
11243 #define ALC_HP_EVENT 0x37
11245 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
11246 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11247 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11248 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11249 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11253 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
11254 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11255 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11259 static struct hda_verb alc262_lenovo_3000_init_verbs[] = {
11260 /* Front Mic pin: input vref at 50% */
11261 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
11262 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11266 static struct hda_input_mux alc262_fujitsu_capture_source = {
11270 { "Int Mic", 0x1 },
11275 static struct hda_input_mux alc262_HP_capture_source = {
11279 { "Front Mic", 0x1 },
11286 static struct hda_input_mux alc262_HP_D7000_capture_source = {
11290 { "Front Mic", 0x2 },
11296 /* mute/unmute internal speaker according to the hp jacks and mute state */
11297 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
11299 struct alc_spec *spec = codec->spec;
11302 if (force || !spec->sense_updated) {
11303 spec->jack_present = snd_hda_jack_detect(codec, 0x14) ||
11304 snd_hda_jack_detect(codec, 0x1b);
11305 spec->sense_updated = 1;
11307 /* unmute internal speaker only if both HPs are unplugged and
11308 * master switch is on
11310 if (spec->jack_present)
11311 mute = HDA_AMP_MUTE;
11313 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11314 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11315 HDA_AMP_MUTE, mute);
11318 /* unsolicited event for HP jack sensing */
11319 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
11322 if ((res >> 26) != ALC_HP_EVENT)
11324 alc262_fujitsu_automute(codec, 1);
11327 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
11329 alc262_fujitsu_automute(codec, 1);
11332 /* bind volumes of both NID 0x0c and 0x0d */
11333 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
11334 .ops = &snd_hda_bind_vol,
11336 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
11337 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
11342 /* mute/unmute internal speaker according to the hp jack and mute state */
11343 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
11345 struct alc_spec *spec = codec->spec;
11348 if (force || !spec->sense_updated) {
11349 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
11350 spec->sense_updated = 1;
11352 if (spec->jack_present) {
11353 /* mute internal speaker */
11354 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11355 HDA_AMP_MUTE, HDA_AMP_MUTE);
11356 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11357 HDA_AMP_MUTE, HDA_AMP_MUTE);
11359 /* unmute internal speaker if necessary */
11360 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
11361 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11362 HDA_AMP_MUTE, mute);
11363 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11364 HDA_AMP_MUTE, mute);
11368 /* unsolicited event for HP jack sensing */
11369 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
11372 if ((res >> 26) != ALC_HP_EVENT)
11374 alc262_lenovo_3000_automute(codec, 1);
11377 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
11378 int dir, int idx, long *valp)
11382 for (i = 0; i < 2; i++, valp++)
11383 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
11385 *valp ? 0 : HDA_AMP_MUTE);
11389 /* bind hp and internal speaker mute (with plug check) */
11390 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
11391 struct snd_ctl_elem_value *ucontrol)
11393 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11394 long *valp = ucontrol->value.integer.value;
11397 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
11398 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11400 alc262_fujitsu_automute(codec, 0);
11404 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
11405 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11407 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11408 .name = "Master Playback Switch",
11409 .subdevice = HDA_SUBDEV_AMP_FLAG,
11410 .info = snd_hda_mixer_amp_switch_info,
11411 .get = snd_hda_mixer_amp_switch_get,
11412 .put = alc262_fujitsu_master_sw_put,
11413 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11416 .iface = NID_MAPPING,
11417 .name = "Master Playback Switch",
11418 .private_value = 0x1b,
11420 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11421 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11422 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11423 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11424 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11425 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11426 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11427 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11431 /* bind hp and internal speaker mute (with plug check) */
11432 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
11433 struct snd_ctl_elem_value *ucontrol)
11435 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11436 long *valp = ucontrol->value.integer.value;
11439 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11441 alc262_lenovo_3000_automute(codec, 0);
11445 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
11446 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11448 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11449 .name = "Master Playback Switch",
11450 .subdevice = HDA_SUBDEV_AMP_FLAG,
11451 .info = snd_hda_mixer_amp_switch_info,
11452 .get = snd_hda_mixer_amp_switch_get,
11453 .put = alc262_lenovo_3000_master_sw_put,
11454 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
11456 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11457 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11458 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11459 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11460 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11461 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11462 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11463 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11467 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
11468 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11469 ALC262_HIPPO_MASTER_SWITCH,
11470 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11471 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11472 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11473 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11474 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11475 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11479 /* additional init verbs for Benq laptops */
11480 static struct hda_verb alc262_EAPD_verbs[] = {
11481 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11482 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
11486 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
11487 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11488 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11490 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11491 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
11495 /* Samsung Q1 Ultra Vista model setup */
11496 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
11497 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11498 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11499 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11500 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11501 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
11502 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
11506 static struct hda_verb alc262_ultra_verbs[] = {
11508 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11509 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11510 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11512 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11513 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11514 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11515 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11517 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11518 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11519 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11520 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11521 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11523 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11524 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11525 /* ADC, choose mic */
11526 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11527 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11528 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11529 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11530 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11531 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11532 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11533 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11534 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11535 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
11539 /* mute/unmute internal speaker according to the hp jack and mute state */
11540 static void alc262_ultra_automute(struct hda_codec *codec)
11542 struct alc_spec *spec = codec->spec;
11546 /* auto-mute only when HP is used as HP */
11547 if (!spec->cur_mux[0]) {
11548 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11549 if (spec->jack_present)
11550 mute = HDA_AMP_MUTE;
11552 /* mute/unmute internal speaker */
11553 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11554 HDA_AMP_MUTE, mute);
11555 /* mute/unmute HP */
11556 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11557 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
11560 /* unsolicited event for HP jack sensing */
11561 static void alc262_ultra_unsol_event(struct hda_codec *codec,
11564 if ((res >> 26) != ALC880_HP_EVENT)
11566 alc262_ultra_automute(codec);
11569 static struct hda_input_mux alc262_ultra_capture_source = {
11573 { "Headphone", 0x7 },
11577 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
11578 struct snd_ctl_elem_value *ucontrol)
11580 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11581 struct alc_spec *spec = codec->spec;
11584 ret = alc_mux_enum_put(kcontrol, ucontrol);
11587 /* reprogram the HP pin as mic or HP according to the input source */
11588 snd_hda_codec_write_cache(codec, 0x15, 0,
11589 AC_VERB_SET_PIN_WIDGET_CONTROL,
11590 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
11591 alc262_ultra_automute(codec); /* mute/unmute HP */
11595 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
11596 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
11597 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
11599 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11600 .name = "Capture Source",
11601 .info = alc_mux_enum_info,
11602 .get = alc_mux_enum_get,
11603 .put = alc262_ultra_mux_enum_put,
11606 .iface = NID_MAPPING,
11607 .name = "Capture Source",
11608 .private_value = 0x15,
11613 /* We use two mixers depending on the output pin; 0x16 is a mono output
11614 * and thus it's bound with a different mixer.
11615 * This function returns which mixer amp should be used.
11617 static int alc262_check_volbit(hda_nid_t nid)
11621 else if (nid == 0x16)
11627 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
11628 const char *pfx, int *vbits)
11633 vbit = alc262_check_volbit(nid);
11636 if (*vbits & vbit) /* a volume control for this mixer already there */
11640 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
11642 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
11643 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, val);
11646 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
11654 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
11656 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
11657 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val);
11660 /* add playback controls from the parsed DAC table */
11661 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
11662 const struct auto_pin_cfg *cfg)
11668 spec->multiout.num_dacs = 1; /* only use one dac */
11669 spec->multiout.dac_nids = spec->private_dac_nids;
11670 spec->multiout.dac_nids[0] = 2;
11672 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
11674 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11678 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx);
11681 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker");
11684 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone");
11688 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
11689 alc262_check_volbit(cfg->speaker_pins[0]) |
11690 alc262_check_volbit(cfg->hp_pins[0]);
11691 if (vbits == 1 || vbits == 2)
11692 pfx = "Master"; /* only one mixer is used */
11693 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11698 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits);
11701 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker",
11705 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone",
11712 #define alc262_auto_create_input_ctls \
11713 alc882_auto_create_input_ctls
11716 * generic initialization of ADC, input mixers and output mixers
11718 static struct hda_verb alc262_volume_init_verbs[] = {
11720 * Unmute ADC0-2 and set the default input to mic-in
11722 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11723 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11724 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11725 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11726 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11727 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11729 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11731 * Note: PASD motherboards uses the Line In 2 as the input for
11732 * front panel mic (mic 2)
11734 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11735 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11736 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11737 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11738 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11739 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11742 * Set up output mixers (0x0c - 0x0f)
11744 /* set vol=0 to output mixers */
11745 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11746 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11747 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11749 /* set up input amps for analog loopback */
11750 /* Amp Indices: DAC = 0, mixer = 1 */
11751 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11752 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11753 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11754 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11755 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11756 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11758 /* FIXME: use matrix-type input source selection */
11759 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11760 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11761 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11762 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11763 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11764 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11766 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11767 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11768 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11769 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11771 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11772 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11773 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11774 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11779 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
11781 * Unmute ADC0-2 and set the default input to mic-in
11783 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11784 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11785 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11786 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11787 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11788 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11790 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11792 * Note: PASD motherboards uses the Line In 2 as the input for
11793 * front panel mic (mic 2)
11795 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11796 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11797 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11798 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11799 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11800 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11801 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11802 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11805 * Set up output mixers (0x0c - 0x0e)
11807 /* set vol=0 to output mixers */
11808 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11809 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11810 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11812 /* set up input amps for analog loopback */
11813 /* Amp Indices: DAC = 0, mixer = 1 */
11814 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11815 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11816 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11817 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11818 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11819 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11821 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11822 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11823 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11825 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11826 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11828 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11829 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11831 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11832 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11833 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11834 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11835 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11837 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11838 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11839 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11840 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11841 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11842 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11845 /* FIXME: use matrix-type input source selection */
11846 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
11847 /* Input mixer1: only unmute Mic */
11848 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11849 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11850 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11851 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11852 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11853 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11854 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11855 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11856 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11858 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11859 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11860 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11861 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11862 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11863 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11864 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11865 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11866 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11868 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11869 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11870 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11871 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11872 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11873 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11874 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11875 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11876 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11878 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11883 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
11885 * Unmute ADC0-2 and set the default input to mic-in
11887 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11888 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11889 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11890 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11891 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11892 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11894 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11896 * Note: PASD motherboards uses the Line In 2 as the input for front
11897 * panel mic (mic 2)
11899 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11900 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11901 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11902 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11903 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11904 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11905 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11906 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11907 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11909 * Set up output mixers (0x0c - 0x0e)
11911 /* set vol=0 to output mixers */
11912 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11913 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11914 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11916 /* set up input amps for analog loopback */
11917 /* Amp Indices: DAC = 0, mixer = 1 */
11918 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11919 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11920 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11921 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11922 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11923 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11926 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
11927 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
11928 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
11929 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
11930 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11931 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
11932 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
11934 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11935 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11937 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11938 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11940 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
11941 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11942 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11943 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
11944 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11945 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11947 /* FIXME: use matrix-type input source selection */
11948 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11949 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11950 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
11951 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
11952 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
11953 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
11954 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
11955 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11956 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
11958 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11959 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11960 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11961 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11962 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11963 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11964 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11966 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11967 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11968 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11969 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11970 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11971 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11972 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11974 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11979 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
11981 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
11982 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11983 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
11985 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
11986 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11987 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11988 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11990 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
11991 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11992 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11997 #ifdef CONFIG_SND_HDA_POWER_SAVE
11998 #define alc262_loopbacks alc880_loopbacks
12001 /* pcm configuration: identical with ALC880 */
12002 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
12003 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
12004 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
12005 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
12008 * BIOS auto configuration
12010 static int alc262_parse_auto_config(struct hda_codec *codec)
12012 struct alc_spec *spec = codec->spec;
12014 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
12016 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12020 if (!spec->autocfg.line_outs) {
12021 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12022 spec->multiout.max_channels = 2;
12023 spec->no_analog = 1;
12026 return 0; /* can't find valid BIOS pin config */
12028 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
12031 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
12035 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12038 if (spec->autocfg.dig_outs) {
12039 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
12040 spec->dig_out_type = spec->autocfg.dig_out_type[0];
12042 if (spec->autocfg.dig_in_pin)
12043 spec->dig_in_nid = ALC262_DIGIN_NID;
12045 if (spec->kctls.list)
12046 add_mixer(spec, spec->kctls.list);
12048 add_verb(spec, alc262_volume_init_verbs);
12049 spec->num_mux_defs = 1;
12050 spec->input_mux = &spec->private_imux[0];
12052 err = alc_auto_add_mic_boost(codec);
12056 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
12061 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
12062 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
12063 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
12064 #define alc262_auto_init_input_src alc882_auto_init_input_src
12067 /* init callback for auto-configuration model -- overriding the default init */
12068 static void alc262_auto_init(struct hda_codec *codec)
12070 struct alc_spec *spec = codec->spec;
12071 alc262_auto_init_multi_out(codec);
12072 alc262_auto_init_hp_out(codec);
12073 alc262_auto_init_analog_input(codec);
12074 alc262_auto_init_input_src(codec);
12075 if (spec->unsol_event)
12076 alc_inithook(codec);
12080 * configuration and preset
12082 static const char *alc262_models[ALC262_MODEL_LAST] = {
12083 [ALC262_BASIC] = "basic",
12084 [ALC262_HIPPO] = "hippo",
12085 [ALC262_HIPPO_1] = "hippo_1",
12086 [ALC262_FUJITSU] = "fujitsu",
12087 [ALC262_HP_BPC] = "hp-bpc",
12088 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
12089 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
12090 [ALC262_HP_RP5700] = "hp-rp5700",
12091 [ALC262_BENQ_ED8] = "benq",
12092 [ALC262_BENQ_T31] = "benq-t31",
12093 [ALC262_SONY_ASSAMD] = "sony-assamd",
12094 [ALC262_TOSHIBA_S06] = "toshiba-s06",
12095 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
12096 [ALC262_ULTRA] = "ultra",
12097 [ALC262_LENOVO_3000] = "lenovo-3000",
12098 [ALC262_NEC] = "nec",
12099 [ALC262_TYAN] = "tyan",
12100 [ALC262_AUTO] = "auto",
12103 static struct snd_pci_quirk alc262_cfg_tbl[] = {
12104 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
12105 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
12106 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
12108 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
12110 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
12112 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
12113 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
12114 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
12115 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
12116 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
12117 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
12118 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
12119 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
12120 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
12121 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
12122 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
12123 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
12124 ALC262_HP_TC_T5735),
12125 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
12126 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12127 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
12128 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12129 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
12130 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
12131 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
12132 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
12133 #if 0 /* disable the quirk since model=auto works better in recent versions */
12134 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
12135 ALC262_SONY_ASSAMD),
12137 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
12138 ALC262_TOSHIBA_RX1),
12139 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
12140 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
12141 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
12142 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
12143 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
12145 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
12146 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
12147 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
12148 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
12149 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
12153 static struct alc_config_preset alc262_presets[] = {
12155 .mixers = { alc262_base_mixer },
12156 .init_verbs = { alc262_init_verbs },
12157 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12158 .dac_nids = alc262_dac_nids,
12160 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12161 .channel_mode = alc262_modes,
12162 .input_mux = &alc262_capture_source,
12165 .mixers = { alc262_hippo_mixer },
12166 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
12167 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12168 .dac_nids = alc262_dac_nids,
12170 .dig_out_nid = ALC262_DIGOUT_NID,
12171 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12172 .channel_mode = alc262_modes,
12173 .input_mux = &alc262_capture_source,
12174 .unsol_event = alc262_hippo_unsol_event,
12175 .setup = alc262_hippo_setup,
12176 .init_hook = alc262_hippo_automute,
12178 [ALC262_HIPPO_1] = {
12179 .mixers = { alc262_hippo1_mixer },
12180 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
12181 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12182 .dac_nids = alc262_dac_nids,
12184 .dig_out_nid = ALC262_DIGOUT_NID,
12185 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12186 .channel_mode = alc262_modes,
12187 .input_mux = &alc262_capture_source,
12188 .unsol_event = alc262_hippo_unsol_event,
12189 .setup = alc262_hippo1_setup,
12190 .init_hook = alc262_hippo_automute,
12192 [ALC262_FUJITSU] = {
12193 .mixers = { alc262_fujitsu_mixer },
12194 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12195 alc262_fujitsu_unsol_verbs },
12196 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12197 .dac_nids = alc262_dac_nids,
12199 .dig_out_nid = ALC262_DIGOUT_NID,
12200 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12201 .channel_mode = alc262_modes,
12202 .input_mux = &alc262_fujitsu_capture_source,
12203 .unsol_event = alc262_fujitsu_unsol_event,
12204 .init_hook = alc262_fujitsu_init_hook,
12206 [ALC262_HP_BPC] = {
12207 .mixers = { alc262_HP_BPC_mixer },
12208 .init_verbs = { alc262_HP_BPC_init_verbs },
12209 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12210 .dac_nids = alc262_dac_nids,
12212 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12213 .channel_mode = alc262_modes,
12214 .input_mux = &alc262_HP_capture_source,
12215 .unsol_event = alc262_hp_bpc_unsol_event,
12216 .init_hook = alc262_hp_bpc_automute,
12218 [ALC262_HP_BPC_D7000_WF] = {
12219 .mixers = { alc262_HP_BPC_WildWest_mixer },
12220 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12221 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12222 .dac_nids = alc262_dac_nids,
12224 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12225 .channel_mode = alc262_modes,
12226 .input_mux = &alc262_HP_D7000_capture_source,
12227 .unsol_event = alc262_hp_wildwest_unsol_event,
12228 .init_hook = alc262_hp_wildwest_automute,
12230 [ALC262_HP_BPC_D7000_WL] = {
12231 .mixers = { alc262_HP_BPC_WildWest_mixer,
12232 alc262_HP_BPC_WildWest_option_mixer },
12233 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12234 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12235 .dac_nids = alc262_dac_nids,
12237 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12238 .channel_mode = alc262_modes,
12239 .input_mux = &alc262_HP_D7000_capture_source,
12240 .unsol_event = alc262_hp_wildwest_unsol_event,
12241 .init_hook = alc262_hp_wildwest_automute,
12243 [ALC262_HP_TC_T5735] = {
12244 .mixers = { alc262_hp_t5735_mixer },
12245 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
12246 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12247 .dac_nids = alc262_dac_nids,
12249 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12250 .channel_mode = alc262_modes,
12251 .input_mux = &alc262_capture_source,
12252 .unsol_event = alc_sku_unsol_event,
12253 .setup = alc262_hp_t5735_setup,
12254 .init_hook = alc_inithook,
12256 [ALC262_HP_RP5700] = {
12257 .mixers = { alc262_hp_rp5700_mixer },
12258 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
12259 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12260 .dac_nids = alc262_dac_nids,
12261 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12262 .channel_mode = alc262_modes,
12263 .input_mux = &alc262_hp_rp5700_capture_source,
12265 [ALC262_BENQ_ED8] = {
12266 .mixers = { alc262_base_mixer },
12267 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
12268 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12269 .dac_nids = alc262_dac_nids,
12271 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12272 .channel_mode = alc262_modes,
12273 .input_mux = &alc262_capture_source,
12275 [ALC262_SONY_ASSAMD] = {
12276 .mixers = { alc262_sony_mixer },
12277 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
12278 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12279 .dac_nids = alc262_dac_nids,
12281 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12282 .channel_mode = alc262_modes,
12283 .input_mux = &alc262_capture_source,
12284 .unsol_event = alc262_hippo_unsol_event,
12285 .setup = alc262_hippo_setup,
12286 .init_hook = alc262_hippo_automute,
12288 [ALC262_BENQ_T31] = {
12289 .mixers = { alc262_benq_t31_mixer },
12290 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
12291 alc_hp15_unsol_verbs },
12292 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12293 .dac_nids = alc262_dac_nids,
12295 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12296 .channel_mode = alc262_modes,
12297 .input_mux = &alc262_capture_source,
12298 .unsol_event = alc262_hippo_unsol_event,
12299 .setup = alc262_hippo_setup,
12300 .init_hook = alc262_hippo_automute,
12303 .mixers = { alc262_ultra_mixer },
12304 .cap_mixer = alc262_ultra_capture_mixer,
12305 .init_verbs = { alc262_ultra_verbs },
12306 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12307 .dac_nids = alc262_dac_nids,
12308 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12309 .channel_mode = alc262_modes,
12310 .input_mux = &alc262_ultra_capture_source,
12311 .adc_nids = alc262_adc_nids, /* ADC0 */
12312 .capsrc_nids = alc262_capsrc_nids,
12313 .num_adc_nids = 1, /* single ADC */
12314 .unsol_event = alc262_ultra_unsol_event,
12315 .init_hook = alc262_ultra_automute,
12317 [ALC262_LENOVO_3000] = {
12318 .mixers = { alc262_lenovo_3000_mixer },
12319 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12320 alc262_lenovo_3000_unsol_verbs,
12321 alc262_lenovo_3000_init_verbs },
12322 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12323 .dac_nids = alc262_dac_nids,
12325 .dig_out_nid = ALC262_DIGOUT_NID,
12326 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12327 .channel_mode = alc262_modes,
12328 .input_mux = &alc262_fujitsu_capture_source,
12329 .unsol_event = alc262_lenovo_3000_unsol_event,
12332 .mixers = { alc262_nec_mixer },
12333 .init_verbs = { alc262_nec_verbs },
12334 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12335 .dac_nids = alc262_dac_nids,
12337 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12338 .channel_mode = alc262_modes,
12339 .input_mux = &alc262_capture_source,
12341 [ALC262_TOSHIBA_S06] = {
12342 .mixers = { alc262_toshiba_s06_mixer },
12343 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
12344 alc262_eapd_verbs },
12345 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12346 .capsrc_nids = alc262_dmic_capsrc_nids,
12347 .dac_nids = alc262_dac_nids,
12348 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
12349 .num_adc_nids = 1, /* single ADC */
12350 .dig_out_nid = ALC262_DIGOUT_NID,
12351 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12352 .channel_mode = alc262_modes,
12353 .unsol_event = alc_sku_unsol_event,
12354 .setup = alc262_toshiba_s06_setup,
12355 .init_hook = alc_inithook,
12357 [ALC262_TOSHIBA_RX1] = {
12358 .mixers = { alc262_toshiba_rx1_mixer },
12359 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
12360 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12361 .dac_nids = alc262_dac_nids,
12363 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12364 .channel_mode = alc262_modes,
12365 .input_mux = &alc262_capture_source,
12366 .unsol_event = alc262_hippo_unsol_event,
12367 .setup = alc262_hippo_setup,
12368 .init_hook = alc262_hippo_automute,
12371 .mixers = { alc262_tyan_mixer },
12372 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
12373 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12374 .dac_nids = alc262_dac_nids,
12376 .dig_out_nid = ALC262_DIGOUT_NID,
12377 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12378 .channel_mode = alc262_modes,
12379 .input_mux = &alc262_capture_source,
12380 .unsol_event = alc_automute_amp_unsol_event,
12381 .setup = alc262_tyan_setup,
12382 .init_hook = alc_automute_amp,
12386 static int patch_alc262(struct hda_codec *codec)
12388 struct alc_spec *spec;
12392 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12396 codec->spec = spec;
12398 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
12403 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12404 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
12405 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12406 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
12409 alc_auto_parse_customize_define(codec);
12411 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
12413 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
12417 if (board_config < 0) {
12418 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12420 board_config = ALC262_AUTO;
12423 if (board_config == ALC262_AUTO) {
12424 /* automatic parse from the BIOS config */
12425 err = alc262_parse_auto_config(codec);
12431 "hda_codec: Cannot set up configuration "
12432 "from BIOS. Using base mode...\n");
12433 board_config = ALC262_BASIC;
12437 if (!spec->no_analog) {
12438 err = snd_hda_attach_beep_device(codec, 0x1);
12445 if (board_config != ALC262_AUTO)
12446 setup_preset(codec, &alc262_presets[board_config]);
12448 spec->stream_analog_playback = &alc262_pcm_analog_playback;
12449 spec->stream_analog_capture = &alc262_pcm_analog_capture;
12451 spec->stream_digital_playback = &alc262_pcm_digital_playback;
12452 spec->stream_digital_capture = &alc262_pcm_digital_capture;
12454 if (!spec->adc_nids && spec->input_mux) {
12456 /* check whether the digital-mic has to be supported */
12457 for (i = 0; i < spec->input_mux->num_items; i++) {
12458 if (spec->input_mux->items[i].index >= 9)
12461 if (i < spec->input_mux->num_items) {
12462 /* use only ADC0 */
12463 spec->adc_nids = alc262_dmic_adc_nids;
12464 spec->num_adc_nids = 1;
12465 spec->capsrc_nids = alc262_dmic_capsrc_nids;
12467 /* all analog inputs */
12468 /* check whether NID 0x07 is valid */
12469 unsigned int wcap = get_wcaps(codec, 0x07);
12472 wcap = get_wcaps_type(wcap);
12473 if (wcap != AC_WID_AUD_IN) {
12474 spec->adc_nids = alc262_adc_nids_alt;
12475 spec->num_adc_nids =
12476 ARRAY_SIZE(alc262_adc_nids_alt);
12477 spec->capsrc_nids = alc262_capsrc_nids_alt;
12479 spec->adc_nids = alc262_adc_nids;
12480 spec->num_adc_nids =
12481 ARRAY_SIZE(alc262_adc_nids);
12482 spec->capsrc_nids = alc262_capsrc_nids;
12486 if (!spec->cap_mixer && !spec->no_analog)
12487 set_capture_mixer(codec);
12488 if (!spec->no_analog && spec->cdefine.enable_pcbeep)
12489 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12491 spec->vmaster_nid = 0x0c;
12493 codec->patch_ops = alc_patch_ops;
12494 if (board_config == ALC262_AUTO)
12495 spec->init_hook = alc262_auto_init;
12496 #ifdef CONFIG_SND_HDA_POWER_SAVE
12497 if (!spec->loopback.amplist)
12498 spec->loopback.amplist = alc262_loopbacks;
12505 * ALC268 channel source setting (2 channel)
12507 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
12508 #define alc268_modes alc260_modes
12510 static hda_nid_t alc268_dac_nids[2] = {
12515 static hda_nid_t alc268_adc_nids[2] = {
12520 static hda_nid_t alc268_adc_nids_alt[1] = {
12525 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
12527 static struct snd_kcontrol_new alc268_base_mixer[] = {
12528 /* output mixer control */
12529 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12530 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12531 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12532 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12533 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12534 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12535 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12539 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
12540 /* output mixer control */
12541 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12542 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12543 ALC262_HIPPO_MASTER_SWITCH,
12544 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12545 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12546 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12550 /* bind Beep switches of both NID 0x0f and 0x10 */
12551 static struct hda_bind_ctls alc268_bind_beep_sw = {
12552 .ops = &snd_hda_bind_sw,
12554 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
12555 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
12560 static struct snd_kcontrol_new alc268_beep_mixer[] = {
12561 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
12562 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
12566 static struct hda_verb alc268_eapd_verbs[] = {
12567 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12568 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12572 /* Toshiba specific */
12573 static struct hda_verb alc268_toshiba_verbs[] = {
12574 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12578 /* Acer specific */
12579 /* bind volumes of both NID 0x02 and 0x03 */
12580 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
12581 .ops = &snd_hda_bind_vol,
12583 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12584 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12589 /* mute/unmute internal speaker according to the hp jack and mute state */
12590 static void alc268_acer_automute(struct hda_codec *codec, int force)
12592 struct alc_spec *spec = codec->spec;
12595 if (force || !spec->sense_updated) {
12596 spec->jack_present = snd_hda_jack_detect(codec, 0x14);
12597 spec->sense_updated = 1;
12599 if (spec->jack_present)
12600 mute = HDA_AMP_MUTE; /* mute internal speaker */
12601 else /* unmute internal speaker if necessary */
12602 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
12603 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12604 HDA_AMP_MUTE, mute);
12608 /* bind hp and internal speaker mute (with plug check) */
12609 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
12610 struct snd_ctl_elem_value *ucontrol)
12612 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12613 long *valp = ucontrol->value.integer.value;
12616 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
12618 alc268_acer_automute(codec, 0);
12622 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
12623 /* output mixer control */
12624 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12626 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12627 .name = "Master Playback Switch",
12628 .subdevice = HDA_SUBDEV_AMP_FLAG,
12629 .info = snd_hda_mixer_amp_switch_info,
12630 .get = snd_hda_mixer_amp_switch_get,
12631 .put = alc268_acer_master_sw_put,
12632 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12634 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
12638 static struct snd_kcontrol_new alc268_acer_mixer[] = {
12639 /* output mixer control */
12640 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12642 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12643 .name = "Master Playback Switch",
12644 .subdevice = HDA_SUBDEV_AMP_FLAG,
12645 .info = snd_hda_mixer_amp_switch_info,
12646 .get = snd_hda_mixer_amp_switch_get,
12647 .put = alc268_acer_master_sw_put,
12648 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12650 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12651 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12652 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12656 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
12657 /* output mixer control */
12658 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12660 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12661 .name = "Master Playback Switch",
12662 .subdevice = HDA_SUBDEV_AMP_FLAG,
12663 .info = snd_hda_mixer_amp_switch_info,
12664 .get = snd_hda_mixer_amp_switch_get,
12665 .put = alc268_acer_master_sw_put,
12666 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12668 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12669 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12673 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
12674 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12675 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12676 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12677 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12678 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
12679 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
12683 static struct hda_verb alc268_acer_verbs[] = {
12684 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
12685 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12686 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12687 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12688 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12689 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12690 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12694 /* unsolicited event for HP jack sensing */
12695 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
12696 #define alc268_toshiba_setup alc262_hippo_setup
12697 #define alc268_toshiba_automute alc262_hippo_automute
12699 static void alc268_acer_unsol_event(struct hda_codec *codec,
12702 if ((res >> 26) != ALC880_HP_EVENT)
12704 alc268_acer_automute(codec, 1);
12707 static void alc268_acer_init_hook(struct hda_codec *codec)
12709 alc268_acer_automute(codec, 1);
12712 /* toggle speaker-output according to the hp-jack state */
12713 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
12715 unsigned int present;
12716 unsigned char bits;
12718 present = snd_hda_jack_detect(codec, 0x15);
12719 bits = present ? HDA_AMP_MUTE : 0;
12720 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
12721 HDA_AMP_MUTE, bits);
12722 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
12723 HDA_AMP_MUTE, bits);
12726 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
12729 switch (res >> 26) {
12730 case ALC880_HP_EVENT:
12731 alc268_aspire_one_speaker_automute(codec);
12733 case ALC880_MIC_EVENT:
12734 alc_mic_automute(codec);
12739 static void alc268_acer_lc_setup(struct hda_codec *codec)
12741 struct alc_spec *spec = codec->spec;
12742 spec->ext_mic.pin = 0x18;
12743 spec->ext_mic.mux_idx = 0;
12744 spec->int_mic.pin = 0x12;
12745 spec->int_mic.mux_idx = 6;
12746 spec->auto_mic = 1;
12749 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
12751 alc268_aspire_one_speaker_automute(codec);
12752 alc_mic_automute(codec);
12755 static struct snd_kcontrol_new alc268_dell_mixer[] = {
12756 /* output mixer control */
12757 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12758 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12759 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12760 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12761 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12762 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12766 static struct hda_verb alc268_dell_verbs[] = {
12767 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12768 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12769 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12770 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12774 /* mute/unmute internal speaker according to the hp jack and mute state */
12775 static void alc268_dell_setup(struct hda_codec *codec)
12777 struct alc_spec *spec = codec->spec;
12779 spec->autocfg.hp_pins[0] = 0x15;
12780 spec->autocfg.speaker_pins[0] = 0x14;
12781 spec->ext_mic.pin = 0x18;
12782 spec->ext_mic.mux_idx = 0;
12783 spec->int_mic.pin = 0x19;
12784 spec->int_mic.mux_idx = 1;
12785 spec->auto_mic = 1;
12788 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
12789 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12790 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12791 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12792 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12793 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12794 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
12795 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
12796 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
12800 static struct hda_verb alc267_quanta_il1_verbs[] = {
12801 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12802 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12806 static void alc267_quanta_il1_setup(struct hda_codec *codec)
12808 struct alc_spec *spec = codec->spec;
12809 spec->autocfg.hp_pins[0] = 0x15;
12810 spec->autocfg.speaker_pins[0] = 0x14;
12811 spec->ext_mic.pin = 0x18;
12812 spec->ext_mic.mux_idx = 0;
12813 spec->int_mic.pin = 0x19;
12814 spec->int_mic.mux_idx = 1;
12815 spec->auto_mic = 1;
12819 * generic initialization of ADC, input mixers and output mixers
12821 static struct hda_verb alc268_base_init_verbs[] = {
12822 /* Unmute DAC0-1 and set vol = 0 */
12823 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12824 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12827 * Set up output mixers (0x0c - 0x0e)
12829 /* set vol=0 to output mixers */
12830 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12831 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
12833 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12834 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12836 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12837 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
12838 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12839 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12840 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12841 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12842 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12843 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12845 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12846 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12847 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12848 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12849 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12851 /* set PCBEEP vol = 0, mute connections */
12852 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12853 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12854 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12856 /* Unmute Selector 23h,24h and set the default input to mic-in */
12858 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
12859 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12860 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
12861 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12867 * generic initialization of ADC, input mixers and output mixers
12869 static struct hda_verb alc268_volume_init_verbs[] = {
12870 /* set output DAC */
12871 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12872 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12874 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12875 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12876 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12877 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12878 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12880 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12881 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12882 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12884 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12885 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12887 /* set PCBEEP vol = 0, mute connections */
12888 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12889 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12890 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12895 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
12896 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12897 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12901 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
12902 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12903 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12908 static struct snd_kcontrol_new alc268_capture_mixer[] = {
12909 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12910 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12911 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
12912 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
12917 static struct hda_input_mux alc268_capture_source = {
12921 { "Front Mic", 0x1 },
12927 static struct hda_input_mux alc268_acer_capture_source = {
12931 { "Internal Mic", 0x1 },
12936 static struct hda_input_mux alc268_acer_dmic_capture_source = {
12940 { "Internal Mic", 0x6 },
12945 #ifdef CONFIG_SND_DEBUG
12946 static struct snd_kcontrol_new alc268_test_mixer[] = {
12947 /* Volume widgets */
12948 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12949 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12950 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12951 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
12952 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
12953 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
12954 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
12955 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
12956 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
12957 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
12958 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
12959 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
12960 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
12961 /* The below appears problematic on some hardwares */
12962 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
12963 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12964 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
12965 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
12966 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
12968 /* Modes for retasking pin widgets */
12969 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
12970 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
12971 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
12972 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
12974 /* Controls for GPIO pins, assuming they are configured as outputs */
12975 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
12976 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
12977 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
12978 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
12980 /* Switches to allow the digital SPDIF output pin to be enabled.
12981 * The ALC268 does not have an SPDIF input.
12983 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
12985 /* A switch allowing EAPD to be enabled. Some laptops seem to use
12986 * this output to turn on an external amplifier.
12988 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
12989 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
12995 /* create input playback/capture controls for the given pin */
12996 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12997 const char *ctlname, int idx)
13008 case 0x21: /* ALC269vb has this pin, too */
13014 if (spec->multiout.dac_nids[0] != dac &&
13015 spec->multiout.dac_nids[1] != dac) {
13016 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
13017 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
13021 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
13025 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
13026 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
13028 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
13029 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
13035 /* add playback controls from the parsed DAC table */
13036 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
13037 const struct auto_pin_cfg *cfg)
13042 spec->multiout.dac_nids = spec->private_dac_nids;
13044 nid = cfg->line_out_pins[0];
13047 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
13051 err = alc268_new_analog_output(spec, nid, name, 0);
13056 nid = cfg->speaker_pins[0];
13058 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
13059 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
13063 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
13067 nid = cfg->hp_pins[0];
13069 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
13074 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
13076 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
13077 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
13084 /* create playback/capture controls for input pins */
13085 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
13086 const struct auto_pin_cfg *cfg)
13088 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
13091 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
13092 hda_nid_t nid, int pin_type)
13096 alc_set_pin_output(codec, nid, pin_type);
13097 if (nid == 0x14 || nid == 0x16)
13101 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
13104 static void alc268_auto_init_multi_out(struct hda_codec *codec)
13106 struct alc_spec *spec = codec->spec;
13107 hda_nid_t nid = spec->autocfg.line_out_pins[0];
13109 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13110 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
13114 static void alc268_auto_init_hp_out(struct hda_codec *codec)
13116 struct alc_spec *spec = codec->spec;
13119 pin = spec->autocfg.hp_pins[0];
13121 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
13122 pin = spec->autocfg.speaker_pins[0];
13124 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
13127 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
13129 struct alc_spec *spec = codec->spec;
13130 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
13131 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
13132 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
13133 unsigned int dac_vol1, dac_vol2;
13135 if (line_nid == 0x1d || speaker_nid == 0x1d) {
13136 snd_hda_codec_write(codec, speaker_nid, 0,
13137 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
13138 /* mute mixer inputs from 0x1d */
13139 snd_hda_codec_write(codec, 0x0f, 0,
13140 AC_VERB_SET_AMP_GAIN_MUTE,
13142 snd_hda_codec_write(codec, 0x10, 0,
13143 AC_VERB_SET_AMP_GAIN_MUTE,
13146 /* unmute mixer inputs from 0x1d */
13147 snd_hda_codec_write(codec, 0x0f, 0,
13148 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13149 snd_hda_codec_write(codec, 0x10, 0,
13150 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13153 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
13154 if (line_nid == 0x14)
13155 dac_vol2 = AMP_OUT_ZERO;
13156 else if (line_nid == 0x15)
13157 dac_vol1 = AMP_OUT_ZERO;
13158 if (hp_nid == 0x14)
13159 dac_vol2 = AMP_OUT_ZERO;
13160 else if (hp_nid == 0x15)
13161 dac_vol1 = AMP_OUT_ZERO;
13162 if (line_nid != 0x16 || hp_nid != 0x16 ||
13163 spec->autocfg.line_out_pins[1] != 0x16 ||
13164 spec->autocfg.line_out_pins[2] != 0x16)
13165 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
13167 snd_hda_codec_write(codec, 0x02, 0,
13168 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
13169 snd_hda_codec_write(codec, 0x03, 0,
13170 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
13173 /* pcm configuration: identical with ALC880 */
13174 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
13175 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
13176 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
13177 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
13180 * BIOS auto configuration
13182 static int alc268_parse_auto_config(struct hda_codec *codec)
13184 struct alc_spec *spec = codec->spec;
13186 static hda_nid_t alc268_ignore[] = { 0 };
13188 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13192 if (!spec->autocfg.line_outs) {
13193 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
13194 spec->multiout.max_channels = 2;
13195 spec->no_analog = 1;
13198 return 0; /* can't find valid BIOS pin config */
13200 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
13203 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
13207 spec->multiout.max_channels = 2;
13210 /* digital only support output */
13211 if (spec->autocfg.dig_outs) {
13212 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
13213 spec->dig_out_type = spec->autocfg.dig_out_type[0];
13215 if (spec->kctls.list)
13216 add_mixer(spec, spec->kctls.list);
13218 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
13219 add_mixer(spec, alc268_beep_mixer);
13221 add_verb(spec, alc268_volume_init_verbs);
13222 spec->num_mux_defs = 2;
13223 spec->input_mux = &spec->private_imux[0];
13225 err = alc_auto_add_mic_boost(codec);
13229 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
13234 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
13236 /* init callback for auto-configuration model -- overriding the default init */
13237 static void alc268_auto_init(struct hda_codec *codec)
13239 struct alc_spec *spec = codec->spec;
13240 alc268_auto_init_multi_out(codec);
13241 alc268_auto_init_hp_out(codec);
13242 alc268_auto_init_mono_speaker_out(codec);
13243 alc268_auto_init_analog_input(codec);
13244 if (spec->unsol_event)
13245 alc_inithook(codec);
13249 * configuration and preset
13251 static const char *alc268_models[ALC268_MODEL_LAST] = {
13252 [ALC267_QUANTA_IL1] = "quanta-il1",
13253 [ALC268_3ST] = "3stack",
13254 [ALC268_TOSHIBA] = "toshiba",
13255 [ALC268_ACER] = "acer",
13256 [ALC268_ACER_DMIC] = "acer-dmic",
13257 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
13258 [ALC268_DELL] = "dell",
13259 [ALC268_ZEPTO] = "zepto",
13260 #ifdef CONFIG_SND_DEBUG
13261 [ALC268_TEST] = "test",
13263 [ALC268_AUTO] = "auto",
13266 static struct snd_pci_quirk alc268_cfg_tbl[] = {
13267 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
13268 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
13269 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
13270 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
13271 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
13272 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
13273 ALC268_ACER_ASPIRE_ONE),
13274 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
13275 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
13276 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
13277 /* almost compatible with toshiba but with optional digital outs;
13278 * auto-probing seems working fine
13280 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
13282 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
13283 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
13284 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
13285 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
13286 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
13287 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
13291 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
13292 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
13293 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
13294 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
13295 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
13300 static struct alc_config_preset alc268_presets[] = {
13301 [ALC267_QUANTA_IL1] = {
13302 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
13303 alc268_capture_nosrc_mixer },
13304 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13305 alc267_quanta_il1_verbs },
13306 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13307 .dac_nids = alc268_dac_nids,
13308 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13309 .adc_nids = alc268_adc_nids_alt,
13311 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13312 .channel_mode = alc268_modes,
13313 .unsol_event = alc_sku_unsol_event,
13314 .setup = alc267_quanta_il1_setup,
13315 .init_hook = alc_inithook,
13318 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13319 alc268_beep_mixer },
13320 .init_verbs = { alc268_base_init_verbs },
13321 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13322 .dac_nids = alc268_dac_nids,
13323 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13324 .adc_nids = alc268_adc_nids_alt,
13325 .capsrc_nids = alc268_capsrc_nids,
13327 .dig_out_nid = ALC268_DIGOUT_NID,
13328 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13329 .channel_mode = alc268_modes,
13330 .input_mux = &alc268_capture_source,
13332 [ALC268_TOSHIBA] = {
13333 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
13334 alc268_beep_mixer },
13335 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13336 alc268_toshiba_verbs },
13337 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13338 .dac_nids = alc268_dac_nids,
13339 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13340 .adc_nids = alc268_adc_nids_alt,
13341 .capsrc_nids = alc268_capsrc_nids,
13343 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13344 .channel_mode = alc268_modes,
13345 .input_mux = &alc268_capture_source,
13346 .unsol_event = alc268_toshiba_unsol_event,
13347 .setup = alc268_toshiba_setup,
13348 .init_hook = alc268_toshiba_automute,
13351 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
13352 alc268_beep_mixer },
13353 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13354 alc268_acer_verbs },
13355 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13356 .dac_nids = alc268_dac_nids,
13357 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13358 .adc_nids = alc268_adc_nids_alt,
13359 .capsrc_nids = alc268_capsrc_nids,
13361 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13362 .channel_mode = alc268_modes,
13363 .input_mux = &alc268_acer_capture_source,
13364 .unsol_event = alc268_acer_unsol_event,
13365 .init_hook = alc268_acer_init_hook,
13367 [ALC268_ACER_DMIC] = {
13368 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
13369 alc268_beep_mixer },
13370 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13371 alc268_acer_verbs },
13372 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13373 .dac_nids = alc268_dac_nids,
13374 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13375 .adc_nids = alc268_adc_nids_alt,
13376 .capsrc_nids = alc268_capsrc_nids,
13378 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13379 .channel_mode = alc268_modes,
13380 .input_mux = &alc268_acer_dmic_capture_source,
13381 .unsol_event = alc268_acer_unsol_event,
13382 .init_hook = alc268_acer_init_hook,
13384 [ALC268_ACER_ASPIRE_ONE] = {
13385 .mixers = { alc268_acer_aspire_one_mixer,
13387 alc268_capture_nosrc_mixer },
13388 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13389 alc268_acer_aspire_one_verbs },
13390 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13391 .dac_nids = alc268_dac_nids,
13392 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13393 .adc_nids = alc268_adc_nids_alt,
13394 .capsrc_nids = alc268_capsrc_nids,
13396 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13397 .channel_mode = alc268_modes,
13398 .unsol_event = alc268_acer_lc_unsol_event,
13399 .setup = alc268_acer_lc_setup,
13400 .init_hook = alc268_acer_lc_init_hook,
13403 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
13404 alc268_capture_nosrc_mixer },
13405 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13406 alc268_dell_verbs },
13407 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13408 .dac_nids = alc268_dac_nids,
13409 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13410 .adc_nids = alc268_adc_nids_alt,
13411 .capsrc_nids = alc268_capsrc_nids,
13413 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13414 .channel_mode = alc268_modes,
13415 .unsol_event = alc_sku_unsol_event,
13416 .setup = alc268_dell_setup,
13417 .init_hook = alc_inithook,
13420 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13421 alc268_beep_mixer },
13422 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13423 alc268_toshiba_verbs },
13424 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13425 .dac_nids = alc268_dac_nids,
13426 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13427 .adc_nids = alc268_adc_nids_alt,
13428 .capsrc_nids = alc268_capsrc_nids,
13430 .dig_out_nid = ALC268_DIGOUT_NID,
13431 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13432 .channel_mode = alc268_modes,
13433 .input_mux = &alc268_capture_source,
13434 .setup = alc268_toshiba_setup,
13435 .init_hook = alc268_toshiba_automute,
13437 #ifdef CONFIG_SND_DEBUG
13439 .mixers = { alc268_test_mixer, alc268_capture_mixer },
13440 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13441 alc268_volume_init_verbs },
13442 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13443 .dac_nids = alc268_dac_nids,
13444 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13445 .adc_nids = alc268_adc_nids_alt,
13446 .capsrc_nids = alc268_capsrc_nids,
13448 .dig_out_nid = ALC268_DIGOUT_NID,
13449 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13450 .channel_mode = alc268_modes,
13451 .input_mux = &alc268_capture_source,
13456 static int patch_alc268(struct hda_codec *codec)
13458 struct alc_spec *spec;
13460 int i, has_beep, err;
13462 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13466 codec->spec = spec;
13468 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
13472 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
13473 board_config = snd_hda_check_board_codec_sid_config(codec,
13474 ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
13476 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
13477 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13479 board_config = ALC268_AUTO;
13482 if (board_config == ALC268_AUTO) {
13483 /* automatic parse from the BIOS config */
13484 err = alc268_parse_auto_config(codec);
13490 "hda_codec: Cannot set up configuration "
13491 "from BIOS. Using base mode...\n");
13492 board_config = ALC268_3ST;
13496 if (board_config != ALC268_AUTO)
13497 setup_preset(codec, &alc268_presets[board_config]);
13499 spec->stream_analog_playback = &alc268_pcm_analog_playback;
13500 spec->stream_analog_capture = &alc268_pcm_analog_capture;
13501 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
13503 spec->stream_digital_playback = &alc268_pcm_digital_playback;
13506 for (i = 0; i < spec->num_mixers; i++) {
13507 if (spec->mixers[i] == alc268_beep_mixer) {
13514 err = snd_hda_attach_beep_device(codec, 0x1);
13519 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
13520 /* override the amp caps for beep generator */
13521 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
13522 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
13523 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
13524 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
13525 (0 << AC_AMPCAP_MUTE_SHIFT));
13528 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
13529 /* check whether NID 0x07 is valid */
13530 unsigned int wcap = get_wcaps(codec, 0x07);
13533 spec->capsrc_nids = alc268_capsrc_nids;
13535 wcap = get_wcaps_type(wcap);
13536 if (spec->auto_mic ||
13537 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
13538 spec->adc_nids = alc268_adc_nids_alt;
13539 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
13540 if (spec->auto_mic)
13541 fixup_automic_adc(codec);
13542 if (spec->auto_mic || spec->input_mux->num_items == 1)
13543 add_mixer(spec, alc268_capture_nosrc_mixer);
13545 add_mixer(spec, alc268_capture_alt_mixer);
13547 spec->adc_nids = alc268_adc_nids;
13548 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
13549 add_mixer(spec, alc268_capture_mixer);
13551 /* set default input source */
13552 for (i = 0; i < spec->num_adc_nids; i++)
13553 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
13554 0, AC_VERB_SET_CONNECT_SEL,
13555 i < spec->num_mux_defs ?
13556 spec->input_mux[i].items[0].index :
13557 spec->input_mux->items[0].index);
13560 spec->vmaster_nid = 0x02;
13562 codec->patch_ops = alc_patch_ops;
13563 if (board_config == ALC268_AUTO)
13564 spec->init_hook = alc268_auto_init;
13570 * ALC269 channel source setting (2 channel)
13572 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
13574 #define alc269_dac_nids alc260_dac_nids
13576 static hda_nid_t alc269_adc_nids[1] = {
13581 static hda_nid_t alc269_capsrc_nids[1] = {
13585 static hda_nid_t alc269vb_adc_nids[1] = {
13590 static hda_nid_t alc269vb_capsrc_nids[1] = {
13594 static hda_nid_t alc269_adc_candidates[] = {
13598 #define alc269_modes alc260_modes
13599 #define alc269_capture_source alc880_lg_lw_capture_source
13601 static struct snd_kcontrol_new alc269_base_mixer[] = {
13602 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13603 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13604 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13605 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13606 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13607 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13608 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13609 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13610 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13611 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13612 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13613 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
13617 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
13618 /* output mixer control */
13619 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13621 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13622 .name = "Master Playback Switch",
13623 .subdevice = HDA_SUBDEV_AMP_FLAG,
13624 .info = snd_hda_mixer_amp_switch_info,
13625 .get = snd_hda_mixer_amp_switch_get,
13626 .put = alc268_acer_master_sw_put,
13627 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13629 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13630 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13631 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13632 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13633 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13634 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13638 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
13639 /* output mixer control */
13640 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13642 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13643 .name = "Master Playback Switch",
13644 .subdevice = HDA_SUBDEV_AMP_FLAG,
13645 .info = snd_hda_mixer_amp_switch_info,
13646 .get = snd_hda_mixer_amp_switch_get,
13647 .put = alc268_acer_master_sw_put,
13648 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13650 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13651 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13652 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13653 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13654 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13655 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13656 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
13657 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
13658 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
13662 static struct snd_kcontrol_new alc269_laptop_mixer[] = {
13663 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13664 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13665 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13666 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13670 static struct snd_kcontrol_new alc269vb_laptop_mixer[] = {
13671 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13672 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13673 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
13674 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13678 /* capture mixer elements */
13679 static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = {
13680 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13681 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13682 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13683 HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT),
13687 static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = {
13688 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13689 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13690 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13694 static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = {
13695 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13696 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13697 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13698 HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT),
13702 static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = {
13703 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13704 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13705 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13710 #define alc269_fujitsu_mixer alc269_laptop_mixer
13712 static struct hda_verb alc269_quanta_fl1_verbs[] = {
13713 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13714 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13715 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13716 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13717 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13718 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13722 static struct hda_verb alc269_lifebook_verbs[] = {
13723 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13724 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
13725 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13726 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13727 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13728 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13729 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13730 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13731 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13732 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13736 /* toggle speaker-output according to the hp-jack state */
13737 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
13739 unsigned int present;
13740 unsigned char bits;
13742 present = snd_hda_jack_detect(codec, 0x15);
13743 bits = present ? HDA_AMP_MUTE : 0;
13744 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13745 HDA_AMP_MUTE, bits);
13746 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13747 HDA_AMP_MUTE, bits);
13749 snd_hda_codec_write(codec, 0x20, 0,
13750 AC_VERB_SET_COEF_INDEX, 0x0c);
13751 snd_hda_codec_write(codec, 0x20, 0,
13752 AC_VERB_SET_PROC_COEF, 0x680);
13754 snd_hda_codec_write(codec, 0x20, 0,
13755 AC_VERB_SET_COEF_INDEX, 0x0c);
13756 snd_hda_codec_write(codec, 0x20, 0,
13757 AC_VERB_SET_PROC_COEF, 0x480);
13760 /* toggle speaker-output according to the hp-jacks state */
13761 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
13763 unsigned int present;
13764 unsigned char bits;
13766 /* Check laptop headphone socket */
13767 present = snd_hda_jack_detect(codec, 0x15);
13769 /* Check port replicator headphone socket */
13770 present |= snd_hda_jack_detect(codec, 0x1a);
13772 bits = present ? HDA_AMP_MUTE : 0;
13773 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13774 HDA_AMP_MUTE, bits);
13775 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13776 HDA_AMP_MUTE, bits);
13778 snd_hda_codec_write(codec, 0x20, 0,
13779 AC_VERB_SET_COEF_INDEX, 0x0c);
13780 snd_hda_codec_write(codec, 0x20, 0,
13781 AC_VERB_SET_PROC_COEF, 0x680);
13783 snd_hda_codec_write(codec, 0x20, 0,
13784 AC_VERB_SET_COEF_INDEX, 0x0c);
13785 snd_hda_codec_write(codec, 0x20, 0,
13786 AC_VERB_SET_PROC_COEF, 0x480);
13789 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
13791 unsigned int present_laptop;
13792 unsigned int present_dock;
13794 present_laptop = snd_hda_jack_detect(codec, 0x18);
13795 present_dock = snd_hda_jack_detect(codec, 0x1b);
13797 /* Laptop mic port overrides dock mic port, design decision */
13799 snd_hda_codec_write(codec, 0x23, 0,
13800 AC_VERB_SET_CONNECT_SEL, 0x3);
13801 if (present_laptop)
13802 snd_hda_codec_write(codec, 0x23, 0,
13803 AC_VERB_SET_CONNECT_SEL, 0x0);
13804 if (!present_dock && !present_laptop)
13805 snd_hda_codec_write(codec, 0x23, 0,
13806 AC_VERB_SET_CONNECT_SEL, 0x1);
13809 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
13812 switch (res >> 26) {
13813 case ALC880_HP_EVENT:
13814 alc269_quanta_fl1_speaker_automute(codec);
13816 case ALC880_MIC_EVENT:
13817 alc_mic_automute(codec);
13822 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
13825 if ((res >> 26) == ALC880_HP_EVENT)
13826 alc269_lifebook_speaker_automute(codec);
13827 if ((res >> 26) == ALC880_MIC_EVENT)
13828 alc269_lifebook_mic_autoswitch(codec);
13831 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
13833 struct alc_spec *spec = codec->spec;
13834 spec->autocfg.hp_pins[0] = 0x15;
13835 spec->autocfg.speaker_pins[0] = 0x14;
13836 spec->ext_mic.pin = 0x18;
13837 spec->ext_mic.mux_idx = 0;
13838 spec->int_mic.pin = 0x19;
13839 spec->int_mic.mux_idx = 1;
13840 spec->auto_mic = 1;
13843 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
13845 alc269_quanta_fl1_speaker_automute(codec);
13846 alc_mic_automute(codec);
13849 static void alc269_lifebook_init_hook(struct hda_codec *codec)
13851 alc269_lifebook_speaker_automute(codec);
13852 alc269_lifebook_mic_autoswitch(codec);
13855 static struct hda_verb alc269_laptop_dmic_init_verbs[] = {
13856 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13857 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
13858 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13859 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13860 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13861 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13862 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13866 static struct hda_verb alc269_laptop_amic_init_verbs[] = {
13867 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13868 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
13869 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13870 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
13871 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13872 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13876 static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = {
13877 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
13878 {0x22, AC_VERB_SET_CONNECT_SEL, 0x06},
13879 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13880 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13881 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13882 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13883 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13887 static struct hda_verb alc269vb_laptop_amic_init_verbs[] = {
13888 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
13889 {0x22, AC_VERB_SET_CONNECT_SEL, 0x01},
13890 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13891 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13892 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13893 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13894 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13898 /* toggle speaker-output according to the hp-jack state */
13899 static void alc269_speaker_automute(struct hda_codec *codec)
13901 struct alc_spec *spec = codec->spec;
13902 unsigned int nid = spec->autocfg.hp_pins[0];
13903 unsigned int present;
13904 unsigned char bits;
13906 present = snd_hda_jack_detect(codec, nid);
13907 bits = present ? HDA_AMP_MUTE : 0;
13908 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13909 HDA_AMP_MUTE, bits);
13910 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13911 HDA_AMP_MUTE, bits);
13914 /* unsolicited event for HP jack sensing */
13915 static void alc269_laptop_unsol_event(struct hda_codec *codec,
13918 switch (res >> 26) {
13919 case ALC880_HP_EVENT:
13920 alc269_speaker_automute(codec);
13922 case ALC880_MIC_EVENT:
13923 alc_mic_automute(codec);
13928 static void alc269_laptop_amic_setup(struct hda_codec *codec)
13930 struct alc_spec *spec = codec->spec;
13931 spec->autocfg.hp_pins[0] = 0x15;
13932 spec->autocfg.speaker_pins[0] = 0x14;
13933 spec->ext_mic.pin = 0x18;
13934 spec->ext_mic.mux_idx = 0;
13935 spec->int_mic.pin = 0x19;
13936 spec->int_mic.mux_idx = 1;
13937 spec->auto_mic = 1;
13940 static void alc269_laptop_dmic_setup(struct hda_codec *codec)
13942 struct alc_spec *spec = codec->spec;
13943 spec->autocfg.hp_pins[0] = 0x15;
13944 spec->autocfg.speaker_pins[0] = 0x14;
13945 spec->ext_mic.pin = 0x18;
13946 spec->ext_mic.mux_idx = 0;
13947 spec->int_mic.pin = 0x12;
13948 spec->int_mic.mux_idx = 5;
13949 spec->auto_mic = 1;
13952 static void alc269vb_laptop_amic_setup(struct hda_codec *codec)
13954 struct alc_spec *spec = codec->spec;
13955 spec->autocfg.hp_pins[0] = 0x21;
13956 spec->autocfg.speaker_pins[0] = 0x14;
13957 spec->ext_mic.pin = 0x18;
13958 spec->ext_mic.mux_idx = 0;
13959 spec->int_mic.pin = 0x19;
13960 spec->int_mic.mux_idx = 1;
13961 spec->auto_mic = 1;
13964 static void alc269vb_laptop_dmic_setup(struct hda_codec *codec)
13966 struct alc_spec *spec = codec->spec;
13967 spec->autocfg.hp_pins[0] = 0x21;
13968 spec->autocfg.speaker_pins[0] = 0x14;
13969 spec->ext_mic.pin = 0x18;
13970 spec->ext_mic.mux_idx = 0;
13971 spec->int_mic.pin = 0x12;
13972 spec->int_mic.mux_idx = 6;
13973 spec->auto_mic = 1;
13976 static void alc269_laptop_inithook(struct hda_codec *codec)
13978 alc269_speaker_automute(codec);
13979 alc_mic_automute(codec);
13983 * generic initialization of ADC, input mixers and output mixers
13985 static struct hda_verb alc269_init_verbs[] = {
13987 * Unmute ADC0 and set the default input to mic-in
13989 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13992 * Set up output mixers (0x02 - 0x03)
13994 /* set vol=0 to output mixers */
13995 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13996 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13998 /* set up input amps for analog loopback */
13999 /* Amp Indices: DAC = 0, mixer = 1 */
14000 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14001 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14002 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14003 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14004 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14005 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14007 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14008 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14009 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14010 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14011 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14012 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14013 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14015 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14016 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14018 /* FIXME: use Mux-type input source selection */
14019 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14020 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14021 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
14024 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14028 static struct hda_verb alc269vb_init_verbs[] = {
14030 * Unmute ADC0 and set the default input to mic-in
14032 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14035 * Set up output mixers (0x02 - 0x03)
14037 /* set vol=0 to output mixers */
14038 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14039 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14041 /* set up input amps for analog loopback */
14042 /* Amp Indices: DAC = 0, mixer = 1 */
14043 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14044 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14045 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14046 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14047 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14048 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14050 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14051 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14052 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14053 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14054 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14055 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14056 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14058 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14059 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14061 /* FIXME: use Mux-type input source selection */
14062 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14063 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14064 {0x22, AC_VERB_SET_CONNECT_SEL, 0x00},
14067 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14071 #define alc269_auto_create_multi_out_ctls \
14072 alc268_auto_create_multi_out_ctls
14073 #define alc269_auto_create_input_ctls \
14074 alc268_auto_create_input_ctls
14076 #ifdef CONFIG_SND_HDA_POWER_SAVE
14077 #define alc269_loopbacks alc880_loopbacks
14080 /* pcm configuration: identical with ALC880 */
14081 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
14082 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
14083 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
14084 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
14086 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
14090 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14091 /* NID is set in alc_build_pcms */
14093 .open = alc880_playback_pcm_open,
14094 .prepare = alc880_playback_pcm_prepare,
14095 .cleanup = alc880_playback_pcm_cleanup
14099 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
14103 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14104 /* NID is set in alc_build_pcms */
14107 #ifdef CONFIG_SND_HDA_POWER_SAVE
14108 static int alc269_mic2_for_mute_led(struct hda_codec *codec)
14110 switch (codec->subsystem_id) {
14117 static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid)
14119 /* update mute-LED according to the speaker mute state */
14120 if (nid == 0x01 || nid == 0x14) {
14122 if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) &
14127 /* mic2 vref pin is used for mute LED control */
14128 snd_hda_codec_update_cache(codec, 0x19, 0,
14129 AC_VERB_SET_PIN_WIDGET_CONTROL,
14132 return alc_check_power_status(codec, nid);
14134 #endif /* CONFIG_SND_HDA_POWER_SAVE */
14137 * BIOS auto configuration
14139 static int alc269_parse_auto_config(struct hda_codec *codec)
14141 struct alc_spec *spec = codec->spec;
14143 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
14145 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14150 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
14153 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
14157 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14159 if (spec->autocfg.dig_outs)
14160 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
14162 if (spec->kctls.list)
14163 add_mixer(spec, spec->kctls.list);
14165 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010) {
14166 add_verb(spec, alc269vb_init_verbs);
14167 alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21);
14169 add_verb(spec, alc269_init_verbs);
14170 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
14173 spec->num_mux_defs = 1;
14174 spec->input_mux = &spec->private_imux[0];
14175 fillup_priv_adc_nids(codec, alc269_adc_candidates,
14176 sizeof(alc269_adc_candidates));
14178 /* set default input source */
14179 snd_hda_codec_write_cache(codec, spec->capsrc_nids[0],
14180 0, AC_VERB_SET_CONNECT_SEL,
14181 spec->input_mux->items[0].index);
14183 err = alc_auto_add_mic_boost(codec);
14187 if (!spec->cap_mixer && !spec->no_analog)
14188 set_capture_mixer(codec);
14193 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
14194 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
14195 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
14198 /* init callback for auto-configuration model -- overriding the default init */
14199 static void alc269_auto_init(struct hda_codec *codec)
14201 struct alc_spec *spec = codec->spec;
14202 alc269_auto_init_multi_out(codec);
14203 alc269_auto_init_hp_out(codec);
14204 alc269_auto_init_analog_input(codec);
14205 if (spec->unsol_event)
14206 alc_inithook(codec);
14210 ALC269_FIXUP_SONY_VAIO,
14213 const static struct hda_verb alc269_sony_vaio_fixup_verbs[] = {
14214 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD},
14218 static const struct alc_fixup alc269_fixups[] = {
14219 [ALC269_FIXUP_SONY_VAIO] = {
14220 .verbs = alc269_sony_vaio_fixup_verbs
14224 static struct snd_pci_quirk alc269_fixup_tbl[] = {
14225 SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
14231 * configuration and preset
14233 static const char *alc269_models[ALC269_MODEL_LAST] = {
14234 [ALC269_BASIC] = "basic",
14235 [ALC269_QUANTA_FL1] = "quanta",
14236 [ALC269_AMIC] = "laptop-amic",
14237 [ALC269_DMIC] = "laptop-dmic",
14238 [ALC269_FUJITSU] = "fujitsu",
14239 [ALC269_LIFEBOOK] = "lifebook",
14240 [ALC269_AUTO] = "auto",
14243 static struct snd_pci_quirk alc269_cfg_tbl[] = {
14244 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
14245 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
14247 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC),
14248 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC),
14249 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC),
14250 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC),
14251 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC),
14252 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC),
14253 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC),
14254 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC),
14255 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC),
14256 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC),
14257 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC),
14258 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC),
14259 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC),
14260 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC),
14261 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC),
14262 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC),
14263 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC),
14264 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC),
14265 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC),
14266 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC),
14267 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC),
14268 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC),
14269 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC),
14270 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC),
14271 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC),
14272 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC),
14273 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC),
14274 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC),
14275 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC),
14276 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC),
14277 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC),
14278 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC),
14279 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC),
14280 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC),
14281 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC),
14282 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC),
14283 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
14285 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
14287 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC),
14288 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC),
14289 SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO),
14290 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
14291 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC),
14292 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
14293 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC),
14294 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC),
14295 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC),
14296 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC),
14300 static struct alc_config_preset alc269_presets[] = {
14302 .mixers = { alc269_base_mixer },
14303 .init_verbs = { alc269_init_verbs },
14304 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14305 .dac_nids = alc269_dac_nids,
14307 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14308 .channel_mode = alc269_modes,
14309 .input_mux = &alc269_capture_source,
14311 [ALC269_QUANTA_FL1] = {
14312 .mixers = { alc269_quanta_fl1_mixer },
14313 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
14314 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14315 .dac_nids = alc269_dac_nids,
14317 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14318 .channel_mode = alc269_modes,
14319 .input_mux = &alc269_capture_source,
14320 .unsol_event = alc269_quanta_fl1_unsol_event,
14321 .setup = alc269_quanta_fl1_setup,
14322 .init_hook = alc269_quanta_fl1_init_hook,
14325 .mixers = { alc269_laptop_mixer },
14326 .cap_mixer = alc269_laptop_analog_capture_mixer,
14327 .init_verbs = { alc269_init_verbs,
14328 alc269_laptop_amic_init_verbs },
14329 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14330 .dac_nids = alc269_dac_nids,
14332 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14333 .channel_mode = alc269_modes,
14334 .unsol_event = alc269_laptop_unsol_event,
14335 .setup = alc269_laptop_amic_setup,
14336 .init_hook = alc269_laptop_inithook,
14339 .mixers = { alc269_laptop_mixer },
14340 .cap_mixer = alc269_laptop_digital_capture_mixer,
14341 .init_verbs = { alc269_init_verbs,
14342 alc269_laptop_dmic_init_verbs },
14343 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14344 .dac_nids = alc269_dac_nids,
14346 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14347 .channel_mode = alc269_modes,
14348 .unsol_event = alc269_laptop_unsol_event,
14349 .setup = alc269_laptop_dmic_setup,
14350 .init_hook = alc269_laptop_inithook,
14352 [ALC269VB_AMIC] = {
14353 .mixers = { alc269vb_laptop_mixer },
14354 .cap_mixer = alc269vb_laptop_analog_capture_mixer,
14355 .init_verbs = { alc269vb_init_verbs,
14356 alc269vb_laptop_amic_init_verbs },
14357 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14358 .dac_nids = alc269_dac_nids,
14360 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14361 .channel_mode = alc269_modes,
14362 .unsol_event = alc269_laptop_unsol_event,
14363 .setup = alc269vb_laptop_amic_setup,
14364 .init_hook = alc269_laptop_inithook,
14366 [ALC269VB_DMIC] = {
14367 .mixers = { alc269vb_laptop_mixer },
14368 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
14369 .init_verbs = { alc269vb_init_verbs,
14370 alc269vb_laptop_dmic_init_verbs },
14371 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14372 .dac_nids = alc269_dac_nids,
14374 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14375 .channel_mode = alc269_modes,
14376 .unsol_event = alc269_laptop_unsol_event,
14377 .setup = alc269vb_laptop_dmic_setup,
14378 .init_hook = alc269_laptop_inithook,
14380 [ALC269_FUJITSU] = {
14381 .mixers = { alc269_fujitsu_mixer },
14382 .cap_mixer = alc269_laptop_digital_capture_mixer,
14383 .init_verbs = { alc269_init_verbs,
14384 alc269_laptop_dmic_init_verbs },
14385 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14386 .dac_nids = alc269_dac_nids,
14388 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14389 .channel_mode = alc269_modes,
14390 .unsol_event = alc269_laptop_unsol_event,
14391 .setup = alc269_laptop_dmic_setup,
14392 .init_hook = alc269_laptop_inithook,
14394 [ALC269_LIFEBOOK] = {
14395 .mixers = { alc269_lifebook_mixer },
14396 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
14397 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14398 .dac_nids = alc269_dac_nids,
14400 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14401 .channel_mode = alc269_modes,
14402 .input_mux = &alc269_capture_source,
14403 .unsol_event = alc269_lifebook_unsol_event,
14404 .init_hook = alc269_lifebook_init_hook,
14408 static int patch_alc269(struct hda_codec *codec)
14410 struct alc_spec *spec;
14413 int is_alc269vb = 0;
14415 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14419 codec->spec = spec;
14421 alc_auto_parse_customize_define(codec);
14423 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){
14424 if (codec->bus->pci->subsystem_vendor == 0x1025 &&
14425 spec->cdefine.platform_type == 1)
14426 alc_codec_rename(codec, "ALC271X");
14428 alc_codec_rename(codec, "ALC259");
14431 alc_fix_pll_init(codec, 0x20, 0x04, 15);
14433 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
14437 if (board_config < 0) {
14438 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14440 board_config = ALC269_AUTO;
14443 if (board_config == ALC269_AUTO)
14444 alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 1);
14446 if (board_config == ALC269_AUTO) {
14447 /* automatic parse from the BIOS config */
14448 err = alc269_parse_auto_config(codec);
14454 "hda_codec: Cannot set up configuration "
14455 "from BIOS. Using base mode...\n");
14456 board_config = ALC269_BASIC;
14460 err = snd_hda_attach_beep_device(codec, 0x1);
14466 if (board_config != ALC269_AUTO)
14467 setup_preset(codec, &alc269_presets[board_config]);
14469 if (board_config == ALC269_QUANTA_FL1) {
14470 /* Due to a hardware problem on Lenovo Ideadpad, we need to
14471 * fix the sample rate of analog I/O to 44.1kHz
14473 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
14474 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
14476 spec->stream_analog_playback = &alc269_pcm_analog_playback;
14477 spec->stream_analog_capture = &alc269_pcm_analog_capture;
14479 spec->stream_digital_playback = &alc269_pcm_digital_playback;
14480 spec->stream_digital_capture = &alc269_pcm_digital_capture;
14482 if (!spec->adc_nids) { /* wasn't filled automatically? use default */
14483 if (!is_alc269vb) {
14484 spec->adc_nids = alc269_adc_nids;
14485 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
14486 spec->capsrc_nids = alc269_capsrc_nids;
14488 spec->adc_nids = alc269vb_adc_nids;
14489 spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids);
14490 spec->capsrc_nids = alc269vb_capsrc_nids;
14494 if (!spec->cap_mixer)
14495 set_capture_mixer(codec);
14496 if (spec->cdefine.enable_pcbeep)
14497 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
14499 if (board_config == ALC269_AUTO)
14500 alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 0);
14502 spec->vmaster_nid = 0x02;
14504 codec->patch_ops = alc_patch_ops;
14505 if (board_config == ALC269_AUTO)
14506 spec->init_hook = alc269_auto_init;
14507 #ifdef CONFIG_SND_HDA_POWER_SAVE
14508 if (!spec->loopback.amplist)
14509 spec->loopback.amplist = alc269_loopbacks;
14510 if (alc269_mic2_for_mute_led(codec))
14511 codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps;
14518 * ALC861 channel source setting (2/6 channel selection for 3-stack)
14522 * set the path ways for 2 channel output
14523 * need to set the codec line out and mic 1 pin widgets to inputs
14525 static struct hda_verb alc861_threestack_ch2_init[] = {
14526 /* set pin widget 1Ah (line in) for input */
14527 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14528 /* set pin widget 18h (mic1/2) for input, for mic also enable
14531 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14533 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
14535 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14536 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
14542 * need to set the codec line out and mic 1 pin widgets to outputs
14544 static struct hda_verb alc861_threestack_ch6_init[] = {
14545 /* set pin widget 1Ah (line in) for output (Back Surround)*/
14546 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14547 /* set pin widget 18h (mic1) for output (CLFE)*/
14548 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14550 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
14551 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
14553 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
14555 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14556 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
14561 static struct hda_channel_mode alc861_threestack_modes[2] = {
14562 { 2, alc861_threestack_ch2_init },
14563 { 6, alc861_threestack_ch6_init },
14565 /* Set mic1 as input and unmute the mixer */
14566 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
14567 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14568 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14571 /* Set mic1 as output and mute mixer */
14572 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
14573 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14574 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14578 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
14579 { 2, alc861_uniwill_m31_ch2_init },
14580 { 4, alc861_uniwill_m31_ch4_init },
14583 /* Set mic1 and line-in as input and unmute the mixer */
14584 static struct hda_verb alc861_asus_ch2_init[] = {
14585 /* set pin widget 1Ah (line in) for input */
14586 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14587 /* set pin widget 18h (mic1/2) for input, for mic also enable
14590 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14592 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
14594 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14595 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
14599 /* Set mic1 nad line-in as output and mute mixer */
14600 static struct hda_verb alc861_asus_ch6_init[] = {
14601 /* set pin widget 1Ah (line in) for output (Back Surround)*/
14602 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14603 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
14604 /* set pin widget 18h (mic1) for output (CLFE)*/
14605 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14606 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
14607 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
14608 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
14610 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
14612 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14613 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
14618 static struct hda_channel_mode alc861_asus_modes[2] = {
14619 { 2, alc861_asus_ch2_init },
14620 { 6, alc861_asus_ch6_init },
14625 static struct snd_kcontrol_new alc861_base_mixer[] = {
14626 /* output mixer control */
14627 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14628 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14629 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14630 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14631 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
14633 /*Input mixer control */
14634 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14635 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14636 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14637 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14638 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14639 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14640 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14641 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14642 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14643 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14648 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
14649 /* output mixer control */
14650 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14651 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14652 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14653 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14654 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
14656 /* Input mixer control */
14657 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14658 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14659 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14660 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14661 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14662 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14663 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14664 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14665 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14666 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14669 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14670 .name = "Channel Mode",
14671 .info = alc_ch_mode_info,
14672 .get = alc_ch_mode_get,
14673 .put = alc_ch_mode_put,
14674 .private_value = ARRAY_SIZE(alc861_threestack_modes),
14679 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
14680 /* output mixer control */
14681 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14682 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14683 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14688 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
14689 /* output mixer control */
14690 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14691 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14692 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14693 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14694 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
14696 /* Input mixer control */
14697 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14698 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14699 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14700 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14701 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14702 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14703 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14704 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14705 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14706 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14709 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14710 .name = "Channel Mode",
14711 .info = alc_ch_mode_info,
14712 .get = alc_ch_mode_get,
14713 .put = alc_ch_mode_put,
14714 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
14719 static struct snd_kcontrol_new alc861_asus_mixer[] = {
14720 /* output mixer control */
14721 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14722 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14723 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14724 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14725 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
14727 /* Input mixer control */
14728 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14729 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14730 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14731 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14732 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14733 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14734 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14735 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14736 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14737 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
14740 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14741 .name = "Channel Mode",
14742 .info = alc_ch_mode_info,
14743 .get = alc_ch_mode_get,
14744 .put = alc_ch_mode_put,
14745 .private_value = ARRAY_SIZE(alc861_asus_modes),
14750 /* additional mixer */
14751 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
14752 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14753 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14758 * generic initialization of ADC, input mixers and output mixers
14760 static struct hda_verb alc861_base_init_verbs[] = {
14762 * Unmute ADC0 and set the default input to mic-in
14764 /* port-A for surround (rear panel) */
14765 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14766 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
14767 /* port-B for mic-in (rear panel) with vref */
14768 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14769 /* port-C for line-in (rear panel) */
14770 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14771 /* port-D for Front */
14772 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14773 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14774 /* port-E for HP out (front panel) */
14775 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14776 /* route front PCM to HP */
14777 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14778 /* port-F for mic-in (front panel) with vref */
14779 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14780 /* port-G for CLFE (rear panel) */
14781 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14782 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14783 /* port-H for side (rear panel) */
14784 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14785 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
14787 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14788 /* route front mic to ADC1*/
14789 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14790 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14792 /* Unmute DAC0~3 & spdif out*/
14793 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14794 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14795 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14796 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14797 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14799 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14800 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14801 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14802 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14803 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14805 /* Unmute Stereo Mixer 15 */
14806 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14807 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14808 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14809 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14811 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14812 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14813 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14814 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14815 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14816 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14817 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14818 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14819 /* hp used DAC 3 (Front) */
14820 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14821 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14826 static struct hda_verb alc861_threestack_init_verbs[] = {
14828 * Unmute ADC0 and set the default input to mic-in
14830 /* port-A for surround (rear panel) */
14831 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14832 /* port-B for mic-in (rear panel) with vref */
14833 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14834 /* port-C for line-in (rear panel) */
14835 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14836 /* port-D for Front */
14837 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14838 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14839 /* port-E for HP out (front panel) */
14840 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14841 /* route front PCM to HP */
14842 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14843 /* port-F for mic-in (front panel) with vref */
14844 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14845 /* port-G for CLFE (rear panel) */
14846 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14847 /* port-H for side (rear panel) */
14848 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14850 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14851 /* route front mic to ADC1*/
14852 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14853 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14854 /* Unmute DAC0~3 & spdif out*/
14855 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14856 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14857 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14858 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14859 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14861 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14862 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14863 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14864 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14865 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14867 /* Unmute Stereo Mixer 15 */
14868 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14869 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14870 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14871 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14873 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14874 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14875 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14876 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14877 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14878 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14879 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14880 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14881 /* hp used DAC 3 (Front) */
14882 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14883 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14887 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
14889 * Unmute ADC0 and set the default input to mic-in
14891 /* port-A for surround (rear panel) */
14892 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14893 /* port-B for mic-in (rear panel) with vref */
14894 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14895 /* port-C for line-in (rear panel) */
14896 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14897 /* port-D for Front */
14898 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14899 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14900 /* port-E for HP out (front panel) */
14901 /* this has to be set to VREF80 */
14902 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14903 /* route front PCM to HP */
14904 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14905 /* port-F for mic-in (front panel) with vref */
14906 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14907 /* port-G for CLFE (rear panel) */
14908 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14909 /* port-H for side (rear panel) */
14910 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14912 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14913 /* route front mic to ADC1*/
14914 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14915 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14916 /* Unmute DAC0~3 & spdif out*/
14917 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14918 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14919 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14920 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14921 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14923 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14924 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14925 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14926 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14927 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14929 /* Unmute Stereo Mixer 15 */
14930 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14931 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14932 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14933 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14935 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14936 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14937 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14938 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14939 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14940 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14941 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14942 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14943 /* hp used DAC 3 (Front) */
14944 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14945 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14949 static struct hda_verb alc861_asus_init_verbs[] = {
14951 * Unmute ADC0 and set the default input to mic-in
14953 /* port-A for surround (rear panel)
14954 * according to codec#0 this is the HP jack
14956 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
14957 /* route front PCM to HP */
14958 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
14959 /* port-B for mic-in (rear panel) with vref */
14960 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14961 /* port-C for line-in (rear panel) */
14962 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14963 /* port-D for Front */
14964 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14965 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14966 /* port-E for HP out (front panel) */
14967 /* this has to be set to VREF80 */
14968 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14969 /* route front PCM to HP */
14970 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14971 /* port-F for mic-in (front panel) with vref */
14972 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14973 /* port-G for CLFE (rear panel) */
14974 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14975 /* port-H for side (rear panel) */
14976 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14978 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14979 /* route front mic to ADC1*/
14980 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14981 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14982 /* Unmute DAC0~3 & spdif out*/
14983 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14984 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14985 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14986 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14987 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14988 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14989 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14990 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14991 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14992 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14994 /* Unmute Stereo Mixer 15 */
14995 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14996 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14997 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14998 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15000 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15001 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15002 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15003 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15004 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15005 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15006 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15007 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15008 /* hp used DAC 3 (Front) */
15009 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15010 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15014 /* additional init verbs for ASUS laptops */
15015 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
15016 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
15017 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
15022 * generic initialization of ADC, input mixers and output mixers
15024 static struct hda_verb alc861_auto_init_verbs[] = {
15026 * Unmute ADC0 and set the default input to mic-in
15028 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
15029 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15031 /* Unmute DAC0~3 & spdif out*/
15032 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15033 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15034 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15035 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15036 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15038 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15039 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15040 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15041 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15042 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15044 /* Unmute Stereo Mixer 15 */
15045 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15046 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15047 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15048 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
15050 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15051 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15052 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15053 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15054 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15055 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15056 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15057 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15059 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15060 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15061 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15062 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15063 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15064 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15065 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15066 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15068 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
15073 static struct hda_verb alc861_toshiba_init_verbs[] = {
15074 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15079 /* toggle speaker-output according to the hp-jack state */
15080 static void alc861_toshiba_automute(struct hda_codec *codec)
15082 unsigned int present = snd_hda_jack_detect(codec, 0x0f);
15084 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
15085 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
15086 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
15087 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
15090 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
15093 if ((res >> 26) == ALC880_HP_EVENT)
15094 alc861_toshiba_automute(codec);
15097 /* pcm configuration: identical with ALC880 */
15098 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
15099 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
15100 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
15101 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
15104 #define ALC861_DIGOUT_NID 0x07
15106 static struct hda_channel_mode alc861_8ch_modes[1] = {
15110 static hda_nid_t alc861_dac_nids[4] = {
15111 /* front, surround, clfe, side */
15112 0x03, 0x06, 0x05, 0x04
15115 static hda_nid_t alc660_dac_nids[3] = {
15116 /* front, clfe, surround */
15120 static hda_nid_t alc861_adc_nids[1] = {
15125 static struct hda_input_mux alc861_capture_source = {
15129 { "Front Mic", 0x3 },
15136 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
15138 struct alc_spec *spec = codec->spec;
15139 hda_nid_t mix, srcs[5];
15142 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
15144 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
15147 for (i = 0; i < num; i++) {
15149 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
15150 if (type != AC_WID_AUD_OUT)
15152 for (j = 0; j < spec->multiout.num_dacs; j++)
15153 if (spec->multiout.dac_nids[j] == srcs[i])
15155 if (j >= spec->multiout.num_dacs)
15161 /* fill in the dac_nids table from the parsed pin configuration */
15162 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
15163 const struct auto_pin_cfg *cfg)
15165 struct alc_spec *spec = codec->spec;
15167 hda_nid_t nid, dac;
15169 spec->multiout.dac_nids = spec->private_dac_nids;
15170 for (i = 0; i < cfg->line_outs; i++) {
15171 nid = cfg->line_out_pins[i];
15172 dac = alc861_look_for_dac(codec, nid);
15175 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
15180 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
15181 hda_nid_t nid, unsigned int chs)
15183 return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx,
15184 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
15187 /* add playback controls from the parsed DAC table */
15188 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
15189 const struct auto_pin_cfg *cfg)
15191 struct alc_spec *spec = codec->spec;
15192 static const char *chname[4] = {
15193 "Front", "Surround", NULL /*CLFE*/, "Side"
15198 if (cfg->line_outs == 1) {
15199 const char *pfx = NULL;
15202 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
15205 nid = spec->multiout.dac_nids[0];
15206 return alc861_create_out_sw(codec, pfx, nid, 3);
15210 for (i = 0; i < cfg->line_outs; i++) {
15211 nid = spec->multiout.dac_nids[i];
15216 err = alc861_create_out_sw(codec, "Center", nid, 1);
15219 err = alc861_create_out_sw(codec, "LFE", nid, 2);
15223 err = alc861_create_out_sw(codec, chname[i], nid, 3);
15231 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
15233 struct alc_spec *spec = codec->spec;
15240 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
15241 nid = alc861_look_for_dac(codec, pin);
15243 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
15246 spec->multiout.hp_nid = nid;
15252 /* create playback/capture controls for input pins */
15253 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
15254 const struct auto_pin_cfg *cfg)
15256 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
15259 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
15261 int pin_type, hda_nid_t dac)
15263 hda_nid_t mix, srcs[5];
15266 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
15268 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15270 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
15272 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
15275 for (i = 0; i < num; i++) {
15277 if (srcs[i] == dac || srcs[i] == 0x15)
15278 mute = AMP_IN_UNMUTE(i);
15280 mute = AMP_IN_MUTE(i);
15281 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15286 static void alc861_auto_init_multi_out(struct hda_codec *codec)
15288 struct alc_spec *spec = codec->spec;
15291 for (i = 0; i < spec->autocfg.line_outs; i++) {
15292 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15293 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15295 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
15296 spec->multiout.dac_nids[i]);
15300 static void alc861_auto_init_hp_out(struct hda_codec *codec)
15302 struct alc_spec *spec = codec->spec;
15304 if (spec->autocfg.hp_outs)
15305 alc861_auto_set_output_and_unmute(codec,
15306 spec->autocfg.hp_pins[0],
15308 spec->multiout.hp_nid);
15309 if (spec->autocfg.speaker_outs)
15310 alc861_auto_set_output_and_unmute(codec,
15311 spec->autocfg.speaker_pins[0],
15313 spec->multiout.dac_nids[0]);
15316 static void alc861_auto_init_analog_input(struct hda_codec *codec)
15318 struct alc_spec *spec = codec->spec;
15321 for (i = 0; i < AUTO_PIN_LAST; i++) {
15322 hda_nid_t nid = spec->autocfg.input_pins[i];
15323 if (nid >= 0x0c && nid <= 0x11)
15324 alc_set_input_pin(codec, nid, i);
15328 /* parse the BIOS configuration and set up the alc_spec */
15329 /* return 1 if successful, 0 if the proper config is not found,
15330 * or a negative error code
15332 static int alc861_parse_auto_config(struct hda_codec *codec)
15334 struct alc_spec *spec = codec->spec;
15336 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
15338 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15342 if (!spec->autocfg.line_outs)
15343 return 0; /* can't find valid BIOS pin config */
15345 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
15348 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
15351 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
15354 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
15358 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15360 if (spec->autocfg.dig_outs)
15361 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
15363 if (spec->kctls.list)
15364 add_mixer(spec, spec->kctls.list);
15366 add_verb(spec, alc861_auto_init_verbs);
15368 spec->num_mux_defs = 1;
15369 spec->input_mux = &spec->private_imux[0];
15371 spec->adc_nids = alc861_adc_nids;
15372 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
15373 set_capture_mixer(codec);
15375 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0);
15380 /* additional initialization for auto-configuration model */
15381 static void alc861_auto_init(struct hda_codec *codec)
15383 struct alc_spec *spec = codec->spec;
15384 alc861_auto_init_multi_out(codec);
15385 alc861_auto_init_hp_out(codec);
15386 alc861_auto_init_analog_input(codec);
15387 if (spec->unsol_event)
15388 alc_inithook(codec);
15391 #ifdef CONFIG_SND_HDA_POWER_SAVE
15392 static struct hda_amp_list alc861_loopbacks[] = {
15393 { 0x15, HDA_INPUT, 0 },
15394 { 0x15, HDA_INPUT, 1 },
15395 { 0x15, HDA_INPUT, 2 },
15396 { 0x15, HDA_INPUT, 3 },
15403 * configuration and preset
15405 static const char *alc861_models[ALC861_MODEL_LAST] = {
15406 [ALC861_3ST] = "3stack",
15407 [ALC660_3ST] = "3stack-660",
15408 [ALC861_3ST_DIG] = "3stack-dig",
15409 [ALC861_6ST_DIG] = "6stack-dig",
15410 [ALC861_UNIWILL_M31] = "uniwill-m31",
15411 [ALC861_TOSHIBA] = "toshiba",
15412 [ALC861_ASUS] = "asus",
15413 [ALC861_ASUS_LAPTOP] = "asus-laptop",
15414 [ALC861_AUTO] = "auto",
15417 static struct snd_pci_quirk alc861_cfg_tbl[] = {
15418 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
15419 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
15420 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
15421 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
15422 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
15423 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
15424 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
15425 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
15426 * Any other models that need this preset?
15428 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
15429 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
15430 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
15431 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
15432 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
15433 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
15434 /* FIXME: the below seems conflict */
15435 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
15436 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
15437 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
15441 static struct alc_config_preset alc861_presets[] = {
15443 .mixers = { alc861_3ST_mixer },
15444 .init_verbs = { alc861_threestack_init_verbs },
15445 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15446 .dac_nids = alc861_dac_nids,
15447 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15448 .channel_mode = alc861_threestack_modes,
15450 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15451 .adc_nids = alc861_adc_nids,
15452 .input_mux = &alc861_capture_source,
15454 [ALC861_3ST_DIG] = {
15455 .mixers = { alc861_base_mixer },
15456 .init_verbs = { alc861_threestack_init_verbs },
15457 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15458 .dac_nids = alc861_dac_nids,
15459 .dig_out_nid = ALC861_DIGOUT_NID,
15460 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15461 .channel_mode = alc861_threestack_modes,
15463 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15464 .adc_nids = alc861_adc_nids,
15465 .input_mux = &alc861_capture_source,
15467 [ALC861_6ST_DIG] = {
15468 .mixers = { alc861_base_mixer },
15469 .init_verbs = { alc861_base_init_verbs },
15470 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15471 .dac_nids = alc861_dac_nids,
15472 .dig_out_nid = ALC861_DIGOUT_NID,
15473 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
15474 .channel_mode = alc861_8ch_modes,
15475 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15476 .adc_nids = alc861_adc_nids,
15477 .input_mux = &alc861_capture_source,
15480 .mixers = { alc861_3ST_mixer },
15481 .init_verbs = { alc861_threestack_init_verbs },
15482 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
15483 .dac_nids = alc660_dac_nids,
15484 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15485 .channel_mode = alc861_threestack_modes,
15487 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15488 .adc_nids = alc861_adc_nids,
15489 .input_mux = &alc861_capture_source,
15491 [ALC861_UNIWILL_M31] = {
15492 .mixers = { alc861_uniwill_m31_mixer },
15493 .init_verbs = { alc861_uniwill_m31_init_verbs },
15494 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15495 .dac_nids = alc861_dac_nids,
15496 .dig_out_nid = ALC861_DIGOUT_NID,
15497 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
15498 .channel_mode = alc861_uniwill_m31_modes,
15500 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15501 .adc_nids = alc861_adc_nids,
15502 .input_mux = &alc861_capture_source,
15504 [ALC861_TOSHIBA] = {
15505 .mixers = { alc861_toshiba_mixer },
15506 .init_verbs = { alc861_base_init_verbs,
15507 alc861_toshiba_init_verbs },
15508 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15509 .dac_nids = alc861_dac_nids,
15510 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
15511 .channel_mode = alc883_3ST_2ch_modes,
15512 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15513 .adc_nids = alc861_adc_nids,
15514 .input_mux = &alc861_capture_source,
15515 .unsol_event = alc861_toshiba_unsol_event,
15516 .init_hook = alc861_toshiba_automute,
15519 .mixers = { alc861_asus_mixer },
15520 .init_verbs = { alc861_asus_init_verbs },
15521 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15522 .dac_nids = alc861_dac_nids,
15523 .dig_out_nid = ALC861_DIGOUT_NID,
15524 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
15525 .channel_mode = alc861_asus_modes,
15528 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15529 .adc_nids = alc861_adc_nids,
15530 .input_mux = &alc861_capture_source,
15532 [ALC861_ASUS_LAPTOP] = {
15533 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
15534 .init_verbs = { alc861_asus_init_verbs,
15535 alc861_asus_laptop_init_verbs },
15536 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15537 .dac_nids = alc861_dac_nids,
15538 .dig_out_nid = ALC861_DIGOUT_NID,
15539 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
15540 .channel_mode = alc883_3ST_2ch_modes,
15542 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15543 .adc_nids = alc861_adc_nids,
15544 .input_mux = &alc861_capture_source,
15548 /* Pin config fixes */
15550 PINFIX_FSC_AMILO_PI1505,
15553 static struct alc_pincfg alc861_fsc_amilo_pi1505_pinfix[] = {
15554 { 0x0b, 0x0221101f }, /* HP */
15555 { 0x0f, 0x90170310 }, /* speaker */
15559 static const struct alc_fixup alc861_fixups[] = {
15560 [PINFIX_FSC_AMILO_PI1505] = {
15561 .pins = alc861_fsc_amilo_pi1505_pinfix
15565 static struct snd_pci_quirk alc861_fixup_tbl[] = {
15566 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
15570 static int patch_alc861(struct hda_codec *codec)
15572 struct alc_spec *spec;
15576 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15580 codec->spec = spec;
15582 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
15586 if (board_config < 0) {
15587 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15589 board_config = ALC861_AUTO;
15592 if (board_config == ALC861_AUTO)
15593 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 1);
15595 if (board_config == ALC861_AUTO) {
15596 /* automatic parse from the BIOS config */
15597 err = alc861_parse_auto_config(codec);
15603 "hda_codec: Cannot set up configuration "
15604 "from BIOS. Using base mode...\n");
15605 board_config = ALC861_3ST_DIG;
15609 err = snd_hda_attach_beep_device(codec, 0x23);
15615 if (board_config != ALC861_AUTO)
15616 setup_preset(codec, &alc861_presets[board_config]);
15618 spec->stream_analog_playback = &alc861_pcm_analog_playback;
15619 spec->stream_analog_capture = &alc861_pcm_analog_capture;
15621 spec->stream_digital_playback = &alc861_pcm_digital_playback;
15622 spec->stream_digital_capture = &alc861_pcm_digital_capture;
15624 if (!spec->cap_mixer)
15625 set_capture_mixer(codec);
15626 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
15628 spec->vmaster_nid = 0x03;
15630 if (board_config == ALC861_AUTO)
15631 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 0);
15633 codec->patch_ops = alc_patch_ops;
15634 if (board_config == ALC861_AUTO) {
15635 spec->init_hook = alc861_auto_init;
15636 #ifdef CONFIG_SND_HDA_POWER_SAVE
15637 spec->power_hook = alc_power_eapd;
15640 #ifdef CONFIG_SND_HDA_POWER_SAVE
15641 if (!spec->loopback.amplist)
15642 spec->loopback.amplist = alc861_loopbacks;
15649 * ALC861-VD support
15653 * In addition, an independent DAC
15655 #define ALC861VD_DIGOUT_NID 0x06
15657 static hda_nid_t alc861vd_dac_nids[4] = {
15658 /* front, surr, clfe, side surr */
15659 0x02, 0x03, 0x04, 0x05
15662 /* dac_nids for ALC660vd are in a different order - according to
15663 * Realtek's driver.
15664 * This should probably result in a different mixer for 6stack models
15665 * of ALC660vd codecs, but for now there is only 3stack mixer
15666 * - and it is the same as in 861vd.
15667 * adc_nids in ALC660vd are (is) the same as in 861vd
15669 static hda_nid_t alc660vd_dac_nids[3] = {
15670 /* front, rear, clfe, rear_surr */
15674 static hda_nid_t alc861vd_adc_nids[1] = {
15679 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
15682 /* FIXME: should be a matrix-type input source selection */
15683 static struct hda_input_mux alc861vd_capture_source = {
15687 { "Front Mic", 0x1 },
15693 static struct hda_input_mux alc861vd_dallas_capture_source = {
15696 { "Ext Mic", 0x0 },
15697 { "Int Mic", 0x1 },
15701 static struct hda_input_mux alc861vd_hp_capture_source = {
15704 { "Front Mic", 0x0 },
15705 { "ATAPI Mic", 0x1 },
15712 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
15719 static struct hda_verb alc861vd_6stack_ch6_init[] = {
15720 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15721 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15722 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15723 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15730 static struct hda_verb alc861vd_6stack_ch8_init[] = {
15731 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15732 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15733 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15734 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15738 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
15739 { 6, alc861vd_6stack_ch6_init },
15740 { 8, alc861vd_6stack_ch8_init },
15743 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
15745 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15746 .name = "Channel Mode",
15747 .info = alc_ch_mode_info,
15748 .get = alc_ch_mode_get,
15749 .put = alc_ch_mode_put,
15754 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15755 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15757 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
15758 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15759 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15761 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15762 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
15764 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
15766 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
15768 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
15769 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
15771 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
15772 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
15774 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15776 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15777 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15778 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15780 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15781 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15782 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15784 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15785 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15787 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15788 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15793 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
15794 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15795 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15797 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15799 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15800 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15801 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15803 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15804 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15805 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15807 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15808 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15810 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15811 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15816 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
15817 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15818 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
15819 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15821 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15823 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15824 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15825 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15827 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15828 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15829 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15831 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15832 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15837 /* Pin assignment: Speaker=0x14, HP = 0x15,
15838 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
15840 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
15841 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15842 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
15843 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15844 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15845 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
15846 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15847 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15848 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
15849 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15850 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15854 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
15855 * Front Mic=0x18, ATAPI Mic = 0x19,
15857 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
15858 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15859 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15860 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15861 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15862 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15863 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15864 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15865 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15871 * generic initialization of ADC, input mixers and output mixers
15873 static struct hda_verb alc861vd_volume_init_verbs[] = {
15875 * Unmute ADC0 and set the default input to mic-in
15877 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15878 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15880 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
15881 * the analog-loopback mixer widget
15883 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15884 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15885 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15886 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15887 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15888 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15890 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
15891 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15892 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15893 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15894 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15897 * Set up output mixers (0x02 - 0x05)
15899 /* set vol=0 to output mixers */
15900 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15901 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15902 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15903 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15905 /* set up input amps for analog loopback */
15906 /* Amp Indices: DAC = 0, mixer = 1 */
15907 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15908 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15909 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15910 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15911 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15912 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15913 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15914 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15920 * 3-stack pin configuration:
15921 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
15923 static struct hda_verb alc861vd_3stack_init_verbs[] = {
15925 * Set pin mode and muting
15927 /* set front pin widgets 0x14 for output */
15928 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15929 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15930 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15932 /* Mic (rear) pin: input vref at 80% */
15933 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15934 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15935 /* Front Mic pin: input vref at 80% */
15936 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15937 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15938 /* Line In pin: input */
15939 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15940 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15941 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15942 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15943 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15944 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15945 /* CD pin widget for input */
15946 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15952 * 6-stack pin configuration:
15954 static struct hda_verb alc861vd_6stack_init_verbs[] = {
15956 * Set pin mode and muting
15958 /* set front pin widgets 0x14 for output */
15959 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15960 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15961 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15963 /* Rear Pin: output 1 (0x0d) */
15964 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15965 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15966 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
15967 /* CLFE Pin: output 2 (0x0e) */
15968 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15969 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15970 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
15971 /* Side Pin: output 3 (0x0f) */
15972 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15973 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15974 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
15976 /* Mic (rear) pin: input vref at 80% */
15977 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15978 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15979 /* Front Mic pin: input vref at 80% */
15980 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15981 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15982 /* Line In pin: input */
15983 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15984 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15985 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15986 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15987 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15988 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15989 /* CD pin widget for input */
15990 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15995 static struct hda_verb alc861vd_eapd_verbs[] = {
15996 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16000 static struct hda_verb alc660vd_eapd_verbs[] = {
16001 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16002 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16006 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
16007 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16008 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16009 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
16010 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16011 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16015 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
16017 unsigned int present;
16018 unsigned char bits;
16020 present = snd_hda_jack_detect(codec, 0x18);
16021 bits = present ? HDA_AMP_MUTE : 0;
16023 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
16024 HDA_AMP_MUTE, bits);
16027 static void alc861vd_lenovo_setup(struct hda_codec *codec)
16029 struct alc_spec *spec = codec->spec;
16030 spec->autocfg.hp_pins[0] = 0x1b;
16031 spec->autocfg.speaker_pins[0] = 0x14;
16034 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
16036 alc_automute_amp(codec);
16037 alc861vd_lenovo_mic_automute(codec);
16040 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
16043 switch (res >> 26) {
16044 case ALC880_MIC_EVENT:
16045 alc861vd_lenovo_mic_automute(codec);
16048 alc_automute_amp_unsol_event(codec, res);
16053 static struct hda_verb alc861vd_dallas_verbs[] = {
16054 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16055 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16056 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16057 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16059 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16060 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16061 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16062 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16063 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16064 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16065 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16066 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16068 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16069 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16070 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16071 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16072 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16073 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16074 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16075 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16077 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
16078 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16079 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
16080 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16081 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16082 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16083 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16084 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16086 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16087 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16088 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16089 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16091 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16092 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16093 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16098 /* toggle speaker-output according to the hp-jack state */
16099 static void alc861vd_dallas_setup(struct hda_codec *codec)
16101 struct alc_spec *spec = codec->spec;
16103 spec->autocfg.hp_pins[0] = 0x15;
16104 spec->autocfg.speaker_pins[0] = 0x14;
16107 #ifdef CONFIG_SND_HDA_POWER_SAVE
16108 #define alc861vd_loopbacks alc880_loopbacks
16111 /* pcm configuration: identical with ALC880 */
16112 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
16113 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
16114 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
16115 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
16118 * configuration and preset
16120 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
16121 [ALC660VD_3ST] = "3stack-660",
16122 [ALC660VD_3ST_DIG] = "3stack-660-digout",
16123 [ALC660VD_ASUS_V1S] = "asus-v1s",
16124 [ALC861VD_3ST] = "3stack",
16125 [ALC861VD_3ST_DIG] = "3stack-digout",
16126 [ALC861VD_6ST_DIG] = "6stack-digout",
16127 [ALC861VD_LENOVO] = "lenovo",
16128 [ALC861VD_DALLAS] = "dallas",
16129 [ALC861VD_HP] = "hp",
16130 [ALC861VD_AUTO] = "auto",
16133 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
16134 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
16135 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
16136 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
16137 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
16138 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
16139 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
16140 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
16141 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
16142 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
16143 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
16144 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
16145 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
16146 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
16147 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
16148 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
16152 static struct alc_config_preset alc861vd_presets[] = {
16154 .mixers = { alc861vd_3st_mixer },
16155 .init_verbs = { alc861vd_volume_init_verbs,
16156 alc861vd_3stack_init_verbs },
16157 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16158 .dac_nids = alc660vd_dac_nids,
16159 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16160 .channel_mode = alc861vd_3stack_2ch_modes,
16161 .input_mux = &alc861vd_capture_source,
16163 [ALC660VD_3ST_DIG] = {
16164 .mixers = { alc861vd_3st_mixer },
16165 .init_verbs = { alc861vd_volume_init_verbs,
16166 alc861vd_3stack_init_verbs },
16167 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16168 .dac_nids = alc660vd_dac_nids,
16169 .dig_out_nid = ALC861VD_DIGOUT_NID,
16170 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16171 .channel_mode = alc861vd_3stack_2ch_modes,
16172 .input_mux = &alc861vd_capture_source,
16175 .mixers = { alc861vd_3st_mixer },
16176 .init_verbs = { alc861vd_volume_init_verbs,
16177 alc861vd_3stack_init_verbs },
16178 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16179 .dac_nids = alc861vd_dac_nids,
16180 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16181 .channel_mode = alc861vd_3stack_2ch_modes,
16182 .input_mux = &alc861vd_capture_source,
16184 [ALC861VD_3ST_DIG] = {
16185 .mixers = { alc861vd_3st_mixer },
16186 .init_verbs = { alc861vd_volume_init_verbs,
16187 alc861vd_3stack_init_verbs },
16188 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16189 .dac_nids = alc861vd_dac_nids,
16190 .dig_out_nid = ALC861VD_DIGOUT_NID,
16191 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16192 .channel_mode = alc861vd_3stack_2ch_modes,
16193 .input_mux = &alc861vd_capture_source,
16195 [ALC861VD_6ST_DIG] = {
16196 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
16197 .init_verbs = { alc861vd_volume_init_verbs,
16198 alc861vd_6stack_init_verbs },
16199 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16200 .dac_nids = alc861vd_dac_nids,
16201 .dig_out_nid = ALC861VD_DIGOUT_NID,
16202 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
16203 .channel_mode = alc861vd_6stack_modes,
16204 .input_mux = &alc861vd_capture_source,
16206 [ALC861VD_LENOVO] = {
16207 .mixers = { alc861vd_lenovo_mixer },
16208 .init_verbs = { alc861vd_volume_init_verbs,
16209 alc861vd_3stack_init_verbs,
16210 alc861vd_eapd_verbs,
16211 alc861vd_lenovo_unsol_verbs },
16212 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16213 .dac_nids = alc660vd_dac_nids,
16214 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16215 .channel_mode = alc861vd_3stack_2ch_modes,
16216 .input_mux = &alc861vd_capture_source,
16217 .unsol_event = alc861vd_lenovo_unsol_event,
16218 .setup = alc861vd_lenovo_setup,
16219 .init_hook = alc861vd_lenovo_init_hook,
16221 [ALC861VD_DALLAS] = {
16222 .mixers = { alc861vd_dallas_mixer },
16223 .init_verbs = { alc861vd_dallas_verbs },
16224 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16225 .dac_nids = alc861vd_dac_nids,
16226 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16227 .channel_mode = alc861vd_3stack_2ch_modes,
16228 .input_mux = &alc861vd_dallas_capture_source,
16229 .unsol_event = alc_automute_amp_unsol_event,
16230 .setup = alc861vd_dallas_setup,
16231 .init_hook = alc_automute_amp,
16234 .mixers = { alc861vd_hp_mixer },
16235 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
16236 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16237 .dac_nids = alc861vd_dac_nids,
16238 .dig_out_nid = ALC861VD_DIGOUT_NID,
16239 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16240 .channel_mode = alc861vd_3stack_2ch_modes,
16241 .input_mux = &alc861vd_hp_capture_source,
16242 .unsol_event = alc_automute_amp_unsol_event,
16243 .setup = alc861vd_dallas_setup,
16244 .init_hook = alc_automute_amp,
16246 [ALC660VD_ASUS_V1S] = {
16247 .mixers = { alc861vd_lenovo_mixer },
16248 .init_verbs = { alc861vd_volume_init_verbs,
16249 alc861vd_3stack_init_verbs,
16250 alc861vd_eapd_verbs,
16251 alc861vd_lenovo_unsol_verbs },
16252 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16253 .dac_nids = alc660vd_dac_nids,
16254 .dig_out_nid = ALC861VD_DIGOUT_NID,
16255 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16256 .channel_mode = alc861vd_3stack_2ch_modes,
16257 .input_mux = &alc861vd_capture_source,
16258 .unsol_event = alc861vd_lenovo_unsol_event,
16259 .setup = alc861vd_lenovo_setup,
16260 .init_hook = alc861vd_lenovo_init_hook,
16265 * BIOS auto configuration
16267 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
16268 const struct auto_pin_cfg *cfg)
16270 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0);
16274 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
16275 hda_nid_t nid, int pin_type, int dac_idx)
16277 alc_set_pin_output(codec, nid, pin_type);
16280 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
16282 struct alc_spec *spec = codec->spec;
16285 for (i = 0; i <= HDA_SIDE; i++) {
16286 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16287 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16289 alc861vd_auto_set_output_and_unmute(codec, nid,
16295 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
16297 struct alc_spec *spec = codec->spec;
16300 pin = spec->autocfg.hp_pins[0];
16301 if (pin) /* connect to front and use dac 0 */
16302 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
16303 pin = spec->autocfg.speaker_pins[0];
16305 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
16308 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
16310 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
16312 struct alc_spec *spec = codec->spec;
16315 for (i = 0; i < AUTO_PIN_LAST; i++) {
16316 hda_nid_t nid = spec->autocfg.input_pins[i];
16317 if (alc_is_input_pin(codec, nid)) {
16318 alc_set_input_pin(codec, nid, i);
16319 if (nid != ALC861VD_PIN_CD_NID &&
16320 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
16321 snd_hda_codec_write(codec, nid, 0,
16322 AC_VERB_SET_AMP_GAIN_MUTE,
16328 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
16330 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
16331 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
16333 /* add playback controls from the parsed DAC table */
16334 /* Based on ALC880 version. But ALC861VD has separate,
16335 * different NIDs for mute/unmute switch and volume control */
16336 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
16337 const struct auto_pin_cfg *cfg)
16339 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
16340 hda_nid_t nid_v, nid_s;
16343 for (i = 0; i < cfg->line_outs; i++) {
16344 if (!spec->multiout.dac_nids[i])
16346 nid_v = alc861vd_idx_to_mixer_vol(
16348 spec->multiout.dac_nids[i]));
16349 nid_s = alc861vd_idx_to_mixer_switch(
16351 spec->multiout.dac_nids[i]));
16355 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
16357 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
16361 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
16363 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
16367 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
16369 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
16373 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
16375 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
16381 if (cfg->line_outs == 1 &&
16382 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
16389 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
16390 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
16394 if (cfg->line_outs == 1 &&
16395 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
16397 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
16398 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
16407 /* add playback controls for speaker and HP outputs */
16408 /* Based on ALC880 version. But ALC861VD has separate,
16409 * different NIDs for mute/unmute switch and volume control */
16410 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
16411 hda_nid_t pin, const char *pfx)
16413 hda_nid_t nid_v, nid_s;
16419 if (alc880_is_fixed_pin(pin)) {
16420 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16421 /* specify the DAC as the extra output */
16422 if (!spec->multiout.hp_nid)
16423 spec->multiout.hp_nid = nid_v;
16425 spec->multiout.extra_out_nid[0] = nid_v;
16426 /* control HP volume/switch on the output mixer amp */
16427 nid_v = alc861vd_idx_to_mixer_vol(
16428 alc880_fixed_pin_idx(pin));
16429 nid_s = alc861vd_idx_to_mixer_switch(
16430 alc880_fixed_pin_idx(pin));
16432 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
16433 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
16436 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
16437 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
16440 } else if (alc880_is_multi_pin(pin)) {
16441 /* set manual connection */
16442 /* we have only a switch on HP-out PIN */
16443 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
16444 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
16451 /* parse the BIOS configuration and set up the alc_spec
16452 * return 1 if successful, 0 if the proper config is not found,
16453 * or a negative error code
16454 * Based on ALC880 version - had to change it to override
16455 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
16456 static int alc861vd_parse_auto_config(struct hda_codec *codec)
16458 struct alc_spec *spec = codec->spec;
16460 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
16462 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16466 if (!spec->autocfg.line_outs)
16467 return 0; /* can't find valid BIOS pin config */
16469 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
16472 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
16475 err = alc861vd_auto_create_extra_out(spec,
16476 spec->autocfg.speaker_pins[0],
16480 err = alc861vd_auto_create_extra_out(spec,
16481 spec->autocfg.hp_pins[0],
16485 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
16489 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16491 if (spec->autocfg.dig_outs)
16492 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
16494 if (spec->kctls.list)
16495 add_mixer(spec, spec->kctls.list);
16497 add_verb(spec, alc861vd_volume_init_verbs);
16499 spec->num_mux_defs = 1;
16500 spec->input_mux = &spec->private_imux[0];
16502 err = alc_auto_add_mic_boost(codec);
16506 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
16511 /* additional initialization for auto-configuration model */
16512 static void alc861vd_auto_init(struct hda_codec *codec)
16514 struct alc_spec *spec = codec->spec;
16515 alc861vd_auto_init_multi_out(codec);
16516 alc861vd_auto_init_hp_out(codec);
16517 alc861vd_auto_init_analog_input(codec);
16518 alc861vd_auto_init_input_src(codec);
16519 if (spec->unsol_event)
16520 alc_inithook(codec);
16524 ALC660VD_FIX_ASUS_GPIO1
16528 static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = {
16529 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
16530 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
16531 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
16535 static const struct alc_fixup alc861vd_fixups[] = {
16536 [ALC660VD_FIX_ASUS_GPIO1] = {
16537 .verbs = alc660vd_fix_asus_gpio1_verbs,
16541 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
16542 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
16546 static int patch_alc861vd(struct hda_codec *codec)
16548 struct alc_spec *spec;
16549 int err, board_config;
16551 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16555 codec->spec = spec;
16557 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
16561 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
16562 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
16564 board_config = ALC861VD_AUTO;
16567 if (board_config == ALC861VD_AUTO)
16568 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 1);
16570 if (board_config == ALC861VD_AUTO) {
16571 /* automatic parse from the BIOS config */
16572 err = alc861vd_parse_auto_config(codec);
16578 "hda_codec: Cannot set up configuration "
16579 "from BIOS. Using base mode...\n");
16580 board_config = ALC861VD_3ST;
16584 err = snd_hda_attach_beep_device(codec, 0x23);
16590 if (board_config != ALC861VD_AUTO)
16591 setup_preset(codec, &alc861vd_presets[board_config]);
16593 if (codec->vendor_id == 0x10ec0660) {
16594 /* always turn on EAPD */
16595 add_verb(spec, alc660vd_eapd_verbs);
16598 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
16599 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
16601 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
16602 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
16604 if (!spec->adc_nids) {
16605 spec->adc_nids = alc861vd_adc_nids;
16606 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
16608 if (!spec->capsrc_nids)
16609 spec->capsrc_nids = alc861vd_capsrc_nids;
16611 set_capture_mixer(codec);
16612 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
16614 spec->vmaster_nid = 0x02;
16616 if (board_config == ALC861VD_AUTO)
16617 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 0);
16619 codec->patch_ops = alc_patch_ops;
16621 if (board_config == ALC861VD_AUTO)
16622 spec->init_hook = alc861vd_auto_init;
16623 #ifdef CONFIG_SND_HDA_POWER_SAVE
16624 if (!spec->loopback.amplist)
16625 spec->loopback.amplist = alc861vd_loopbacks;
16634 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
16635 * configuration. Each pin widget can choose any input DACs and a mixer.
16636 * Each ADC is connected from a mixer of all inputs. This makes possible
16637 * 6-channel independent captures.
16639 * In addition, an independent DAC for the multi-playback (not used in this
16642 #define ALC662_DIGOUT_NID 0x06
16643 #define ALC662_DIGIN_NID 0x0a
16645 static hda_nid_t alc662_dac_nids[4] = {
16646 /* front, rear, clfe, rear_surr */
16650 static hda_nid_t alc272_dac_nids[2] = {
16654 static hda_nid_t alc662_adc_nids[2] = {
16659 static hda_nid_t alc272_adc_nids[1] = {
16664 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
16665 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
16669 /* FIXME: should be a matrix-type input source selection */
16670 static struct hda_input_mux alc662_capture_source = {
16674 { "Front Mic", 0x1 },
16680 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
16688 static struct hda_input_mux alc663_capture_source = {
16692 { "Front Mic", 0x1 },
16697 #if 0 /* set to 1 for testing other input sources below */
16698 static struct hda_input_mux alc272_nc10_capture_source = {
16701 { "Autoselect Mic", 0x0 },
16702 { "Internal Mic", 0x1 },
16703 { "In-0x02", 0x2 },
16704 { "In-0x03", 0x3 },
16705 { "In-0x04", 0x4 },
16706 { "In-0x05", 0x5 },
16707 { "In-0x06", 0x6 },
16708 { "In-0x07", 0x7 },
16709 { "In-0x08", 0x8 },
16710 { "In-0x09", 0x9 },
16711 { "In-0x0a", 0x0a },
16712 { "In-0x0b", 0x0b },
16713 { "In-0x0c", 0x0c },
16714 { "In-0x0d", 0x0d },
16715 { "In-0x0e", 0x0e },
16716 { "In-0x0f", 0x0f },
16724 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
16731 static struct hda_verb alc662_3ST_ch2_init[] = {
16732 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
16733 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
16734 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
16735 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
16742 static struct hda_verb alc662_3ST_ch6_init[] = {
16743 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16744 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
16745 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
16746 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16747 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
16748 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
16752 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
16753 { 2, alc662_3ST_ch2_init },
16754 { 6, alc662_3ST_ch6_init },
16760 static struct hda_verb alc662_sixstack_ch6_init[] = {
16761 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16762 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16763 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16770 static struct hda_verb alc662_sixstack_ch8_init[] = {
16771 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16772 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16773 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16777 static struct hda_channel_mode alc662_5stack_modes[2] = {
16778 { 2, alc662_sixstack_ch6_init },
16779 { 6, alc662_sixstack_ch8_init },
16782 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16783 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16786 static struct snd_kcontrol_new alc662_base_mixer[] = {
16787 /* output mixer control */
16788 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
16789 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16790 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
16791 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16792 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16793 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16794 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16795 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16796 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16798 /*Input mixer control */
16799 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
16800 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
16801 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
16802 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
16803 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
16804 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
16805 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
16806 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
16810 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
16811 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16812 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16813 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16814 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16815 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16816 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16817 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16818 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16819 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16820 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16821 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16825 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
16826 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16827 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16828 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16829 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16830 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16831 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16832 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16833 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16834 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16835 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16836 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16837 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16838 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16839 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16840 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16841 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16842 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16846 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
16847 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16848 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
16849 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16850 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
16851 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16852 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16853 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16854 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16855 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16859 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
16860 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16861 ALC262_HIPPO_MASTER_SWITCH,
16863 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
16864 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16865 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16867 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16868 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16869 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16873 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
16874 ALC262_HIPPO_MASTER_SWITCH,
16875 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16876 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16877 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16878 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16879 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
16880 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16881 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16882 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16883 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16887 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
16888 .ops = &snd_hda_bind_vol,
16890 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16891 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
16896 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
16897 .ops = &snd_hda_bind_sw,
16899 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16900 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16905 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
16906 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16907 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
16908 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16909 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16913 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
16914 .ops = &snd_hda_bind_sw,
16916 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16917 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16918 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16923 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
16924 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16925 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
16926 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16927 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16928 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16929 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16934 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
16935 .ops = &snd_hda_bind_sw,
16937 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16938 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16939 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16944 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
16945 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16946 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
16947 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16948 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16949 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16950 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16954 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
16955 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16956 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16957 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16958 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16959 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16960 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16961 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16965 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
16966 .ops = &snd_hda_bind_vol,
16968 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16969 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
16974 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
16975 .ops = &snd_hda_bind_sw,
16977 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16978 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
16983 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
16984 HDA_BIND_VOL("Master Playback Volume",
16985 &alc663_asus_two_bind_master_vol),
16986 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16987 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16988 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16989 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16990 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16994 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
16995 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16996 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16997 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16998 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16999 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17000 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17004 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
17005 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17006 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17007 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17008 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17009 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17011 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17012 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17013 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17014 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17018 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
17019 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17020 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17021 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17023 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17024 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17025 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17026 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17027 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17028 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17032 static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
17033 .ops = &snd_hda_bind_sw,
17035 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17036 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17037 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
17038 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
17039 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17044 static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
17045 .ops = &snd_hda_bind_sw,
17047 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17048 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
17053 static struct snd_kcontrol_new alc663_mode7_mixer[] = {
17054 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17055 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17056 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
17057 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17058 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17059 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17060 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17061 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17062 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17066 static struct snd_kcontrol_new alc663_mode8_mixer[] = {
17067 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17068 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17069 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
17070 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17071 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17072 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17073 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17078 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
17080 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
17081 .name = "Channel Mode",
17082 .info = alc_ch_mode_info,
17083 .get = alc_ch_mode_get,
17084 .put = alc_ch_mode_put,
17089 static struct hda_verb alc662_init_verbs[] = {
17090 /* ADC: mute amp left and right */
17091 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17092 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
17094 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17095 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17096 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17097 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17098 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17099 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17101 /* Front Pin: output 0 (0x0c) */
17102 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17103 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17105 /* Rear Pin: output 1 (0x0d) */
17106 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17107 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17109 /* CLFE Pin: output 2 (0x0e) */
17110 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17111 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17113 /* Mic (rear) pin: input vref at 80% */
17114 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
17115 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17116 /* Front Mic pin: input vref at 80% */
17117 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
17118 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17119 /* Line In pin: input */
17120 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17121 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17122 /* Line-2 In: Headphone output (output 0 - 0x0c) */
17123 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17124 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17125 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
17126 /* CD pin widget for input */
17127 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17129 /* FIXME: use matrix-type input source selection */
17130 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
17132 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17133 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17135 /* always trun on EAPD */
17136 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
17137 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
17142 static struct hda_verb alc663_init_verbs[] = {
17143 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17144 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17145 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17146 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17147 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17148 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17152 static struct hda_verb alc272_init_verbs[] = {
17153 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17154 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17155 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17156 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17157 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17158 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17159 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17160 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17164 static struct hda_verb alc662_sue_init_verbs[] = {
17165 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
17166 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
17170 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
17171 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17172 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17176 /* Set Unsolicited Event*/
17177 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
17178 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17179 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17183 static struct hda_verb alc663_m51va_init_verbs[] = {
17184 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17185 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17186 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17187 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17188 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17189 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17190 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17191 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17192 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17196 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
17197 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17198 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17199 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17200 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17201 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17202 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17203 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17207 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
17208 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17209 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17210 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17211 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17212 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17213 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17214 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17215 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17219 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
17220 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17221 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17222 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17223 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17224 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17225 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17226 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17230 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
17231 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17232 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17233 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17234 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
17235 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17236 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17237 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
17238 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17239 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17240 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17241 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17242 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17246 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
17247 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17248 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17249 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17250 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17251 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17252 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17253 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17254 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17255 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17256 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17257 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17258 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17262 static struct hda_verb alc663_g71v_init_verbs[] = {
17263 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17264 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
17265 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
17267 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17268 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17269 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17271 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
17272 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
17273 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
17277 static struct hda_verb alc663_g50v_init_verbs[] = {
17278 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17279 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17280 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17282 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17283 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17287 static struct hda_verb alc662_ecs_init_verbs[] = {
17288 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
17289 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17290 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17291 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17295 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
17296 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17297 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17298 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17299 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17300 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17301 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17302 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17303 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17304 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17305 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17306 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17310 static struct hda_verb alc272_dell_init_verbs[] = {
17311 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17312 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17313 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17314 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17315 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17316 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17317 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17318 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17319 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17320 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17321 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17325 static struct hda_verb alc663_mode7_init_verbs[] = {
17326 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17327 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17328 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17329 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17330 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17331 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17332 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
17333 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17334 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17335 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17336 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17337 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17338 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17339 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17340 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17344 static struct hda_verb alc663_mode8_init_verbs[] = {
17345 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17346 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17347 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17348 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
17349 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17350 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17351 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17352 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17353 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17354 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17355 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17356 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17357 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17358 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17359 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17360 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17364 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
17365 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
17366 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
17370 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
17371 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
17372 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
17376 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
17378 unsigned int present;
17379 unsigned char bits;
17381 present = snd_hda_jack_detect(codec, 0x14);
17382 bits = present ? HDA_AMP_MUTE : 0;
17384 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17385 HDA_AMP_MUTE, bits);
17388 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
17390 unsigned int present;
17391 unsigned char bits;
17393 present = snd_hda_jack_detect(codec, 0x1b);
17394 bits = present ? HDA_AMP_MUTE : 0;
17396 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17397 HDA_AMP_MUTE, bits);
17398 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17399 HDA_AMP_MUTE, bits);
17402 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
17405 if ((res >> 26) == ALC880_HP_EVENT)
17406 alc662_lenovo_101e_all_automute(codec);
17407 if ((res >> 26) == ALC880_FRONT_EVENT)
17408 alc662_lenovo_101e_ispeaker_automute(codec);
17411 /* unsolicited event for HP jack sensing */
17412 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
17415 if ((res >> 26) == ALC880_MIC_EVENT)
17416 alc_mic_automute(codec);
17418 alc262_hippo_unsol_event(codec, res);
17421 static void alc662_eeepc_setup(struct hda_codec *codec)
17423 struct alc_spec *spec = codec->spec;
17425 alc262_hippo1_setup(codec);
17426 spec->ext_mic.pin = 0x18;
17427 spec->ext_mic.mux_idx = 0;
17428 spec->int_mic.pin = 0x19;
17429 spec->int_mic.mux_idx = 1;
17430 spec->auto_mic = 1;
17433 static void alc662_eeepc_inithook(struct hda_codec *codec)
17435 alc262_hippo_automute(codec);
17436 alc_mic_automute(codec);
17439 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
17441 struct alc_spec *spec = codec->spec;
17443 spec->autocfg.hp_pins[0] = 0x14;
17444 spec->autocfg.speaker_pins[0] = 0x1b;
17447 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
17449 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
17451 unsigned int present;
17452 unsigned char bits;
17454 present = snd_hda_jack_detect(codec, 0x21);
17455 bits = present ? HDA_AMP_MUTE : 0;
17456 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17457 HDA_AMP_MUTE, bits);
17458 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17459 HDA_AMP_MUTE, bits);
17462 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
17464 unsigned int present;
17465 unsigned char bits;
17467 present = snd_hda_jack_detect(codec, 0x21);
17468 bits = present ? HDA_AMP_MUTE : 0;
17469 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17470 HDA_AMP_MUTE, bits);
17471 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17472 HDA_AMP_MUTE, bits);
17473 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
17474 HDA_AMP_MUTE, bits);
17475 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
17476 HDA_AMP_MUTE, bits);
17479 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
17481 unsigned int present;
17482 unsigned char bits;
17484 present = snd_hda_jack_detect(codec, 0x15);
17485 bits = present ? HDA_AMP_MUTE : 0;
17486 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17487 HDA_AMP_MUTE, bits);
17488 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17489 HDA_AMP_MUTE, bits);
17490 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
17491 HDA_AMP_MUTE, bits);
17492 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
17493 HDA_AMP_MUTE, bits);
17496 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
17498 unsigned int present;
17499 unsigned char bits;
17501 present = snd_hda_jack_detect(codec, 0x1b);
17502 bits = present ? 0 : PIN_OUT;
17503 snd_hda_codec_write(codec, 0x14, 0,
17504 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
17507 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
17509 unsigned int present1, present2;
17511 present1 = snd_hda_jack_detect(codec, 0x21);
17512 present2 = snd_hda_jack_detect(codec, 0x15);
17514 if (present1 || present2) {
17515 snd_hda_codec_write_cache(codec, 0x14, 0,
17516 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17518 snd_hda_codec_write_cache(codec, 0x14, 0,
17519 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17523 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
17525 unsigned int present1, present2;
17527 present1 = snd_hda_jack_detect(codec, 0x1b);
17528 present2 = snd_hda_jack_detect(codec, 0x15);
17530 if (present1 || present2) {
17531 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17532 HDA_AMP_MUTE, HDA_AMP_MUTE);
17533 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17534 HDA_AMP_MUTE, HDA_AMP_MUTE);
17536 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17538 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17543 static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
17545 unsigned int present1, present2;
17547 present1 = snd_hda_codec_read(codec, 0x1b, 0,
17548 AC_VERB_GET_PIN_SENSE, 0)
17549 & AC_PINSENSE_PRESENCE;
17550 present2 = snd_hda_codec_read(codec, 0x21, 0,
17551 AC_VERB_GET_PIN_SENSE, 0)
17552 & AC_PINSENSE_PRESENCE;
17554 if (present1 || present2) {
17555 snd_hda_codec_write_cache(codec, 0x14, 0,
17556 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17557 snd_hda_codec_write_cache(codec, 0x17, 0,
17558 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17560 snd_hda_codec_write_cache(codec, 0x14, 0,
17561 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17562 snd_hda_codec_write_cache(codec, 0x17, 0,
17563 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17567 static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
17569 unsigned int present1, present2;
17571 present1 = snd_hda_codec_read(codec, 0x21, 0,
17572 AC_VERB_GET_PIN_SENSE, 0)
17573 & AC_PINSENSE_PRESENCE;
17574 present2 = snd_hda_codec_read(codec, 0x15, 0,
17575 AC_VERB_GET_PIN_SENSE, 0)
17576 & AC_PINSENSE_PRESENCE;
17578 if (present1 || present2) {
17579 snd_hda_codec_write_cache(codec, 0x14, 0,
17580 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17581 snd_hda_codec_write_cache(codec, 0x17, 0,
17582 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17584 snd_hda_codec_write_cache(codec, 0x14, 0,
17585 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17586 snd_hda_codec_write_cache(codec, 0x17, 0,
17587 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17591 static void alc663_m51va_unsol_event(struct hda_codec *codec,
17594 switch (res >> 26) {
17595 case ALC880_HP_EVENT:
17596 alc663_m51va_speaker_automute(codec);
17598 case ALC880_MIC_EVENT:
17599 alc_mic_automute(codec);
17604 static void alc663_m51va_setup(struct hda_codec *codec)
17606 struct alc_spec *spec = codec->spec;
17607 spec->ext_mic.pin = 0x18;
17608 spec->ext_mic.mux_idx = 0;
17609 spec->int_mic.pin = 0x12;
17610 spec->int_mic.mux_idx = 9;
17611 spec->auto_mic = 1;
17614 static void alc663_m51va_inithook(struct hda_codec *codec)
17616 alc663_m51va_speaker_automute(codec);
17617 alc_mic_automute(codec);
17620 /* ***************** Mode1 ******************************/
17621 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
17623 static void alc663_mode1_setup(struct hda_codec *codec)
17625 struct alc_spec *spec = codec->spec;
17626 spec->ext_mic.pin = 0x18;
17627 spec->ext_mic.mux_idx = 0;
17628 spec->int_mic.pin = 0x19;
17629 spec->int_mic.mux_idx = 1;
17630 spec->auto_mic = 1;
17633 #define alc663_mode1_inithook alc663_m51va_inithook
17635 /* ***************** Mode2 ******************************/
17636 static void alc662_mode2_unsol_event(struct hda_codec *codec,
17639 switch (res >> 26) {
17640 case ALC880_HP_EVENT:
17641 alc662_f5z_speaker_automute(codec);
17643 case ALC880_MIC_EVENT:
17644 alc_mic_automute(codec);
17649 #define alc662_mode2_setup alc663_mode1_setup
17651 static void alc662_mode2_inithook(struct hda_codec *codec)
17653 alc662_f5z_speaker_automute(codec);
17654 alc_mic_automute(codec);
17656 /* ***************** Mode3 ******************************/
17657 static void alc663_mode3_unsol_event(struct hda_codec *codec,
17660 switch (res >> 26) {
17661 case ALC880_HP_EVENT:
17662 alc663_two_hp_m1_speaker_automute(codec);
17664 case ALC880_MIC_EVENT:
17665 alc_mic_automute(codec);
17670 #define alc663_mode3_setup alc663_mode1_setup
17672 static void alc663_mode3_inithook(struct hda_codec *codec)
17674 alc663_two_hp_m1_speaker_automute(codec);
17675 alc_mic_automute(codec);
17677 /* ***************** Mode4 ******************************/
17678 static void alc663_mode4_unsol_event(struct hda_codec *codec,
17681 switch (res >> 26) {
17682 case ALC880_HP_EVENT:
17683 alc663_21jd_two_speaker_automute(codec);
17685 case ALC880_MIC_EVENT:
17686 alc_mic_automute(codec);
17691 #define alc663_mode4_setup alc663_mode1_setup
17693 static void alc663_mode4_inithook(struct hda_codec *codec)
17695 alc663_21jd_two_speaker_automute(codec);
17696 alc_mic_automute(codec);
17698 /* ***************** Mode5 ******************************/
17699 static void alc663_mode5_unsol_event(struct hda_codec *codec,
17702 switch (res >> 26) {
17703 case ALC880_HP_EVENT:
17704 alc663_15jd_two_speaker_automute(codec);
17706 case ALC880_MIC_EVENT:
17707 alc_mic_automute(codec);
17712 #define alc663_mode5_setup alc663_mode1_setup
17714 static void alc663_mode5_inithook(struct hda_codec *codec)
17716 alc663_15jd_two_speaker_automute(codec);
17717 alc_mic_automute(codec);
17719 /* ***************** Mode6 ******************************/
17720 static void alc663_mode6_unsol_event(struct hda_codec *codec,
17723 switch (res >> 26) {
17724 case ALC880_HP_EVENT:
17725 alc663_two_hp_m2_speaker_automute(codec);
17727 case ALC880_MIC_EVENT:
17728 alc_mic_automute(codec);
17733 #define alc663_mode6_setup alc663_mode1_setup
17735 static void alc663_mode6_inithook(struct hda_codec *codec)
17737 alc663_two_hp_m2_speaker_automute(codec);
17738 alc_mic_automute(codec);
17741 /* ***************** Mode7 ******************************/
17742 static void alc663_mode7_unsol_event(struct hda_codec *codec,
17745 switch (res >> 26) {
17746 case ALC880_HP_EVENT:
17747 alc663_two_hp_m7_speaker_automute(codec);
17749 case ALC880_MIC_EVENT:
17750 alc_mic_automute(codec);
17755 #define alc663_mode7_setup alc663_mode1_setup
17757 static void alc663_mode7_inithook(struct hda_codec *codec)
17759 alc663_two_hp_m7_speaker_automute(codec);
17760 alc_mic_automute(codec);
17763 /* ***************** Mode8 ******************************/
17764 static void alc663_mode8_unsol_event(struct hda_codec *codec,
17767 switch (res >> 26) {
17768 case ALC880_HP_EVENT:
17769 alc663_two_hp_m8_speaker_automute(codec);
17771 case ALC880_MIC_EVENT:
17772 alc_mic_automute(codec);
17777 #define alc663_mode8_setup alc663_m51va_setup
17779 static void alc663_mode8_inithook(struct hda_codec *codec)
17781 alc663_two_hp_m8_speaker_automute(codec);
17782 alc_mic_automute(codec);
17785 static void alc663_g71v_hp_automute(struct hda_codec *codec)
17787 unsigned int present;
17788 unsigned char bits;
17790 present = snd_hda_jack_detect(codec, 0x21);
17791 bits = present ? HDA_AMP_MUTE : 0;
17792 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17793 HDA_AMP_MUTE, bits);
17794 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17795 HDA_AMP_MUTE, bits);
17798 static void alc663_g71v_front_automute(struct hda_codec *codec)
17800 unsigned int present;
17801 unsigned char bits;
17803 present = snd_hda_jack_detect(codec, 0x15);
17804 bits = present ? HDA_AMP_MUTE : 0;
17805 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17806 HDA_AMP_MUTE, bits);
17809 static void alc663_g71v_unsol_event(struct hda_codec *codec,
17812 switch (res >> 26) {
17813 case ALC880_HP_EVENT:
17814 alc663_g71v_hp_automute(codec);
17816 case ALC880_FRONT_EVENT:
17817 alc663_g71v_front_automute(codec);
17819 case ALC880_MIC_EVENT:
17820 alc_mic_automute(codec);
17825 #define alc663_g71v_setup alc663_m51va_setup
17827 static void alc663_g71v_inithook(struct hda_codec *codec)
17829 alc663_g71v_front_automute(codec);
17830 alc663_g71v_hp_automute(codec);
17831 alc_mic_automute(codec);
17834 static void alc663_g50v_unsol_event(struct hda_codec *codec,
17837 switch (res >> 26) {
17838 case ALC880_HP_EVENT:
17839 alc663_m51va_speaker_automute(codec);
17841 case ALC880_MIC_EVENT:
17842 alc_mic_automute(codec);
17847 #define alc663_g50v_setup alc663_m51va_setup
17849 static void alc663_g50v_inithook(struct hda_codec *codec)
17851 alc663_m51va_speaker_automute(codec);
17852 alc_mic_automute(codec);
17855 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
17856 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17857 ALC262_HIPPO_MASTER_SWITCH,
17859 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
17860 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
17861 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
17863 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
17864 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17865 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17869 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
17870 /* Master Playback automatically created from Speaker and Headphone */
17871 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17872 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17873 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17874 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17876 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17877 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17878 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
17880 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17881 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17882 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
17886 #ifdef CONFIG_SND_HDA_POWER_SAVE
17887 #define alc662_loopbacks alc880_loopbacks
17891 /* pcm configuration: identical with ALC880 */
17892 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
17893 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
17894 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
17895 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
17898 * configuration and preset
17900 static const char *alc662_models[ALC662_MODEL_LAST] = {
17901 [ALC662_3ST_2ch_DIG] = "3stack-dig",
17902 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
17903 [ALC662_3ST_6ch] = "3stack-6ch",
17904 [ALC662_5ST_DIG] = "6stack-dig",
17905 [ALC662_LENOVO_101E] = "lenovo-101e",
17906 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
17907 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
17908 [ALC662_ECS] = "ecs",
17909 [ALC663_ASUS_M51VA] = "m51va",
17910 [ALC663_ASUS_G71V] = "g71v",
17911 [ALC663_ASUS_H13] = "h13",
17912 [ALC663_ASUS_G50V] = "g50v",
17913 [ALC663_ASUS_MODE1] = "asus-mode1",
17914 [ALC662_ASUS_MODE2] = "asus-mode2",
17915 [ALC663_ASUS_MODE3] = "asus-mode3",
17916 [ALC663_ASUS_MODE4] = "asus-mode4",
17917 [ALC663_ASUS_MODE5] = "asus-mode5",
17918 [ALC663_ASUS_MODE6] = "asus-mode6",
17919 [ALC663_ASUS_MODE7] = "asus-mode7",
17920 [ALC663_ASUS_MODE8] = "asus-mode8",
17921 [ALC272_DELL] = "dell",
17922 [ALC272_DELL_ZM1] = "dell-zm1",
17923 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
17924 [ALC662_AUTO] = "auto",
17927 static struct snd_pci_quirk alc662_cfg_tbl[] = {
17928 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
17929 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
17930 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
17931 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
17932 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
17933 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1),
17934 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
17935 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
17936 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
17937 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
17938 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
17939 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
17940 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
17941 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
17942 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
17943 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
17944 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
17945 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
17946 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
17947 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
17948 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
17949 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
17950 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
17951 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
17952 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
17953 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
17954 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
17955 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
17956 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
17957 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
17958 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
17959 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
17960 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
17961 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
17962 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
17963 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
17964 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
17965 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
17966 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
17967 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
17968 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
17969 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1),
17970 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
17971 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
17972 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
17973 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
17974 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
17975 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
17976 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
17977 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
17978 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
17979 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
17980 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
17981 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
17982 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
17983 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
17984 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
17985 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
17986 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
17987 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
17988 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
17989 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
17990 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
17991 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
17992 ALC662_3ST_6ch_DIG),
17993 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO),
17994 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
17995 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
17996 ALC662_3ST_6ch_DIG),
17997 SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13),
17998 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
17999 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
18000 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
18001 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
18002 ALC662_3ST_6ch_DIG),
18003 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
18005 SND_PCI_QUIRK(0x8086, 0xd604, "Intel mobo", ALC662_3ST_2ch_DIG),
18009 static struct alc_config_preset alc662_presets[] = {
18010 [ALC662_3ST_2ch_DIG] = {
18011 .mixers = { alc662_3ST_2ch_mixer },
18012 .init_verbs = { alc662_init_verbs },
18013 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18014 .dac_nids = alc662_dac_nids,
18015 .dig_out_nid = ALC662_DIGOUT_NID,
18016 .dig_in_nid = ALC662_DIGIN_NID,
18017 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18018 .channel_mode = alc662_3ST_2ch_modes,
18019 .input_mux = &alc662_capture_source,
18021 [ALC662_3ST_6ch_DIG] = {
18022 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18023 .init_verbs = { alc662_init_verbs },
18024 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18025 .dac_nids = alc662_dac_nids,
18026 .dig_out_nid = ALC662_DIGOUT_NID,
18027 .dig_in_nid = ALC662_DIGIN_NID,
18028 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18029 .channel_mode = alc662_3ST_6ch_modes,
18031 .input_mux = &alc662_capture_source,
18033 [ALC662_3ST_6ch] = {
18034 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18035 .init_verbs = { alc662_init_verbs },
18036 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18037 .dac_nids = alc662_dac_nids,
18038 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18039 .channel_mode = alc662_3ST_6ch_modes,
18041 .input_mux = &alc662_capture_source,
18043 [ALC662_5ST_DIG] = {
18044 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
18045 .init_verbs = { alc662_init_verbs },
18046 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18047 .dac_nids = alc662_dac_nids,
18048 .dig_out_nid = ALC662_DIGOUT_NID,
18049 .dig_in_nid = ALC662_DIGIN_NID,
18050 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
18051 .channel_mode = alc662_5stack_modes,
18052 .input_mux = &alc662_capture_source,
18054 [ALC662_LENOVO_101E] = {
18055 .mixers = { alc662_lenovo_101e_mixer },
18056 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
18057 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18058 .dac_nids = alc662_dac_nids,
18059 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18060 .channel_mode = alc662_3ST_2ch_modes,
18061 .input_mux = &alc662_lenovo_101e_capture_source,
18062 .unsol_event = alc662_lenovo_101e_unsol_event,
18063 .init_hook = alc662_lenovo_101e_all_automute,
18065 [ALC662_ASUS_EEEPC_P701] = {
18066 .mixers = { alc662_eeepc_p701_mixer },
18067 .init_verbs = { alc662_init_verbs,
18068 alc662_eeepc_sue_init_verbs },
18069 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18070 .dac_nids = alc662_dac_nids,
18071 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18072 .channel_mode = alc662_3ST_2ch_modes,
18073 .unsol_event = alc662_eeepc_unsol_event,
18074 .setup = alc662_eeepc_setup,
18075 .init_hook = alc662_eeepc_inithook,
18077 [ALC662_ASUS_EEEPC_EP20] = {
18078 .mixers = { alc662_eeepc_ep20_mixer,
18079 alc662_chmode_mixer },
18080 .init_verbs = { alc662_init_verbs,
18081 alc662_eeepc_ep20_sue_init_verbs },
18082 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18083 .dac_nids = alc662_dac_nids,
18084 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18085 .channel_mode = alc662_3ST_6ch_modes,
18086 .input_mux = &alc662_lenovo_101e_capture_source,
18087 .unsol_event = alc662_eeepc_unsol_event,
18088 .setup = alc662_eeepc_ep20_setup,
18089 .init_hook = alc662_eeepc_ep20_inithook,
18092 .mixers = { alc662_ecs_mixer },
18093 .init_verbs = { alc662_init_verbs,
18094 alc662_ecs_init_verbs },
18095 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18096 .dac_nids = alc662_dac_nids,
18097 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18098 .channel_mode = alc662_3ST_2ch_modes,
18099 .unsol_event = alc662_eeepc_unsol_event,
18100 .setup = alc662_eeepc_setup,
18101 .init_hook = alc662_eeepc_inithook,
18103 [ALC663_ASUS_M51VA] = {
18104 .mixers = { alc663_m51va_mixer },
18105 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
18106 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18107 .dac_nids = alc662_dac_nids,
18108 .dig_out_nid = ALC662_DIGOUT_NID,
18109 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18110 .channel_mode = alc662_3ST_2ch_modes,
18111 .unsol_event = alc663_m51va_unsol_event,
18112 .setup = alc663_m51va_setup,
18113 .init_hook = alc663_m51va_inithook,
18115 [ALC663_ASUS_G71V] = {
18116 .mixers = { alc663_g71v_mixer },
18117 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
18118 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18119 .dac_nids = alc662_dac_nids,
18120 .dig_out_nid = ALC662_DIGOUT_NID,
18121 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18122 .channel_mode = alc662_3ST_2ch_modes,
18123 .unsol_event = alc663_g71v_unsol_event,
18124 .setup = alc663_g71v_setup,
18125 .init_hook = alc663_g71v_inithook,
18127 [ALC663_ASUS_H13] = {
18128 .mixers = { alc663_m51va_mixer },
18129 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
18130 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18131 .dac_nids = alc662_dac_nids,
18132 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18133 .channel_mode = alc662_3ST_2ch_modes,
18134 .unsol_event = alc663_m51va_unsol_event,
18135 .init_hook = alc663_m51va_inithook,
18137 [ALC663_ASUS_G50V] = {
18138 .mixers = { alc663_g50v_mixer },
18139 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
18140 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18141 .dac_nids = alc662_dac_nids,
18142 .dig_out_nid = ALC662_DIGOUT_NID,
18143 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18144 .channel_mode = alc662_3ST_6ch_modes,
18145 .input_mux = &alc663_capture_source,
18146 .unsol_event = alc663_g50v_unsol_event,
18147 .setup = alc663_g50v_setup,
18148 .init_hook = alc663_g50v_inithook,
18150 [ALC663_ASUS_MODE1] = {
18151 .mixers = { alc663_m51va_mixer },
18152 .cap_mixer = alc662_auto_capture_mixer,
18153 .init_verbs = { alc662_init_verbs,
18154 alc663_21jd_amic_init_verbs },
18155 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18157 .dac_nids = alc662_dac_nids,
18158 .dig_out_nid = ALC662_DIGOUT_NID,
18159 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18160 .channel_mode = alc662_3ST_2ch_modes,
18161 .unsol_event = alc663_mode1_unsol_event,
18162 .setup = alc663_mode1_setup,
18163 .init_hook = alc663_mode1_inithook,
18165 [ALC662_ASUS_MODE2] = {
18166 .mixers = { alc662_1bjd_mixer },
18167 .cap_mixer = alc662_auto_capture_mixer,
18168 .init_verbs = { alc662_init_verbs,
18169 alc662_1bjd_amic_init_verbs },
18170 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18171 .dac_nids = alc662_dac_nids,
18172 .dig_out_nid = ALC662_DIGOUT_NID,
18173 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18174 .channel_mode = alc662_3ST_2ch_modes,
18175 .unsol_event = alc662_mode2_unsol_event,
18176 .setup = alc662_mode2_setup,
18177 .init_hook = alc662_mode2_inithook,
18179 [ALC663_ASUS_MODE3] = {
18180 .mixers = { alc663_two_hp_m1_mixer },
18181 .cap_mixer = alc662_auto_capture_mixer,
18182 .init_verbs = { alc662_init_verbs,
18183 alc663_two_hp_amic_m1_init_verbs },
18184 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18186 .dac_nids = alc662_dac_nids,
18187 .dig_out_nid = ALC662_DIGOUT_NID,
18188 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18189 .channel_mode = alc662_3ST_2ch_modes,
18190 .unsol_event = alc663_mode3_unsol_event,
18191 .setup = alc663_mode3_setup,
18192 .init_hook = alc663_mode3_inithook,
18194 [ALC663_ASUS_MODE4] = {
18195 .mixers = { alc663_asus_21jd_clfe_mixer },
18196 .cap_mixer = alc662_auto_capture_mixer,
18197 .init_verbs = { alc662_init_verbs,
18198 alc663_21jd_amic_init_verbs},
18199 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18201 .dac_nids = alc662_dac_nids,
18202 .dig_out_nid = ALC662_DIGOUT_NID,
18203 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18204 .channel_mode = alc662_3ST_2ch_modes,
18205 .unsol_event = alc663_mode4_unsol_event,
18206 .setup = alc663_mode4_setup,
18207 .init_hook = alc663_mode4_inithook,
18209 [ALC663_ASUS_MODE5] = {
18210 .mixers = { alc663_asus_15jd_clfe_mixer },
18211 .cap_mixer = alc662_auto_capture_mixer,
18212 .init_verbs = { alc662_init_verbs,
18213 alc663_15jd_amic_init_verbs },
18214 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18216 .dac_nids = alc662_dac_nids,
18217 .dig_out_nid = ALC662_DIGOUT_NID,
18218 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18219 .channel_mode = alc662_3ST_2ch_modes,
18220 .unsol_event = alc663_mode5_unsol_event,
18221 .setup = alc663_mode5_setup,
18222 .init_hook = alc663_mode5_inithook,
18224 [ALC663_ASUS_MODE6] = {
18225 .mixers = { alc663_two_hp_m2_mixer },
18226 .cap_mixer = alc662_auto_capture_mixer,
18227 .init_verbs = { alc662_init_verbs,
18228 alc663_two_hp_amic_m2_init_verbs },
18229 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18231 .dac_nids = alc662_dac_nids,
18232 .dig_out_nid = ALC662_DIGOUT_NID,
18233 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18234 .channel_mode = alc662_3ST_2ch_modes,
18235 .unsol_event = alc663_mode6_unsol_event,
18236 .setup = alc663_mode6_setup,
18237 .init_hook = alc663_mode6_inithook,
18239 [ALC663_ASUS_MODE7] = {
18240 .mixers = { alc663_mode7_mixer },
18241 .cap_mixer = alc662_auto_capture_mixer,
18242 .init_verbs = { alc662_init_verbs,
18243 alc663_mode7_init_verbs },
18244 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18246 .dac_nids = alc662_dac_nids,
18247 .dig_out_nid = ALC662_DIGOUT_NID,
18248 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18249 .channel_mode = alc662_3ST_2ch_modes,
18250 .unsol_event = alc663_mode7_unsol_event,
18251 .setup = alc663_mode7_setup,
18252 .init_hook = alc663_mode7_inithook,
18254 [ALC663_ASUS_MODE8] = {
18255 .mixers = { alc663_mode8_mixer },
18256 .cap_mixer = alc662_auto_capture_mixer,
18257 .init_verbs = { alc662_init_verbs,
18258 alc663_mode8_init_verbs },
18259 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18261 .dac_nids = alc662_dac_nids,
18262 .dig_out_nid = ALC662_DIGOUT_NID,
18263 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18264 .channel_mode = alc662_3ST_2ch_modes,
18265 .unsol_event = alc663_mode8_unsol_event,
18266 .setup = alc663_mode8_setup,
18267 .init_hook = alc663_mode8_inithook,
18270 .mixers = { alc663_m51va_mixer },
18271 .cap_mixer = alc272_auto_capture_mixer,
18272 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
18273 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18274 .dac_nids = alc662_dac_nids,
18275 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18276 .adc_nids = alc272_adc_nids,
18277 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
18278 .capsrc_nids = alc272_capsrc_nids,
18279 .channel_mode = alc662_3ST_2ch_modes,
18280 .unsol_event = alc663_m51va_unsol_event,
18281 .setup = alc663_m51va_setup,
18282 .init_hook = alc663_m51va_inithook,
18284 [ALC272_DELL_ZM1] = {
18285 .mixers = { alc663_m51va_mixer },
18286 .cap_mixer = alc662_auto_capture_mixer,
18287 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
18288 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18289 .dac_nids = alc662_dac_nids,
18290 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18291 .adc_nids = alc662_adc_nids,
18293 .capsrc_nids = alc662_capsrc_nids,
18294 .channel_mode = alc662_3ST_2ch_modes,
18295 .unsol_event = alc663_m51va_unsol_event,
18296 .setup = alc663_m51va_setup,
18297 .init_hook = alc663_m51va_inithook,
18299 [ALC272_SAMSUNG_NC10] = {
18300 .mixers = { alc272_nc10_mixer },
18301 .init_verbs = { alc662_init_verbs,
18302 alc663_21jd_amic_init_verbs },
18303 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18304 .dac_nids = alc272_dac_nids,
18305 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18306 .channel_mode = alc662_3ST_2ch_modes,
18307 /*.input_mux = &alc272_nc10_capture_source,*/
18308 .unsol_event = alc663_mode4_unsol_event,
18309 .setup = alc663_mode4_setup,
18310 .init_hook = alc663_mode4_inithook,
18316 * BIOS auto configuration
18319 /* convert from MIX nid to DAC */
18320 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
18324 else if (nid >= 0x0c && nid <= 0x0e)
18325 return nid - 0x0c + 0x02;
18330 /* get MIX nid connected to the given pin targeted to DAC */
18331 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
18337 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
18338 for (i = 0; i < num; i++) {
18339 if (alc662_mix_to_dac(mix[i]) == dac)
18345 /* look for an empty DAC slot */
18346 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
18348 struct alc_spec *spec = codec->spec;
18352 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
18355 for (i = 0; i < num; i++) {
18356 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
18359 for (j = 0; j < spec->multiout.num_dacs; j++)
18360 if (spec->multiout.dac_nids[j] == nid)
18362 if (j >= spec->multiout.num_dacs)
18368 /* fill in the dac_nids table from the parsed pin configuration */
18369 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
18370 const struct auto_pin_cfg *cfg)
18372 struct alc_spec *spec = codec->spec;
18376 spec->multiout.dac_nids = spec->private_dac_nids;
18377 for (i = 0; i < cfg->line_outs; i++) {
18378 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
18381 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
18386 static inline int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
18387 hda_nid_t nid, unsigned int chs)
18389 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
18390 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
18393 static inline int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
18394 hda_nid_t nid, unsigned int chs)
18396 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
18397 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
18400 #define alc662_add_stereo_vol(spec, pfx, nid) \
18401 alc662_add_vol_ctl(spec, pfx, nid, 3)
18402 #define alc662_add_stereo_sw(spec, pfx, nid) \
18403 alc662_add_sw_ctl(spec, pfx, nid, 3)
18405 /* add playback controls from the parsed DAC table */
18406 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
18407 const struct auto_pin_cfg *cfg)
18409 struct alc_spec *spec = codec->spec;
18410 static const char *chname[4] = {
18411 "Front", "Surround", NULL /*CLFE*/, "Side"
18413 hda_nid_t nid, mix;
18416 for (i = 0; i < cfg->line_outs; i++) {
18417 nid = spec->multiout.dac_nids[i];
18420 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
18425 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
18428 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
18431 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
18434 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
18439 if (cfg->line_outs == 1 &&
18440 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
18447 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
18450 if (cfg->line_outs == 1 &&
18451 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
18453 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
18461 /* add playback controls for speaker and HP outputs */
18462 /* return DAC nid if any new DAC is assigned */
18463 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
18466 struct alc_spec *spec = codec->spec;
18467 hda_nid_t nid, mix;
18472 nid = alc662_look_for_dac(codec, pin);
18474 /* the corresponding DAC is already occupied */
18475 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
18476 return 0; /* no way */
18477 /* create a switch only */
18478 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
18479 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
18482 mix = alc662_dac_to_mix(codec, pin, nid);
18485 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
18488 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
18494 /* create playback/capture controls for input pins */
18495 #define alc662_auto_create_input_ctls \
18496 alc882_auto_create_input_ctls
18498 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
18499 hda_nid_t nid, int pin_type,
18505 alc_set_pin_output(codec, nid, pin_type);
18506 /* need the manual connection? */
18507 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
18510 for (i = 0; i < num; i++) {
18511 if (alc662_mix_to_dac(srcs[i]) != dac)
18513 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
18518 static void alc662_auto_init_multi_out(struct hda_codec *codec)
18520 struct alc_spec *spec = codec->spec;
18521 int pin_type = get_pin_type(spec->autocfg.line_out_type);
18524 for (i = 0; i <= HDA_SIDE; i++) {
18525 hda_nid_t nid = spec->autocfg.line_out_pins[i];
18527 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
18528 spec->multiout.dac_nids[i]);
18532 static void alc662_auto_init_hp_out(struct hda_codec *codec)
18534 struct alc_spec *spec = codec->spec;
18537 pin = spec->autocfg.hp_pins[0];
18539 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
18540 spec->multiout.hp_nid);
18541 pin = spec->autocfg.speaker_pins[0];
18543 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
18544 spec->multiout.extra_out_nid[0]);
18547 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
18549 static void alc662_auto_init_analog_input(struct hda_codec *codec)
18551 struct alc_spec *spec = codec->spec;
18554 for (i = 0; i < AUTO_PIN_LAST; i++) {
18555 hda_nid_t nid = spec->autocfg.input_pins[i];
18556 if (alc_is_input_pin(codec, nid)) {
18557 alc_set_input_pin(codec, nid, i);
18558 if (nid != ALC662_PIN_CD_NID &&
18559 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
18560 snd_hda_codec_write(codec, nid, 0,
18561 AC_VERB_SET_AMP_GAIN_MUTE,
18567 #define alc662_auto_init_input_src alc882_auto_init_input_src
18569 static int alc662_parse_auto_config(struct hda_codec *codec)
18571 struct alc_spec *spec = codec->spec;
18573 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
18575 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
18579 if (!spec->autocfg.line_outs)
18580 return 0; /* can't find valid BIOS pin config */
18582 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
18585 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
18588 err = alc662_auto_create_extra_out(codec,
18589 spec->autocfg.speaker_pins[0],
18594 spec->multiout.extra_out_nid[0] = err;
18595 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
18600 spec->multiout.hp_nid = err;
18601 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
18605 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
18607 if (spec->autocfg.dig_outs)
18608 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
18610 if (spec->kctls.list)
18611 add_mixer(spec, spec->kctls.list);
18613 spec->num_mux_defs = 1;
18614 spec->input_mux = &spec->private_imux[0];
18616 add_verb(spec, alc662_init_verbs);
18617 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
18618 codec->vendor_id == 0x10ec0665)
18619 add_verb(spec, alc663_init_verbs);
18621 if (codec->vendor_id == 0x10ec0272)
18622 add_verb(spec, alc272_init_verbs);
18624 err = alc_auto_add_mic_boost(codec);
18628 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
18629 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
18630 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21);
18632 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
18637 /* additional initialization for auto-configuration model */
18638 static void alc662_auto_init(struct hda_codec *codec)
18640 struct alc_spec *spec = codec->spec;
18641 alc662_auto_init_multi_out(codec);
18642 alc662_auto_init_hp_out(codec);
18643 alc662_auto_init_analog_input(codec);
18644 alc662_auto_init_input_src(codec);
18645 if (spec->unsol_event)
18646 alc_inithook(codec);
18649 static int patch_alc662(struct hda_codec *codec)
18651 struct alc_spec *spec;
18652 int err, board_config;
18654 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
18658 codec->spec = spec;
18660 alc_auto_parse_customize_define(codec);
18662 alc_fix_pll_init(codec, 0x20, 0x04, 15);
18664 if (alc_read_coef_idx(codec, 0) == 0x8020)
18665 alc_codec_rename(codec, "ALC661");
18666 else if ((alc_read_coef_idx(codec, 0) & (1 << 14)) &&
18667 codec->bus->pci->subsystem_vendor == 0x1025 &&
18668 spec->cdefine.platform_type == 1)
18669 alc_codec_rename(codec, "ALC272X");
18671 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
18674 if (board_config < 0) {
18675 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
18677 board_config = ALC662_AUTO;
18680 if (board_config == ALC662_AUTO) {
18681 /* automatic parse from the BIOS config */
18682 err = alc662_parse_auto_config(codec);
18688 "hda_codec: Cannot set up configuration "
18689 "from BIOS. Using base mode...\n");
18690 board_config = ALC662_3ST_2ch_DIG;
18694 err = snd_hda_attach_beep_device(codec, 0x1);
18700 if (board_config != ALC662_AUTO)
18701 setup_preset(codec, &alc662_presets[board_config]);
18703 spec->stream_analog_playback = &alc662_pcm_analog_playback;
18704 spec->stream_analog_capture = &alc662_pcm_analog_capture;
18706 spec->stream_digital_playback = &alc662_pcm_digital_playback;
18707 spec->stream_digital_capture = &alc662_pcm_digital_capture;
18709 if (!spec->adc_nids) {
18710 spec->adc_nids = alc662_adc_nids;
18711 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
18713 if (!spec->capsrc_nids)
18714 spec->capsrc_nids = alc662_capsrc_nids;
18716 if (!spec->cap_mixer)
18717 set_capture_mixer(codec);
18719 if (spec->cdefine.enable_pcbeep) {
18720 switch (codec->vendor_id) {
18722 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
18727 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
18730 set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
18734 spec->vmaster_nid = 0x02;
18736 codec->patch_ops = alc_patch_ops;
18737 if (board_config == ALC662_AUTO)
18738 spec->init_hook = alc662_auto_init;
18739 #ifdef CONFIG_SND_HDA_POWER_SAVE
18740 if (!spec->loopback.amplist)
18741 spec->loopback.amplist = alc662_loopbacks;
18747 static int patch_alc888(struct hda_codec *codec)
18749 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
18750 kfree(codec->chip_name);
18751 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
18752 if (!codec->chip_name) {
18756 return patch_alc662(codec);
18758 return patch_alc882(codec);
18764 static struct hda_codec_preset snd_hda_preset_realtek[] = {
18765 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
18766 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
18767 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
18768 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
18769 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
18770 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
18771 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
18772 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
18773 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
18774 .patch = patch_alc861 },
18775 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
18776 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
18777 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
18778 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
18779 .patch = patch_alc882 },
18780 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
18781 .patch = patch_alc662 },
18782 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
18783 { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
18784 { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
18785 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
18786 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
18787 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
18788 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
18789 .patch = patch_alc882 },
18790 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
18791 .patch = patch_alc882 },
18792 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
18793 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
18794 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
18795 .patch = patch_alc882 },
18796 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
18797 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
18798 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
18799 {} /* terminator */
18802 MODULE_ALIAS("snd-hda-codec-id:10ec*");
18804 MODULE_LICENSE("GPL");
18805 MODULE_DESCRIPTION("Realtek HD-audio codec");
18807 static struct hda_codec_preset_list realtek_list = {
18808 .preset = snd_hda_preset_realtek,
18809 .owner = THIS_MODULE,
18812 static int __init patch_realtek_init(void)
18814 return snd_hda_add_codec_preset(&realtek_list);
18817 static void __exit patch_realtek_exit(void)
18819 snd_hda_delete_codec_preset(&realtek_list);
18822 module_init(patch_realtek_init)
18823 module_exit(patch_realtek_exit)