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)
1464 const struct alc_pincfg *cfg;
1466 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1470 fix += quirk->value;
1473 for (; cfg->nid; cfg++)
1474 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1477 add_verb(codec->spec, fix->verbs);
1480 static int alc_read_coef_idx(struct hda_codec *codec,
1481 unsigned int coef_idx)
1484 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX,
1486 val = snd_hda_codec_read(codec, 0x20, 0,
1487 AC_VERB_GET_PROC_COEF, 0);
1498 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1499 /* Mic-in jack as mic in */
1500 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1501 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1502 /* Line-in jack as Line in */
1503 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1504 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1505 /* Line-Out as Front */
1506 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1513 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1514 /* Mic-in jack as mic in */
1515 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1516 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1517 /* Line-in jack as Surround */
1518 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1519 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1520 /* Line-Out as Front */
1521 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1528 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1529 /* Mic-in jack as CLFE */
1530 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1531 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1532 /* Line-in jack as Surround */
1533 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1534 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1535 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1536 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1543 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1544 /* Mic-in jack as CLFE */
1545 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1546 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1547 /* Line-in jack as Surround */
1548 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1549 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1550 /* Line-Out as Side */
1551 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1555 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1556 { 2, alc888_4ST_ch2_intel_init },
1557 { 4, alc888_4ST_ch4_intel_init },
1558 { 6, alc888_4ST_ch6_intel_init },
1559 { 8, alc888_4ST_ch8_intel_init },
1563 * ALC888 Fujitsu Siemens Amillo xa3530
1566 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1567 /* Front Mic: set to PIN_IN (empty by default) */
1568 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1569 /* Connect Internal HP to Front */
1570 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1571 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1572 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1573 /* Connect Bass HP to Front */
1574 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1575 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1576 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1577 /* Connect Line-Out side jack (SPDIF) to Side */
1578 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1579 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1580 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1581 /* Connect Mic jack to CLFE */
1582 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1583 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1584 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1585 /* Connect Line-in jack to Surround */
1586 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1587 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1588 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1589 /* Connect HP out jack to Front */
1590 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1591 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1592 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1593 /* Enable unsolicited event for HP jack and Line-out jack */
1594 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1595 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1599 static void alc_automute_amp(struct hda_codec *codec)
1601 struct alc_spec *spec = codec->spec;
1606 spec->jack_present = 0;
1607 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
1608 nid = spec->autocfg.hp_pins[i];
1611 if (snd_hda_jack_detect(codec, nid)) {
1612 spec->jack_present = 1;
1617 mute = spec->jack_present ? HDA_AMP_MUTE : 0;
1618 /* Toggle internal speakers muting */
1619 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1620 nid = spec->autocfg.speaker_pins[i];
1623 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1624 HDA_AMP_MUTE, mute);
1628 static void alc_automute_amp_unsol_event(struct hda_codec *codec,
1631 if (codec->vendor_id == 0x10ec0880)
1635 if (res == ALC880_HP_EVENT)
1636 alc_automute_amp(codec);
1639 static void alc889_automute_setup(struct hda_codec *codec)
1641 struct alc_spec *spec = codec->spec;
1643 spec->autocfg.hp_pins[0] = 0x15;
1644 spec->autocfg.speaker_pins[0] = 0x14;
1645 spec->autocfg.speaker_pins[1] = 0x16;
1646 spec->autocfg.speaker_pins[2] = 0x17;
1647 spec->autocfg.speaker_pins[3] = 0x19;
1648 spec->autocfg.speaker_pins[4] = 0x1a;
1651 static void alc889_intel_init_hook(struct hda_codec *codec)
1653 alc889_coef_init(codec);
1654 alc_automute_amp(codec);
1657 static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec)
1659 struct alc_spec *spec = codec->spec;
1661 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
1662 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
1663 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
1664 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
1668 * ALC888 Acer Aspire 4930G model
1671 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1672 /* Front Mic: set to PIN_IN (empty by default) */
1673 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1674 /* Unselect Front Mic by default in input mixer 3 */
1675 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1676 /* Enable unsolicited event for HP jack */
1677 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1678 /* Connect Internal HP to front */
1679 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1680 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1681 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1682 /* Connect HP out to front */
1683 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1684 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1685 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1690 * ALC888 Acer Aspire 6530G model
1693 static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
1694 /* Route to built-in subwoofer as well as speakers */
1695 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1696 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1697 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1698 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1699 /* Bias voltage on for external mic port */
1700 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
1701 /* Front Mic: set to PIN_IN (empty by default) */
1702 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1703 /* Unselect Front Mic by default in input mixer 3 */
1704 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1705 /* Enable unsolicited event for HP jack */
1706 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1707 /* Enable speaker output */
1708 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1709 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1710 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
1711 /* Enable headphone output */
1712 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1713 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1714 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1715 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
1720 * ALC889 Acer Aspire 8930G model
1723 static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
1724 /* Front Mic: set to PIN_IN (empty by default) */
1725 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1726 /* Unselect Front Mic by default in input mixer 3 */
1727 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1728 /* Enable unsolicited event for HP jack */
1729 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1730 /* Connect Internal Front to Front */
1731 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1732 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1733 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1734 /* Connect Internal Rear to Rear */
1735 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1736 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1737 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
1738 /* Connect Internal CLFE to CLFE */
1739 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1740 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1741 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
1742 /* Connect HP out to Front */
1743 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1744 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1745 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1746 /* Enable all DACs */
1747 /* DAC DISABLE/MUTE 1? */
1748 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
1749 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
1750 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1751 /* DAC DISABLE/MUTE 2? */
1752 /* some bit here disables the other DACs. Init=0x4900 */
1753 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
1754 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1756 * This laptop has a stereo digital microphone. The mics are only 1cm apart
1757 * which makes the stereo useless. However, either the mic or the ALC889
1758 * makes the signal become a difference/sum signal instead of standard
1759 * stereo, which is annoying. So instead we flip this bit which makes the
1760 * codec replicate the sum signal to both channels, turning it into a
1763 /* DMIC_CONTROL? Init value = 0x0001 */
1764 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
1765 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
1769 static struct hda_input_mux alc888_2_capture_sources[2] = {
1770 /* Front mic only available on one ADC */
1777 { "Front Mic", 0xb },
1790 static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
1791 /* Interal mic only available on one ADC */
1798 { "Input Mix", 0xa },
1808 { "Input Mix", 0xa },
1813 static struct hda_input_mux alc889_capture_sources[3] = {
1814 /* Digital mic only available on first "ADC" */
1821 { "Front Mic", 0xb },
1822 { "Input Mix", 0xa },
1831 { "Input Mix", 0xa },
1840 { "Input Mix", 0xa },
1845 static struct snd_kcontrol_new alc888_base_mixer[] = {
1846 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1847 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1848 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1849 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1850 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1852 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1853 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1854 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1855 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1856 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1857 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1858 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1859 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1860 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1861 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1862 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1863 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1867 static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = {
1868 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1869 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1870 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1871 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1872 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1874 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1875 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1876 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1877 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1878 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1879 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1880 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1881 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1886 static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
1888 struct alc_spec *spec = codec->spec;
1890 spec->autocfg.hp_pins[0] = 0x15;
1891 spec->autocfg.speaker_pins[0] = 0x14;
1892 spec->autocfg.speaker_pins[1] = 0x16;
1893 spec->autocfg.speaker_pins[2] = 0x17;
1896 static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
1898 struct alc_spec *spec = codec->spec;
1900 spec->autocfg.hp_pins[0] = 0x15;
1901 spec->autocfg.speaker_pins[0] = 0x14;
1902 spec->autocfg.speaker_pins[1] = 0x16;
1903 spec->autocfg.speaker_pins[2] = 0x17;
1906 static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
1908 struct alc_spec *spec = codec->spec;
1910 spec->autocfg.hp_pins[0] = 0x15;
1911 spec->autocfg.speaker_pins[0] = 0x14;
1912 spec->autocfg.speaker_pins[1] = 0x16;
1913 spec->autocfg.speaker_pins[2] = 0x1b;
1917 * ALC880 3-stack model
1919 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1920 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1921 * F-Mic = 0x1b, HP = 0x19
1924 static hda_nid_t alc880_dac_nids[4] = {
1925 /* front, rear, clfe, rear_surr */
1926 0x02, 0x05, 0x04, 0x03
1929 static hda_nid_t alc880_adc_nids[3] = {
1934 /* The datasheet says the node 0x07 is connected from inputs,
1935 * but it shows zero connection in the real implementation on some devices.
1936 * Note: this is a 915GAV bug, fixed on 915GLV
1938 static hda_nid_t alc880_adc_nids_alt[2] = {
1943 #define ALC880_DIGOUT_NID 0x06
1944 #define ALC880_DIGIN_NID 0x0a
1946 static struct hda_input_mux alc880_capture_source = {
1950 { "Front Mic", 0x3 },
1956 /* channel source setting (2/6 channel selection for 3-stack) */
1958 static struct hda_verb alc880_threestack_ch2_init[] = {
1959 /* set line-in to input, mute it */
1960 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1961 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1962 /* set mic-in to input vref 80%, mute it */
1963 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1964 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1969 static struct hda_verb alc880_threestack_ch6_init[] = {
1970 /* set line-in to output, unmute it */
1971 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1972 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1973 /* set mic-in to output, unmute it */
1974 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1975 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1979 static struct hda_channel_mode alc880_threestack_modes[2] = {
1980 { 2, alc880_threestack_ch2_init },
1981 { 6, alc880_threestack_ch6_init },
1984 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1985 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1986 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1987 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1988 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1989 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1990 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1991 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1992 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1993 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1994 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1995 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1996 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1997 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1998 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1999 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
2000 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
2001 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
2003 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2004 .name = "Channel Mode",
2005 .info = alc_ch_mode_info,
2006 .get = alc_ch_mode_get,
2007 .put = alc_ch_mode_put,
2012 /* capture mixer elements */
2013 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
2014 struct snd_ctl_elem_info *uinfo)
2016 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2017 struct alc_spec *spec = codec->spec;
2020 mutex_lock(&codec->control_mutex);
2021 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
2023 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
2024 mutex_unlock(&codec->control_mutex);
2028 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
2029 unsigned int size, unsigned int __user *tlv)
2031 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2032 struct alc_spec *spec = codec->spec;
2035 mutex_lock(&codec->control_mutex);
2036 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
2038 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
2039 mutex_unlock(&codec->control_mutex);
2043 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
2044 struct snd_ctl_elem_value *ucontrol);
2046 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
2047 struct snd_ctl_elem_value *ucontrol,
2050 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2051 struct alc_spec *spec = codec->spec;
2052 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
2055 mutex_lock(&codec->control_mutex);
2056 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
2058 err = func(kcontrol, ucontrol);
2059 mutex_unlock(&codec->control_mutex);
2063 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
2064 struct snd_ctl_elem_value *ucontrol)
2066 return alc_cap_getput_caller(kcontrol, ucontrol,
2067 snd_hda_mixer_amp_volume_get);
2070 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
2071 struct snd_ctl_elem_value *ucontrol)
2073 return alc_cap_getput_caller(kcontrol, ucontrol,
2074 snd_hda_mixer_amp_volume_put);
2077 /* capture mixer elements */
2078 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
2080 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
2081 struct snd_ctl_elem_value *ucontrol)
2083 return alc_cap_getput_caller(kcontrol, ucontrol,
2084 snd_hda_mixer_amp_switch_get);
2087 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
2088 struct snd_ctl_elem_value *ucontrol)
2090 return alc_cap_getput_caller(kcontrol, ucontrol,
2091 snd_hda_mixer_amp_switch_put);
2094 #define _DEFINE_CAPMIX(num) \
2096 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2097 .name = "Capture Switch", \
2098 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
2100 .info = alc_cap_sw_info, \
2101 .get = alc_cap_sw_get, \
2102 .put = alc_cap_sw_put, \
2105 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2106 .name = "Capture Volume", \
2107 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
2108 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
2109 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
2111 .info = alc_cap_vol_info, \
2112 .get = alc_cap_vol_get, \
2113 .put = alc_cap_vol_put, \
2114 .tlv = { .c = alc_cap_vol_tlv }, \
2117 #define _DEFINE_CAPSRC(num) \
2119 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2120 /* .name = "Capture Source", */ \
2121 .name = "Input Source", \
2123 .info = alc_mux_enum_info, \
2124 .get = alc_mux_enum_get, \
2125 .put = alc_mux_enum_put, \
2128 #define DEFINE_CAPMIX(num) \
2129 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2130 _DEFINE_CAPMIX(num), \
2131 _DEFINE_CAPSRC(num), \
2135 #define DEFINE_CAPMIX_NOSRC(num) \
2136 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2137 _DEFINE_CAPMIX(num), \
2141 /* up to three ADCs */
2145 DEFINE_CAPMIX_NOSRC(1);
2146 DEFINE_CAPMIX_NOSRC(2);
2147 DEFINE_CAPMIX_NOSRC(3);
2150 * ALC880 5-stack model
2152 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2154 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2155 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2158 /* additional mixers to alc880_three_stack_mixer */
2159 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2160 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2161 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2165 /* channel source setting (6/8 channel selection for 5-stack) */
2167 static struct hda_verb alc880_fivestack_ch6_init[] = {
2168 /* set line-in to input, mute it */
2169 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2170 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2175 static struct hda_verb alc880_fivestack_ch8_init[] = {
2176 /* set line-in to output, unmute it */
2177 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2178 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2182 static struct hda_channel_mode alc880_fivestack_modes[2] = {
2183 { 6, alc880_fivestack_ch6_init },
2184 { 8, alc880_fivestack_ch8_init },
2189 * ALC880 6-stack model
2191 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2192 * Side = 0x05 (0x0f)
2193 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2194 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2197 static hda_nid_t alc880_6st_dac_nids[4] = {
2198 /* front, rear, clfe, rear_surr */
2199 0x02, 0x03, 0x04, 0x05
2202 static struct hda_input_mux alc880_6stack_capture_source = {
2206 { "Front Mic", 0x1 },
2212 /* fixed 8-channels */
2213 static struct hda_channel_mode alc880_sixstack_modes[1] = {
2217 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2218 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2219 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2220 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2221 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2222 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2223 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2224 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2225 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2226 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2227 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2228 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2229 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2230 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2231 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2232 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2233 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2234 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2235 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2237 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2238 .name = "Channel Mode",
2239 .info = alc_ch_mode_info,
2240 .get = alc_ch_mode_get,
2241 .put = alc_ch_mode_put,
2250 * W810 has rear IO for:
2253 * Center/LFE (DAC 04)
2256 * The system also has a pair of internal speakers, and a headphone jack.
2257 * These are both connected to Line2 on the codec, hence to DAC 02.
2259 * There is a variable resistor to control the speaker or headphone
2260 * volume. This is a hardware-only device without a software API.
2262 * Plugging headphones in will disable the internal speakers. This is
2263 * implemented in hardware, not via the driver using jack sense. In
2264 * a similar fashion, plugging into the rear socket marked "front" will
2265 * disable both the speakers and headphones.
2267 * For input, there's a microphone jack, and an "audio in" jack.
2268 * These may not do anything useful with this driver yet, because I
2269 * haven't setup any initialization verbs for these yet...
2272 static hda_nid_t alc880_w810_dac_nids[3] = {
2273 /* front, rear/surround, clfe */
2277 /* fixed 6 channels */
2278 static struct hda_channel_mode alc880_w810_modes[1] = {
2282 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2283 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2284 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2285 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2286 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2287 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2288 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2289 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2290 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2291 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2292 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2300 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2301 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2305 static hda_nid_t alc880_z71v_dac_nids[1] = {
2308 #define ALC880_Z71V_HP_DAC 0x03
2310 /* fixed 2 channels */
2311 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2315 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2316 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2317 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2318 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2319 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2320 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2321 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2322 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2323 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2329 * ALC880 F1734 model
2331 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2332 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2335 static hda_nid_t alc880_f1734_dac_nids[1] = {
2338 #define ALC880_F1734_HP_DAC 0x02
2340 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2341 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2342 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2343 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2344 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2345 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2346 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2347 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2348 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2352 static struct hda_input_mux alc880_f1734_capture_source = {
2364 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2365 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2366 * Mic = 0x18, Line = 0x1a
2369 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2370 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2372 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2373 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2374 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2375 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2376 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2377 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2378 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2379 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2380 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2381 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2382 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2383 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2384 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2385 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2386 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2388 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2389 .name = "Channel Mode",
2390 .info = alc_ch_mode_info,
2391 .get = alc_ch_mode_get,
2392 .put = alc_ch_mode_put,
2398 * ALC880 ASUS W1V model
2400 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2401 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2402 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2405 /* additional mixers to alc880_asus_mixer */
2406 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2407 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2408 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2413 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2414 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2415 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2416 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2417 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2418 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2419 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2420 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2421 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2422 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2427 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2428 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2429 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2430 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2431 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2432 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2433 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2434 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2435 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2436 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2437 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2438 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2439 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2440 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2441 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2442 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2443 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2445 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2446 .name = "Channel Mode",
2447 .info = alc_ch_mode_info,
2448 .get = alc_ch_mode_get,
2449 .put = alc_ch_mode_put,
2454 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2455 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2456 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2457 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2458 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2459 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2460 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2461 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2462 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2463 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2464 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2468 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2469 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2470 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2471 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2472 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2473 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2474 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2479 * virtual master controls
2483 * slave controls for virtual master
2485 static const char *alc_slave_vols[] = {
2486 "Front Playback Volume",
2487 "Surround Playback Volume",
2488 "Center Playback Volume",
2489 "LFE Playback Volume",
2490 "Side Playback Volume",
2491 "Headphone Playback Volume",
2492 "Speaker Playback Volume",
2493 "Mono Playback Volume",
2494 "Line-Out Playback Volume",
2495 "PCM Playback Volume",
2499 static const char *alc_slave_sws[] = {
2500 "Front Playback Switch",
2501 "Surround Playback Switch",
2502 "Center Playback Switch",
2503 "LFE Playback Switch",
2504 "Side Playback Switch",
2505 "Headphone Playback Switch",
2506 "Speaker Playback Switch",
2507 "Mono Playback Switch",
2508 "IEC958 Playback Switch",
2509 "Line-Out Playback Switch",
2510 "PCM Playback Switch",
2515 * build control elements
2518 #define NID_MAPPING (-1)
2520 #define SUBDEV_SPEAKER_ (0 << 6)
2521 #define SUBDEV_HP_ (1 << 6)
2522 #define SUBDEV_LINE_ (2 << 6)
2523 #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f))
2524 #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f))
2525 #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f))
2527 static void alc_free_kctls(struct hda_codec *codec);
2529 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2530 /* additional beep mixers; the actual parameters are overwritten at build */
2531 static struct snd_kcontrol_new alc_beep_mixer[] = {
2532 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2533 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
2538 static int alc_build_controls(struct hda_codec *codec)
2540 struct alc_spec *spec = codec->spec;
2541 struct snd_kcontrol *kctl;
2542 struct snd_kcontrol_new *knew;
2547 for (i = 0; i < spec->num_mixers; i++) {
2548 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2552 if (spec->cap_mixer) {
2553 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2557 if (spec->multiout.dig_out_nid) {
2558 err = snd_hda_create_spdif_out_ctls(codec,
2559 spec->multiout.dig_out_nid);
2562 if (!spec->no_analog) {
2563 err = snd_hda_create_spdif_share_sw(codec,
2567 spec->multiout.share_spdif = 1;
2570 if (spec->dig_in_nid) {
2571 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2576 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2577 /* create beep controls if needed */
2578 if (spec->beep_amp) {
2579 struct snd_kcontrol_new *knew;
2580 for (knew = alc_beep_mixer; knew->name; knew++) {
2581 struct snd_kcontrol *kctl;
2582 kctl = snd_ctl_new1(knew, codec);
2585 kctl->private_value = spec->beep_amp;
2586 err = snd_hda_ctl_add(codec, 0, kctl);
2593 /* if we have no master control, let's create it */
2594 if (!spec->no_analog &&
2595 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2596 unsigned int vmaster_tlv[4];
2597 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2598 HDA_OUTPUT, vmaster_tlv);
2599 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2600 vmaster_tlv, alc_slave_vols);
2604 if (!spec->no_analog &&
2605 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2606 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2607 NULL, alc_slave_sws);
2612 /* assign Capture Source enums to NID */
2613 kctl = snd_hda_find_mixer_ctl(codec, "Capture Source");
2615 kctl = snd_hda_find_mixer_ctl(codec, "Input Source");
2616 for (i = 0; kctl && i < kctl->count; i++) {
2617 hda_nid_t *nids = spec->capsrc_nids;
2619 nids = spec->adc_nids;
2620 err = snd_hda_add_nid(codec, kctl, i, nids[i]);
2624 if (spec->cap_mixer) {
2625 const char *kname = kctl ? kctl->id.name : NULL;
2626 for (knew = spec->cap_mixer; knew->name; knew++) {
2627 if (kname && strcmp(knew->name, kname) == 0)
2629 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2630 for (i = 0; kctl && i < kctl->count; i++) {
2631 err = snd_hda_add_nid(codec, kctl, i,
2639 /* other nid->control mapping */
2640 for (i = 0; i < spec->num_mixers; i++) {
2641 for (knew = spec->mixers[i]; knew->name; knew++) {
2642 if (knew->iface != NID_MAPPING)
2644 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2647 u = knew->subdevice;
2648 for (j = 0; j < 4; j++, u >>= 8) {
2653 case SUBDEV_SPEAKER_:
2654 nid = spec->autocfg.speaker_pins[nid];
2657 nid = spec->autocfg.line_out_pins[nid];
2660 nid = spec->autocfg.hp_pins[nid];
2665 err = snd_hda_add_nid(codec, kctl, 0, nid);
2669 u = knew->private_value;
2670 for (j = 0; j < 4; j++, u >>= 8) {
2674 err = snd_hda_add_nid(codec, kctl, 0, nid);
2681 alc_free_kctls(codec); /* no longer needed */
2688 * initialize the codec volumes, etc
2692 * generic initialization of ADC, input mixers and output mixers
2694 static struct hda_verb alc880_volume_init_verbs[] = {
2696 * Unmute ADC0-2 and set the default input to mic-in
2698 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2699 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2700 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2701 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2702 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2703 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2705 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2707 * Note: PASD motherboards uses the Line In 2 as the input for front
2710 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2711 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2712 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2713 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2714 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2715 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2716 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2717 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2720 * Set up output mixers (0x0c - 0x0f)
2722 /* set vol=0 to output mixers */
2723 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2724 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2725 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2726 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2727 /* set up input amps for analog loopback */
2728 /* Amp Indices: DAC = 0, mixer = 1 */
2729 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2730 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2731 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2732 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2733 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2734 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2735 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2736 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2742 * 3-stack pin configuration:
2743 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2745 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2747 * preset connection lists of input pins
2748 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2750 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2751 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2752 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2755 * Set pin mode and muting
2757 /* set front pin widgets 0x14 for output */
2758 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2759 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2760 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2761 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2762 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2763 /* Mic2 (as headphone out) for HP output */
2764 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2765 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2766 /* Line In pin widget for input */
2767 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2768 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2769 /* Line2 (as front mic) pin widget for input and vref at 80% */
2770 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2771 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2772 /* CD pin widget for input */
2773 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2779 * 5-stack pin configuration:
2780 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2781 * line-in/side = 0x1a, f-mic = 0x1b
2783 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2785 * preset connection lists of input pins
2786 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2788 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2789 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2792 * Set pin mode and muting
2794 /* set pin widgets 0x14-0x17 for output */
2795 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2796 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2797 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2798 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2799 /* unmute pins for output (no gain on this amp) */
2800 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2801 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2802 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2803 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2805 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2806 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2807 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2808 /* Mic2 (as headphone out) for HP output */
2809 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2810 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2811 /* Line In pin widget for input */
2812 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2813 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2814 /* Line2 (as front mic) pin widget for input and vref at 80% */
2815 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2816 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2817 /* CD pin widget for input */
2818 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2824 * W810 pin configuration:
2825 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2827 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2828 /* hphone/speaker input selector: front DAC */
2829 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2831 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2832 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2833 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2834 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2835 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2836 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2838 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2839 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2845 * Z71V pin configuration:
2846 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2848 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2849 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2850 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2851 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2852 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2854 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2855 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2856 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2857 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2863 * 6-stack pin configuration:
2864 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2865 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2867 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2868 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2870 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2871 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2872 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2873 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2874 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2875 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2876 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2877 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2879 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2880 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2881 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2882 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2883 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2884 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2885 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2886 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2887 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2893 * Uniwill pin configuration:
2894 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2897 static struct hda_verb alc880_uniwill_init_verbs[] = {
2898 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2900 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2901 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2902 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2903 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2904 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2905 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2906 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2907 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2908 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2909 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2910 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2911 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2912 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2913 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2915 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2916 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2917 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2918 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2919 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2920 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2921 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2922 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2923 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2925 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2926 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2933 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2935 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2936 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2938 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2939 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2940 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2941 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2942 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2943 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2944 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2945 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2946 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2947 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2948 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2949 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2951 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2952 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2953 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2954 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2955 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2956 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2958 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2959 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2964 static struct hda_verb alc880_beep_init_verbs[] = {
2965 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2969 /* auto-toggle front mic */
2970 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2972 unsigned int present;
2975 present = snd_hda_jack_detect(codec, 0x18);
2976 bits = present ? HDA_AMP_MUTE : 0;
2977 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2980 static void alc880_uniwill_setup(struct hda_codec *codec)
2982 struct alc_spec *spec = codec->spec;
2984 spec->autocfg.hp_pins[0] = 0x14;
2985 spec->autocfg.speaker_pins[0] = 0x15;
2986 spec->autocfg.speaker_pins[0] = 0x16;
2989 static void alc880_uniwill_init_hook(struct hda_codec *codec)
2991 alc_automute_amp(codec);
2992 alc880_uniwill_mic_automute(codec);
2995 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2998 /* Looks like the unsol event is incompatible with the standard
2999 * definition. 4bit tag is placed at 28 bit!
3001 switch (res >> 28) {
3002 case ALC880_MIC_EVENT:
3003 alc880_uniwill_mic_automute(codec);
3006 alc_automute_amp_unsol_event(codec, res);
3011 static void alc880_uniwill_p53_setup(struct hda_codec *codec)
3013 struct alc_spec *spec = codec->spec;
3015 spec->autocfg.hp_pins[0] = 0x14;
3016 spec->autocfg.speaker_pins[0] = 0x15;
3019 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
3021 unsigned int present;
3023 present = snd_hda_codec_read(codec, 0x21, 0,
3024 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
3025 present &= HDA_AMP_VOLMASK;
3026 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
3027 HDA_AMP_VOLMASK, present);
3028 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
3029 HDA_AMP_VOLMASK, present);
3032 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
3035 /* Looks like the unsol event is incompatible with the standard
3036 * definition. 4bit tag is placed at 28 bit!
3038 if ((res >> 28) == ALC880_DCVOL_EVENT)
3039 alc880_uniwill_p53_dcvol_automute(codec);
3041 alc_automute_amp_unsol_event(codec, res);
3045 * F1734 pin configuration:
3046 * HP = 0x14, speaker-out = 0x15, mic = 0x18
3048 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
3049 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
3050 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3051 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3052 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3053 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3055 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3056 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3057 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3058 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3060 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3061 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3062 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
3063 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3064 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3065 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3066 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3067 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3068 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3070 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
3071 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
3077 * ASUS pin configuration:
3078 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
3080 static struct hda_verb alc880_pin_asus_init_verbs[] = {
3081 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3082 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3083 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3084 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3086 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3087 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3088 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3089 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3090 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3091 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3092 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3093 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3095 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3096 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3097 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3098 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3099 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3100 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3101 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3102 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3103 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3108 /* Enable GPIO mask and set output */
3109 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
3110 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
3111 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
3113 /* Clevo m520g init */
3114 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
3115 /* headphone output */
3116 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3118 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3119 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3121 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3122 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3124 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3125 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3126 /* Mic1 (rear panel) */
3127 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3128 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3129 /* Mic2 (front panel) */
3130 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3131 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3133 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3134 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3135 /* change to EAPD mode */
3136 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3137 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3142 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
3143 /* change to EAPD mode */
3144 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3145 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3147 /* Headphone output */
3148 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3150 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3151 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
3153 /* Line In pin widget for input */
3154 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3155 /* CD pin widget for input */
3156 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3157 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3158 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3160 /* change to EAPD mode */
3161 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3162 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
3168 * LG m1 express dual
3171 * Rear Line-In/Out (blue): 0x14
3172 * Build-in Mic-In: 0x15
3174 * HP-Out (green): 0x1b
3175 * Mic-In/Out (red): 0x19
3179 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
3180 static hda_nid_t alc880_lg_dac_nids[3] = {
3184 /* seems analog CD is not working */
3185 static struct hda_input_mux alc880_lg_capture_source = {
3190 { "Internal Mic", 0x6 },
3194 /* 2,4,6 channel modes */
3195 static struct hda_verb alc880_lg_ch2_init[] = {
3196 /* set line-in and mic-in to input */
3197 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
3198 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3202 static struct hda_verb alc880_lg_ch4_init[] = {
3203 /* set line-in to out and mic-in to input */
3204 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3205 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3209 static struct hda_verb alc880_lg_ch6_init[] = {
3210 /* set line-in and mic-in to output */
3211 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3212 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3216 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
3217 { 2, alc880_lg_ch2_init },
3218 { 4, alc880_lg_ch4_init },
3219 { 6, alc880_lg_ch6_init },
3222 static struct snd_kcontrol_new alc880_lg_mixer[] = {
3223 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3224 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3225 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3226 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3227 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3228 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3229 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3230 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3231 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3232 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3233 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3234 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3235 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3236 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3238 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3239 .name = "Channel Mode",
3240 .info = alc_ch_mode_info,
3241 .get = alc_ch_mode_get,
3242 .put = alc_ch_mode_put,
3247 static struct hda_verb alc880_lg_init_verbs[] = {
3248 /* set capture source to mic-in */
3249 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3250 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3251 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3252 /* mute all amp mixer inputs */
3253 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3254 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3255 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3256 /* line-in to input */
3257 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3258 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3260 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3261 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3263 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3264 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3265 /* mic-in to input */
3266 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3267 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3268 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3270 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3271 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3272 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3274 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3278 /* toggle speaker-output according to the hp-jack state */
3279 static void alc880_lg_setup(struct hda_codec *codec)
3281 struct alc_spec *spec = codec->spec;
3283 spec->autocfg.hp_pins[0] = 0x1b;
3284 spec->autocfg.speaker_pins[0] = 0x17;
3293 * Built-in Mic-In: 0x19
3299 static struct hda_input_mux alc880_lg_lw_capture_source = {
3303 { "Internal Mic", 0x1 },
3308 #define alc880_lg_lw_modes alc880_threestack_modes
3310 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3311 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3312 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3313 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3314 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3315 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3316 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3317 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3318 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3319 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3320 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3321 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3322 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3323 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
3324 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
3326 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3327 .name = "Channel Mode",
3328 .info = alc_ch_mode_info,
3329 .get = alc_ch_mode_get,
3330 .put = alc_ch_mode_put,
3335 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3336 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3337 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3338 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3340 /* set capture source to mic-in */
3341 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3342 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3343 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3344 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3346 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3347 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3349 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3350 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3351 /* mic-in to input */
3352 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3353 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3355 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3356 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3358 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3362 /* toggle speaker-output according to the hp-jack state */
3363 static void alc880_lg_lw_setup(struct hda_codec *codec)
3365 struct alc_spec *spec = codec->spec;
3367 spec->autocfg.hp_pins[0] = 0x1b;
3368 spec->autocfg.speaker_pins[0] = 0x14;
3371 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3372 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3373 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3374 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3375 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3376 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3377 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3381 static struct hda_input_mux alc880_medion_rim_capture_source = {
3385 { "Internal Mic", 0x1 },
3389 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3390 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3392 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3393 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3395 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3396 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3397 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3398 /* Mic2 (as headphone out) for HP output */
3399 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3400 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3401 /* Internal Speaker */
3402 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3403 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3405 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3406 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3408 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3412 /* toggle speaker-output according to the hp-jack state */
3413 static void alc880_medion_rim_automute(struct hda_codec *codec)
3415 struct alc_spec *spec = codec->spec;
3416 alc_automute_amp(codec);
3418 if (spec->jack_present)
3419 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3421 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3424 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3427 /* Looks like the unsol event is incompatible with the standard
3428 * definition. 4bit tag is placed at 28 bit!
3430 if ((res >> 28) == ALC880_HP_EVENT)
3431 alc880_medion_rim_automute(codec);
3434 static void alc880_medion_rim_setup(struct hda_codec *codec)
3436 struct alc_spec *spec = codec->spec;
3438 spec->autocfg.hp_pins[0] = 0x14;
3439 spec->autocfg.speaker_pins[0] = 0x1b;
3442 #ifdef CONFIG_SND_HDA_POWER_SAVE
3443 static struct hda_amp_list alc880_loopbacks[] = {
3444 { 0x0b, HDA_INPUT, 0 },
3445 { 0x0b, HDA_INPUT, 1 },
3446 { 0x0b, HDA_INPUT, 2 },
3447 { 0x0b, HDA_INPUT, 3 },
3448 { 0x0b, HDA_INPUT, 4 },
3452 static struct hda_amp_list alc880_lg_loopbacks[] = {
3453 { 0x0b, HDA_INPUT, 1 },
3454 { 0x0b, HDA_INPUT, 6 },
3455 { 0x0b, HDA_INPUT, 7 },
3464 static int alc_init(struct hda_codec *codec)
3466 struct alc_spec *spec = codec->spec;
3470 alc_auto_init_amp(codec, spec->init_amp);
3472 for (i = 0; i < spec->num_init_verbs; i++)
3473 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3475 if (spec->init_hook)
3476 spec->init_hook(codec);
3478 #ifdef CONFIG_SND_HDA_POWER_SAVE
3479 if (codec->patch_ops.check_power_status)
3480 codec->patch_ops.check_power_status(codec, 0x01);
3485 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3487 struct alc_spec *spec = codec->spec;
3489 if (spec->unsol_event)
3490 spec->unsol_event(codec, res);
3493 #ifdef CONFIG_SND_HDA_POWER_SAVE
3494 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3496 struct alc_spec *spec = codec->spec;
3497 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3502 * Analog playback callbacks
3504 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3505 struct hda_codec *codec,
3506 struct snd_pcm_substream *substream)
3508 struct alc_spec *spec = codec->spec;
3509 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3513 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3514 struct hda_codec *codec,
3515 unsigned int stream_tag,
3516 unsigned int format,
3517 struct snd_pcm_substream *substream)
3519 struct alc_spec *spec = codec->spec;
3520 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3521 stream_tag, format, substream);
3524 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3525 struct hda_codec *codec,
3526 struct snd_pcm_substream *substream)
3528 struct alc_spec *spec = codec->spec;
3529 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3535 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3536 struct hda_codec *codec,
3537 struct snd_pcm_substream *substream)
3539 struct alc_spec *spec = codec->spec;
3540 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3543 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3544 struct hda_codec *codec,
3545 unsigned int stream_tag,
3546 unsigned int format,
3547 struct snd_pcm_substream *substream)
3549 struct alc_spec *spec = codec->spec;
3550 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3551 stream_tag, format, substream);
3554 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3555 struct hda_codec *codec,
3556 struct snd_pcm_substream *substream)
3558 struct alc_spec *spec = codec->spec;
3559 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3562 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3563 struct hda_codec *codec,
3564 struct snd_pcm_substream *substream)
3566 struct alc_spec *spec = codec->spec;
3567 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3573 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3574 struct hda_codec *codec,
3575 unsigned int stream_tag,
3576 unsigned int format,
3577 struct snd_pcm_substream *substream)
3579 struct alc_spec *spec = codec->spec;
3581 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3582 stream_tag, 0, format);
3586 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3587 struct hda_codec *codec,
3588 struct snd_pcm_substream *substream)
3590 struct alc_spec *spec = codec->spec;
3592 snd_hda_codec_cleanup_stream(codec,
3593 spec->adc_nids[substream->number + 1]);
3600 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3604 /* NID is set in alc_build_pcms */
3606 .open = alc880_playback_pcm_open,
3607 .prepare = alc880_playback_pcm_prepare,
3608 .cleanup = alc880_playback_pcm_cleanup
3612 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3616 /* NID is set in alc_build_pcms */
3619 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3623 /* NID is set in alc_build_pcms */
3626 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3627 .substreams = 2, /* can be overridden */
3630 /* NID is set in alc_build_pcms */
3632 .prepare = alc880_alt_capture_pcm_prepare,
3633 .cleanup = alc880_alt_capture_pcm_cleanup
3637 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3641 /* NID is set in alc_build_pcms */
3643 .open = alc880_dig_playback_pcm_open,
3644 .close = alc880_dig_playback_pcm_close,
3645 .prepare = alc880_dig_playback_pcm_prepare,
3646 .cleanup = alc880_dig_playback_pcm_cleanup
3650 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3654 /* NID is set in alc_build_pcms */
3657 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3658 static struct hda_pcm_stream alc_pcm_null_stream = {
3664 static int alc_build_pcms(struct hda_codec *codec)
3666 struct alc_spec *spec = codec->spec;
3667 struct hda_pcm *info = spec->pcm_rec;
3670 codec->num_pcms = 1;
3671 codec->pcm_info = info;
3673 if (spec->no_analog)
3676 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
3677 "%s Analog", codec->chip_name);
3678 info->name = spec->stream_name_analog;
3680 if (spec->stream_analog_playback) {
3681 if (snd_BUG_ON(!spec->multiout.dac_nids))
3683 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3684 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3686 if (spec->stream_analog_capture) {
3687 if (snd_BUG_ON(!spec->adc_nids))
3689 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3690 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3693 if (spec->channel_mode) {
3694 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3695 for (i = 0; i < spec->num_channel_mode; i++) {
3696 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3697 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3703 /* SPDIF for stream index #1 */
3704 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3705 snprintf(spec->stream_name_digital,
3706 sizeof(spec->stream_name_digital),
3707 "%s Digital", codec->chip_name);
3708 codec->num_pcms = 2;
3709 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3710 info = spec->pcm_rec + 1;
3711 info->name = spec->stream_name_digital;
3712 if (spec->dig_out_type)
3713 info->pcm_type = spec->dig_out_type;
3715 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3716 if (spec->multiout.dig_out_nid &&
3717 spec->stream_digital_playback) {
3718 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3719 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3721 if (spec->dig_in_nid &&
3722 spec->stream_digital_capture) {
3723 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3724 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3726 /* FIXME: do we need this for all Realtek codec models? */
3727 codec->spdif_status_reset = 1;
3730 if (spec->no_analog)
3733 /* If the use of more than one ADC is requested for the current
3734 * model, configure a second analog capture-only PCM.
3736 /* Additional Analaog capture for index #2 */
3737 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3738 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3739 codec->num_pcms = 3;
3740 info = spec->pcm_rec + 2;
3741 info->name = spec->stream_name_analog;
3742 if (spec->alt_dac_nid) {
3743 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3744 *spec->stream_analog_alt_playback;
3745 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3748 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3749 alc_pcm_null_stream;
3750 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3752 if (spec->num_adc_nids > 1) {
3753 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3754 *spec->stream_analog_alt_capture;
3755 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3757 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3758 spec->num_adc_nids - 1;
3760 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3761 alc_pcm_null_stream;
3762 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3769 static inline void alc_shutup(struct hda_codec *codec)
3771 snd_hda_shutup_pins(codec);
3774 static void alc_free_kctls(struct hda_codec *codec)
3776 struct alc_spec *spec = codec->spec;
3778 if (spec->kctls.list) {
3779 struct snd_kcontrol_new *kctl = spec->kctls.list;
3781 for (i = 0; i < spec->kctls.used; i++)
3782 kfree(kctl[i].name);
3784 snd_array_free(&spec->kctls);
3787 static void alc_free(struct hda_codec *codec)
3789 struct alc_spec *spec = codec->spec;
3795 alc_free_kctls(codec);
3797 snd_hda_detach_beep_device(codec);
3800 #ifdef CONFIG_SND_HDA_POWER_SAVE
3801 static void alc_power_eapd(struct hda_codec *codec)
3803 /* We currently only handle front, HP */
3804 switch (codec->vendor_id) {
3806 set_eapd(codec, 0x0f, 0);
3807 set_eapd(codec, 0x10, 0);
3820 set_eapd(codec, 0x14, 0);
3821 set_eapd(codec, 0x15, 0);
3826 static int alc_suspend(struct hda_codec *codec, pm_message_t state)
3828 struct alc_spec *spec = codec->spec;
3830 if (spec && spec->power_hook)
3831 spec->power_hook(codec);
3836 #ifdef SND_HDA_NEEDS_RESUME
3837 static int alc_resume(struct hda_codec *codec)
3839 codec->patch_ops.init(codec);
3840 snd_hda_codec_resume_amp(codec);
3841 snd_hda_codec_resume_cache(codec);
3842 #ifdef CONFIG_SND_HDA_POWER_SAVE
3843 if (codec->patch_ops.check_power_status)
3844 codec->patch_ops.check_power_status(codec, 0x01);
3852 static struct hda_codec_ops alc_patch_ops = {
3853 .build_controls = alc_build_controls,
3854 .build_pcms = alc_build_pcms,
3857 .unsol_event = alc_unsol_event,
3858 #ifdef SND_HDA_NEEDS_RESUME
3859 .resume = alc_resume,
3861 #ifdef CONFIG_SND_HDA_POWER_SAVE
3862 .suspend = alc_suspend,
3863 .check_power_status = alc_check_power_status,
3865 .reboot_notify = alc_shutup,
3868 /* replace the codec chip_name with the given string */
3869 static int alc_codec_rename(struct hda_codec *codec, const char *name)
3871 kfree(codec->chip_name);
3872 codec->chip_name = kstrdup(name, GFP_KERNEL);
3873 if (!codec->chip_name) {
3881 * Test configuration for debugging
3883 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3886 #ifdef CONFIG_SND_DEBUG
3887 static hda_nid_t alc880_test_dac_nids[4] = {
3888 0x02, 0x03, 0x04, 0x05
3891 static struct hda_input_mux alc880_test_capture_source = {
3900 { "Surround", 0x6 },
3904 static struct hda_channel_mode alc880_test_modes[4] = {
3911 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3912 struct snd_ctl_elem_info *uinfo)
3914 static char *texts[] = {
3915 "N/A", "Line Out", "HP Out",
3916 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3918 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3920 uinfo->value.enumerated.items = 8;
3921 if (uinfo->value.enumerated.item >= 8)
3922 uinfo->value.enumerated.item = 7;
3923 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3927 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3928 struct snd_ctl_elem_value *ucontrol)
3930 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3931 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3932 unsigned int pin_ctl, item = 0;
3934 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3935 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3936 if (pin_ctl & AC_PINCTL_OUT_EN) {
3937 if (pin_ctl & AC_PINCTL_HP_EN)
3941 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3942 switch (pin_ctl & AC_PINCTL_VREFEN) {
3943 case AC_PINCTL_VREF_HIZ: item = 3; break;
3944 case AC_PINCTL_VREF_50: item = 4; break;
3945 case AC_PINCTL_VREF_GRD: item = 5; break;
3946 case AC_PINCTL_VREF_80: item = 6; break;
3947 case AC_PINCTL_VREF_100: item = 7; break;
3950 ucontrol->value.enumerated.item[0] = item;
3954 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3955 struct snd_ctl_elem_value *ucontrol)
3957 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3958 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3959 static unsigned int ctls[] = {
3960 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3961 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3962 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3963 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3964 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3965 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3967 unsigned int old_ctl, new_ctl;
3969 old_ctl = snd_hda_codec_read(codec, nid, 0,
3970 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3971 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3972 if (old_ctl != new_ctl) {
3974 snd_hda_codec_write_cache(codec, nid, 0,
3975 AC_VERB_SET_PIN_WIDGET_CONTROL,
3977 val = ucontrol->value.enumerated.item[0] >= 3 ?
3979 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3986 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3987 struct snd_ctl_elem_info *uinfo)
3989 static char *texts[] = {
3990 "Front", "Surround", "CLFE", "Side"
3992 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3994 uinfo->value.enumerated.items = 4;
3995 if (uinfo->value.enumerated.item >= 4)
3996 uinfo->value.enumerated.item = 3;
3997 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
4001 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
4002 struct snd_ctl_elem_value *ucontrol)
4004 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4005 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4008 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
4009 ucontrol->value.enumerated.item[0] = sel & 3;
4013 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
4014 struct snd_ctl_elem_value *ucontrol)
4016 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4017 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4020 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
4021 if (ucontrol->value.enumerated.item[0] != sel) {
4022 sel = ucontrol->value.enumerated.item[0] & 3;
4023 snd_hda_codec_write_cache(codec, nid, 0,
4024 AC_VERB_SET_CONNECT_SEL, sel);
4030 #define PIN_CTL_TEST(xname,nid) { \
4031 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4033 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4034 .info = alc_test_pin_ctl_info, \
4035 .get = alc_test_pin_ctl_get, \
4036 .put = alc_test_pin_ctl_put, \
4037 .private_value = nid \
4040 #define PIN_SRC_TEST(xname,nid) { \
4041 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4043 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4044 .info = alc_test_pin_src_info, \
4045 .get = alc_test_pin_src_get, \
4046 .put = alc_test_pin_src_put, \
4047 .private_value = nid \
4050 static struct snd_kcontrol_new alc880_test_mixer[] = {
4051 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
4052 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
4053 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
4054 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
4055 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
4056 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
4057 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
4058 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
4059 PIN_CTL_TEST("Front Pin Mode", 0x14),
4060 PIN_CTL_TEST("Surround Pin Mode", 0x15),
4061 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
4062 PIN_CTL_TEST("Side Pin Mode", 0x17),
4063 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
4064 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
4065 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
4066 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
4067 PIN_SRC_TEST("In-1 Pin Source", 0x18),
4068 PIN_SRC_TEST("In-2 Pin Source", 0x19),
4069 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
4070 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
4071 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
4072 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
4073 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
4074 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
4075 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
4076 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
4077 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
4078 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
4079 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
4080 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
4082 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4083 .name = "Channel Mode",
4084 .info = alc_ch_mode_info,
4085 .get = alc_ch_mode_get,
4086 .put = alc_ch_mode_put,
4091 static struct hda_verb alc880_test_init_verbs[] = {
4092 /* Unmute inputs of 0x0c - 0x0f */
4093 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4094 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4095 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4096 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4097 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4098 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4099 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4100 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4101 /* Vol output for 0x0c-0x0f */
4102 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4103 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4104 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4105 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4106 /* Set output pins 0x14-0x17 */
4107 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4108 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4109 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4110 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4111 /* Unmute output pins 0x14-0x17 */
4112 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4113 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4114 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4115 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4116 /* Set input pins 0x18-0x1c */
4117 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4118 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4119 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4120 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4121 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4122 /* Mute input pins 0x18-0x1b */
4123 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4124 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4125 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4126 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4128 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4129 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
4130 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4131 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
4132 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4133 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
4134 /* Analog input/passthru */
4135 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4136 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4137 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4138 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4139 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4147 static const char *alc880_models[ALC880_MODEL_LAST] = {
4148 [ALC880_3ST] = "3stack",
4149 [ALC880_TCL_S700] = "tcl",
4150 [ALC880_3ST_DIG] = "3stack-digout",
4151 [ALC880_CLEVO] = "clevo",
4152 [ALC880_5ST] = "5stack",
4153 [ALC880_5ST_DIG] = "5stack-digout",
4154 [ALC880_W810] = "w810",
4155 [ALC880_Z71V] = "z71v",
4156 [ALC880_6ST] = "6stack",
4157 [ALC880_6ST_DIG] = "6stack-digout",
4158 [ALC880_ASUS] = "asus",
4159 [ALC880_ASUS_W1V] = "asus-w1v",
4160 [ALC880_ASUS_DIG] = "asus-dig",
4161 [ALC880_ASUS_DIG2] = "asus-dig2",
4162 [ALC880_UNIWILL_DIG] = "uniwill",
4163 [ALC880_UNIWILL_P53] = "uniwill-p53",
4164 [ALC880_FUJITSU] = "fujitsu",
4165 [ALC880_F1734] = "F1734",
4167 [ALC880_LG_LW] = "lg-lw",
4168 [ALC880_MEDION_RIM] = "medion",
4169 #ifdef CONFIG_SND_DEBUG
4170 [ALC880_TEST] = "test",
4172 [ALC880_AUTO] = "auto",
4175 static struct snd_pci_quirk alc880_cfg_tbl[] = {
4176 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
4177 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
4178 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
4179 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
4180 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
4181 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
4182 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
4183 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
4184 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
4185 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
4186 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
4187 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
4188 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
4189 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
4190 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
4191 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
4192 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
4193 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
4194 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
4195 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
4196 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
4197 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
4198 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
4199 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
4200 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
4201 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
4202 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
4203 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
4204 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
4205 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
4206 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
4207 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
4208 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
4209 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
4210 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
4211 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
4212 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
4213 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
4214 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
4215 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
4216 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
4217 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
4218 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
4219 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
4220 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
4221 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
4222 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
4223 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
4224 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
4225 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
4226 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
4227 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
4228 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
4229 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
4230 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
4231 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
4232 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
4233 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
4234 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
4235 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
4236 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
4237 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
4238 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
4239 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
4240 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
4241 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
4242 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
4243 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
4245 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
4246 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
4247 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
4252 * ALC880 codec presets
4254 static struct alc_config_preset alc880_presets[] = {
4256 .mixers = { alc880_three_stack_mixer },
4257 .init_verbs = { alc880_volume_init_verbs,
4258 alc880_pin_3stack_init_verbs },
4259 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4260 .dac_nids = alc880_dac_nids,
4261 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4262 .channel_mode = alc880_threestack_modes,
4264 .input_mux = &alc880_capture_source,
4266 [ALC880_3ST_DIG] = {
4267 .mixers = { alc880_three_stack_mixer },
4268 .init_verbs = { alc880_volume_init_verbs,
4269 alc880_pin_3stack_init_verbs },
4270 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4271 .dac_nids = alc880_dac_nids,
4272 .dig_out_nid = ALC880_DIGOUT_NID,
4273 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4274 .channel_mode = alc880_threestack_modes,
4276 .input_mux = &alc880_capture_source,
4278 [ALC880_TCL_S700] = {
4279 .mixers = { alc880_tcl_s700_mixer },
4280 .init_verbs = { alc880_volume_init_verbs,
4281 alc880_pin_tcl_S700_init_verbs,
4282 alc880_gpio2_init_verbs },
4283 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4284 .dac_nids = alc880_dac_nids,
4285 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4286 .num_adc_nids = 1, /* single ADC */
4288 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4289 .channel_mode = alc880_2_jack_modes,
4290 .input_mux = &alc880_capture_source,
4293 .mixers = { alc880_three_stack_mixer,
4294 alc880_five_stack_mixer},
4295 .init_verbs = { alc880_volume_init_verbs,
4296 alc880_pin_5stack_init_verbs },
4297 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4298 .dac_nids = alc880_dac_nids,
4299 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4300 .channel_mode = alc880_fivestack_modes,
4301 .input_mux = &alc880_capture_source,
4303 [ALC880_5ST_DIG] = {
4304 .mixers = { alc880_three_stack_mixer,
4305 alc880_five_stack_mixer },
4306 .init_verbs = { alc880_volume_init_verbs,
4307 alc880_pin_5stack_init_verbs },
4308 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4309 .dac_nids = alc880_dac_nids,
4310 .dig_out_nid = ALC880_DIGOUT_NID,
4311 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4312 .channel_mode = alc880_fivestack_modes,
4313 .input_mux = &alc880_capture_source,
4316 .mixers = { alc880_six_stack_mixer },
4317 .init_verbs = { alc880_volume_init_verbs,
4318 alc880_pin_6stack_init_verbs },
4319 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4320 .dac_nids = alc880_6st_dac_nids,
4321 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4322 .channel_mode = alc880_sixstack_modes,
4323 .input_mux = &alc880_6stack_capture_source,
4325 [ALC880_6ST_DIG] = {
4326 .mixers = { alc880_six_stack_mixer },
4327 .init_verbs = { alc880_volume_init_verbs,
4328 alc880_pin_6stack_init_verbs },
4329 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4330 .dac_nids = alc880_6st_dac_nids,
4331 .dig_out_nid = ALC880_DIGOUT_NID,
4332 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4333 .channel_mode = alc880_sixstack_modes,
4334 .input_mux = &alc880_6stack_capture_source,
4337 .mixers = { alc880_w810_base_mixer },
4338 .init_verbs = { alc880_volume_init_verbs,
4339 alc880_pin_w810_init_verbs,
4340 alc880_gpio2_init_verbs },
4341 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
4342 .dac_nids = alc880_w810_dac_nids,
4343 .dig_out_nid = ALC880_DIGOUT_NID,
4344 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4345 .channel_mode = alc880_w810_modes,
4346 .input_mux = &alc880_capture_source,
4349 .mixers = { alc880_z71v_mixer },
4350 .init_verbs = { alc880_volume_init_verbs,
4351 alc880_pin_z71v_init_verbs },
4352 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
4353 .dac_nids = alc880_z71v_dac_nids,
4354 .dig_out_nid = ALC880_DIGOUT_NID,
4356 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4357 .channel_mode = alc880_2_jack_modes,
4358 .input_mux = &alc880_capture_source,
4361 .mixers = { alc880_f1734_mixer },
4362 .init_verbs = { alc880_volume_init_verbs,
4363 alc880_pin_f1734_init_verbs },
4364 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
4365 .dac_nids = alc880_f1734_dac_nids,
4367 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4368 .channel_mode = alc880_2_jack_modes,
4369 .input_mux = &alc880_f1734_capture_source,
4370 .unsol_event = alc880_uniwill_p53_unsol_event,
4371 .setup = alc880_uniwill_p53_setup,
4372 .init_hook = alc_automute_amp,
4375 .mixers = { alc880_asus_mixer },
4376 .init_verbs = { alc880_volume_init_verbs,
4377 alc880_pin_asus_init_verbs,
4378 alc880_gpio1_init_verbs },
4379 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4380 .dac_nids = alc880_asus_dac_nids,
4381 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4382 .channel_mode = alc880_asus_modes,
4384 .input_mux = &alc880_capture_source,
4386 [ALC880_ASUS_DIG] = {
4387 .mixers = { alc880_asus_mixer },
4388 .init_verbs = { alc880_volume_init_verbs,
4389 alc880_pin_asus_init_verbs,
4390 alc880_gpio1_init_verbs },
4391 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4392 .dac_nids = alc880_asus_dac_nids,
4393 .dig_out_nid = ALC880_DIGOUT_NID,
4394 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4395 .channel_mode = alc880_asus_modes,
4397 .input_mux = &alc880_capture_source,
4399 [ALC880_ASUS_DIG2] = {
4400 .mixers = { alc880_asus_mixer },
4401 .init_verbs = { alc880_volume_init_verbs,
4402 alc880_pin_asus_init_verbs,
4403 alc880_gpio2_init_verbs }, /* use GPIO2 */
4404 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4405 .dac_nids = alc880_asus_dac_nids,
4406 .dig_out_nid = ALC880_DIGOUT_NID,
4407 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4408 .channel_mode = alc880_asus_modes,
4410 .input_mux = &alc880_capture_source,
4412 [ALC880_ASUS_W1V] = {
4413 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4414 .init_verbs = { alc880_volume_init_verbs,
4415 alc880_pin_asus_init_verbs,
4416 alc880_gpio1_init_verbs },
4417 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4418 .dac_nids = alc880_asus_dac_nids,
4419 .dig_out_nid = ALC880_DIGOUT_NID,
4420 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4421 .channel_mode = alc880_asus_modes,
4423 .input_mux = &alc880_capture_source,
4425 [ALC880_UNIWILL_DIG] = {
4426 .mixers = { alc880_asus_mixer },
4427 .init_verbs = { alc880_volume_init_verbs,
4428 alc880_pin_asus_init_verbs },
4429 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4430 .dac_nids = alc880_asus_dac_nids,
4431 .dig_out_nid = ALC880_DIGOUT_NID,
4432 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4433 .channel_mode = alc880_asus_modes,
4435 .input_mux = &alc880_capture_source,
4437 [ALC880_UNIWILL] = {
4438 .mixers = { alc880_uniwill_mixer },
4439 .init_verbs = { alc880_volume_init_verbs,
4440 alc880_uniwill_init_verbs },
4441 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4442 .dac_nids = alc880_asus_dac_nids,
4443 .dig_out_nid = ALC880_DIGOUT_NID,
4444 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4445 .channel_mode = alc880_threestack_modes,
4447 .input_mux = &alc880_capture_source,
4448 .unsol_event = alc880_uniwill_unsol_event,
4449 .setup = alc880_uniwill_setup,
4450 .init_hook = alc880_uniwill_init_hook,
4452 [ALC880_UNIWILL_P53] = {
4453 .mixers = { alc880_uniwill_p53_mixer },
4454 .init_verbs = { alc880_volume_init_verbs,
4455 alc880_uniwill_p53_init_verbs },
4456 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4457 .dac_nids = alc880_asus_dac_nids,
4458 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4459 .channel_mode = alc880_threestack_modes,
4460 .input_mux = &alc880_capture_source,
4461 .unsol_event = alc880_uniwill_p53_unsol_event,
4462 .setup = alc880_uniwill_p53_setup,
4463 .init_hook = alc_automute_amp,
4465 [ALC880_FUJITSU] = {
4466 .mixers = { alc880_fujitsu_mixer },
4467 .init_verbs = { alc880_volume_init_verbs,
4468 alc880_uniwill_p53_init_verbs,
4469 alc880_beep_init_verbs },
4470 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4471 .dac_nids = alc880_dac_nids,
4472 .dig_out_nid = ALC880_DIGOUT_NID,
4473 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4474 .channel_mode = alc880_2_jack_modes,
4475 .input_mux = &alc880_capture_source,
4476 .unsol_event = alc880_uniwill_p53_unsol_event,
4477 .setup = alc880_uniwill_p53_setup,
4478 .init_hook = alc_automute_amp,
4481 .mixers = { alc880_three_stack_mixer },
4482 .init_verbs = { alc880_volume_init_verbs,
4483 alc880_pin_clevo_init_verbs },
4484 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4485 .dac_nids = alc880_dac_nids,
4487 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4488 .channel_mode = alc880_threestack_modes,
4490 .input_mux = &alc880_capture_source,
4493 .mixers = { alc880_lg_mixer },
4494 .init_verbs = { alc880_volume_init_verbs,
4495 alc880_lg_init_verbs },
4496 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4497 .dac_nids = alc880_lg_dac_nids,
4498 .dig_out_nid = ALC880_DIGOUT_NID,
4499 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4500 .channel_mode = alc880_lg_ch_modes,
4502 .input_mux = &alc880_lg_capture_source,
4503 .unsol_event = alc_automute_amp_unsol_event,
4504 .setup = alc880_lg_setup,
4505 .init_hook = alc_automute_amp,
4506 #ifdef CONFIG_SND_HDA_POWER_SAVE
4507 .loopbacks = alc880_lg_loopbacks,
4511 .mixers = { alc880_lg_lw_mixer },
4512 .init_verbs = { alc880_volume_init_verbs,
4513 alc880_lg_lw_init_verbs },
4514 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4515 .dac_nids = alc880_dac_nids,
4516 .dig_out_nid = ALC880_DIGOUT_NID,
4517 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4518 .channel_mode = alc880_lg_lw_modes,
4519 .input_mux = &alc880_lg_lw_capture_source,
4520 .unsol_event = alc_automute_amp_unsol_event,
4521 .setup = alc880_lg_lw_setup,
4522 .init_hook = alc_automute_amp,
4524 [ALC880_MEDION_RIM] = {
4525 .mixers = { alc880_medion_rim_mixer },
4526 .init_verbs = { alc880_volume_init_verbs,
4527 alc880_medion_rim_init_verbs,
4528 alc_gpio2_init_verbs },
4529 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4530 .dac_nids = alc880_dac_nids,
4531 .dig_out_nid = ALC880_DIGOUT_NID,
4532 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4533 .channel_mode = alc880_2_jack_modes,
4534 .input_mux = &alc880_medion_rim_capture_source,
4535 .unsol_event = alc880_medion_rim_unsol_event,
4536 .setup = alc880_medion_rim_setup,
4537 .init_hook = alc880_medion_rim_automute,
4539 #ifdef CONFIG_SND_DEBUG
4541 .mixers = { alc880_test_mixer },
4542 .init_verbs = { alc880_test_init_verbs },
4543 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4544 .dac_nids = alc880_test_dac_nids,
4545 .dig_out_nid = ALC880_DIGOUT_NID,
4546 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4547 .channel_mode = alc880_test_modes,
4548 .input_mux = &alc880_test_capture_source,
4554 * Automatic parse of I/O pins from the BIOS configuration
4559 ALC_CTL_WIDGET_MUTE,
4562 static struct snd_kcontrol_new alc880_control_templates[] = {
4563 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4564 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4565 HDA_BIND_MUTE(NULL, 0, 0, 0),
4568 /* add dynamic controls */
4569 static int add_control(struct alc_spec *spec, int type, const char *name,
4572 struct snd_kcontrol_new *knew;
4574 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4575 knew = snd_array_new(&spec->kctls);
4578 *knew = alc880_control_templates[type];
4579 knew->name = kstrdup(name, GFP_KERNEL);
4582 if (get_amp_nid_(val))
4583 knew->subdevice = HDA_SUBDEV_AMP_FLAG;
4584 knew->private_value = val;
4588 static int add_control_with_pfx(struct alc_spec *spec, int type,
4589 const char *pfx, const char *dir,
4590 const char *sfx, unsigned long val)
4593 snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx);
4594 return add_control(spec, type, name, val);
4597 #define add_pb_vol_ctrl(spec, type, pfx, val) \
4598 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", val)
4599 #define add_pb_sw_ctrl(spec, type, pfx, val) \
4600 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", val)
4602 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4603 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4604 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4605 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4606 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4607 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4608 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4609 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4610 #define ALC880_PIN_CD_NID 0x1c
4612 /* fill in the dac_nids table from the parsed pin configuration */
4613 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4614 const struct auto_pin_cfg *cfg)
4620 memset(assigned, 0, sizeof(assigned));
4621 spec->multiout.dac_nids = spec->private_dac_nids;
4623 /* check the pins hardwired to audio widget */
4624 for (i = 0; i < cfg->line_outs; i++) {
4625 nid = cfg->line_out_pins[i];
4626 if (alc880_is_fixed_pin(nid)) {
4627 int idx = alc880_fixed_pin_idx(nid);
4628 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4632 /* left pins can be connect to any 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))
4637 /* search for an empty channel */
4638 for (j = 0; j < cfg->line_outs; j++) {
4640 spec->multiout.dac_nids[i] =
4641 alc880_idx_to_dac(j);
4647 spec->multiout.num_dacs = cfg->line_outs;
4651 /* add playback controls from the parsed DAC table */
4652 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4653 const struct auto_pin_cfg *cfg)
4655 static const char *chname[4] = {
4656 "Front", "Surround", NULL /*CLFE*/, "Side"
4661 for (i = 0; i < cfg->line_outs; i++) {
4662 if (!spec->multiout.dac_nids[i])
4664 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4667 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4669 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4673 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4675 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4679 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4681 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4685 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4687 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4693 if (cfg->line_outs == 1 &&
4694 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
4698 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4699 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4703 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4704 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4713 /* add playback controls for speaker and HP outputs */
4714 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4723 if (alc880_is_fixed_pin(pin)) {
4724 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4725 /* specify the DAC as the extra output */
4726 if (!spec->multiout.hp_nid)
4727 spec->multiout.hp_nid = nid;
4729 spec->multiout.extra_out_nid[0] = nid;
4730 /* control HP volume/switch on the output mixer amp */
4731 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4732 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4733 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4736 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4737 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4740 } else if (alc880_is_multi_pin(pin)) {
4741 /* set manual connection */
4742 /* we have only a switch on HP-out PIN */
4743 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
4744 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4751 /* create input playback/capture controls for the given pin */
4752 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4753 const char *ctlname,
4754 int idx, hda_nid_t mix_nid)
4758 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
4759 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4762 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
4763 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4769 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
4771 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
4772 return (pincap & AC_PINCAP_IN) != 0;
4775 /* create playback/capture controls for input pins */
4776 static int alc_auto_create_input_ctls(struct hda_codec *codec,
4777 const struct auto_pin_cfg *cfg,
4779 hda_nid_t cap1, hda_nid_t cap2)
4781 struct alc_spec *spec = codec->spec;
4782 struct hda_input_mux *imux = &spec->private_imux[0];
4785 for (i = 0; i < AUTO_PIN_LAST; i++) {
4788 pin = cfg->input_pins[i];
4789 if (!alc_is_input_pin(codec, pin))
4793 idx = get_connection_index(codec, mixer, pin);
4795 err = new_analog_input(spec, pin,
4796 auto_pin_cfg_labels[i],
4805 idx = get_connection_index(codec, cap1, pin);
4806 if (idx < 0 && cap2)
4807 idx = get_connection_index(codec, cap2, pin);
4809 imux->items[imux->num_items].label =
4810 auto_pin_cfg_labels[i];
4811 imux->items[imux->num_items].index = idx;
4818 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
4819 const struct auto_pin_cfg *cfg)
4821 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
4824 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4825 unsigned int pin_type)
4827 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4830 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4834 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4835 hda_nid_t nid, int pin_type,
4838 alc_set_pin_output(codec, nid, pin_type);
4839 /* need the manual connection? */
4840 if (alc880_is_multi_pin(nid)) {
4841 struct alc_spec *spec = codec->spec;
4842 int idx = alc880_multi_pin_idx(nid);
4843 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4844 AC_VERB_SET_CONNECT_SEL,
4845 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4849 static int get_pin_type(int line_out_type)
4851 if (line_out_type == AUTO_PIN_HP_OUT)
4857 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4859 struct alc_spec *spec = codec->spec;
4862 for (i = 0; i < spec->autocfg.line_outs; i++) {
4863 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4864 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4865 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4869 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4871 struct alc_spec *spec = codec->spec;
4874 pin = spec->autocfg.speaker_pins[0];
4875 if (pin) /* connect to front */
4876 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4877 pin = spec->autocfg.hp_pins[0];
4878 if (pin) /* connect to front */
4879 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4882 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4884 struct alc_spec *spec = codec->spec;
4887 for (i = 0; i < AUTO_PIN_LAST; i++) {
4888 hda_nid_t nid = spec->autocfg.input_pins[i];
4889 if (alc_is_input_pin(codec, nid)) {
4890 alc_set_input_pin(codec, nid, i);
4891 if (nid != ALC880_PIN_CD_NID &&
4892 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
4893 snd_hda_codec_write(codec, nid, 0,
4894 AC_VERB_SET_AMP_GAIN_MUTE,
4900 static void alc880_auto_init_input_src(struct hda_codec *codec)
4902 struct alc_spec *spec = codec->spec;
4905 for (c = 0; c < spec->num_adc_nids; c++) {
4906 unsigned int mux_idx;
4907 const struct hda_input_mux *imux;
4908 mux_idx = c >= spec->num_mux_defs ? 0 : c;
4909 imux = &spec->input_mux[mux_idx];
4910 if (!imux->num_items && mux_idx > 0)
4911 imux = &spec->input_mux[0];
4913 snd_hda_codec_write(codec, spec->adc_nids[c], 0,
4914 AC_VERB_SET_CONNECT_SEL,
4915 imux->items[0].index);
4919 /* parse the BIOS configuration and set up the alc_spec */
4920 /* return 1 if successful, 0 if the proper config is not found,
4921 * or a negative error code
4923 static int alc880_parse_auto_config(struct hda_codec *codec)
4925 struct alc_spec *spec = codec->spec;
4927 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4929 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4933 if (!spec->autocfg.line_outs)
4934 return 0; /* can't find valid BIOS pin config */
4936 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4939 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4942 err = alc880_auto_create_extra_out(spec,
4943 spec->autocfg.speaker_pins[0],
4947 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4951 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
4955 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4957 /* check multiple SPDIF-out (for recent codecs) */
4958 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4960 err = snd_hda_get_connections(codec,
4961 spec->autocfg.dig_out_pins[i],
4966 spec->multiout.dig_out_nid = dig_nid;
4968 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4969 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
4971 spec->slave_dig_outs[i - 1] = dig_nid;
4974 if (spec->autocfg.dig_in_pin)
4975 spec->dig_in_nid = ALC880_DIGIN_NID;
4977 if (spec->kctls.list)
4978 add_mixer(spec, spec->kctls.list);
4980 add_verb(spec, alc880_volume_init_verbs);
4982 spec->num_mux_defs = 1;
4983 spec->input_mux = &spec->private_imux[0];
4985 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
4990 /* additional initialization for auto-configuration model */
4991 static void alc880_auto_init(struct hda_codec *codec)
4993 struct alc_spec *spec = codec->spec;
4994 alc880_auto_init_multi_out(codec);
4995 alc880_auto_init_extra_out(codec);
4996 alc880_auto_init_analog_input(codec);
4997 alc880_auto_init_input_src(codec);
4998 if (spec->unsol_event)
4999 alc_inithook(codec);
5002 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
5003 * one of two digital mic pins, e.g. on ALC272
5005 static void fixup_automic_adc(struct hda_codec *codec)
5007 struct alc_spec *spec = codec->spec;
5010 for (i = 0; i < spec->num_adc_nids; i++) {
5011 hda_nid_t cap = spec->capsrc_nids ?
5012 spec->capsrc_nids[i] : spec->adc_nids[i];
5015 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
5018 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
5021 spec->int_mic.mux_idx = iidx;
5022 spec->ext_mic.mux_idx = eidx;
5023 if (spec->capsrc_nids)
5024 spec->capsrc_nids += i;
5025 spec->adc_nids += i;
5026 spec->num_adc_nids = 1;
5029 snd_printd(KERN_INFO "hda_codec: %s: "
5030 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
5031 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
5032 spec->auto_mic = 0; /* disable auto-mic to be sure */
5035 /* choose the ADC/MUX containing the input pin and initialize the setup */
5036 static void fixup_single_adc(struct hda_codec *codec)
5038 struct alc_spec *spec = codec->spec;
5042 /* search for the input pin; there must be only one */
5043 for (i = 0; i < AUTO_PIN_LAST; i++) {
5044 if (spec->autocfg.input_pins[i]) {
5045 pin = spec->autocfg.input_pins[i];
5052 /* set the default connection to that pin */
5053 for (i = 0; i < spec->num_adc_nids; i++) {
5054 hda_nid_t cap = spec->capsrc_nids ?
5055 spec->capsrc_nids[i] : spec->adc_nids[i];
5058 idx = get_connection_index(codec, cap, pin);
5061 /* use only this ADC */
5062 if (spec->capsrc_nids)
5063 spec->capsrc_nids += i;
5064 spec->adc_nids += i;
5065 spec->num_adc_nids = 1;
5066 /* select or unmute this route */
5067 if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) {
5068 snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx,
5071 snd_hda_codec_write_cache(codec, cap, 0,
5072 AC_VERB_SET_CONNECT_SEL, idx);
5078 static void set_capture_mixer(struct hda_codec *codec)
5080 struct alc_spec *spec = codec->spec;
5081 static struct snd_kcontrol_new *caps[2][3] = {
5082 { alc_capture_mixer_nosrc1,
5083 alc_capture_mixer_nosrc2,
5084 alc_capture_mixer_nosrc3 },
5085 { alc_capture_mixer1,
5087 alc_capture_mixer3 },
5089 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
5092 fixup_automic_adc(codec);
5093 else if (spec->input_mux) {
5094 if (spec->input_mux->num_items > 1)
5096 else if (spec->input_mux->num_items == 1)
5097 fixup_single_adc(codec);
5099 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
5103 /* fill adc_nids (and capsrc_nids) containing all active input pins */
5104 static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids,
5107 struct alc_spec *spec = codec->spec;
5109 hda_nid_t fallback_adc = 0, fallback_cap = 0;
5111 for (n = 0; n < num_nids; n++) {
5113 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
5117 if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN)
5120 nconns = snd_hda_get_connections(codec, cap, conn,
5124 nconns = snd_hda_get_connections(codec, cap, conn,
5129 if (!fallback_adc) {
5133 for (i = 0; i < AUTO_PIN_LAST; i++) {
5134 hda_nid_t nid = spec->autocfg.input_pins[i];
5137 for (j = 0; j < nconns; j++) {
5144 if (i >= AUTO_PIN_LAST) {
5145 int num_adcs = spec->num_adc_nids;
5146 spec->private_adc_nids[num_adcs] = adc;
5147 spec->private_capsrc_nids[num_adcs] = cap;
5148 spec->num_adc_nids++;
5149 spec->adc_nids = spec->private_adc_nids;
5151 spec->capsrc_nids = spec->private_capsrc_nids;
5154 if (!spec->num_adc_nids) {
5155 printk(KERN_WARNING "hda_codec: %s: no valid ADC found;"
5156 " using fallback 0x%x\n",
5157 codec->chip_name, fallback_adc);
5158 spec->private_adc_nids[0] = fallback_adc;
5159 spec->adc_nids = spec->private_adc_nids;
5160 if (fallback_adc != fallback_cap) {
5161 spec->private_capsrc_nids[0] = fallback_cap;
5162 spec->capsrc_nids = spec->private_adc_nids;
5167 #ifdef CONFIG_SND_HDA_INPUT_BEEP
5168 #define set_beep_amp(spec, nid, idx, dir) \
5169 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
5171 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
5175 * OK, here we have finally the patch for ALC880
5178 static int patch_alc880(struct hda_codec *codec)
5180 struct alc_spec *spec;
5184 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5190 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
5193 if (board_config < 0) {
5194 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
5196 board_config = ALC880_AUTO;
5199 if (board_config == ALC880_AUTO) {
5200 /* automatic parse from the BIOS config */
5201 err = alc880_parse_auto_config(codec);
5207 "hda_codec: Cannot set up configuration "
5208 "from BIOS. Using 3-stack mode...\n");
5209 board_config = ALC880_3ST;
5213 err = snd_hda_attach_beep_device(codec, 0x1);
5219 if (board_config != ALC880_AUTO)
5220 setup_preset(codec, &alc880_presets[board_config]);
5222 spec->stream_analog_playback = &alc880_pcm_analog_playback;
5223 spec->stream_analog_capture = &alc880_pcm_analog_capture;
5224 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
5226 spec->stream_digital_playback = &alc880_pcm_digital_playback;
5227 spec->stream_digital_capture = &alc880_pcm_digital_capture;
5229 if (!spec->adc_nids && spec->input_mux) {
5230 /* check whether NID 0x07 is valid */
5231 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
5233 wcap = get_wcaps_type(wcap);
5234 if (wcap != AC_WID_AUD_IN) {
5235 spec->adc_nids = alc880_adc_nids_alt;
5236 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
5238 spec->adc_nids = alc880_adc_nids;
5239 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
5242 set_capture_mixer(codec);
5243 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
5245 spec->vmaster_nid = 0x0c;
5247 codec->patch_ops = alc_patch_ops;
5248 if (board_config == ALC880_AUTO)
5249 spec->init_hook = alc880_auto_init;
5250 #ifdef CONFIG_SND_HDA_POWER_SAVE
5251 if (!spec->loopback.amplist)
5252 spec->loopback.amplist = alc880_loopbacks;
5263 static hda_nid_t alc260_dac_nids[1] = {
5268 static hda_nid_t alc260_adc_nids[1] = {
5273 static hda_nid_t alc260_adc_nids_alt[1] = {
5278 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
5279 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
5281 static hda_nid_t alc260_dual_adc_nids[2] = {
5286 #define ALC260_DIGOUT_NID 0x03
5287 #define ALC260_DIGIN_NID 0x06
5289 static struct hda_input_mux alc260_capture_source = {
5293 { "Front Mic", 0x1 },
5299 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
5300 * headphone jack and the internal CD lines since these are the only pins at
5301 * which audio can appear. For flexibility, also allow the option of
5302 * recording the mixer output on the second ADC (ADC0 doesn't have a
5303 * connection to the mixer output).
5305 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
5309 { "Mic/Line", 0x0 },
5311 { "Headphone", 0x2 },
5317 { "Mic/Line", 0x0 },
5319 { "Headphone", 0x2 },
5326 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
5327 * the Fujitsu S702x, but jacks are marked differently.
5329 static struct hda_input_mux alc260_acer_capture_sources[2] = {
5336 { "Headphone", 0x5 },
5345 { "Headphone", 0x6 },
5351 /* Maxdata Favorit 100XS */
5352 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
5356 { "Line/Mic", 0x0 },
5363 { "Line/Mic", 0x0 },
5371 * This is just place-holder, so there's something for alc_build_pcms to look
5372 * at when it calculates the maximum number of channels. ALC260 has no mixer
5373 * element which allows changing the channel mode, so the verb list is
5376 static struct hda_channel_mode alc260_modes[1] = {
5381 /* Mixer combinations
5383 * basic: base_output + input + pc_beep + capture
5384 * HP: base_output + input + capture_alt
5385 * HP_3013: hp_3013 + input + capture
5386 * fujitsu: fujitsu + capture
5387 * acer: acer + capture
5390 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
5391 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5392 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5393 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5394 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5395 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5396 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5400 static struct snd_kcontrol_new alc260_input_mixer[] = {
5401 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5402 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5403 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5404 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5405 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5406 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5407 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
5408 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
5412 /* update HP, line and mono out pins according to the master switch */
5413 static void alc260_hp_master_update(struct hda_codec *codec,
5414 hda_nid_t hp, hda_nid_t line,
5417 struct alc_spec *spec = codec->spec;
5418 unsigned int val = spec->master_sw ? PIN_HP : 0;
5419 /* change HP and line-out pins */
5420 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5422 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5424 /* mono (speaker) depending on the HP jack sense */
5425 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5426 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5430 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5431 struct snd_ctl_elem_value *ucontrol)
5433 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5434 struct alc_spec *spec = codec->spec;
5435 *ucontrol->value.integer.value = spec->master_sw;
5439 static int alc260_hp_master_sw_put(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 int val = !!*ucontrol->value.integer.value;
5445 hda_nid_t hp, line, mono;
5447 if (val == spec->master_sw)
5449 spec->master_sw = val;
5450 hp = (kcontrol->private_value >> 16) & 0xff;
5451 line = (kcontrol->private_value >> 8) & 0xff;
5452 mono = kcontrol->private_value & 0xff;
5453 alc260_hp_master_update(codec, hp, line, mono);
5457 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5459 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5460 .name = "Master Playback Switch",
5461 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5462 .info = snd_ctl_boolean_mono_info,
5463 .get = alc260_hp_master_sw_get,
5464 .put = alc260_hp_master_sw_put,
5465 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5467 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5468 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5469 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5470 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5471 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5473 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5477 static struct hda_verb alc260_hp_unsol_verbs[] = {
5478 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5482 static void alc260_hp_automute(struct hda_codec *codec)
5484 struct alc_spec *spec = codec->spec;
5486 spec->jack_present = snd_hda_jack_detect(codec, 0x10);
5487 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5490 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5492 if ((res >> 26) == ALC880_HP_EVENT)
5493 alc260_hp_automute(codec);
5496 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5498 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5499 .name = "Master Playback Switch",
5500 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5501 .info = snd_ctl_boolean_mono_info,
5502 .get = alc260_hp_master_sw_get,
5503 .put = alc260_hp_master_sw_put,
5504 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5506 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5507 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5508 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
5509 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
5510 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5511 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5512 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5513 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
5517 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
5518 .ops = &snd_hda_bind_vol,
5520 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
5521 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
5522 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
5527 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
5528 .ops = &snd_hda_bind_sw,
5530 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
5531 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
5536 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
5537 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
5538 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
5539 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
5540 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5544 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
5545 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5549 static void alc260_hp_3013_automute(struct hda_codec *codec)
5551 struct alc_spec *spec = codec->spec;
5553 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
5554 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
5557 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
5560 if ((res >> 26) == ALC880_HP_EVENT)
5561 alc260_hp_3013_automute(codec);
5564 static void alc260_hp_3012_automute(struct hda_codec *codec)
5566 unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT;
5568 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5570 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5572 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5576 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
5579 if ((res >> 26) == ALC880_HP_EVENT)
5580 alc260_hp_3012_automute(codec);
5583 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
5584 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
5586 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
5587 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5588 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
5589 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5590 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5591 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5592 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
5593 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
5594 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
5595 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5596 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
5600 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
5601 * versions of the ALC260 don't act on requests to enable mic bias from NID
5602 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5603 * datasheet doesn't mention this restriction. At this stage it's not clear
5604 * whether this behaviour is intentional or is a hardware bug in chip
5605 * revisions available in early 2006. Therefore for now allow the
5606 * "Headphone Jack Mode" control to span all choices, but if it turns out
5607 * that the lack of mic bias for this NID is intentional we could change the
5608 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5610 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5611 * don't appear to make the mic bias available from the "line" jack, even
5612 * though the NID used for this jack (0x14) can supply it. The theory is
5613 * that perhaps Acer have included blocking capacitors between the ALC260
5614 * and the output jack. If this turns out to be the case for all such
5615 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5616 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5618 * The C20x Tablet series have a mono internal speaker which is controlled
5619 * via the chip's Mono sum widget and pin complex, so include the necessary
5620 * controls for such models. On models without a "mono speaker" the control
5621 * won't do anything.
5623 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5624 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5625 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5626 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5627 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5629 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5631 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5632 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5633 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5634 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5635 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5636 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5637 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5638 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5642 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5644 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
5645 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5646 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5647 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5648 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5649 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5650 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5654 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5655 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5657 static struct snd_kcontrol_new alc260_will_mixer[] = {
5658 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5659 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5660 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5661 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5662 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5663 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5664 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5665 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5666 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5667 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5671 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5672 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5674 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5675 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5676 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5677 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5678 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5679 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5680 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
5681 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
5682 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5683 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5684 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5689 * initialization verbs
5691 static struct hda_verb alc260_init_verbs[] = {
5692 /* Line In pin widget for input */
5693 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5694 /* CD pin widget for input */
5695 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5696 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5697 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5698 /* Mic2 (front panel) pin widget for input and vref at 80% */
5699 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5700 /* LINE-2 is used for line-out in rear */
5701 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5702 /* select line-out */
5703 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
5705 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5707 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5709 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5710 /* mute capture amp left and right */
5711 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5712 /* set connection select to line in (default select for this ADC) */
5713 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5714 /* mute capture amp left and right */
5715 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5716 /* set connection select to line in (default select for this ADC) */
5717 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
5718 /* set vol=0 Line-Out mixer amp left and right */
5719 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5720 /* unmute pin widget amp left and right (no gain on this amp) */
5721 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5722 /* set vol=0 HP mixer amp left and right */
5723 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5724 /* unmute pin widget amp left and right (no gain on this amp) */
5725 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5726 /* set vol=0 Mono mixer amp left and right */
5727 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5728 /* unmute pin widget amp left and right (no gain on this amp) */
5729 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5730 /* unmute LINE-2 out pin */
5731 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5732 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5735 /* mute analog inputs */
5736 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5737 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5738 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5739 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5740 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5741 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5742 /* mute Front out path */
5743 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5744 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5745 /* mute Headphone out path */
5746 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5747 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5748 /* mute Mono out path */
5749 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5750 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5754 #if 0 /* should be identical with alc260_init_verbs? */
5755 static struct hda_verb alc260_hp_init_verbs[] = {
5756 /* Headphone and output */
5757 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5759 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5760 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5761 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5762 /* Mic2 (front panel) pin widget for input and vref at 80% */
5763 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5764 /* Line In pin widget for input */
5765 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5766 /* Line-2 pin widget for output */
5767 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5768 /* CD pin widget for input */
5769 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5770 /* unmute amp left and right */
5771 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5772 /* set connection select to line in (default select for this ADC) */
5773 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5774 /* unmute Line-Out mixer amp left and right (volume = 0) */
5775 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5776 /* mute pin widget amp left and right (no gain on this amp) */
5777 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5778 /* unmute HP mixer amp left and right (volume = 0) */
5779 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5780 /* mute pin widget amp left and right (no gain on this amp) */
5781 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5782 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5785 /* mute analog inputs */
5786 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5787 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5788 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5789 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5790 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5791 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5792 /* Unmute Front out path */
5793 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5794 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5795 /* Unmute Headphone out path */
5796 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5797 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5798 /* Unmute Mono out path */
5799 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5800 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5805 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5806 /* Line out and output */
5807 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5809 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5810 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5811 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5812 /* Mic2 (front panel) pin widget for input and vref at 80% */
5813 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5814 /* Line In pin widget for input */
5815 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5816 /* Headphone pin widget for output */
5817 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5818 /* CD pin widget for input */
5819 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5820 /* unmute amp left and right */
5821 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5822 /* set connection select to line in (default select for this ADC) */
5823 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5824 /* unmute Line-Out mixer amp left and right (volume = 0) */
5825 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5826 /* mute pin widget amp left and right (no gain on this amp) */
5827 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5828 /* unmute HP mixer amp left and right (volume = 0) */
5829 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5830 /* mute pin widget amp left and right (no gain on this amp) */
5831 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5832 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5835 /* mute analog inputs */
5836 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5837 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5838 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5839 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5840 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5841 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5842 /* Unmute Front out path */
5843 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5844 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5845 /* Unmute Headphone out path */
5846 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5847 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5848 /* Unmute Mono out path */
5849 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5850 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5854 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5855 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5856 * audio = 0x16, internal speaker = 0x10.
5858 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5859 /* Disable all GPIOs */
5860 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5861 /* Internal speaker is connected to headphone pin */
5862 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5863 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5864 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5865 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5866 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5867 /* Ensure all other unused pins are disabled and muted. */
5868 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5869 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5870 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5871 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5872 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5873 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5874 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5875 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5877 /* Disable digital (SPDIF) pins */
5878 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5879 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5881 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5882 * when acting as an output.
5884 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5886 /* Start with output sum widgets muted and their output gains at min */
5887 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5888 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5889 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5890 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5891 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5892 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5893 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5894 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5895 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5897 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5898 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5899 /* Unmute Line1 pin widget output buffer since it starts as an output.
5900 * If the pin mode is changed by the user the pin mode control will
5901 * take care of enabling the pin's input/output buffers as needed.
5902 * Therefore there's no need to enable the input buffer at this
5905 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5906 /* Unmute input buffer of pin widget used for Line-in (no equiv
5909 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5911 /* Mute capture amp left and right */
5912 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5913 /* Set ADC connection select to match default mixer setting - line
5916 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5918 /* Do the same for the second ADC: mute capture input amp and
5919 * set ADC connection to line in (on mic1 pin)
5921 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5922 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5924 /* Mute all inputs to mixer widget (even unconnected ones) */
5925 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5926 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5927 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5928 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5929 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5930 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5931 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5932 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5937 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5938 * similar laptops (adapted from Fujitsu init verbs).
5940 static struct hda_verb alc260_acer_init_verbs[] = {
5941 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5942 * the headphone jack. Turn this on and rely on the standard mute
5943 * methods whenever the user wants to turn these outputs off.
5945 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5946 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5947 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5948 /* Internal speaker/Headphone jack is connected to Line-out pin */
5949 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5950 /* Internal microphone/Mic jack is connected to Mic1 pin */
5951 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5952 /* Line In jack is connected to Line1 pin */
5953 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5954 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5955 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5956 /* Ensure all other unused pins are disabled and muted. */
5957 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5958 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5959 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5960 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5961 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5962 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5963 /* Disable digital (SPDIF) pins */
5964 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5965 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5967 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5968 * bus when acting as outputs.
5970 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5971 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5973 /* Start with output sum widgets muted and their output gains at min */
5974 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5975 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5976 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5977 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5978 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5979 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5980 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5981 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5982 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5984 /* Unmute Line-out pin widget amp left and right
5985 * (no equiv mixer ctrl)
5987 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5988 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5989 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5990 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5991 * inputs. If the pin mode is changed by the user the pin mode control
5992 * will take care of enabling the pin's input/output buffers as needed.
5993 * Therefore there's no need to enable the input buffer at this
5996 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5997 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5999 /* Mute capture amp left and right */
6000 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6001 /* Set ADC connection select to match default mixer setting - mic
6004 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6006 /* Do similar with the second ADC: mute capture input amp and
6007 * set ADC connection to mic to match ALSA's default state.
6009 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6010 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6012 /* Mute all inputs to mixer widget (even unconnected ones) */
6013 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6014 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6015 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6016 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6017 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6018 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6019 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6020 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6025 /* Initialisation sequence for Maxdata Favorit 100XS
6026 * (adapted from Acer init verbs).
6028 static struct hda_verb alc260_favorit100_init_verbs[] = {
6029 /* GPIO 0 enables the output jack.
6030 * Turn this on and rely on the standard mute
6031 * methods whenever the user wants to turn these outputs off.
6033 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6034 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6035 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
6036 /* Line/Mic input jack is connected to Mic1 pin */
6037 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
6038 /* Ensure all other unused pins are disabled and muted. */
6039 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6040 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6041 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6042 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6043 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6044 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6045 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6046 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6047 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6048 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6049 /* Disable digital (SPDIF) pins */
6050 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6051 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6053 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6054 * bus when acting as outputs.
6056 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6057 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6059 /* Start with output sum widgets muted and their output gains at min */
6060 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6061 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6062 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6063 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6064 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6065 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6066 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6067 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6068 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6070 /* Unmute Line-out pin widget amp left and right
6071 * (no equiv mixer ctrl)
6073 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6074 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6075 * inputs. If the pin mode is changed by the user the pin mode control
6076 * will take care of enabling the pin's input/output buffers as needed.
6077 * Therefore there's no need to enable the input buffer at this
6080 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6082 /* Mute capture amp left and right */
6083 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6084 /* Set ADC connection select to match default mixer setting - mic
6087 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6089 /* Do similar with the second ADC: mute capture input amp and
6090 * set ADC connection to mic to match ALSA's default state.
6092 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6093 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6095 /* Mute all inputs to mixer widget (even unconnected ones) */
6096 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6097 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6098 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6099 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6100 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6101 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6102 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6103 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6108 static struct hda_verb alc260_will_verbs[] = {
6109 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6110 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
6111 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
6112 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6113 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6114 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
6118 static struct hda_verb alc260_replacer_672v_verbs[] = {
6119 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6120 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6121 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
6123 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6124 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6125 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6127 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6131 /* toggle speaker-output according to the hp-jack state */
6132 static void alc260_replacer_672v_automute(struct hda_codec *codec)
6134 unsigned int present;
6136 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
6137 present = snd_hda_jack_detect(codec, 0x0f);
6139 snd_hda_codec_write_cache(codec, 0x01, 0,
6140 AC_VERB_SET_GPIO_DATA, 1);
6141 snd_hda_codec_write_cache(codec, 0x0f, 0,
6142 AC_VERB_SET_PIN_WIDGET_CONTROL,
6145 snd_hda_codec_write_cache(codec, 0x01, 0,
6146 AC_VERB_SET_GPIO_DATA, 0);
6147 snd_hda_codec_write_cache(codec, 0x0f, 0,
6148 AC_VERB_SET_PIN_WIDGET_CONTROL,
6153 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
6156 if ((res >> 26) == ALC880_HP_EVENT)
6157 alc260_replacer_672v_automute(codec);
6160 static struct hda_verb alc260_hp_dc7600_verbs[] = {
6161 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
6162 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6163 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6164 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6165 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6166 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6167 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6168 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6169 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6170 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6174 /* Test configuration for debugging, modelled after the ALC880 test
6177 #ifdef CONFIG_SND_DEBUG
6178 static hda_nid_t alc260_test_dac_nids[1] = {
6181 static hda_nid_t alc260_test_adc_nids[2] = {
6184 /* For testing the ALC260, each input MUX needs its own definition since
6185 * the signal assignments are different. This assumes that the first ADC
6188 static struct hda_input_mux alc260_test_capture_sources[2] = {
6192 { "MIC1 pin", 0x0 },
6193 { "MIC2 pin", 0x1 },
6194 { "LINE1 pin", 0x2 },
6195 { "LINE2 pin", 0x3 },
6197 { "LINE-OUT pin", 0x5 },
6198 { "HP-OUT pin", 0x6 },
6204 { "MIC1 pin", 0x0 },
6205 { "MIC2 pin", 0x1 },
6206 { "LINE1 pin", 0x2 },
6207 { "LINE2 pin", 0x3 },
6210 { "LINE-OUT pin", 0x6 },
6211 { "HP-OUT pin", 0x7 },
6215 static struct snd_kcontrol_new alc260_test_mixer[] = {
6216 /* Output driver widgets */
6217 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
6218 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
6219 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6220 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
6221 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6222 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
6224 /* Modes for retasking pin widgets
6225 * Note: the ALC260 doesn't seem to act on requests to enable mic
6226 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
6227 * mention this restriction. At this stage it's not clear whether
6228 * this behaviour is intentional or is a hardware bug in chip
6229 * revisions available at least up until early 2006. Therefore for
6230 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
6231 * choices, but if it turns out that the lack of mic bias for these
6232 * NIDs is intentional we could change their modes from
6233 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6235 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
6236 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
6237 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
6238 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
6239 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
6240 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
6242 /* Loopback mixer controls */
6243 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
6244 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
6245 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
6246 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
6247 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
6248 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
6249 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
6250 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
6251 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6252 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6253 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
6254 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
6255 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
6256 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
6258 /* Controls for GPIO pins, assuming they are configured as outputs */
6259 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
6260 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
6261 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
6262 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
6264 /* Switches to allow the digital IO pins to be enabled. The datasheet
6265 * is ambigious as to which NID is which; testing on laptops which
6266 * make this output available should provide clarification.
6268 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
6269 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
6271 /* A switch allowing EAPD to be enabled. Some laptops seem to use
6272 * this output to turn on an external amplifier.
6274 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
6275 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
6279 static struct hda_verb alc260_test_init_verbs[] = {
6280 /* Enable all GPIOs as outputs with an initial value of 0 */
6281 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
6282 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6283 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
6285 /* Enable retasking pins as output, initially without power amp */
6286 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6287 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6288 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6289 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6290 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6291 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6293 /* Disable digital (SPDIF) pins initially, but users can enable
6294 * them via a mixer switch. In the case of SPDIF-out, this initverb
6295 * payload also sets the generation to 0, output to be in "consumer"
6296 * PCM format, copyright asserted, no pre-emphasis and no validity
6299 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6300 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6302 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
6303 * OUT1 sum bus when acting as an output.
6305 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6306 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
6307 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6308 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
6310 /* Start with output sum widgets muted and their output gains at min */
6311 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6312 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6313 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6314 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6315 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6316 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6317 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6318 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6319 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6321 /* Unmute retasking pin widget output buffers since the default
6322 * state appears to be output. As the pin mode is changed by the
6323 * user the pin mode control will take care of enabling the pin's
6324 * input/output buffers as needed.
6326 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6327 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6328 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6329 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6330 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6331 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6332 /* Also unmute the mono-out pin widget */
6333 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6335 /* Mute capture amp left and right */
6336 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6337 /* Set ADC connection select to match default mixer setting (mic1
6340 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6342 /* Do the same for the second ADC: mute capture input amp and
6343 * set ADC connection to mic1 pin
6345 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6346 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6348 /* Mute all inputs to mixer widget (even unconnected ones) */
6349 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6350 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6351 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6352 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6353 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6354 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6355 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6356 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6362 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
6363 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
6365 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
6366 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
6369 * for BIOS auto-configuration
6372 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
6373 const char *pfx, int *vol_bits)
6376 unsigned long vol_val, sw_val;
6379 if (nid >= 0x0f && nid < 0x11) {
6380 nid_vol = nid - 0x7;
6381 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6382 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6383 } else if (nid == 0x11) {
6384 nid_vol = nid - 0x7;
6385 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
6386 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
6387 } else if (nid >= 0x12 && nid <= 0x15) {
6389 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6390 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6394 if (!(*vol_bits & (1 << nid_vol))) {
6395 /* first control for the volume widget */
6396 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val);
6399 *vol_bits |= (1 << nid_vol);
6401 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val);
6407 /* add playback controls from the parsed DAC table */
6408 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6409 const struct auto_pin_cfg *cfg)
6415 spec->multiout.num_dacs = 1;
6416 spec->multiout.dac_nids = spec->private_dac_nids;
6417 spec->multiout.dac_nids[0] = 0x02;
6419 nid = cfg->line_out_pins[0];
6422 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6424 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6428 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6433 nid = cfg->speaker_pins[0];
6435 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6440 nid = cfg->hp_pins[0];
6442 err = alc260_add_playback_controls(spec, nid, "Headphone",
6450 /* create playback/capture controls for input pins */
6451 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6452 const struct auto_pin_cfg *cfg)
6454 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
6457 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6458 hda_nid_t nid, int pin_type,
6461 alc_set_pin_output(codec, nid, pin_type);
6462 /* need the manual connection? */
6464 int idx = nid - 0x12;
6465 snd_hda_codec_write(codec, idx + 0x0b, 0,
6466 AC_VERB_SET_CONNECT_SEL, sel_idx);
6470 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6472 struct alc_spec *spec = codec->spec;
6475 nid = spec->autocfg.line_out_pins[0];
6477 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6478 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6481 nid = spec->autocfg.speaker_pins[0];
6483 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6485 nid = spec->autocfg.hp_pins[0];
6487 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6490 #define ALC260_PIN_CD_NID 0x16
6491 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6493 struct alc_spec *spec = codec->spec;
6496 for (i = 0; i < AUTO_PIN_LAST; i++) {
6497 hda_nid_t nid = spec->autocfg.input_pins[i];
6499 alc_set_input_pin(codec, nid, i);
6500 if (nid != ALC260_PIN_CD_NID &&
6501 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6502 snd_hda_codec_write(codec, nid, 0,
6503 AC_VERB_SET_AMP_GAIN_MUTE,
6509 #define alc260_auto_init_input_src alc880_auto_init_input_src
6512 * generic initialization of ADC, input mixers and output mixers
6514 static struct hda_verb alc260_volume_init_verbs[] = {
6516 * Unmute ADC0-1 and set the default input to mic-in
6518 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6519 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6520 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6521 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6523 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6525 * Note: PASD motherboards uses the Line In 2 as the input for
6526 * front panel mic (mic 2)
6528 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6529 /* mute analog inputs */
6530 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6531 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6532 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6533 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6534 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6537 * Set up output mixers (0x08 - 0x0a)
6539 /* set vol=0 to output mixers */
6540 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6541 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6542 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6543 /* set up input amps for analog loopback */
6544 /* Amp Indices: DAC = 0, mixer = 1 */
6545 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6546 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6547 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6548 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6549 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6550 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6555 static int alc260_parse_auto_config(struct hda_codec *codec)
6557 struct alc_spec *spec = codec->spec;
6559 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
6561 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
6565 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
6568 if (!spec->kctls.list)
6569 return 0; /* can't find valid BIOS pin config */
6570 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
6574 spec->multiout.max_channels = 2;
6576 if (spec->autocfg.dig_outs)
6577 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6578 if (spec->kctls.list)
6579 add_mixer(spec, spec->kctls.list);
6581 add_verb(spec, alc260_volume_init_verbs);
6583 spec->num_mux_defs = 1;
6584 spec->input_mux = &spec->private_imux[0];
6586 alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0);
6591 /* additional initialization for auto-configuration model */
6592 static void alc260_auto_init(struct hda_codec *codec)
6594 struct alc_spec *spec = codec->spec;
6595 alc260_auto_init_multi_out(codec);
6596 alc260_auto_init_analog_input(codec);
6597 alc260_auto_init_input_src(codec);
6598 if (spec->unsol_event)
6599 alc_inithook(codec);
6602 #ifdef CONFIG_SND_HDA_POWER_SAVE
6603 static struct hda_amp_list alc260_loopbacks[] = {
6604 { 0x07, HDA_INPUT, 0 },
6605 { 0x07, HDA_INPUT, 1 },
6606 { 0x07, HDA_INPUT, 2 },
6607 { 0x07, HDA_INPUT, 3 },
6608 { 0x07, HDA_INPUT, 4 },
6614 * ALC260 configurations
6616 static const char *alc260_models[ALC260_MODEL_LAST] = {
6617 [ALC260_BASIC] = "basic",
6619 [ALC260_HP_3013] = "hp-3013",
6620 [ALC260_HP_DC7600] = "hp-dc7600",
6621 [ALC260_FUJITSU_S702X] = "fujitsu",
6622 [ALC260_ACER] = "acer",
6623 [ALC260_WILL] = "will",
6624 [ALC260_REPLACER_672V] = "replacer",
6625 [ALC260_FAVORIT100] = "favorit100",
6626 #ifdef CONFIG_SND_DEBUG
6627 [ALC260_TEST] = "test",
6629 [ALC260_AUTO] = "auto",
6632 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6633 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6634 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
6635 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6636 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6637 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6638 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */
6639 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6640 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6641 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6642 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6643 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6644 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6645 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6646 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6647 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6648 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6649 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6650 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6651 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6652 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6656 static struct alc_config_preset alc260_presets[] = {
6658 .mixers = { alc260_base_output_mixer,
6659 alc260_input_mixer },
6660 .init_verbs = { alc260_init_verbs },
6661 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6662 .dac_nids = alc260_dac_nids,
6663 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6664 .adc_nids = alc260_dual_adc_nids,
6665 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6666 .channel_mode = alc260_modes,
6667 .input_mux = &alc260_capture_source,
6670 .mixers = { alc260_hp_output_mixer,
6671 alc260_input_mixer },
6672 .init_verbs = { alc260_init_verbs,
6673 alc260_hp_unsol_verbs },
6674 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6675 .dac_nids = alc260_dac_nids,
6676 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6677 .adc_nids = alc260_adc_nids_alt,
6678 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6679 .channel_mode = alc260_modes,
6680 .input_mux = &alc260_capture_source,
6681 .unsol_event = alc260_hp_unsol_event,
6682 .init_hook = alc260_hp_automute,
6684 [ALC260_HP_DC7600] = {
6685 .mixers = { alc260_hp_dc7600_mixer,
6686 alc260_input_mixer },
6687 .init_verbs = { alc260_init_verbs,
6688 alc260_hp_dc7600_verbs },
6689 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6690 .dac_nids = alc260_dac_nids,
6691 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6692 .adc_nids = alc260_adc_nids_alt,
6693 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6694 .channel_mode = alc260_modes,
6695 .input_mux = &alc260_capture_source,
6696 .unsol_event = alc260_hp_3012_unsol_event,
6697 .init_hook = alc260_hp_3012_automute,
6699 [ALC260_HP_3013] = {
6700 .mixers = { alc260_hp_3013_mixer,
6701 alc260_input_mixer },
6702 .init_verbs = { alc260_hp_3013_init_verbs,
6703 alc260_hp_3013_unsol_verbs },
6704 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6705 .dac_nids = alc260_dac_nids,
6706 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6707 .adc_nids = alc260_adc_nids_alt,
6708 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6709 .channel_mode = alc260_modes,
6710 .input_mux = &alc260_capture_source,
6711 .unsol_event = alc260_hp_3013_unsol_event,
6712 .init_hook = alc260_hp_3013_automute,
6714 [ALC260_FUJITSU_S702X] = {
6715 .mixers = { alc260_fujitsu_mixer },
6716 .init_verbs = { alc260_fujitsu_init_verbs },
6717 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6718 .dac_nids = alc260_dac_nids,
6719 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6720 .adc_nids = alc260_dual_adc_nids,
6721 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6722 .channel_mode = alc260_modes,
6723 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
6724 .input_mux = alc260_fujitsu_capture_sources,
6727 .mixers = { alc260_acer_mixer },
6728 .init_verbs = { alc260_acer_init_verbs },
6729 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6730 .dac_nids = alc260_dac_nids,
6731 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6732 .adc_nids = alc260_dual_adc_nids,
6733 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6734 .channel_mode = alc260_modes,
6735 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
6736 .input_mux = alc260_acer_capture_sources,
6738 [ALC260_FAVORIT100] = {
6739 .mixers = { alc260_favorit100_mixer },
6740 .init_verbs = { alc260_favorit100_init_verbs },
6741 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6742 .dac_nids = alc260_dac_nids,
6743 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6744 .adc_nids = alc260_dual_adc_nids,
6745 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6746 .channel_mode = alc260_modes,
6747 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
6748 .input_mux = alc260_favorit100_capture_sources,
6751 .mixers = { alc260_will_mixer },
6752 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6753 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6754 .dac_nids = alc260_dac_nids,
6755 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6756 .adc_nids = alc260_adc_nids,
6757 .dig_out_nid = ALC260_DIGOUT_NID,
6758 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6759 .channel_mode = alc260_modes,
6760 .input_mux = &alc260_capture_source,
6762 [ALC260_REPLACER_672V] = {
6763 .mixers = { alc260_replacer_672v_mixer },
6764 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6765 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6766 .dac_nids = alc260_dac_nids,
6767 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6768 .adc_nids = alc260_adc_nids,
6769 .dig_out_nid = ALC260_DIGOUT_NID,
6770 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6771 .channel_mode = alc260_modes,
6772 .input_mux = &alc260_capture_source,
6773 .unsol_event = alc260_replacer_672v_unsol_event,
6774 .init_hook = alc260_replacer_672v_automute,
6776 #ifdef CONFIG_SND_DEBUG
6778 .mixers = { alc260_test_mixer },
6779 .init_verbs = { alc260_test_init_verbs },
6780 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6781 .dac_nids = alc260_test_dac_nids,
6782 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6783 .adc_nids = alc260_test_adc_nids,
6784 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6785 .channel_mode = alc260_modes,
6786 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6787 .input_mux = alc260_test_capture_sources,
6792 static int patch_alc260(struct hda_codec *codec)
6794 struct alc_spec *spec;
6795 int err, board_config;
6797 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6803 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6806 if (board_config < 0) {
6807 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6809 board_config = ALC260_AUTO;
6812 if (board_config == ALC260_AUTO) {
6813 /* automatic parse from the BIOS config */
6814 err = alc260_parse_auto_config(codec);
6820 "hda_codec: Cannot set up configuration "
6821 "from BIOS. Using base mode...\n");
6822 board_config = ALC260_BASIC;
6826 err = snd_hda_attach_beep_device(codec, 0x1);
6832 if (board_config != ALC260_AUTO)
6833 setup_preset(codec, &alc260_presets[board_config]);
6835 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6836 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6838 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6839 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6841 if (!spec->adc_nids && spec->input_mux) {
6842 /* check whether NID 0x04 is valid */
6843 unsigned int wcap = get_wcaps(codec, 0x04);
6844 wcap = get_wcaps_type(wcap);
6846 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6847 spec->adc_nids = alc260_adc_nids_alt;
6848 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6850 spec->adc_nids = alc260_adc_nids;
6851 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6854 set_capture_mixer(codec);
6855 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6857 spec->vmaster_nid = 0x08;
6859 codec->patch_ops = alc_patch_ops;
6860 if (board_config == ALC260_AUTO)
6861 spec->init_hook = alc260_auto_init;
6862 #ifdef CONFIG_SND_HDA_POWER_SAVE
6863 if (!spec->loopback.amplist)
6864 spec->loopback.amplist = alc260_loopbacks;
6872 * ALC882/883/885/888/889 support
6874 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6875 * configuration. Each pin widget can choose any input DACs and a mixer.
6876 * Each ADC is connected from a mixer of all inputs. This makes possible
6877 * 6-channel independent captures.
6879 * In addition, an independent DAC for the multi-playback (not used in this
6882 #define ALC882_DIGOUT_NID 0x06
6883 #define ALC882_DIGIN_NID 0x0a
6884 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
6885 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
6886 #define ALC1200_DIGOUT_NID 0x10
6889 static struct hda_channel_mode alc882_ch_modes[1] = {
6894 static hda_nid_t alc882_dac_nids[4] = {
6895 /* front, rear, clfe, rear_surr */
6896 0x02, 0x03, 0x04, 0x05
6898 #define alc883_dac_nids alc882_dac_nids
6901 #define alc882_adc_nids alc880_adc_nids
6902 #define alc882_adc_nids_alt alc880_adc_nids_alt
6903 #define alc883_adc_nids alc882_adc_nids_alt
6904 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
6905 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
6906 #define alc889_adc_nids alc880_adc_nids
6908 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6909 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6910 #define alc883_capsrc_nids alc882_capsrc_nids_alt
6911 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
6912 #define alc889_capsrc_nids alc882_capsrc_nids
6915 /* FIXME: should be a matrix-type input source selection */
6917 static struct hda_input_mux alc882_capture_source = {
6921 { "Front Mic", 0x1 },
6927 #define alc883_capture_source alc882_capture_source
6929 static struct hda_input_mux alc889_capture_source = {
6932 { "Front Mic", 0x0 },
6938 static struct hda_input_mux mb5_capture_source = {
6947 static struct hda_input_mux macmini3_capture_source = {
6955 static struct hda_input_mux alc883_3stack_6ch_intel = {
6959 { "Front Mic", 0x0 },
6965 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6973 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6983 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6991 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
6995 { "Front Mic", 0x1 },
7000 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
7008 static struct hda_input_mux alc889A_mb31_capture_source = {
7012 /* Front Mic (0x01) unused */
7014 /* Line 2 (0x03) unused */
7015 /* CD (0x04) unused? */
7022 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
7029 static struct hda_verb alc882_3ST_ch2_init[] = {
7030 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7031 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7032 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7033 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7040 static struct hda_verb alc882_3ST_ch4_init[] = {
7041 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7042 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7043 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7044 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7045 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7052 static struct hda_verb alc882_3ST_ch6_init[] = {
7053 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7054 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7055 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7056 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7057 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7058 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7062 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
7063 { 2, alc882_3ST_ch2_init },
7064 { 4, alc882_3ST_ch4_init },
7065 { 6, alc882_3ST_ch6_init },
7068 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
7073 static struct hda_verb alc883_3ST_ch2_clevo_init[] = {
7074 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
7075 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7076 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7077 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7078 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7085 static struct hda_verb alc883_3ST_ch4_clevo_init[] = {
7086 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7087 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7088 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7089 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7090 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7091 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7098 static struct hda_verb alc883_3ST_ch6_clevo_init[] = {
7099 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7100 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7101 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7102 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7103 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7104 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7105 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7109 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
7110 { 2, alc883_3ST_ch2_clevo_init },
7111 { 4, alc883_3ST_ch4_clevo_init },
7112 { 6, alc883_3ST_ch6_clevo_init },
7119 static struct hda_verb alc882_sixstack_ch6_init[] = {
7120 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7121 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7122 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7123 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7130 static struct hda_verb alc882_sixstack_ch8_init[] = {
7131 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7132 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7133 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7134 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7138 static struct hda_channel_mode alc882_sixstack_modes[2] = {
7139 { 6, alc882_sixstack_ch6_init },
7140 { 8, alc882_sixstack_ch8_init },
7144 /* Macbook Air 2,1 */
7146 static struct hda_channel_mode alc885_mba21_ch_modes[1] = {
7151 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
7157 static struct hda_verb alc885_mbp_ch2_init[] = {
7158 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7159 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7160 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7167 static struct hda_verb alc885_mbp_ch4_init[] = {
7168 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7169 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7170 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7171 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7172 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7176 static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
7177 { 2, alc885_mbp_ch2_init },
7178 { 4, alc885_mbp_ch4_init },
7183 * Speakers/Woofer/HP = Front
7186 static struct hda_verb alc885_mb5_ch2_init[] = {
7187 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7188 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7194 * Speakers/HP = Front
7198 static struct hda_verb alc885_mb5_ch6_init[] = {
7199 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7200 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7201 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7205 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
7206 { 2, alc885_mb5_ch2_init },
7207 { 6, alc885_mb5_ch6_init },
7210 #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes
7215 static struct hda_verb alc883_4ST_ch2_init[] = {
7216 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7217 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7218 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7219 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7220 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7221 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7228 static struct hda_verb alc883_4ST_ch4_init[] = {
7229 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7230 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7231 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7232 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7233 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7234 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7235 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7242 static struct hda_verb alc883_4ST_ch6_init[] = {
7243 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7244 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7245 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7246 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7247 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7248 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7249 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7250 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7257 static struct hda_verb alc883_4ST_ch8_init[] = {
7258 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7259 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7260 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7261 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7262 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7263 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7264 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7265 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7266 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7270 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
7271 { 2, alc883_4ST_ch2_init },
7272 { 4, alc883_4ST_ch4_init },
7273 { 6, alc883_4ST_ch6_init },
7274 { 8, alc883_4ST_ch8_init },
7281 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7282 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7283 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7284 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7285 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7292 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7293 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7294 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7295 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7296 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7297 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7304 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7305 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7306 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7307 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7308 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7309 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7310 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7314 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7315 { 2, alc883_3ST_ch2_intel_init },
7316 { 4, alc883_3ST_ch4_intel_init },
7317 { 6, alc883_3ST_ch6_intel_init },
7323 static struct hda_verb alc889_ch2_intel_init[] = {
7324 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7325 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
7326 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
7327 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
7328 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7329 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7336 static struct hda_verb alc889_ch6_intel_init[] = {
7337 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7338 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7339 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7340 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7341 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7342 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7349 static struct hda_verb alc889_ch8_intel_init[] = {
7350 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7351 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7352 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7353 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7354 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
7355 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7356 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7360 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
7361 { 2, alc889_ch2_intel_init },
7362 { 6, alc889_ch6_intel_init },
7363 { 8, alc889_ch8_intel_init },
7369 static struct hda_verb alc883_sixstack_ch6_init[] = {
7370 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7371 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7372 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7373 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7380 static struct hda_verb alc883_sixstack_ch8_init[] = {
7381 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7382 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7383 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7384 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7388 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7389 { 6, alc883_sixstack_ch6_init },
7390 { 8, alc883_sixstack_ch8_init },
7394 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7395 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7397 static struct snd_kcontrol_new alc882_base_mixer[] = {
7398 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7399 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7400 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7401 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7402 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7403 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7404 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7405 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7406 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7407 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7408 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7409 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7410 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7411 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7412 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7413 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7414 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7415 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7416 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7417 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7418 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7422 /* Macbook Air 2,1 same control for HP and internal Speaker */
7424 static struct snd_kcontrol_new alc885_mba21_mixer[] = {
7425 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7426 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT),
7431 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
7432 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7433 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7434 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7435 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
7436 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7437 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7438 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7439 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7440 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7441 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
7442 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7446 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7447 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7448 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7449 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7450 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7451 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7452 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7453 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7454 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7455 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7456 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7457 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7458 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7459 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7460 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
7464 static struct snd_kcontrol_new alc885_macmini3_mixer[] = {
7465 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7466 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7467 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7468 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7469 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7470 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7471 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7472 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7473 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
7474 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
7475 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7479 static struct snd_kcontrol_new alc885_imac91_mixer[] = {
7480 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7481 HDA_BIND_MUTE ("Line-Out Playback Switch", 0x0c, 0x02, HDA_INPUT),
7482 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
7483 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7484 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7485 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7486 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7487 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7488 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7493 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
7494 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7495 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7496 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7497 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7498 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7499 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7500 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7501 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7502 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7506 static struct snd_kcontrol_new alc882_targa_mixer[] = {
7507 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7508 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7509 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7510 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7511 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7512 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7513 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7514 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7515 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7516 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7517 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7518 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7519 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7523 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
7524 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
7526 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
7527 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7528 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7529 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7530 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
7531 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7532 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7533 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7534 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7535 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
7536 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
7537 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7538 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7539 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7543 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
7544 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7545 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7546 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7547 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7548 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7549 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7550 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7551 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7552 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7553 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7557 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
7559 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7560 .name = "Channel Mode",
7561 .info = alc_ch_mode_info,
7562 .get = alc_ch_mode_get,
7563 .put = alc_ch_mode_put,
7568 static struct hda_verb alc882_base_init_verbs[] = {
7569 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7570 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7571 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7573 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7574 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7576 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7577 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7579 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7580 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7582 /* Front Pin: output 0 (0x0c) */
7583 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7584 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7585 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7586 /* Rear Pin: output 1 (0x0d) */
7587 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7588 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7589 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7590 /* CLFE Pin: output 2 (0x0e) */
7591 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7592 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7593 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7594 /* Side Pin: output 3 (0x0f) */
7595 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7596 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7597 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7598 /* Mic (rear) pin: input vref at 80% */
7599 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7600 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7601 /* Front Mic pin: input vref at 80% */
7602 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7603 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7604 /* Line In pin: input */
7605 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7606 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7607 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7608 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7609 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7610 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7611 /* CD pin widget for input */
7612 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7614 /* FIXME: use matrix-type input source selection */
7615 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7617 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7619 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7620 /* ADC2: mute amp left and right */
7621 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7622 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7623 /* ADC3: mute amp left and right */
7624 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7625 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7630 static struct hda_verb alc882_adc1_init_verbs[] = {
7631 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7632 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7633 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7634 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7635 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7636 /* ADC1: mute amp left and right */
7637 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7638 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7642 static struct hda_verb alc882_eapd_verbs[] = {
7643 /* change to EAPD mode */
7644 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7645 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
7649 static struct hda_verb alc889_eapd_verbs[] = {
7650 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
7651 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
7655 static struct hda_verb alc_hp15_unsol_verbs[] = {
7656 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7657 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7661 static struct hda_verb alc885_init_verbs[] = {
7662 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7663 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7664 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7666 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7667 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7669 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7670 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7672 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7673 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7675 /* Front HP Pin: output 0 (0x0c) */
7676 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7677 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7678 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7679 /* Front Pin: output 0 (0x0c) */
7680 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7681 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7682 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7683 /* Rear Pin: output 1 (0x0d) */
7684 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7685 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7686 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
7687 /* CLFE Pin: output 2 (0x0e) */
7688 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7689 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7690 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7691 /* Side Pin: output 3 (0x0f) */
7692 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7693 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7694 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7695 /* Mic (rear) pin: input vref at 80% */
7696 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7697 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7698 /* Front Mic pin: input vref at 80% */
7699 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7700 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7701 /* Line In pin: input */
7702 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7703 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7705 /* Mixer elements: 0x18, , 0x1a, 0x1b */
7707 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7709 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7711 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7712 /* ADC2: mute amp left and right */
7713 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7714 /* ADC3: mute amp left and right */
7715 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7720 static struct hda_verb alc885_init_input_verbs[] = {
7721 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7722 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7723 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7728 /* Unmute Selector 24h and set the default input to front mic */
7729 static struct hda_verb alc889_init_input_verbs[] = {
7730 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
7731 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7736 #define alc883_init_verbs alc882_base_init_verbs
7739 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
7740 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7741 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7742 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
7743 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7744 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7745 /* FIXME: this looks suspicious...
7746 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
7747 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
7752 static struct hda_verb alc882_macpro_init_verbs[] = {
7753 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7754 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7755 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7756 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7757 /* Front Pin: output 0 (0x0c) */
7758 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7759 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7760 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7761 /* Front Mic pin: input vref at 80% */
7762 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7763 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7764 /* Speaker: output */
7765 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7766 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7767 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
7768 /* Headphone output (output 0 - 0x0c) */
7769 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7770 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7771 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7773 /* FIXME: use matrix-type input source selection */
7774 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7775 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7776 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7777 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7778 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7779 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7781 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7782 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7783 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7784 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7786 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7787 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7788 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7789 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7790 /* ADC1: mute amp left and right */
7791 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7792 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7793 /* ADC2: mute amp left and right */
7794 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7795 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7796 /* ADC3: mute amp left and right */
7797 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7798 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7804 static struct hda_verb alc885_mb5_init_verbs[] = {
7806 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7807 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7808 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7809 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7811 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7812 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7813 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7814 /* Surround mixer */
7815 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7816 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7817 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7819 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7820 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7821 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7823 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7824 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7825 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7826 /* Front Pin (0x0c) */
7827 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7828 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7829 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7830 /* LFE Pin (0x0e) */
7831 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7832 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7833 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7835 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7836 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7837 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7838 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7839 /* Front Mic pin: input vref at 80% */
7840 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7841 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7843 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7844 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7846 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7847 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7848 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7849 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7854 static struct hda_verb alc885_macmini3_init_verbs[] = {
7856 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7857 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7858 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7859 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7861 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7862 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7863 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7864 /* Surround mixer */
7865 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7866 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7867 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7869 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7870 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7871 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7873 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7874 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7875 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7876 /* Front Pin (0x0c) */
7877 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7878 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7879 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7880 /* LFE Pin (0x0e) */
7881 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7882 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7883 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7885 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7886 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7887 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7888 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7890 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7891 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7893 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7894 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7895 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7896 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7901 static struct hda_verb alc885_mba21_init_verbs[] = {
7902 /*Internal and HP Speaker Mixer*/
7903 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7904 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7905 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7906 /*Internal Speaker Pin (0x0c)*/
7907 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
7908 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7909 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7910 /* HP Pin: output 0 (0x0e) */
7911 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7912 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7913 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7914 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
7915 /* Line in (is hp when jack connected)*/
7916 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
7917 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7923 /* Macbook Pro rev3 */
7924 static struct hda_verb alc885_mbp3_init_verbs[] = {
7925 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7926 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7927 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7928 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7930 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7931 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7932 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7934 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7935 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7936 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7937 /* Front Pin: output 0 (0x0c) */
7938 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7939 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7940 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7941 /* HP Pin: output 0 (0x0e) */
7942 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7943 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7944 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
7945 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7946 /* Mic (rear) pin: input vref at 80% */
7947 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7948 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7949 /* Front Mic pin: input vref at 80% */
7950 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7951 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7952 /* Line In pin: use output 1 when in LineOut mode */
7953 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7954 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7955 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7957 /* FIXME: use matrix-type input source selection */
7958 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7959 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7960 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7961 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7962 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7963 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7965 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7966 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7967 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7968 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7970 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7971 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7972 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7973 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7974 /* ADC1: mute amp left and right */
7975 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7976 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7977 /* ADC2: mute amp left and right */
7978 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7979 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7980 /* ADC3: mute amp left and right */
7981 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7982 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7988 static struct hda_verb alc885_imac91_init_verbs[] = {
7989 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
7990 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7991 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7992 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7994 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7995 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7996 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7997 /* HP Pin: output 0 (0x0c) */
7998 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7999 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8000 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8001 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8002 /* Internal Speakers: output 0 (0x0d) */
8003 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8004 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8005 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8006 /* Mic (rear) pin: input vref at 80% */
8007 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8008 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8009 /* Front Mic pin: input vref at 80% */
8010 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8011 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8012 /* Line In pin: use output 1 when in LineOut mode */
8013 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8014 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8015 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8017 /* FIXME: use matrix-type input source selection */
8018 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8019 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8020 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8021 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8022 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8023 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8025 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8026 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8027 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8028 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8030 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8031 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8032 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8033 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8034 /* ADC1: mute amp left and right */
8035 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8036 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8037 /* ADC2: mute amp left and right */
8038 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8039 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8040 /* ADC3: mute amp left and right */
8041 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8042 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8047 /* iMac 24 mixer. */
8048 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
8049 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8050 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
8054 /* iMac 24 init verbs. */
8055 static struct hda_verb alc885_imac24_init_verbs[] = {
8056 /* Internal speakers: output 0 (0x0c) */
8057 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8058 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8059 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8060 /* Internal speakers: output 0 (0x0c) */
8061 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8062 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8063 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8064 /* Headphone: output 0 (0x0c) */
8065 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8066 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8067 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8068 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8069 /* Front Mic: input vref at 80% */
8070 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8071 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8075 /* Toggle speaker-output according to the hp-jack state */
8076 static void alc885_imac24_setup(struct hda_codec *codec)
8078 struct alc_spec *spec = codec->spec;
8080 spec->autocfg.hp_pins[0] = 0x14;
8081 spec->autocfg.speaker_pins[0] = 0x18;
8082 spec->autocfg.speaker_pins[1] = 0x1a;
8085 #define alc885_mb5_setup alc885_imac24_setup
8086 #define alc885_macmini3_setup alc885_imac24_setup
8088 /* Macbook Air 2,1 */
8089 static void alc885_mba21_setup(struct hda_codec *codec)
8091 struct alc_spec *spec = codec->spec;
8093 spec->autocfg.hp_pins[0] = 0x14;
8094 spec->autocfg.speaker_pins[0] = 0x18;
8099 static void alc885_mbp3_setup(struct hda_codec *codec)
8101 struct alc_spec *spec = codec->spec;
8103 spec->autocfg.hp_pins[0] = 0x15;
8104 spec->autocfg.speaker_pins[0] = 0x14;
8107 static void alc885_imac91_setup(struct hda_codec *codec)
8109 struct alc_spec *spec = codec->spec;
8111 spec->autocfg.hp_pins[0] = 0x14;
8112 spec->autocfg.speaker_pins[0] = 0x15;
8113 spec->autocfg.speaker_pins[1] = 0x1a;
8116 static struct hda_verb alc882_targa_verbs[] = {
8117 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8118 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8120 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8121 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8123 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8124 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8125 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8127 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8131 /* toggle speaker-output according to the hp-jack state */
8132 static void alc882_targa_automute(struct hda_codec *codec)
8134 struct alc_spec *spec = codec->spec;
8135 alc_automute_amp(codec);
8136 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
8137 spec->jack_present ? 1 : 3);
8140 static void alc882_targa_setup(struct hda_codec *codec)
8142 struct alc_spec *spec = codec->spec;
8144 spec->autocfg.hp_pins[0] = 0x14;
8145 spec->autocfg.speaker_pins[0] = 0x1b;
8148 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
8150 if ((res >> 26) == ALC880_HP_EVENT)
8151 alc882_targa_automute(codec);
8154 static struct hda_verb alc882_asus_a7j_verbs[] = {
8155 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8156 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8158 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8159 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8160 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8162 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8163 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8164 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8166 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8167 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8168 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8172 static struct hda_verb alc882_asus_a7m_verbs[] = {
8173 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8174 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8176 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8177 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8178 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8180 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8181 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8182 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8184 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8185 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8186 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8190 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
8192 unsigned int gpiostate, gpiomask, gpiodir;
8194 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
8195 AC_VERB_GET_GPIO_DATA, 0);
8198 gpiostate |= (1 << pin);
8200 gpiostate &= ~(1 << pin);
8202 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
8203 AC_VERB_GET_GPIO_MASK, 0);
8204 gpiomask |= (1 << pin);
8206 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
8207 AC_VERB_GET_GPIO_DIRECTION, 0);
8208 gpiodir |= (1 << pin);
8211 snd_hda_codec_write(codec, codec->afg, 0,
8212 AC_VERB_SET_GPIO_MASK, gpiomask);
8213 snd_hda_codec_write(codec, codec->afg, 0,
8214 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
8218 snd_hda_codec_write(codec, codec->afg, 0,
8219 AC_VERB_SET_GPIO_DATA, gpiostate);
8222 /* set up GPIO at initialization */
8223 static void alc885_macpro_init_hook(struct hda_codec *codec)
8225 alc882_gpio_mute(codec, 0, 0);
8226 alc882_gpio_mute(codec, 1, 0);
8229 /* set up GPIO and update auto-muting at initialization */
8230 static void alc885_imac24_init_hook(struct hda_codec *codec)
8232 alc885_macpro_init_hook(codec);
8233 alc_automute_amp(codec);
8237 * generic initialization of ADC, input mixers and output mixers
8239 static struct hda_verb alc883_auto_init_verbs[] = {
8241 * Unmute ADC0-2 and set the default input to mic-in
8243 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8244 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8245 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8246 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8249 * Set up output mixers (0x0c - 0x0f)
8251 /* set vol=0 to output mixers */
8252 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8253 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8254 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8255 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8256 /* set up input amps for analog loopback */
8257 /* Amp Indices: DAC = 0, mixer = 1 */
8258 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8259 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8260 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8261 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8262 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8263 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8264 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8265 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8266 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8267 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8269 /* FIXME: use matrix-type input source selection */
8270 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8272 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8274 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8278 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
8279 static struct hda_verb alc889A_mb31_ch2_init[] = {
8280 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8281 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8282 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8283 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8287 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
8288 static struct hda_verb alc889A_mb31_ch4_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_OUT}, /* Line as output */
8292 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8296 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
8297 static struct hda_verb alc889A_mb31_ch5_init[] = {
8298 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
8299 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8300 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8301 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8305 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
8306 static struct hda_verb alc889A_mb31_ch6_init[] = {
8307 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
8308 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
8309 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8310 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8314 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
8315 { 2, alc889A_mb31_ch2_init },
8316 { 4, alc889A_mb31_ch4_init },
8317 { 5, alc889A_mb31_ch5_init },
8318 { 6, alc889A_mb31_ch6_init },
8321 static struct hda_verb alc883_medion_eapd_verbs[] = {
8322 /* eanable EAPD on medion laptop */
8323 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8324 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
8328 #define alc883_base_mixer alc882_base_mixer
8330 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
8331 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8332 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8333 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8334 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8335 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8336 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8337 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8338 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8339 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8340 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8341 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8342 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8343 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8347 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
8348 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8349 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8350 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8351 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8352 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8353 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8354 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8355 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8356 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8357 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8361 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
8362 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8363 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8364 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8365 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8366 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8367 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8368 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8369 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8370 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8371 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8375 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
8376 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8377 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8378 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8379 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8380 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8381 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8382 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8383 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8384 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8385 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8386 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8387 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8388 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8392 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
8393 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8394 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8395 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8396 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8397 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8398 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8399 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8400 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8401 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8402 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8403 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8404 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8405 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8406 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8407 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8408 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8409 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8410 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8411 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8415 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
8416 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8417 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8418 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8419 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8420 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8422 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8423 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8424 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8425 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8426 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8427 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8428 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8429 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8430 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8431 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8432 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8433 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8434 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8435 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8439 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
8440 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8441 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8442 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8443 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8444 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8446 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8447 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8448 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8449 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8450 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
8451 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8452 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8453 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8454 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
8455 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT),
8456 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
8457 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8458 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8459 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8463 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
8464 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8465 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8466 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8467 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8468 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8469 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8470 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8471 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8472 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8473 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8474 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8475 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8476 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8477 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8478 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8479 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8480 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8481 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8482 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8486 static struct snd_kcontrol_new alc883_targa_mixer[] = {
8487 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8488 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8489 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8490 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8491 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8492 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8493 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8494 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8495 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8496 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8497 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8498 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8499 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8500 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8501 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8502 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8503 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8507 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
8508 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8509 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8510 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8511 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8512 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8513 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8514 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8515 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8516 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8517 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8518 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8519 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8523 static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
8524 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8525 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, 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_lenovo_101e_2ch_mixer[] = {
8533 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8534 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8535 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8536 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8537 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8538 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8539 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8540 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8544 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
8545 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8546 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
8547 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8548 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8549 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8550 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8551 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8552 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8553 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8557 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
8558 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8559 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8560 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8561 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8562 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8563 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8564 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8565 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8566 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8570 static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = {
8571 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8572 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8573 HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8574 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
8575 HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT),
8576 HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT),
8580 static struct hda_verb alc883_medion_wim2160_verbs[] = {
8581 /* Unmute front mixer */
8582 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8583 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8585 /* Set speaker pin to front mixer */
8586 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8588 /* Init headphone pin */
8589 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8590 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8591 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8592 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8597 /* toggle speaker-output according to the hp-jack state */
8598 static void alc883_medion_wim2160_setup(struct hda_codec *codec)
8600 struct alc_spec *spec = codec->spec;
8602 spec->autocfg.hp_pins[0] = 0x1a;
8603 spec->autocfg.speaker_pins[0] = 0x15;
8606 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
8607 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8608 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8609 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8610 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8611 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8612 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8613 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8614 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8618 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
8619 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8620 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8621 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8622 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8623 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8624 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8625 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8626 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8627 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8631 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
8632 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8633 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8634 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8635 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
8636 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
8637 0x0d, 1, 0x0, HDA_OUTPUT),
8638 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
8639 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
8640 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
8641 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8642 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8643 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8644 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8645 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8646 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8647 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8648 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8649 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8650 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8651 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8652 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8656 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
8658 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8659 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8660 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8661 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8662 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
8664 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
8665 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
8666 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
8667 /* Output switches */
8668 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
8669 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
8670 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
8672 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
8673 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
8675 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8676 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8677 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8678 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8682 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
8683 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8684 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8685 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8686 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8687 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8688 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8692 static struct hda_bind_ctls alc883_bind_cap_vol = {
8693 .ops = &snd_hda_bind_vol,
8695 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8696 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8701 static struct hda_bind_ctls alc883_bind_cap_switch = {
8702 .ops = &snd_hda_bind_sw,
8704 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8705 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8710 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
8711 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8712 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8713 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8714 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8715 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8716 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8717 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8718 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8722 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
8723 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
8724 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
8726 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8727 /* .name = "Capture Source", */
8728 .name = "Input Source",
8730 .info = alc_mux_enum_info,
8731 .get = alc_mux_enum_get,
8732 .put = alc_mux_enum_put,
8737 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
8739 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8740 .name = "Channel Mode",
8741 .info = alc_ch_mode_info,
8742 .get = alc_ch_mode_get,
8743 .put = alc_ch_mode_put,
8748 /* toggle speaker-output according to the hp-jack state */
8749 static void alc883_mitac_setup(struct hda_codec *codec)
8751 struct alc_spec *spec = codec->spec;
8753 spec->autocfg.hp_pins[0] = 0x15;
8754 spec->autocfg.speaker_pins[0] = 0x14;
8755 spec->autocfg.speaker_pins[1] = 0x17;
8758 /* auto-toggle front mic */
8760 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8762 unsigned char bits = snd_hda_jack_detect(codec, 0x18) ? HDA_AMP_MUTE : 0;
8764 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8768 static struct hda_verb alc883_mitac_verbs[] = {
8770 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8771 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8773 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8774 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8776 /* enable unsolicited event */
8777 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8778 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8783 static struct hda_verb alc883_clevo_m540r_verbs[] = {
8785 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8786 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8788 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
8790 /* enable unsolicited event */
8792 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8793 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8799 static struct hda_verb alc883_clevo_m720_verbs[] = {
8801 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8802 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8804 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
8805 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8807 /* enable unsolicited event */
8808 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8809 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8814 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8816 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8817 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8819 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8820 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8822 /* enable unsolicited event */
8823 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8828 static struct hda_verb alc883_targa_verbs[] = {
8829 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8830 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8832 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8833 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8835 /* Connect Line-Out side jack (SPDIF) to Side */
8836 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8837 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8838 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8839 /* Connect Mic jack to CLFE */
8840 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8841 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8842 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
8843 /* Connect Line-in jack to Surround */
8844 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8845 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8846 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8847 /* Connect HP out jack to Front */
8848 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8849 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8850 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8852 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8857 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8858 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8859 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8860 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8864 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8865 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8866 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8867 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8868 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8872 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8873 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8874 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8875 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8876 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8877 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8881 static struct hda_verb alc883_haier_w66_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)},
8885 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8887 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8888 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8889 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8890 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8894 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8895 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8896 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8897 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8898 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8899 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8900 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8901 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8902 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8906 static struct hda_verb alc888_6st_dell_verbs[] = {
8907 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8911 static struct hda_verb alc883_vaiott_verbs[] = {
8913 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8914 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8916 /* enable unsolicited event */
8917 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8922 static void alc888_3st_hp_setup(struct hda_codec *codec)
8924 struct alc_spec *spec = codec->spec;
8926 spec->autocfg.hp_pins[0] = 0x1b;
8927 spec->autocfg.speaker_pins[0] = 0x14;
8928 spec->autocfg.speaker_pins[1] = 0x16;
8929 spec->autocfg.speaker_pins[2] = 0x18;
8932 static struct hda_verb alc888_3st_hp_verbs[] = {
8933 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8934 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8935 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8936 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8943 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8944 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8945 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8946 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8947 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8954 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8955 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8956 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8957 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8958 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8959 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8966 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8967 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8968 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8969 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8970 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8971 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8972 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8976 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8977 { 2, alc888_3st_hp_2ch_init },
8978 { 4, alc888_3st_hp_4ch_init },
8979 { 6, alc888_3st_hp_6ch_init },
8982 /* toggle front-jack and RCA according to the hp-jack state */
8983 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8985 unsigned int present = snd_hda_jack_detect(codec, 0x1b);
8987 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8988 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8989 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8990 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8993 /* toggle RCA according to the front-jack state */
8994 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8996 unsigned int present = snd_hda_jack_detect(codec, 0x14);
8998 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8999 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9002 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
9005 if ((res >> 26) == ALC880_HP_EVENT)
9006 alc888_lenovo_ms7195_front_automute(codec);
9007 if ((res >> 26) == ALC880_FRONT_EVENT)
9008 alc888_lenovo_ms7195_rca_automute(codec);
9011 static struct hda_verb alc883_medion_md2_verbs[] = {
9012 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9013 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9015 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9017 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9021 /* toggle speaker-output according to the hp-jack state */
9022 static void alc883_medion_md2_setup(struct hda_codec *codec)
9024 struct alc_spec *spec = codec->spec;
9026 spec->autocfg.hp_pins[0] = 0x14;
9027 spec->autocfg.speaker_pins[0] = 0x15;
9030 /* toggle speaker-output according to the hp-jack state */
9031 #define alc883_targa_init_hook alc882_targa_init_hook
9032 #define alc883_targa_unsol_event alc882_targa_unsol_event
9034 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
9036 unsigned int present;
9038 present = snd_hda_jack_detect(codec, 0x18);
9039 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
9040 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9043 static void alc883_clevo_m720_setup(struct hda_codec *codec)
9045 struct alc_spec *spec = codec->spec;
9047 spec->autocfg.hp_pins[0] = 0x15;
9048 spec->autocfg.speaker_pins[0] = 0x14;
9051 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
9053 alc_automute_amp(codec);
9054 alc883_clevo_m720_mic_automute(codec);
9057 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
9060 switch (res >> 26) {
9061 case ALC880_MIC_EVENT:
9062 alc883_clevo_m720_mic_automute(codec);
9065 alc_automute_amp_unsol_event(codec, res);
9070 /* toggle speaker-output according to the hp-jack state */
9071 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
9073 struct alc_spec *spec = codec->spec;
9075 spec->autocfg.hp_pins[0] = 0x14;
9076 spec->autocfg.speaker_pins[0] = 0x15;
9079 static void alc883_haier_w66_setup(struct hda_codec *codec)
9081 struct alc_spec *spec = codec->spec;
9083 spec->autocfg.hp_pins[0] = 0x1b;
9084 spec->autocfg.speaker_pins[0] = 0x14;
9087 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
9089 int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0;
9091 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9092 HDA_AMP_MUTE, bits);
9095 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
9097 int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0;
9099 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9100 HDA_AMP_MUTE, bits);
9101 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9102 HDA_AMP_MUTE, bits);
9105 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
9108 if ((res >> 26) == ALC880_HP_EVENT)
9109 alc883_lenovo_101e_all_automute(codec);
9110 if ((res >> 26) == ALC880_FRONT_EVENT)
9111 alc883_lenovo_101e_ispeaker_automute(codec);
9114 /* toggle speaker-output according to the hp-jack state */
9115 static void alc883_acer_aspire_setup(struct hda_codec *codec)
9117 struct alc_spec *spec = codec->spec;
9119 spec->autocfg.hp_pins[0] = 0x14;
9120 spec->autocfg.speaker_pins[0] = 0x15;
9121 spec->autocfg.speaker_pins[1] = 0x16;
9124 static struct hda_verb alc883_acer_eapd_verbs[] = {
9125 /* HP Pin: output 0 (0x0c) */
9126 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9127 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9128 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9129 /* Front Pin: output 0 (0x0c) */
9130 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9131 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9132 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9133 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
9134 /* eanable EAPD on medion laptop */
9135 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9136 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
9137 /* enable unsolicited event */
9138 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9142 static struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
9143 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9144 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
9145 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9149 static void alc888_6st_dell_setup(struct hda_codec *codec)
9151 struct alc_spec *spec = codec->spec;
9153 spec->autocfg.hp_pins[0] = 0x1b;
9154 spec->autocfg.speaker_pins[0] = 0x14;
9155 spec->autocfg.speaker_pins[1] = 0x15;
9156 spec->autocfg.speaker_pins[2] = 0x16;
9157 spec->autocfg.speaker_pins[3] = 0x17;
9160 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
9162 struct alc_spec *spec = codec->spec;
9164 spec->autocfg.hp_pins[0] = 0x1b;
9165 spec->autocfg.speaker_pins[0] = 0x14;
9166 spec->autocfg.speaker_pins[1] = 0x15;
9167 spec->autocfg.speaker_pins[2] = 0x16;
9168 spec->autocfg.speaker_pins[3] = 0x17;
9169 spec->autocfg.speaker_pins[4] = 0x1a;
9172 static void alc883_vaiott_setup(struct hda_codec *codec)
9174 struct alc_spec *spec = codec->spec;
9176 spec->autocfg.hp_pins[0] = 0x15;
9177 spec->autocfg.speaker_pins[0] = 0x14;
9178 spec->autocfg.speaker_pins[1] = 0x17;
9181 static struct hda_verb alc888_asus_m90v_verbs[] = {
9182 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9183 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9184 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9185 /* enable unsolicited event */
9186 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9187 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9191 static void alc883_mode2_setup(struct hda_codec *codec)
9193 struct alc_spec *spec = codec->spec;
9195 spec->autocfg.hp_pins[0] = 0x1b;
9196 spec->autocfg.speaker_pins[0] = 0x14;
9197 spec->autocfg.speaker_pins[1] = 0x15;
9198 spec->autocfg.speaker_pins[2] = 0x16;
9199 spec->ext_mic.pin = 0x18;
9200 spec->int_mic.pin = 0x19;
9201 spec->ext_mic.mux_idx = 0;
9202 spec->int_mic.mux_idx = 1;
9206 static struct hda_verb alc888_asus_eee1601_verbs[] = {
9207 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9208 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9209 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9210 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9211 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9212 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
9213 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
9214 /* enable unsolicited event */
9215 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9219 static void alc883_eee1601_inithook(struct hda_codec *codec)
9221 struct alc_spec *spec = codec->spec;
9223 spec->autocfg.hp_pins[0] = 0x14;
9224 spec->autocfg.speaker_pins[0] = 0x1b;
9225 alc_automute_pin(codec);
9228 static struct hda_verb alc889A_mb31_verbs[] = {
9229 /* Init rear pin (used as headphone output) */
9230 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
9231 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
9232 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9233 /* Init line pin (used as output in 4ch and 6ch mode) */
9234 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
9235 /* Init line 2 pin (used as headphone out by default) */
9236 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
9237 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
9241 /* Mute speakers according to the headphone jack state */
9242 static void alc889A_mb31_automute(struct hda_codec *codec)
9244 unsigned int present;
9246 /* Mute only in 2ch or 4ch mode */
9247 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
9249 present = snd_hda_jack_detect(codec, 0x15);
9250 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9251 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9252 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9253 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9257 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
9259 if ((res >> 26) == ALC880_HP_EVENT)
9260 alc889A_mb31_automute(codec);
9264 #ifdef CONFIG_SND_HDA_POWER_SAVE
9265 #define alc882_loopbacks alc880_loopbacks
9268 /* pcm configuration: identical with ALC880 */
9269 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
9270 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
9271 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
9272 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
9274 static hda_nid_t alc883_slave_dig_outs[] = {
9275 ALC1200_DIGOUT_NID, 0,
9278 static hda_nid_t alc1200_slave_dig_outs[] = {
9279 ALC883_DIGOUT_NID, 0,
9283 * configuration and preset
9285 static const char *alc882_models[ALC882_MODEL_LAST] = {
9286 [ALC882_3ST_DIG] = "3stack-dig",
9287 [ALC882_6ST_DIG] = "6stack-dig",
9288 [ALC882_ARIMA] = "arima",
9289 [ALC882_W2JC] = "w2jc",
9290 [ALC882_TARGA] = "targa",
9291 [ALC882_ASUS_A7J] = "asus-a7j",
9292 [ALC882_ASUS_A7M] = "asus-a7m",
9293 [ALC885_MACPRO] = "macpro",
9294 [ALC885_MB5] = "mb5",
9295 [ALC885_MACMINI3] = "macmini3",
9296 [ALC885_MBA21] = "mba21",
9297 [ALC885_MBP3] = "mbp3",
9298 [ALC885_IMAC24] = "imac24",
9299 [ALC885_IMAC91] = "imac91",
9300 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
9301 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
9302 [ALC883_3ST_6ch] = "3stack-6ch",
9303 [ALC883_6ST_DIG] = "alc883-6stack-dig",
9304 [ALC883_TARGA_DIG] = "targa-dig",
9305 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
9306 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
9307 [ALC883_ACER] = "acer",
9308 [ALC883_ACER_ASPIRE] = "acer-aspire",
9309 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
9310 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
9311 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
9312 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
9313 [ALC883_MEDION] = "medion",
9314 [ALC883_MEDION_MD2] = "medion-md2",
9315 [ALC883_MEDION_WIM2160] = "medion-wim2160",
9316 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
9317 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
9318 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
9319 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
9320 [ALC888_LENOVO_SKY] = "lenovo-sky",
9321 [ALC883_HAIER_W66] = "haier-w66",
9322 [ALC888_3ST_HP] = "3stack-hp",
9323 [ALC888_6ST_DELL] = "6stack-dell",
9324 [ALC883_MITAC] = "mitac",
9325 [ALC883_CLEVO_M540R] = "clevo-m540r",
9326 [ALC883_CLEVO_M720] = "clevo-m720",
9327 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
9328 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
9329 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
9330 [ALC889A_INTEL] = "intel-alc889a",
9331 [ALC889_INTEL] = "intel-x58",
9332 [ALC1200_ASUS_P5Q] = "asus-p5q",
9333 [ALC889A_MB31] = "mb31",
9334 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
9335 [ALC882_AUTO] = "auto",
9338 static struct snd_pci_quirk alc882_cfg_tbl[] = {
9339 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
9341 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
9342 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
9343 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
9344 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
9345 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
9346 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
9347 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
9348 ALC888_ACER_ASPIRE_4930G),
9349 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
9350 ALC888_ACER_ASPIRE_4930G),
9351 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
9352 ALC888_ACER_ASPIRE_8930G),
9353 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
9354 ALC888_ACER_ASPIRE_8930G),
9355 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
9356 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
9357 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
9358 ALC888_ACER_ASPIRE_6530G),
9359 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
9360 ALC888_ACER_ASPIRE_6530G),
9361 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
9362 ALC888_ACER_ASPIRE_7730G),
9363 /* default Acer -- disabled as it causes more problems.
9364 * model=auto should work fine now
9366 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
9368 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
9370 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
9371 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
9372 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
9373 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
9374 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
9375 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
9377 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
9378 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
9379 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
9380 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
9381 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
9382 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
9383 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
9384 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
9385 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
9386 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
9387 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
9389 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
9390 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
9391 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
9392 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
9393 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
9394 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
9395 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
9396 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
9397 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
9399 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
9400 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
9401 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
9402 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
9403 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
9404 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
9405 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
9406 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
9407 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
9408 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
9409 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
9410 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
9411 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
9412 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
9413 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
9414 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
9415 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
9416 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
9417 SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG),
9418 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
9419 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
9420 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
9421 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
9422 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
9423 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
9424 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
9425 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
9426 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
9427 SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG),
9428 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
9429 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
9431 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
9432 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
9433 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
9434 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
9435 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
9436 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
9437 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
9438 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
9439 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9440 ALC883_FUJITSU_PI2515),
9441 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9442 ALC888_FUJITSU_XA3530),
9443 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
9444 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9445 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9446 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9447 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
9448 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
9449 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
9450 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
9451 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
9453 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
9454 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
9455 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
9456 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
9457 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
9458 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
9459 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG),
9464 /* codec SSID table for Intel Mac */
9465 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
9466 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
9467 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
9468 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
9469 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
9470 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
9471 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
9472 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
9473 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
9474 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
9475 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
9476 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
9477 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
9478 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
9479 * so apparently no perfect solution yet
9481 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
9482 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
9483 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3),
9487 static struct alc_config_preset alc882_presets[] = {
9488 [ALC882_3ST_DIG] = {
9489 .mixers = { alc882_base_mixer },
9490 .init_verbs = { alc882_base_init_verbs,
9491 alc882_adc1_init_verbs },
9492 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9493 .dac_nids = alc882_dac_nids,
9494 .dig_out_nid = ALC882_DIGOUT_NID,
9495 .dig_in_nid = ALC882_DIGIN_NID,
9496 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9497 .channel_mode = alc882_ch_modes,
9499 .input_mux = &alc882_capture_source,
9501 [ALC882_6ST_DIG] = {
9502 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9503 .init_verbs = { alc882_base_init_verbs,
9504 alc882_adc1_init_verbs },
9505 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9506 .dac_nids = alc882_dac_nids,
9507 .dig_out_nid = ALC882_DIGOUT_NID,
9508 .dig_in_nid = ALC882_DIGIN_NID,
9509 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9510 .channel_mode = alc882_sixstack_modes,
9511 .input_mux = &alc882_capture_source,
9514 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9515 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9516 alc882_eapd_verbs },
9517 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9518 .dac_nids = alc882_dac_nids,
9519 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9520 .channel_mode = alc882_sixstack_modes,
9521 .input_mux = &alc882_capture_source,
9524 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
9525 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9526 alc882_eapd_verbs, alc880_gpio1_init_verbs },
9527 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9528 .dac_nids = alc882_dac_nids,
9529 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9530 .channel_mode = alc880_threestack_modes,
9532 .input_mux = &alc882_capture_source,
9533 .dig_out_nid = ALC882_DIGOUT_NID,
9536 .mixers = { alc885_mba21_mixer },
9537 .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs },
9539 .dac_nids = alc882_dac_nids,
9540 .channel_mode = alc885_mba21_ch_modes,
9541 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
9542 .input_mux = &alc882_capture_source,
9543 .unsol_event = alc_automute_amp_unsol_event,
9544 .setup = alc885_mba21_setup,
9545 .init_hook = alc_automute_amp,
9548 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
9549 .init_verbs = { alc885_mbp3_init_verbs,
9550 alc880_gpio1_init_verbs },
9552 .dac_nids = alc882_dac_nids,
9554 .channel_mode = alc885_mbp_4ch_modes,
9555 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9556 .input_mux = &alc882_capture_source,
9557 .dig_out_nid = ALC882_DIGOUT_NID,
9558 .dig_in_nid = ALC882_DIGIN_NID,
9559 .unsol_event = alc_automute_amp_unsol_event,
9560 .setup = alc885_mbp3_setup,
9561 .init_hook = alc_automute_amp,
9564 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
9565 .init_verbs = { alc885_mb5_init_verbs,
9566 alc880_gpio1_init_verbs },
9567 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9568 .dac_nids = alc882_dac_nids,
9569 .channel_mode = alc885_mb5_6ch_modes,
9570 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
9571 .input_mux = &mb5_capture_source,
9572 .dig_out_nid = ALC882_DIGOUT_NID,
9573 .dig_in_nid = ALC882_DIGIN_NID,
9574 .unsol_event = alc_automute_amp_unsol_event,
9575 .setup = alc885_mb5_setup,
9576 .init_hook = alc_automute_amp,
9578 [ALC885_MACMINI3] = {
9579 .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer },
9580 .init_verbs = { alc885_macmini3_init_verbs,
9581 alc880_gpio1_init_verbs },
9582 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9583 .dac_nids = alc882_dac_nids,
9584 .channel_mode = alc885_macmini3_6ch_modes,
9585 .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes),
9586 .input_mux = &macmini3_capture_source,
9587 .dig_out_nid = ALC882_DIGOUT_NID,
9588 .dig_in_nid = ALC882_DIGIN_NID,
9589 .unsol_event = alc_automute_amp_unsol_event,
9590 .setup = alc885_macmini3_setup,
9591 .init_hook = alc_automute_amp,
9594 .mixers = { alc882_macpro_mixer },
9595 .init_verbs = { alc882_macpro_init_verbs },
9596 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9597 .dac_nids = alc882_dac_nids,
9598 .dig_out_nid = ALC882_DIGOUT_NID,
9599 .dig_in_nid = ALC882_DIGIN_NID,
9600 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9601 .channel_mode = alc882_ch_modes,
9602 .input_mux = &alc882_capture_source,
9603 .init_hook = alc885_macpro_init_hook,
9606 .mixers = { alc885_imac24_mixer },
9607 .init_verbs = { alc885_imac24_init_verbs },
9608 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9609 .dac_nids = alc882_dac_nids,
9610 .dig_out_nid = ALC882_DIGOUT_NID,
9611 .dig_in_nid = ALC882_DIGIN_NID,
9612 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9613 .channel_mode = alc882_ch_modes,
9614 .input_mux = &alc882_capture_source,
9615 .unsol_event = alc_automute_amp_unsol_event,
9616 .setup = alc885_imac24_setup,
9617 .init_hook = alc885_imac24_init_hook,
9620 .mixers = { alc885_imac91_mixer, alc882_chmode_mixer },
9621 .init_verbs = { alc885_imac91_init_verbs,
9622 alc880_gpio1_init_verbs },
9623 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9624 .dac_nids = alc882_dac_nids,
9625 .channel_mode = alc885_mbp_4ch_modes,
9626 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9627 .input_mux = &alc882_capture_source,
9628 .dig_out_nid = ALC882_DIGOUT_NID,
9629 .dig_in_nid = ALC882_DIGIN_NID,
9630 .unsol_event = alc_automute_amp_unsol_event,
9631 .setup = alc885_imac91_setup,
9632 .init_hook = alc_automute_amp,
9635 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
9636 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9637 alc880_gpio3_init_verbs, alc882_targa_verbs},
9638 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9639 .dac_nids = alc882_dac_nids,
9640 .dig_out_nid = ALC882_DIGOUT_NID,
9641 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9642 .adc_nids = alc882_adc_nids,
9643 .capsrc_nids = alc882_capsrc_nids,
9644 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9645 .channel_mode = alc882_3ST_6ch_modes,
9647 .input_mux = &alc882_capture_source,
9648 .unsol_event = alc882_targa_unsol_event,
9649 .setup = alc882_targa_setup,
9650 .init_hook = alc882_targa_automute,
9652 [ALC882_ASUS_A7J] = {
9653 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
9654 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9655 alc882_asus_a7j_verbs},
9656 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9657 .dac_nids = alc882_dac_nids,
9658 .dig_out_nid = ALC882_DIGOUT_NID,
9659 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9660 .adc_nids = alc882_adc_nids,
9661 .capsrc_nids = alc882_capsrc_nids,
9662 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9663 .channel_mode = alc882_3ST_6ch_modes,
9665 .input_mux = &alc882_capture_source,
9667 [ALC882_ASUS_A7M] = {
9668 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
9669 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9670 alc882_eapd_verbs, alc880_gpio1_init_verbs,
9671 alc882_asus_a7m_verbs },
9672 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9673 .dac_nids = alc882_dac_nids,
9674 .dig_out_nid = ALC882_DIGOUT_NID,
9675 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9676 .channel_mode = alc880_threestack_modes,
9678 .input_mux = &alc882_capture_source,
9680 [ALC883_3ST_2ch_DIG] = {
9681 .mixers = { alc883_3ST_2ch_mixer },
9682 .init_verbs = { alc883_init_verbs },
9683 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9684 .dac_nids = alc883_dac_nids,
9685 .dig_out_nid = ALC883_DIGOUT_NID,
9686 .dig_in_nid = ALC883_DIGIN_NID,
9687 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9688 .channel_mode = alc883_3ST_2ch_modes,
9689 .input_mux = &alc883_capture_source,
9691 [ALC883_3ST_6ch_DIG] = {
9692 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9693 .init_verbs = { alc883_init_verbs },
9694 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9695 .dac_nids = alc883_dac_nids,
9696 .dig_out_nid = ALC883_DIGOUT_NID,
9697 .dig_in_nid = ALC883_DIGIN_NID,
9698 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9699 .channel_mode = alc883_3ST_6ch_modes,
9701 .input_mux = &alc883_capture_source,
9703 [ALC883_3ST_6ch] = {
9704 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9705 .init_verbs = { alc883_init_verbs },
9706 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9707 .dac_nids = alc883_dac_nids,
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_INTEL] = {
9714 .mixers = { alc883_3ST_6ch_intel_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 .dig_out_nid = ALC883_DIGOUT_NID,
9719 .dig_in_nid = ALC883_DIGIN_NID,
9720 .slave_dig_outs = alc883_slave_dig_outs,
9721 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
9722 .channel_mode = alc883_3ST_6ch_intel_modes,
9724 .input_mux = &alc883_3stack_6ch_intel,
9727 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9728 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
9729 alc_hp15_unsol_verbs },
9730 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9731 .dac_nids = alc883_dac_nids,
9732 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9733 .adc_nids = alc889_adc_nids,
9734 .dig_out_nid = ALC883_DIGOUT_NID,
9735 .dig_in_nid = ALC883_DIGIN_NID,
9736 .slave_dig_outs = alc883_slave_dig_outs,
9737 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9738 .channel_mode = alc889_8ch_intel_modes,
9739 .capsrc_nids = alc889_capsrc_nids,
9740 .input_mux = &alc889_capture_source,
9741 .setup = alc889_automute_setup,
9742 .init_hook = alc_automute_amp,
9743 .unsol_event = alc_automute_amp_unsol_event,
9747 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9748 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
9749 alc889_eapd_verbs, alc_hp15_unsol_verbs},
9750 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9751 .dac_nids = alc883_dac_nids,
9752 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9753 .adc_nids = alc889_adc_nids,
9754 .dig_out_nid = ALC883_DIGOUT_NID,
9755 .dig_in_nid = ALC883_DIGIN_NID,
9756 .slave_dig_outs = alc883_slave_dig_outs,
9757 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9758 .channel_mode = alc889_8ch_intel_modes,
9759 .capsrc_nids = alc889_capsrc_nids,
9760 .input_mux = &alc889_capture_source,
9761 .setup = alc889_automute_setup,
9762 .init_hook = alc889_intel_init_hook,
9763 .unsol_event = alc_automute_amp_unsol_event,
9766 [ALC883_6ST_DIG] = {
9767 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9768 .init_verbs = { alc883_init_verbs },
9769 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9770 .dac_nids = alc883_dac_nids,
9771 .dig_out_nid = ALC883_DIGOUT_NID,
9772 .dig_in_nid = ALC883_DIGIN_NID,
9773 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9774 .channel_mode = alc883_sixstack_modes,
9775 .input_mux = &alc883_capture_source,
9777 [ALC883_TARGA_DIG] = {
9778 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
9779 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9780 alc883_targa_verbs},
9781 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9782 .dac_nids = alc883_dac_nids,
9783 .dig_out_nid = ALC883_DIGOUT_NID,
9784 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9785 .channel_mode = alc883_3ST_6ch_modes,
9787 .input_mux = &alc883_capture_source,
9788 .unsol_event = alc883_targa_unsol_event,
9789 .setup = alc882_targa_setup,
9790 .init_hook = alc882_targa_automute,
9792 [ALC883_TARGA_2ch_DIG] = {
9793 .mixers = { alc883_targa_2ch_mixer},
9794 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9795 alc883_targa_verbs},
9796 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9797 .dac_nids = alc883_dac_nids,
9798 .adc_nids = alc883_adc_nids_alt,
9799 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9800 .capsrc_nids = alc883_capsrc_nids,
9801 .dig_out_nid = ALC883_DIGOUT_NID,
9802 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9803 .channel_mode = alc883_3ST_2ch_modes,
9804 .input_mux = &alc883_capture_source,
9805 .unsol_event = alc883_targa_unsol_event,
9806 .setup = alc882_targa_setup,
9807 .init_hook = alc882_targa_automute,
9809 [ALC883_TARGA_8ch_DIG] = {
9810 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
9811 alc883_chmode_mixer },
9812 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9813 alc883_targa_verbs },
9814 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9815 .dac_nids = alc883_dac_nids,
9816 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9817 .adc_nids = alc883_adc_nids_rev,
9818 .capsrc_nids = alc883_capsrc_nids_rev,
9819 .dig_out_nid = ALC883_DIGOUT_NID,
9820 .dig_in_nid = ALC883_DIGIN_NID,
9821 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
9822 .channel_mode = alc883_4ST_8ch_modes,
9824 .input_mux = &alc883_capture_source,
9825 .unsol_event = alc883_targa_unsol_event,
9826 .setup = alc882_targa_setup,
9827 .init_hook = alc882_targa_automute,
9830 .mixers = { alc883_base_mixer },
9831 /* On TravelMate laptops, GPIO 0 enables the internal speaker
9832 * and the headphone jack. Turn this on and rely on the
9833 * standard mute methods whenever the user wants to turn
9834 * these outputs off.
9836 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
9837 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9838 .dac_nids = alc883_dac_nids,
9839 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9840 .channel_mode = alc883_3ST_2ch_modes,
9841 .input_mux = &alc883_capture_source,
9843 [ALC883_ACER_ASPIRE] = {
9844 .mixers = { alc883_acer_aspire_mixer },
9845 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
9846 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9847 .dac_nids = alc883_dac_nids,
9848 .dig_out_nid = ALC883_DIGOUT_NID,
9849 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9850 .channel_mode = alc883_3ST_2ch_modes,
9851 .input_mux = &alc883_capture_source,
9852 .unsol_event = alc_automute_amp_unsol_event,
9853 .setup = alc883_acer_aspire_setup,
9854 .init_hook = alc_automute_amp,
9856 [ALC888_ACER_ASPIRE_4930G] = {
9857 .mixers = { alc888_base_mixer,
9858 alc883_chmode_mixer },
9859 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9860 alc888_acer_aspire_4930g_verbs },
9861 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9862 .dac_nids = alc883_dac_nids,
9863 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9864 .adc_nids = alc883_adc_nids_rev,
9865 .capsrc_nids = alc883_capsrc_nids_rev,
9866 .dig_out_nid = ALC883_DIGOUT_NID,
9867 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9868 .channel_mode = alc883_3ST_6ch_modes,
9870 .const_channel_count = 6,
9872 ARRAY_SIZE(alc888_2_capture_sources),
9873 .input_mux = alc888_2_capture_sources,
9874 .unsol_event = alc_automute_amp_unsol_event,
9875 .setup = alc888_acer_aspire_4930g_setup,
9876 .init_hook = alc_automute_amp,
9878 [ALC888_ACER_ASPIRE_6530G] = {
9879 .mixers = { alc888_acer_aspire_6530_mixer },
9880 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9881 alc888_acer_aspire_6530g_verbs },
9882 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9883 .dac_nids = alc883_dac_nids,
9884 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9885 .adc_nids = alc883_adc_nids_rev,
9886 .capsrc_nids = alc883_capsrc_nids_rev,
9887 .dig_out_nid = ALC883_DIGOUT_NID,
9888 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9889 .channel_mode = alc883_3ST_2ch_modes,
9891 ARRAY_SIZE(alc888_2_capture_sources),
9892 .input_mux = alc888_acer_aspire_6530_sources,
9893 .unsol_event = alc_automute_amp_unsol_event,
9894 .setup = alc888_acer_aspire_6530g_setup,
9895 .init_hook = alc_automute_amp,
9897 [ALC888_ACER_ASPIRE_8930G] = {
9898 .mixers = { alc889_acer_aspire_8930g_mixer,
9899 alc883_chmode_mixer },
9900 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9901 alc889_acer_aspire_8930g_verbs,
9903 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9904 .dac_nids = alc883_dac_nids,
9905 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9906 .adc_nids = alc889_adc_nids,
9907 .capsrc_nids = alc889_capsrc_nids,
9908 .dig_out_nid = ALC883_DIGOUT_NID,
9909 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9910 .channel_mode = alc883_3ST_6ch_modes,
9912 .const_channel_count = 6,
9914 ARRAY_SIZE(alc889_capture_sources),
9915 .input_mux = alc889_capture_sources,
9916 .unsol_event = alc_automute_amp_unsol_event,
9917 .setup = alc889_acer_aspire_8930g_setup,
9918 .init_hook = alc_automute_amp,
9919 #ifdef CONFIG_SND_HDA_POWER_SAVE
9920 .power_hook = alc_power_eapd,
9923 [ALC888_ACER_ASPIRE_7730G] = {
9924 .mixers = { alc883_3ST_6ch_mixer,
9925 alc883_chmode_mixer },
9926 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9927 alc888_acer_aspire_7730G_verbs },
9928 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9929 .dac_nids = alc883_dac_nids,
9930 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9931 .adc_nids = alc883_adc_nids_rev,
9932 .capsrc_nids = alc883_capsrc_nids_rev,
9933 .dig_out_nid = ALC883_DIGOUT_NID,
9934 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9935 .channel_mode = alc883_3ST_6ch_modes,
9937 .const_channel_count = 6,
9938 .input_mux = &alc883_capture_source,
9939 .unsol_event = alc_automute_amp_unsol_event,
9940 .setup = alc888_acer_aspire_6530g_setup,
9941 .init_hook = alc_automute_amp,
9944 .mixers = { alc883_fivestack_mixer,
9945 alc883_chmode_mixer },
9946 .init_verbs = { alc883_init_verbs,
9947 alc883_medion_eapd_verbs },
9948 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9949 .dac_nids = alc883_dac_nids,
9950 .adc_nids = alc883_adc_nids_alt,
9951 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9952 .capsrc_nids = alc883_capsrc_nids,
9953 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9954 .channel_mode = alc883_sixstack_modes,
9955 .input_mux = &alc883_capture_source,
9957 [ALC883_MEDION_MD2] = {
9958 .mixers = { alc883_medion_md2_mixer},
9959 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
9960 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9961 .dac_nids = alc883_dac_nids,
9962 .dig_out_nid = ALC883_DIGOUT_NID,
9963 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9964 .channel_mode = alc883_3ST_2ch_modes,
9965 .input_mux = &alc883_capture_source,
9966 .unsol_event = alc_automute_amp_unsol_event,
9967 .setup = alc883_medion_md2_setup,
9968 .init_hook = alc_automute_amp,
9970 [ALC883_MEDION_WIM2160] = {
9971 .mixers = { alc883_medion_wim2160_mixer },
9972 .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs },
9973 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9974 .dac_nids = alc883_dac_nids,
9975 .dig_out_nid = ALC883_DIGOUT_NID,
9976 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
9977 .adc_nids = alc883_adc_nids,
9978 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9979 .channel_mode = alc883_3ST_2ch_modes,
9980 .input_mux = &alc883_capture_source,
9981 .unsol_event = alc_automute_amp_unsol_event,
9982 .setup = alc883_medion_wim2160_setup,
9983 .init_hook = alc_automute_amp,
9985 [ALC883_LAPTOP_EAPD] = {
9986 .mixers = { alc883_base_mixer },
9987 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
9988 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9989 .dac_nids = alc883_dac_nids,
9990 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9991 .channel_mode = alc883_3ST_2ch_modes,
9992 .input_mux = &alc883_capture_source,
9994 [ALC883_CLEVO_M540R] = {
9995 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9996 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
9997 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9998 .dac_nids = alc883_dac_nids,
9999 .dig_out_nid = ALC883_DIGOUT_NID,
10000 .dig_in_nid = ALC883_DIGIN_NID,
10001 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
10002 .channel_mode = alc883_3ST_6ch_clevo_modes,
10004 .input_mux = &alc883_capture_source,
10005 /* This machine has the hardware HP auto-muting, thus
10006 * we need no software mute via unsol event
10009 [ALC883_CLEVO_M720] = {
10010 .mixers = { alc883_clevo_m720_mixer },
10011 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
10012 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10013 .dac_nids = alc883_dac_nids,
10014 .dig_out_nid = ALC883_DIGOUT_NID,
10015 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10016 .channel_mode = alc883_3ST_2ch_modes,
10017 .input_mux = &alc883_capture_source,
10018 .unsol_event = alc883_clevo_m720_unsol_event,
10019 .setup = alc883_clevo_m720_setup,
10020 .init_hook = alc883_clevo_m720_init_hook,
10022 [ALC883_LENOVO_101E_2ch] = {
10023 .mixers = { alc883_lenovo_101e_2ch_mixer},
10024 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
10025 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10026 .dac_nids = alc883_dac_nids,
10027 .adc_nids = alc883_adc_nids_alt,
10028 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10029 .capsrc_nids = alc883_capsrc_nids,
10030 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10031 .channel_mode = alc883_3ST_2ch_modes,
10032 .input_mux = &alc883_lenovo_101e_capture_source,
10033 .unsol_event = alc883_lenovo_101e_unsol_event,
10034 .init_hook = alc883_lenovo_101e_all_automute,
10036 [ALC883_LENOVO_NB0763] = {
10037 .mixers = { alc883_lenovo_nb0763_mixer },
10038 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
10039 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10040 .dac_nids = alc883_dac_nids,
10041 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10042 .channel_mode = alc883_3ST_2ch_modes,
10044 .input_mux = &alc883_lenovo_nb0763_capture_source,
10045 .unsol_event = alc_automute_amp_unsol_event,
10046 .setup = alc883_medion_md2_setup,
10047 .init_hook = alc_automute_amp,
10049 [ALC888_LENOVO_MS7195_DIG] = {
10050 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10051 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
10052 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10053 .dac_nids = alc883_dac_nids,
10054 .dig_out_nid = ALC883_DIGOUT_NID,
10055 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10056 .channel_mode = alc883_3ST_6ch_modes,
10058 .input_mux = &alc883_capture_source,
10059 .unsol_event = alc883_lenovo_ms7195_unsol_event,
10060 .init_hook = alc888_lenovo_ms7195_front_automute,
10062 [ALC883_HAIER_W66] = {
10063 .mixers = { alc883_targa_2ch_mixer},
10064 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
10065 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10066 .dac_nids = alc883_dac_nids,
10067 .dig_out_nid = ALC883_DIGOUT_NID,
10068 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10069 .channel_mode = alc883_3ST_2ch_modes,
10070 .input_mux = &alc883_capture_source,
10071 .unsol_event = alc_automute_amp_unsol_event,
10072 .setup = alc883_haier_w66_setup,
10073 .init_hook = alc_automute_amp,
10075 [ALC888_3ST_HP] = {
10076 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10077 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
10078 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10079 .dac_nids = alc883_dac_nids,
10080 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
10081 .channel_mode = alc888_3st_hp_modes,
10083 .input_mux = &alc883_capture_source,
10084 .unsol_event = alc_automute_amp_unsol_event,
10085 .setup = alc888_3st_hp_setup,
10086 .init_hook = alc_automute_amp,
10088 [ALC888_6ST_DELL] = {
10089 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10090 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
10091 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10092 .dac_nids = alc883_dac_nids,
10093 .dig_out_nid = ALC883_DIGOUT_NID,
10094 .dig_in_nid = ALC883_DIGIN_NID,
10095 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10096 .channel_mode = alc883_sixstack_modes,
10097 .input_mux = &alc883_capture_source,
10098 .unsol_event = alc_automute_amp_unsol_event,
10099 .setup = alc888_6st_dell_setup,
10100 .init_hook = alc_automute_amp,
10103 .mixers = { alc883_mitac_mixer },
10104 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
10105 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10106 .dac_nids = alc883_dac_nids,
10107 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10108 .channel_mode = alc883_3ST_2ch_modes,
10109 .input_mux = &alc883_capture_source,
10110 .unsol_event = alc_automute_amp_unsol_event,
10111 .setup = alc883_mitac_setup,
10112 .init_hook = alc_automute_amp,
10114 [ALC883_FUJITSU_PI2515] = {
10115 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
10116 .init_verbs = { alc883_init_verbs,
10117 alc883_2ch_fujitsu_pi2515_verbs},
10118 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10119 .dac_nids = alc883_dac_nids,
10120 .dig_out_nid = ALC883_DIGOUT_NID,
10121 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10122 .channel_mode = alc883_3ST_2ch_modes,
10123 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10124 .unsol_event = alc_automute_amp_unsol_event,
10125 .setup = alc883_2ch_fujitsu_pi2515_setup,
10126 .init_hook = alc_automute_amp,
10128 [ALC888_FUJITSU_XA3530] = {
10129 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
10130 .init_verbs = { alc883_init_verbs,
10131 alc888_fujitsu_xa3530_verbs },
10132 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10133 .dac_nids = alc883_dac_nids,
10134 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10135 .adc_nids = alc883_adc_nids_rev,
10136 .capsrc_nids = alc883_capsrc_nids_rev,
10137 .dig_out_nid = ALC883_DIGOUT_NID,
10138 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
10139 .channel_mode = alc888_4ST_8ch_intel_modes,
10141 ARRAY_SIZE(alc888_2_capture_sources),
10142 .input_mux = alc888_2_capture_sources,
10143 .unsol_event = alc_automute_amp_unsol_event,
10144 .setup = alc888_fujitsu_xa3530_setup,
10145 .init_hook = alc_automute_amp,
10147 [ALC888_LENOVO_SKY] = {
10148 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
10149 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
10150 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10151 .dac_nids = alc883_dac_nids,
10152 .dig_out_nid = ALC883_DIGOUT_NID,
10153 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10154 .channel_mode = alc883_sixstack_modes,
10156 .input_mux = &alc883_lenovo_sky_capture_source,
10157 .unsol_event = alc_automute_amp_unsol_event,
10158 .setup = alc888_lenovo_sky_setup,
10159 .init_hook = alc_automute_amp,
10161 [ALC888_ASUS_M90V] = {
10162 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10163 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
10164 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10165 .dac_nids = alc883_dac_nids,
10166 .dig_out_nid = ALC883_DIGOUT_NID,
10167 .dig_in_nid = ALC883_DIGIN_NID,
10168 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10169 .channel_mode = alc883_3ST_6ch_modes,
10171 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10172 .unsol_event = alc_sku_unsol_event,
10173 .setup = alc883_mode2_setup,
10174 .init_hook = alc_inithook,
10176 [ALC888_ASUS_EEE1601] = {
10177 .mixers = { alc883_asus_eee1601_mixer },
10178 .cap_mixer = alc883_asus_eee1601_cap_mixer,
10179 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
10180 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10181 .dac_nids = alc883_dac_nids,
10182 .dig_out_nid = ALC883_DIGOUT_NID,
10183 .dig_in_nid = ALC883_DIGIN_NID,
10184 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10185 .channel_mode = alc883_3ST_2ch_modes,
10187 .input_mux = &alc883_asus_eee1601_capture_source,
10188 .unsol_event = alc_sku_unsol_event,
10189 .init_hook = alc883_eee1601_inithook,
10191 [ALC1200_ASUS_P5Q] = {
10192 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10193 .init_verbs = { alc883_init_verbs },
10194 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10195 .dac_nids = alc883_dac_nids,
10196 .dig_out_nid = ALC1200_DIGOUT_NID,
10197 .dig_in_nid = ALC883_DIGIN_NID,
10198 .slave_dig_outs = alc1200_slave_dig_outs,
10199 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10200 .channel_mode = alc883_sixstack_modes,
10201 .input_mux = &alc883_capture_source,
10204 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
10205 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
10206 alc880_gpio1_init_verbs },
10207 .adc_nids = alc883_adc_nids,
10208 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10209 .capsrc_nids = alc883_capsrc_nids,
10210 .dac_nids = alc883_dac_nids,
10211 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10212 .channel_mode = alc889A_mb31_6ch_modes,
10213 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
10214 .input_mux = &alc889A_mb31_capture_source,
10215 .dig_out_nid = ALC883_DIGOUT_NID,
10216 .unsol_event = alc889A_mb31_unsol_event,
10217 .init_hook = alc889A_mb31_automute,
10219 [ALC883_SONY_VAIO_TT] = {
10220 .mixers = { alc883_vaiott_mixer },
10221 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
10222 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10223 .dac_nids = alc883_dac_nids,
10224 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10225 .channel_mode = alc883_3ST_2ch_modes,
10226 .input_mux = &alc883_capture_source,
10227 .unsol_event = alc_automute_amp_unsol_event,
10228 .setup = alc883_vaiott_setup,
10229 .init_hook = alc_automute_amp,
10238 PINFIX_ABIT_AW9D_MAX
10241 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
10242 { 0x15, 0x01080104 }, /* side */
10243 { 0x16, 0x01011012 }, /* rear */
10244 { 0x17, 0x01016011 }, /* clfe */
10248 static const struct alc_fixup alc882_fixups[] = {
10249 [PINFIX_ABIT_AW9D_MAX] = {
10250 .pins = alc882_abit_aw9d_pinfix
10254 static struct snd_pci_quirk alc882_fixup_tbl[] = {
10255 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
10260 * BIOS auto configuration
10262 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
10263 const struct auto_pin_cfg *cfg)
10265 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
10268 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
10269 hda_nid_t nid, int pin_type,
10274 /* set as output */
10275 alc_set_pin_output(codec, nid, pin_type);
10279 else if (dac >= 0x02 && dac <= 0x05)
10283 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
10286 static void alc882_auto_init_multi_out(struct hda_codec *codec)
10288 struct alc_spec *spec = codec->spec;
10291 for (i = 0; i <= HDA_SIDE; i++) {
10292 hda_nid_t nid = spec->autocfg.line_out_pins[i];
10293 int pin_type = get_pin_type(spec->autocfg.line_out_type);
10295 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
10296 spec->multiout.dac_nids[i]);
10300 static void alc882_auto_init_hp_out(struct hda_codec *codec)
10302 struct alc_spec *spec = codec->spec;
10303 hda_nid_t pin, dac;
10305 pin = spec->autocfg.hp_pins[0];
10307 dac = spec->multiout.hp_nid;
10309 dac = spec->multiout.dac_nids[0]; /* to front */
10310 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac);
10312 pin = spec->autocfg.speaker_pins[0];
10314 dac = spec->multiout.extra_out_nid[0];
10316 dac = spec->multiout.dac_nids[0]; /* to front */
10317 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac);
10321 static void alc882_auto_init_analog_input(struct hda_codec *codec)
10323 struct alc_spec *spec = codec->spec;
10326 for (i = 0; i < AUTO_PIN_LAST; i++) {
10327 hda_nid_t nid = spec->autocfg.input_pins[i];
10330 alc_set_input_pin(codec, nid, i);
10331 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
10332 snd_hda_codec_write(codec, nid, 0,
10333 AC_VERB_SET_AMP_GAIN_MUTE,
10338 static void alc882_auto_init_input_src(struct hda_codec *codec)
10340 struct alc_spec *spec = codec->spec;
10343 for (c = 0; c < spec->num_adc_nids; c++) {
10344 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
10345 hda_nid_t nid = spec->capsrc_nids[c];
10346 unsigned int mux_idx;
10347 const struct hda_input_mux *imux;
10348 int conns, mute, idx, item;
10350 conns = snd_hda_get_connections(codec, nid, conn_list,
10351 ARRAY_SIZE(conn_list));
10354 mux_idx = c >= spec->num_mux_defs ? 0 : c;
10355 imux = &spec->input_mux[mux_idx];
10356 if (!imux->num_items && mux_idx > 0)
10357 imux = &spec->input_mux[0];
10358 for (idx = 0; idx < conns; idx++) {
10359 /* if the current connection is the selected one,
10360 * unmute it as default - otherwise mute it
10362 mute = AMP_IN_MUTE(idx);
10363 for (item = 0; item < imux->num_items; item++) {
10364 if (imux->items[item].index == idx) {
10365 if (spec->cur_mux[c] == item)
10366 mute = AMP_IN_UNMUTE(idx);
10370 /* check if we have a selector or mixer
10371 * we could check for the widget type instead, but
10372 * just check for Amp-In presence (in case of mixer
10373 * without amp-in there is something wrong, this
10374 * function shouldn't be used or capsrc nid is wrong)
10376 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
10377 snd_hda_codec_write(codec, nid, 0,
10378 AC_VERB_SET_AMP_GAIN_MUTE,
10380 else if (mute != AMP_IN_MUTE(idx))
10381 snd_hda_codec_write(codec, nid, 0,
10382 AC_VERB_SET_CONNECT_SEL,
10388 /* add mic boosts if needed */
10389 static int alc_auto_add_mic_boost(struct hda_codec *codec)
10391 struct alc_spec *spec = codec->spec;
10395 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
10396 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
10397 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10399 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10403 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
10404 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
10405 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10407 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10414 /* almost identical with ALC880 parser... */
10415 static int alc882_parse_auto_config(struct hda_codec *codec)
10417 struct alc_spec *spec = codec->spec;
10418 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
10421 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10425 if (!spec->autocfg.line_outs)
10426 return 0; /* can't find valid BIOS pin config */
10428 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
10431 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
10434 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
10438 err = alc880_auto_create_extra_out(spec,
10439 spec->autocfg.speaker_pins[0],
10443 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
10447 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10449 /* check multiple SPDIF-out (for recent codecs) */
10450 for (i = 0; i < spec->autocfg.dig_outs; i++) {
10452 err = snd_hda_get_connections(codec,
10453 spec->autocfg.dig_out_pins[i],
10458 spec->multiout.dig_out_nid = dig_nid;
10460 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
10461 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
10463 spec->slave_dig_outs[i - 1] = dig_nid;
10466 if (spec->autocfg.dig_in_pin)
10467 spec->dig_in_nid = ALC880_DIGIN_NID;
10469 if (spec->kctls.list)
10470 add_mixer(spec, spec->kctls.list);
10472 add_verb(spec, alc883_auto_init_verbs);
10473 /* if ADC 0x07 is available, initialize it, too */
10474 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
10475 add_verb(spec, alc882_adc1_init_verbs);
10477 spec->num_mux_defs = 1;
10478 spec->input_mux = &spec->private_imux[0];
10480 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
10482 err = alc_auto_add_mic_boost(codec);
10486 return 1; /* config found */
10489 /* additional initialization for auto-configuration model */
10490 static void alc882_auto_init(struct hda_codec *codec)
10492 struct alc_spec *spec = codec->spec;
10493 alc882_auto_init_multi_out(codec);
10494 alc882_auto_init_hp_out(codec);
10495 alc882_auto_init_analog_input(codec);
10496 alc882_auto_init_input_src(codec);
10497 if (spec->unsol_event)
10498 alc_inithook(codec);
10501 static int patch_alc882(struct hda_codec *codec)
10503 struct alc_spec *spec;
10504 int err, board_config;
10506 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10510 codec->spec = spec;
10512 alc_auto_parse_customize_define(codec);
10514 switch (codec->vendor_id) {
10519 /* ALC883 and variants */
10520 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10524 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
10528 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
10529 board_config = snd_hda_check_board_codec_sid_config(codec,
10530 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
10532 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
10533 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
10535 board_config = ALC882_AUTO;
10538 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups);
10540 if (board_config == ALC882_AUTO) {
10541 /* automatic parse from the BIOS config */
10542 err = alc882_parse_auto_config(codec);
10548 "hda_codec: Cannot set up configuration "
10549 "from BIOS. Using base mode...\n");
10550 board_config = ALC882_3ST_DIG;
10554 err = snd_hda_attach_beep_device(codec, 0x1);
10560 if (board_config != ALC882_AUTO)
10561 setup_preset(codec, &alc882_presets[board_config]);
10563 spec->stream_analog_playback = &alc882_pcm_analog_playback;
10564 spec->stream_analog_capture = &alc882_pcm_analog_capture;
10565 /* FIXME: setup DAC5 */
10566 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
10567 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
10569 spec->stream_digital_playback = &alc882_pcm_digital_playback;
10570 spec->stream_digital_capture = &alc882_pcm_digital_capture;
10572 if (codec->vendor_id == 0x10ec0888)
10573 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
10575 if (!spec->adc_nids && spec->input_mux) {
10577 spec->num_adc_nids = 0;
10578 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
10579 const struct hda_input_mux *imux = spec->input_mux;
10581 hda_nid_t items[16];
10582 hda_nid_t nid = alc882_adc_nids[i];
10583 unsigned int wcap = get_wcaps(codec, nid);
10585 wcap = get_wcaps_type(wcap);
10586 if (wcap != AC_WID_AUD_IN)
10588 spec->private_adc_nids[spec->num_adc_nids] = nid;
10589 err = snd_hda_get_connections(codec, nid, &cap, 1);
10592 err = snd_hda_get_connections(codec, cap, items,
10593 ARRAY_SIZE(items));
10596 for (j = 0; j < imux->num_items; j++)
10597 if (imux->items[j].index >= err)
10599 if (j < imux->num_items)
10601 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
10602 spec->num_adc_nids++;
10604 spec->adc_nids = spec->private_adc_nids;
10605 spec->capsrc_nids = spec->private_capsrc_nids;
10608 set_capture_mixer(codec);
10610 if (spec->cdefine.enable_pcbeep)
10611 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10613 spec->vmaster_nid = 0x0c;
10615 codec->patch_ops = alc_patch_ops;
10616 if (board_config == ALC882_AUTO)
10617 spec->init_hook = alc882_auto_init;
10618 #ifdef CONFIG_SND_HDA_POWER_SAVE
10619 if (!spec->loopback.amplist)
10620 spec->loopback.amplist = alc882_loopbacks;
10631 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
10632 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
10634 #define alc262_dac_nids alc260_dac_nids
10635 #define alc262_adc_nids alc882_adc_nids
10636 #define alc262_adc_nids_alt alc882_adc_nids_alt
10637 #define alc262_capsrc_nids alc882_capsrc_nids
10638 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
10640 #define alc262_modes alc260_modes
10641 #define alc262_capture_source alc882_capture_source
10643 static hda_nid_t alc262_dmic_adc_nids[1] = {
10648 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
10650 static struct snd_kcontrol_new alc262_base_mixer[] = {
10651 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10652 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10653 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10654 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10655 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10656 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10657 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10658 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10659 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10660 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10661 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10662 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10663 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
10664 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10665 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
10666 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
10670 /* update HP, line and mono-out pins according to the master switch */
10671 static void alc262_hp_master_update(struct hda_codec *codec)
10673 struct alc_spec *spec = codec->spec;
10674 int val = spec->master_sw;
10676 /* HP & line-out */
10677 snd_hda_codec_write_cache(codec, 0x1b, 0,
10678 AC_VERB_SET_PIN_WIDGET_CONTROL,
10680 snd_hda_codec_write_cache(codec, 0x15, 0,
10681 AC_VERB_SET_PIN_WIDGET_CONTROL,
10683 /* mono (speaker) depending on the HP jack sense */
10684 val = val && !spec->jack_present;
10685 snd_hda_codec_write_cache(codec, 0x16, 0,
10686 AC_VERB_SET_PIN_WIDGET_CONTROL,
10687 val ? PIN_OUT : 0);
10690 static void alc262_hp_bpc_automute(struct hda_codec *codec)
10692 struct alc_spec *spec = codec->spec;
10694 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
10695 alc262_hp_master_update(codec);
10698 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
10700 if ((res >> 26) != ALC880_HP_EVENT)
10702 alc262_hp_bpc_automute(codec);
10705 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
10707 struct alc_spec *spec = codec->spec;
10709 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
10710 alc262_hp_master_update(codec);
10713 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
10716 if ((res >> 26) != ALC880_HP_EVENT)
10718 alc262_hp_wildwest_automute(codec);
10721 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
10723 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
10724 struct snd_ctl_elem_value *ucontrol)
10726 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10727 struct alc_spec *spec = codec->spec;
10728 int val = !!*ucontrol->value.integer.value;
10730 if (val == spec->master_sw)
10732 spec->master_sw = val;
10733 alc262_hp_master_update(codec);
10737 #define ALC262_HP_MASTER_SWITCH \
10739 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10740 .name = "Master Playback Switch", \
10741 .info = snd_ctl_boolean_mono_info, \
10742 .get = alc262_hp_master_sw_get, \
10743 .put = alc262_hp_master_sw_put, \
10746 .iface = NID_MAPPING, \
10747 .name = "Master Playback Switch", \
10748 .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \
10752 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
10753 ALC262_HP_MASTER_SWITCH,
10754 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10755 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10756 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10757 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10759 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10761 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10762 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10763 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10764 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10765 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10766 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10767 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10768 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10769 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10770 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10771 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
10772 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
10776 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
10777 ALC262_HP_MASTER_SWITCH,
10778 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10779 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10780 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10781 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10782 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10784 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10786 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
10787 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
10788 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
10789 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10790 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10791 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10792 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10796 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
10797 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10798 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10799 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
10803 /* mute/unmute internal speaker according to the hp jack and mute state */
10804 static void alc262_hp_t5735_setup(struct hda_codec *codec)
10806 struct alc_spec *spec = codec->spec;
10808 spec->autocfg.hp_pins[0] = 0x15;
10809 spec->autocfg.speaker_pins[0] = 0x14;
10812 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
10813 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10814 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10815 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10816 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10817 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10818 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10819 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10823 static struct hda_verb alc262_hp_t5735_verbs[] = {
10824 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10825 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10827 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10831 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
10832 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10833 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10834 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
10835 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
10836 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10837 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10841 static struct hda_verb alc262_hp_rp5700_verbs[] = {
10842 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10843 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10844 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10845 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10846 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10847 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10848 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10849 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10850 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10851 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10855 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
10862 /* bind hp and internal speaker mute (with plug check) as master switch */
10863 static void alc262_hippo_master_update(struct hda_codec *codec)
10865 struct alc_spec *spec = codec->spec;
10866 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10867 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10868 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10872 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
10873 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
10874 HDA_AMP_MUTE, mute);
10875 /* mute internal speaker per jack sense */
10876 if (spec->jack_present)
10877 mute = HDA_AMP_MUTE;
10879 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
10880 HDA_AMP_MUTE, mute);
10881 if (speaker_nid && speaker_nid != line_nid)
10882 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
10883 HDA_AMP_MUTE, mute);
10886 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
10888 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
10889 struct snd_ctl_elem_value *ucontrol)
10891 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10892 struct alc_spec *spec = codec->spec;
10893 int val = !!*ucontrol->value.integer.value;
10895 if (val == spec->master_sw)
10897 spec->master_sw = val;
10898 alc262_hippo_master_update(codec);
10902 #define ALC262_HIPPO_MASTER_SWITCH \
10904 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10905 .name = "Master Playback Switch", \
10906 .info = snd_ctl_boolean_mono_info, \
10907 .get = alc262_hippo_master_sw_get, \
10908 .put = alc262_hippo_master_sw_put, \
10911 .iface = NID_MAPPING, \
10912 .name = "Master Playback Switch", \
10913 .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \
10914 (SUBDEV_SPEAKER(0) << 16), \
10917 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
10918 ALC262_HIPPO_MASTER_SWITCH,
10919 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10920 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10921 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10922 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10923 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10924 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10925 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10926 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10927 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10928 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10929 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10930 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10934 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
10935 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10936 ALC262_HIPPO_MASTER_SWITCH,
10937 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10938 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10939 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10940 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10941 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10942 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10943 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10944 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10945 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10946 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10950 /* mute/unmute internal speaker according to the hp jack and mute state */
10951 static void alc262_hippo_automute(struct hda_codec *codec)
10953 struct alc_spec *spec = codec->spec;
10954 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10956 spec->jack_present = snd_hda_jack_detect(codec, hp_nid);
10957 alc262_hippo_master_update(codec);
10960 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
10962 if ((res >> 26) != ALC880_HP_EVENT)
10964 alc262_hippo_automute(codec);
10967 static void alc262_hippo_setup(struct hda_codec *codec)
10969 struct alc_spec *spec = codec->spec;
10971 spec->autocfg.hp_pins[0] = 0x15;
10972 spec->autocfg.speaker_pins[0] = 0x14;
10975 static void alc262_hippo1_setup(struct hda_codec *codec)
10977 struct alc_spec *spec = codec->spec;
10979 spec->autocfg.hp_pins[0] = 0x1b;
10980 spec->autocfg.speaker_pins[0] = 0x14;
10984 static struct snd_kcontrol_new alc262_sony_mixer[] = {
10985 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10986 ALC262_HIPPO_MASTER_SWITCH,
10987 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10988 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10989 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10990 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10994 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
10995 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10996 ALC262_HIPPO_MASTER_SWITCH,
10997 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10998 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10999 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11000 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11001 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11005 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
11006 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11007 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11008 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
11009 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
11010 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11011 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
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("Mic Boost", 0x18, 0, HDA_INPUT),
11015 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11016 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11017 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11021 static struct hda_verb alc262_tyan_verbs[] = {
11022 /* Headphone automute */
11023 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11024 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11025 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11027 /* P11 AUX_IN, white 4-pin connector */
11028 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11029 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
11030 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
11031 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
11036 /* unsolicited event for HP jack sensing */
11037 static void alc262_tyan_setup(struct hda_codec *codec)
11039 struct alc_spec *spec = codec->spec;
11041 spec->autocfg.hp_pins[0] = 0x1b;
11042 spec->autocfg.speaker_pins[0] = 0x15;
11046 #define alc262_capture_mixer alc882_capture_mixer
11047 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
11050 * generic initialization of ADC, input mixers and output mixers
11052 static struct hda_verb alc262_init_verbs[] = {
11054 * Unmute ADC0-2 and set the default input to mic-in
11056 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11057 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11058 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11059 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11060 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11061 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11063 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11065 * Note: PASD motherboards uses the Line In 2 as the input for
11066 * front panel mic (mic 2)
11068 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11069 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11070 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11071 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11072 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11073 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11076 * Set up output mixers (0x0c - 0x0e)
11078 /* set vol=0 to output mixers */
11079 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11080 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11081 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11082 /* set up input amps for analog loopback */
11083 /* Amp Indices: DAC = 0, mixer = 1 */
11084 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11085 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11086 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11087 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11088 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11089 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11091 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11092 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11093 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11094 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11095 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11096 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11098 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11099 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11100 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11101 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11102 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11104 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11105 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11107 /* FIXME: use matrix-type input source selection */
11108 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11109 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11110 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11111 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11112 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11113 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11115 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11116 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11117 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11118 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11120 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11121 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11122 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11123 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11128 static struct hda_verb alc262_eapd_verbs[] = {
11129 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11130 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11134 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
11135 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11136 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11137 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11139 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11140 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11144 static struct hda_verb alc262_sony_unsol_verbs[] = {
11145 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11146 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11147 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
11149 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11150 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11154 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
11155 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11156 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11157 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11158 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11159 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11163 static struct hda_verb alc262_toshiba_s06_verbs[] = {
11164 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11165 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11166 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11167 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11168 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
11169 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11170 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11171 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11175 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
11177 struct alc_spec *spec = codec->spec;
11179 spec->autocfg.hp_pins[0] = 0x15;
11180 spec->autocfg.speaker_pins[0] = 0x14;
11181 spec->ext_mic.pin = 0x18;
11182 spec->ext_mic.mux_idx = 0;
11183 spec->int_mic.pin = 0x12;
11184 spec->int_mic.mux_idx = 9;
11185 spec->auto_mic = 1;
11191 * 0x16 = internal speaker
11192 * 0x18 = external mic
11195 static struct snd_kcontrol_new alc262_nec_mixer[] = {
11196 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
11197 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
11199 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11200 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11201 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11203 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11204 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11208 static struct hda_verb alc262_nec_verbs[] = {
11209 /* Unmute Speaker */
11210 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11213 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11214 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11216 /* External mic to headphone */
11217 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11218 /* External mic to speaker */
11219 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11225 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
11226 * 0x1b = port replicator headphone out
11229 #define ALC_HP_EVENT 0x37
11231 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
11232 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11233 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11234 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11235 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11239 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
11240 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11241 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11245 static struct hda_verb alc262_lenovo_3000_init_verbs[] = {
11246 /* Front Mic pin: input vref at 50% */
11247 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
11248 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11252 static struct hda_input_mux alc262_fujitsu_capture_source = {
11256 { "Int Mic", 0x1 },
11261 static struct hda_input_mux alc262_HP_capture_source = {
11265 { "Front Mic", 0x1 },
11272 static struct hda_input_mux alc262_HP_D7000_capture_source = {
11276 { "Front Mic", 0x2 },
11282 /* mute/unmute internal speaker according to the hp jacks and mute state */
11283 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
11285 struct alc_spec *spec = codec->spec;
11288 if (force || !spec->sense_updated) {
11289 spec->jack_present = snd_hda_jack_detect(codec, 0x14) ||
11290 snd_hda_jack_detect(codec, 0x1b);
11291 spec->sense_updated = 1;
11293 /* unmute internal speaker only if both HPs are unplugged and
11294 * master switch is on
11296 if (spec->jack_present)
11297 mute = HDA_AMP_MUTE;
11299 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11300 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11301 HDA_AMP_MUTE, mute);
11304 /* unsolicited event for HP jack sensing */
11305 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
11308 if ((res >> 26) != ALC_HP_EVENT)
11310 alc262_fujitsu_automute(codec, 1);
11313 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
11315 alc262_fujitsu_automute(codec, 1);
11318 /* bind volumes of both NID 0x0c and 0x0d */
11319 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
11320 .ops = &snd_hda_bind_vol,
11322 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
11323 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
11328 /* mute/unmute internal speaker according to the hp jack and mute state */
11329 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
11331 struct alc_spec *spec = codec->spec;
11334 if (force || !spec->sense_updated) {
11335 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
11336 spec->sense_updated = 1;
11338 if (spec->jack_present) {
11339 /* mute internal speaker */
11340 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11341 HDA_AMP_MUTE, HDA_AMP_MUTE);
11342 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11343 HDA_AMP_MUTE, HDA_AMP_MUTE);
11345 /* unmute internal speaker if necessary */
11346 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
11347 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11348 HDA_AMP_MUTE, mute);
11349 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11350 HDA_AMP_MUTE, mute);
11354 /* unsolicited event for HP jack sensing */
11355 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
11358 if ((res >> 26) != ALC_HP_EVENT)
11360 alc262_lenovo_3000_automute(codec, 1);
11363 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
11364 int dir, int idx, long *valp)
11368 for (i = 0; i < 2; i++, valp++)
11369 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
11371 *valp ? 0 : HDA_AMP_MUTE);
11375 /* bind hp and internal speaker mute (with plug check) */
11376 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
11377 struct snd_ctl_elem_value *ucontrol)
11379 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11380 long *valp = ucontrol->value.integer.value;
11383 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
11384 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11386 alc262_fujitsu_automute(codec, 0);
11390 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
11391 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11393 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11394 .name = "Master Playback Switch",
11395 .subdevice = HDA_SUBDEV_AMP_FLAG,
11396 .info = snd_hda_mixer_amp_switch_info,
11397 .get = snd_hda_mixer_amp_switch_get,
11398 .put = alc262_fujitsu_master_sw_put,
11399 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11402 .iface = NID_MAPPING,
11403 .name = "Master Playback Switch",
11404 .private_value = 0x1b,
11406 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11407 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11408 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11409 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11410 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11411 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11412 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11413 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11417 /* bind hp and internal speaker mute (with plug check) */
11418 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
11419 struct snd_ctl_elem_value *ucontrol)
11421 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11422 long *valp = ucontrol->value.integer.value;
11425 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11427 alc262_lenovo_3000_automute(codec, 0);
11431 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
11432 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11434 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11435 .name = "Master Playback Switch",
11436 .subdevice = HDA_SUBDEV_AMP_FLAG,
11437 .info = snd_hda_mixer_amp_switch_info,
11438 .get = snd_hda_mixer_amp_switch_get,
11439 .put = alc262_lenovo_3000_master_sw_put,
11440 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
11442 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11443 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11444 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11445 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11446 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11447 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11448 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11449 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11453 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
11454 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11455 ALC262_HIPPO_MASTER_SWITCH,
11456 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11457 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11458 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11459 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11460 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11461 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11465 /* additional init verbs for Benq laptops */
11466 static struct hda_verb alc262_EAPD_verbs[] = {
11467 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11468 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
11472 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
11473 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11474 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11476 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11477 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
11481 /* Samsung Q1 Ultra Vista model setup */
11482 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
11483 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11484 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11485 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11486 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11487 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
11488 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
11492 static struct hda_verb alc262_ultra_verbs[] = {
11494 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11495 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11496 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11498 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11499 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11500 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11501 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11503 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11504 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11505 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11506 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11507 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11509 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11510 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11511 /* ADC, choose mic */
11512 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11513 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11514 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11515 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11516 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11517 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11518 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11519 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11520 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11521 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
11525 /* mute/unmute internal speaker according to the hp jack and mute state */
11526 static void alc262_ultra_automute(struct hda_codec *codec)
11528 struct alc_spec *spec = codec->spec;
11532 /* auto-mute only when HP is used as HP */
11533 if (!spec->cur_mux[0]) {
11534 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11535 if (spec->jack_present)
11536 mute = HDA_AMP_MUTE;
11538 /* mute/unmute internal speaker */
11539 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11540 HDA_AMP_MUTE, mute);
11541 /* mute/unmute HP */
11542 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11543 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
11546 /* unsolicited event for HP jack sensing */
11547 static void alc262_ultra_unsol_event(struct hda_codec *codec,
11550 if ((res >> 26) != ALC880_HP_EVENT)
11552 alc262_ultra_automute(codec);
11555 static struct hda_input_mux alc262_ultra_capture_source = {
11559 { "Headphone", 0x7 },
11563 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
11564 struct snd_ctl_elem_value *ucontrol)
11566 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11567 struct alc_spec *spec = codec->spec;
11570 ret = alc_mux_enum_put(kcontrol, ucontrol);
11573 /* reprogram the HP pin as mic or HP according to the input source */
11574 snd_hda_codec_write_cache(codec, 0x15, 0,
11575 AC_VERB_SET_PIN_WIDGET_CONTROL,
11576 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
11577 alc262_ultra_automute(codec); /* mute/unmute HP */
11581 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
11582 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
11583 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
11585 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11586 .name = "Capture Source",
11587 .info = alc_mux_enum_info,
11588 .get = alc_mux_enum_get,
11589 .put = alc262_ultra_mux_enum_put,
11592 .iface = NID_MAPPING,
11593 .name = "Capture Source",
11594 .private_value = 0x15,
11599 /* We use two mixers depending on the output pin; 0x16 is a mono output
11600 * and thus it's bound with a different mixer.
11601 * This function returns which mixer amp should be used.
11603 static int alc262_check_volbit(hda_nid_t nid)
11607 else if (nid == 0x16)
11613 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
11614 const char *pfx, int *vbits)
11619 vbit = alc262_check_volbit(nid);
11622 if (*vbits & vbit) /* a volume control for this mixer already there */
11626 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
11628 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
11629 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, val);
11632 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
11640 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
11642 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
11643 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val);
11646 /* add playback controls from the parsed DAC table */
11647 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
11648 const struct auto_pin_cfg *cfg)
11654 spec->multiout.num_dacs = 1; /* only use one dac */
11655 spec->multiout.dac_nids = spec->private_dac_nids;
11656 spec->multiout.dac_nids[0] = 2;
11658 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
11660 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11664 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx);
11667 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker");
11670 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone");
11674 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
11675 alc262_check_volbit(cfg->speaker_pins[0]) |
11676 alc262_check_volbit(cfg->hp_pins[0]);
11677 if (vbits == 1 || vbits == 2)
11678 pfx = "Master"; /* only one mixer is used */
11679 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11684 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits);
11687 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker",
11691 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone",
11698 #define alc262_auto_create_input_ctls \
11699 alc882_auto_create_input_ctls
11702 * generic initialization of ADC, input mixers and output mixers
11704 static struct hda_verb alc262_volume_init_verbs[] = {
11706 * Unmute ADC0-2 and set the default input to mic-in
11708 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11709 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11710 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11711 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11712 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11713 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11715 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11717 * Note: PASD motherboards uses the Line In 2 as the input for
11718 * front panel mic (mic 2)
11720 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11721 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11722 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11723 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11724 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11725 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11728 * Set up output mixers (0x0c - 0x0f)
11730 /* set vol=0 to output mixers */
11731 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11732 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11733 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11735 /* set up input amps for analog loopback */
11736 /* Amp Indices: DAC = 0, mixer = 1 */
11737 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11738 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11739 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11740 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11741 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11742 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11744 /* FIXME: use matrix-type input source selection */
11745 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11746 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11747 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11748 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11749 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11750 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11752 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11753 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11754 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11755 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11757 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11758 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11759 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11760 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11765 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
11767 * Unmute ADC0-2 and set the default input to mic-in
11769 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11770 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11771 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11772 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11773 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11774 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11776 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11778 * Note: PASD motherboards uses the Line In 2 as the input for
11779 * front panel mic (mic 2)
11781 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11782 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11783 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11784 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11785 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11786 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11787 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11788 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11791 * Set up output mixers (0x0c - 0x0e)
11793 /* set vol=0 to output mixers */
11794 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11795 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11796 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11798 /* set up input amps for analog loopback */
11799 /* Amp Indices: DAC = 0, mixer = 1 */
11800 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11801 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11802 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11803 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11804 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11805 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11807 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11808 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11809 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11811 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11812 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11814 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11815 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11817 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11818 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11819 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11820 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11821 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11823 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11824 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11825 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11826 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11827 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11828 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11831 /* FIXME: use matrix-type input source selection */
11832 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
11833 /* Input mixer1: only unmute Mic */
11834 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11835 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11836 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11837 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11838 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11839 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11840 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11841 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11842 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11844 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11845 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11846 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11847 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11848 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11849 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11850 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11851 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11852 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11854 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11855 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11856 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11857 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11858 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11859 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11860 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11861 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11862 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11864 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11869 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
11871 * Unmute ADC0-2 and set the default input to mic-in
11873 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11874 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11875 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11876 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11877 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11878 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11880 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11882 * Note: PASD motherboards uses the Line In 2 as the input for front
11883 * panel mic (mic 2)
11885 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11886 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11887 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11888 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11889 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11890 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11891 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11892 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11893 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11895 * Set up output mixers (0x0c - 0x0e)
11897 /* set vol=0 to output mixers */
11898 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11899 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11900 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11902 /* set up input amps for analog loopback */
11903 /* Amp Indices: DAC = 0, mixer = 1 */
11904 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11905 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11906 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11907 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11908 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11909 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11912 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
11913 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
11914 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
11915 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
11916 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11917 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
11918 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
11920 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11921 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11923 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11924 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11926 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
11927 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11928 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11929 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
11930 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11931 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11933 /* FIXME: use matrix-type input source selection */
11934 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11935 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11936 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
11937 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
11938 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
11939 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
11940 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
11941 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11942 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
11944 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11945 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11946 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11947 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11948 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11949 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11950 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11952 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11953 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11954 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11955 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11956 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11957 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11958 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11960 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11965 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
11967 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
11968 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11969 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
11971 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
11972 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11973 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11974 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11976 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
11977 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11978 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11983 #ifdef CONFIG_SND_HDA_POWER_SAVE
11984 #define alc262_loopbacks alc880_loopbacks
11987 /* pcm configuration: identical with ALC880 */
11988 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
11989 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
11990 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
11991 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
11994 * BIOS auto configuration
11996 static int alc262_parse_auto_config(struct hda_codec *codec)
11998 struct alc_spec *spec = codec->spec;
12000 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
12002 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12006 if (!spec->autocfg.line_outs) {
12007 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12008 spec->multiout.max_channels = 2;
12009 spec->no_analog = 1;
12012 return 0; /* can't find valid BIOS pin config */
12014 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
12017 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
12021 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12024 if (spec->autocfg.dig_outs) {
12025 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
12026 spec->dig_out_type = spec->autocfg.dig_out_type[0];
12028 if (spec->autocfg.dig_in_pin)
12029 spec->dig_in_nid = ALC262_DIGIN_NID;
12031 if (spec->kctls.list)
12032 add_mixer(spec, spec->kctls.list);
12034 add_verb(spec, alc262_volume_init_verbs);
12035 spec->num_mux_defs = 1;
12036 spec->input_mux = &spec->private_imux[0];
12038 err = alc_auto_add_mic_boost(codec);
12042 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
12047 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
12048 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
12049 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
12050 #define alc262_auto_init_input_src alc882_auto_init_input_src
12053 /* init callback for auto-configuration model -- overriding the default init */
12054 static void alc262_auto_init(struct hda_codec *codec)
12056 struct alc_spec *spec = codec->spec;
12057 alc262_auto_init_multi_out(codec);
12058 alc262_auto_init_hp_out(codec);
12059 alc262_auto_init_analog_input(codec);
12060 alc262_auto_init_input_src(codec);
12061 if (spec->unsol_event)
12062 alc_inithook(codec);
12066 * configuration and preset
12068 static const char *alc262_models[ALC262_MODEL_LAST] = {
12069 [ALC262_BASIC] = "basic",
12070 [ALC262_HIPPO] = "hippo",
12071 [ALC262_HIPPO_1] = "hippo_1",
12072 [ALC262_FUJITSU] = "fujitsu",
12073 [ALC262_HP_BPC] = "hp-bpc",
12074 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
12075 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
12076 [ALC262_HP_RP5700] = "hp-rp5700",
12077 [ALC262_BENQ_ED8] = "benq",
12078 [ALC262_BENQ_T31] = "benq-t31",
12079 [ALC262_SONY_ASSAMD] = "sony-assamd",
12080 [ALC262_TOSHIBA_S06] = "toshiba-s06",
12081 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
12082 [ALC262_ULTRA] = "ultra",
12083 [ALC262_LENOVO_3000] = "lenovo-3000",
12084 [ALC262_NEC] = "nec",
12085 [ALC262_TYAN] = "tyan",
12086 [ALC262_AUTO] = "auto",
12089 static struct snd_pci_quirk alc262_cfg_tbl[] = {
12090 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
12091 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
12092 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
12094 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
12096 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
12098 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
12099 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
12100 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
12101 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
12102 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
12103 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
12104 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
12105 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
12106 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
12107 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
12108 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
12109 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
12110 ALC262_HP_TC_T5735),
12111 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
12112 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12113 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
12114 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12115 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
12116 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
12117 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
12118 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
12119 #if 0 /* disable the quirk since model=auto works better in recent versions */
12120 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
12121 ALC262_SONY_ASSAMD),
12123 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
12124 ALC262_TOSHIBA_RX1),
12125 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
12126 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
12127 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
12128 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
12129 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
12131 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
12132 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
12133 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
12134 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
12135 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
12139 static struct alc_config_preset alc262_presets[] = {
12141 .mixers = { alc262_base_mixer },
12142 .init_verbs = { alc262_init_verbs },
12143 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12144 .dac_nids = alc262_dac_nids,
12146 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12147 .channel_mode = alc262_modes,
12148 .input_mux = &alc262_capture_source,
12151 .mixers = { alc262_hippo_mixer },
12152 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
12153 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12154 .dac_nids = alc262_dac_nids,
12156 .dig_out_nid = ALC262_DIGOUT_NID,
12157 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12158 .channel_mode = alc262_modes,
12159 .input_mux = &alc262_capture_source,
12160 .unsol_event = alc262_hippo_unsol_event,
12161 .setup = alc262_hippo_setup,
12162 .init_hook = alc262_hippo_automute,
12164 [ALC262_HIPPO_1] = {
12165 .mixers = { alc262_hippo1_mixer },
12166 .init_verbs = { alc262_init_verbs, alc262_hippo1_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_hippo1_setup,
12176 .init_hook = alc262_hippo_automute,
12178 [ALC262_FUJITSU] = {
12179 .mixers = { alc262_fujitsu_mixer },
12180 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12181 alc262_fujitsu_unsol_verbs },
12182 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12183 .dac_nids = alc262_dac_nids,
12185 .dig_out_nid = ALC262_DIGOUT_NID,
12186 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12187 .channel_mode = alc262_modes,
12188 .input_mux = &alc262_fujitsu_capture_source,
12189 .unsol_event = alc262_fujitsu_unsol_event,
12190 .init_hook = alc262_fujitsu_init_hook,
12192 [ALC262_HP_BPC] = {
12193 .mixers = { alc262_HP_BPC_mixer },
12194 .init_verbs = { alc262_HP_BPC_init_verbs },
12195 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12196 .dac_nids = alc262_dac_nids,
12198 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12199 .channel_mode = alc262_modes,
12200 .input_mux = &alc262_HP_capture_source,
12201 .unsol_event = alc262_hp_bpc_unsol_event,
12202 .init_hook = alc262_hp_bpc_automute,
12204 [ALC262_HP_BPC_D7000_WF] = {
12205 .mixers = { alc262_HP_BPC_WildWest_mixer },
12206 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12207 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12208 .dac_nids = alc262_dac_nids,
12210 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12211 .channel_mode = alc262_modes,
12212 .input_mux = &alc262_HP_D7000_capture_source,
12213 .unsol_event = alc262_hp_wildwest_unsol_event,
12214 .init_hook = alc262_hp_wildwest_automute,
12216 [ALC262_HP_BPC_D7000_WL] = {
12217 .mixers = { alc262_HP_BPC_WildWest_mixer,
12218 alc262_HP_BPC_WildWest_option_mixer },
12219 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12220 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12221 .dac_nids = alc262_dac_nids,
12223 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12224 .channel_mode = alc262_modes,
12225 .input_mux = &alc262_HP_D7000_capture_source,
12226 .unsol_event = alc262_hp_wildwest_unsol_event,
12227 .init_hook = alc262_hp_wildwest_automute,
12229 [ALC262_HP_TC_T5735] = {
12230 .mixers = { alc262_hp_t5735_mixer },
12231 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
12232 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12233 .dac_nids = alc262_dac_nids,
12235 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12236 .channel_mode = alc262_modes,
12237 .input_mux = &alc262_capture_source,
12238 .unsol_event = alc_sku_unsol_event,
12239 .setup = alc262_hp_t5735_setup,
12240 .init_hook = alc_inithook,
12242 [ALC262_HP_RP5700] = {
12243 .mixers = { alc262_hp_rp5700_mixer },
12244 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
12245 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12246 .dac_nids = alc262_dac_nids,
12247 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12248 .channel_mode = alc262_modes,
12249 .input_mux = &alc262_hp_rp5700_capture_source,
12251 [ALC262_BENQ_ED8] = {
12252 .mixers = { alc262_base_mixer },
12253 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
12254 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12255 .dac_nids = alc262_dac_nids,
12257 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12258 .channel_mode = alc262_modes,
12259 .input_mux = &alc262_capture_source,
12261 [ALC262_SONY_ASSAMD] = {
12262 .mixers = { alc262_sony_mixer },
12263 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
12264 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12265 .dac_nids = alc262_dac_nids,
12267 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12268 .channel_mode = alc262_modes,
12269 .input_mux = &alc262_capture_source,
12270 .unsol_event = alc262_hippo_unsol_event,
12271 .setup = alc262_hippo_setup,
12272 .init_hook = alc262_hippo_automute,
12274 [ALC262_BENQ_T31] = {
12275 .mixers = { alc262_benq_t31_mixer },
12276 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
12277 alc_hp15_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,
12289 .mixers = { alc262_ultra_mixer },
12290 .cap_mixer = alc262_ultra_capture_mixer,
12291 .init_verbs = { alc262_ultra_verbs },
12292 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12293 .dac_nids = alc262_dac_nids,
12294 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12295 .channel_mode = alc262_modes,
12296 .input_mux = &alc262_ultra_capture_source,
12297 .adc_nids = alc262_adc_nids, /* ADC0 */
12298 .capsrc_nids = alc262_capsrc_nids,
12299 .num_adc_nids = 1, /* single ADC */
12300 .unsol_event = alc262_ultra_unsol_event,
12301 .init_hook = alc262_ultra_automute,
12303 [ALC262_LENOVO_3000] = {
12304 .mixers = { alc262_lenovo_3000_mixer },
12305 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12306 alc262_lenovo_3000_unsol_verbs,
12307 alc262_lenovo_3000_init_verbs },
12308 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12309 .dac_nids = alc262_dac_nids,
12311 .dig_out_nid = ALC262_DIGOUT_NID,
12312 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12313 .channel_mode = alc262_modes,
12314 .input_mux = &alc262_fujitsu_capture_source,
12315 .unsol_event = alc262_lenovo_3000_unsol_event,
12318 .mixers = { alc262_nec_mixer },
12319 .init_verbs = { alc262_nec_verbs },
12320 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12321 .dac_nids = alc262_dac_nids,
12323 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12324 .channel_mode = alc262_modes,
12325 .input_mux = &alc262_capture_source,
12327 [ALC262_TOSHIBA_S06] = {
12328 .mixers = { alc262_toshiba_s06_mixer },
12329 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
12330 alc262_eapd_verbs },
12331 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12332 .capsrc_nids = alc262_dmic_capsrc_nids,
12333 .dac_nids = alc262_dac_nids,
12334 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
12335 .num_adc_nids = 1, /* single ADC */
12336 .dig_out_nid = ALC262_DIGOUT_NID,
12337 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12338 .channel_mode = alc262_modes,
12339 .unsol_event = alc_sku_unsol_event,
12340 .setup = alc262_toshiba_s06_setup,
12341 .init_hook = alc_inithook,
12343 [ALC262_TOSHIBA_RX1] = {
12344 .mixers = { alc262_toshiba_rx1_mixer },
12345 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
12346 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12347 .dac_nids = alc262_dac_nids,
12349 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12350 .channel_mode = alc262_modes,
12351 .input_mux = &alc262_capture_source,
12352 .unsol_event = alc262_hippo_unsol_event,
12353 .setup = alc262_hippo_setup,
12354 .init_hook = alc262_hippo_automute,
12357 .mixers = { alc262_tyan_mixer },
12358 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
12359 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12360 .dac_nids = alc262_dac_nids,
12362 .dig_out_nid = ALC262_DIGOUT_NID,
12363 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12364 .channel_mode = alc262_modes,
12365 .input_mux = &alc262_capture_source,
12366 .unsol_event = alc_automute_amp_unsol_event,
12367 .setup = alc262_tyan_setup,
12368 .init_hook = alc_automute_amp,
12372 static int patch_alc262(struct hda_codec *codec)
12374 struct alc_spec *spec;
12378 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12382 codec->spec = spec;
12384 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
12389 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12390 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
12391 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12392 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
12395 alc_auto_parse_customize_define(codec);
12397 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
12399 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
12403 if (board_config < 0) {
12404 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12406 board_config = ALC262_AUTO;
12409 if (board_config == ALC262_AUTO) {
12410 /* automatic parse from the BIOS config */
12411 err = alc262_parse_auto_config(codec);
12417 "hda_codec: Cannot set up configuration "
12418 "from BIOS. Using base mode...\n");
12419 board_config = ALC262_BASIC;
12423 if (!spec->no_analog) {
12424 err = snd_hda_attach_beep_device(codec, 0x1);
12431 if (board_config != ALC262_AUTO)
12432 setup_preset(codec, &alc262_presets[board_config]);
12434 spec->stream_analog_playback = &alc262_pcm_analog_playback;
12435 spec->stream_analog_capture = &alc262_pcm_analog_capture;
12437 spec->stream_digital_playback = &alc262_pcm_digital_playback;
12438 spec->stream_digital_capture = &alc262_pcm_digital_capture;
12440 if (!spec->adc_nids && spec->input_mux) {
12442 /* check whether the digital-mic has to be supported */
12443 for (i = 0; i < spec->input_mux->num_items; i++) {
12444 if (spec->input_mux->items[i].index >= 9)
12447 if (i < spec->input_mux->num_items) {
12448 /* use only ADC0 */
12449 spec->adc_nids = alc262_dmic_adc_nids;
12450 spec->num_adc_nids = 1;
12451 spec->capsrc_nids = alc262_dmic_capsrc_nids;
12453 /* all analog inputs */
12454 /* check whether NID 0x07 is valid */
12455 unsigned int wcap = get_wcaps(codec, 0x07);
12458 wcap = get_wcaps_type(wcap);
12459 if (wcap != AC_WID_AUD_IN) {
12460 spec->adc_nids = alc262_adc_nids_alt;
12461 spec->num_adc_nids =
12462 ARRAY_SIZE(alc262_adc_nids_alt);
12463 spec->capsrc_nids = alc262_capsrc_nids_alt;
12465 spec->adc_nids = alc262_adc_nids;
12466 spec->num_adc_nids =
12467 ARRAY_SIZE(alc262_adc_nids);
12468 spec->capsrc_nids = alc262_capsrc_nids;
12472 if (!spec->cap_mixer && !spec->no_analog)
12473 set_capture_mixer(codec);
12474 if (!spec->no_analog && spec->cdefine.enable_pcbeep)
12475 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12477 spec->vmaster_nid = 0x0c;
12479 codec->patch_ops = alc_patch_ops;
12480 if (board_config == ALC262_AUTO)
12481 spec->init_hook = alc262_auto_init;
12482 #ifdef CONFIG_SND_HDA_POWER_SAVE
12483 if (!spec->loopback.amplist)
12484 spec->loopback.amplist = alc262_loopbacks;
12491 * ALC268 channel source setting (2 channel)
12493 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
12494 #define alc268_modes alc260_modes
12496 static hda_nid_t alc268_dac_nids[2] = {
12501 static hda_nid_t alc268_adc_nids[2] = {
12506 static hda_nid_t alc268_adc_nids_alt[1] = {
12511 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
12513 static struct snd_kcontrol_new alc268_base_mixer[] = {
12514 /* output mixer control */
12515 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12516 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12517 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12518 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12519 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12520 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12521 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12525 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
12526 /* output mixer control */
12527 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12528 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12529 ALC262_HIPPO_MASTER_SWITCH,
12530 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12531 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12532 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12536 /* bind Beep switches of both NID 0x0f and 0x10 */
12537 static struct hda_bind_ctls alc268_bind_beep_sw = {
12538 .ops = &snd_hda_bind_sw,
12540 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
12541 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
12546 static struct snd_kcontrol_new alc268_beep_mixer[] = {
12547 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
12548 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
12552 static struct hda_verb alc268_eapd_verbs[] = {
12553 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12554 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12558 /* Toshiba specific */
12559 static struct hda_verb alc268_toshiba_verbs[] = {
12560 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12564 /* Acer specific */
12565 /* bind volumes of both NID 0x02 and 0x03 */
12566 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
12567 .ops = &snd_hda_bind_vol,
12569 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12570 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12575 /* mute/unmute internal speaker according to the hp jack and mute state */
12576 static void alc268_acer_automute(struct hda_codec *codec, int force)
12578 struct alc_spec *spec = codec->spec;
12581 if (force || !spec->sense_updated) {
12582 spec->jack_present = snd_hda_jack_detect(codec, 0x14);
12583 spec->sense_updated = 1;
12585 if (spec->jack_present)
12586 mute = HDA_AMP_MUTE; /* mute internal speaker */
12587 else /* unmute internal speaker if necessary */
12588 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
12589 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12590 HDA_AMP_MUTE, mute);
12594 /* bind hp and internal speaker mute (with plug check) */
12595 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
12596 struct snd_ctl_elem_value *ucontrol)
12598 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12599 long *valp = ucontrol->value.integer.value;
12602 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
12604 alc268_acer_automute(codec, 0);
12608 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
12609 /* output mixer control */
12610 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12612 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12613 .name = "Master Playback Switch",
12614 .subdevice = HDA_SUBDEV_AMP_FLAG,
12615 .info = snd_hda_mixer_amp_switch_info,
12616 .get = snd_hda_mixer_amp_switch_get,
12617 .put = alc268_acer_master_sw_put,
12618 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12620 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
12624 static struct snd_kcontrol_new alc268_acer_mixer[] = {
12625 /* output mixer control */
12626 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12628 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12629 .name = "Master Playback Switch",
12630 .subdevice = HDA_SUBDEV_AMP_FLAG,
12631 .info = snd_hda_mixer_amp_switch_info,
12632 .get = snd_hda_mixer_amp_switch_get,
12633 .put = alc268_acer_master_sw_put,
12634 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12636 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12637 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12638 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12642 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
12643 /* output mixer control */
12644 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12646 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12647 .name = "Master Playback Switch",
12648 .subdevice = HDA_SUBDEV_AMP_FLAG,
12649 .info = snd_hda_mixer_amp_switch_info,
12650 .get = snd_hda_mixer_amp_switch_get,
12651 .put = alc268_acer_master_sw_put,
12652 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12654 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12655 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12659 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
12660 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12661 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12662 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12663 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12664 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
12665 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
12669 static struct hda_verb alc268_acer_verbs[] = {
12670 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
12671 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12672 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12673 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12674 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12675 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12676 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12680 /* unsolicited event for HP jack sensing */
12681 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
12682 #define alc268_toshiba_setup alc262_hippo_setup
12683 #define alc268_toshiba_automute alc262_hippo_automute
12685 static void alc268_acer_unsol_event(struct hda_codec *codec,
12688 if ((res >> 26) != ALC880_HP_EVENT)
12690 alc268_acer_automute(codec, 1);
12693 static void alc268_acer_init_hook(struct hda_codec *codec)
12695 alc268_acer_automute(codec, 1);
12698 /* toggle speaker-output according to the hp-jack state */
12699 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
12701 unsigned int present;
12702 unsigned char bits;
12704 present = snd_hda_jack_detect(codec, 0x15);
12705 bits = present ? HDA_AMP_MUTE : 0;
12706 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
12707 HDA_AMP_MUTE, bits);
12708 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
12709 HDA_AMP_MUTE, bits);
12712 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
12715 switch (res >> 26) {
12716 case ALC880_HP_EVENT:
12717 alc268_aspire_one_speaker_automute(codec);
12719 case ALC880_MIC_EVENT:
12720 alc_mic_automute(codec);
12725 static void alc268_acer_lc_setup(struct hda_codec *codec)
12727 struct alc_spec *spec = codec->spec;
12728 spec->ext_mic.pin = 0x18;
12729 spec->ext_mic.mux_idx = 0;
12730 spec->int_mic.pin = 0x12;
12731 spec->int_mic.mux_idx = 6;
12732 spec->auto_mic = 1;
12735 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
12737 alc268_aspire_one_speaker_automute(codec);
12738 alc_mic_automute(codec);
12741 static struct snd_kcontrol_new alc268_dell_mixer[] = {
12742 /* output mixer control */
12743 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12744 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12745 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12746 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12747 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12748 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12752 static struct hda_verb alc268_dell_verbs[] = {
12753 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12754 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12755 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12756 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12760 /* mute/unmute internal speaker according to the hp jack and mute state */
12761 static void alc268_dell_setup(struct hda_codec *codec)
12763 struct alc_spec *spec = codec->spec;
12765 spec->autocfg.hp_pins[0] = 0x15;
12766 spec->autocfg.speaker_pins[0] = 0x14;
12767 spec->ext_mic.pin = 0x18;
12768 spec->ext_mic.mux_idx = 0;
12769 spec->int_mic.pin = 0x19;
12770 spec->int_mic.mux_idx = 1;
12771 spec->auto_mic = 1;
12774 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
12775 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12776 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12777 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12778 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12779 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12780 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
12781 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
12782 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
12786 static struct hda_verb alc267_quanta_il1_verbs[] = {
12787 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12788 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12792 static void alc267_quanta_il1_setup(struct hda_codec *codec)
12794 struct alc_spec *spec = codec->spec;
12795 spec->autocfg.hp_pins[0] = 0x15;
12796 spec->autocfg.speaker_pins[0] = 0x14;
12797 spec->ext_mic.pin = 0x18;
12798 spec->ext_mic.mux_idx = 0;
12799 spec->int_mic.pin = 0x19;
12800 spec->int_mic.mux_idx = 1;
12801 spec->auto_mic = 1;
12805 * generic initialization of ADC, input mixers and output mixers
12807 static struct hda_verb alc268_base_init_verbs[] = {
12808 /* Unmute DAC0-1 and set vol = 0 */
12809 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12810 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12813 * Set up output mixers (0x0c - 0x0e)
12815 /* set vol=0 to output mixers */
12816 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12817 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
12819 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12820 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12822 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12823 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
12824 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12825 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12826 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12827 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12828 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12829 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12831 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12832 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12833 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12834 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12835 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12837 /* set PCBEEP vol = 0, mute connections */
12838 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12839 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12840 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12842 /* Unmute Selector 23h,24h and set the default input to mic-in */
12844 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
12845 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12846 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
12847 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12853 * generic initialization of ADC, input mixers and output mixers
12855 static struct hda_verb alc268_volume_init_verbs[] = {
12856 /* set output DAC */
12857 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12858 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12860 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12861 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12862 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12863 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12864 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12866 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12867 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12868 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12870 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12871 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12873 /* set PCBEEP vol = 0, mute connections */
12874 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12875 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12876 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12881 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
12882 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12883 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12887 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
12888 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12889 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12894 static struct snd_kcontrol_new alc268_capture_mixer[] = {
12895 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12896 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12897 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
12898 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
12903 static struct hda_input_mux alc268_capture_source = {
12907 { "Front Mic", 0x1 },
12913 static struct hda_input_mux alc268_acer_capture_source = {
12917 { "Internal Mic", 0x1 },
12922 static struct hda_input_mux alc268_acer_dmic_capture_source = {
12926 { "Internal Mic", 0x6 },
12931 #ifdef CONFIG_SND_DEBUG
12932 static struct snd_kcontrol_new alc268_test_mixer[] = {
12933 /* Volume widgets */
12934 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12935 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12936 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12937 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
12938 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
12939 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
12940 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
12941 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
12942 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
12943 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
12944 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
12945 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
12946 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
12947 /* The below appears problematic on some hardwares */
12948 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
12949 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12950 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
12951 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
12952 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
12954 /* Modes for retasking pin widgets */
12955 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
12956 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
12957 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
12958 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
12960 /* Controls for GPIO pins, assuming they are configured as outputs */
12961 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
12962 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
12963 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
12964 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
12966 /* Switches to allow the digital SPDIF output pin to be enabled.
12967 * The ALC268 does not have an SPDIF input.
12969 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
12971 /* A switch allowing EAPD to be enabled. Some laptops seem to use
12972 * this output to turn on an external amplifier.
12974 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
12975 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
12981 /* create input playback/capture controls for the given pin */
12982 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12983 const char *ctlname, int idx)
12994 case 0x21: /* ALC269vb has this pin, too */
13000 if (spec->multiout.dac_nids[0] != dac &&
13001 spec->multiout.dac_nids[1] != dac) {
13002 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
13003 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
13007 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
13011 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
13012 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
13014 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
13015 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
13021 /* add playback controls from the parsed DAC table */
13022 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
13023 const struct auto_pin_cfg *cfg)
13028 spec->multiout.dac_nids = spec->private_dac_nids;
13030 nid = cfg->line_out_pins[0];
13033 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
13037 err = alc268_new_analog_output(spec, nid, name, 0);
13042 nid = cfg->speaker_pins[0];
13044 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
13045 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
13049 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
13053 nid = cfg->hp_pins[0];
13055 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
13060 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
13062 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
13063 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
13070 /* create playback/capture controls for input pins */
13071 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
13072 const struct auto_pin_cfg *cfg)
13074 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
13077 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
13078 hda_nid_t nid, int pin_type)
13082 alc_set_pin_output(codec, nid, pin_type);
13083 if (nid == 0x14 || nid == 0x16)
13087 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
13090 static void alc268_auto_init_multi_out(struct hda_codec *codec)
13092 struct alc_spec *spec = codec->spec;
13093 hda_nid_t nid = spec->autocfg.line_out_pins[0];
13095 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13096 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
13100 static void alc268_auto_init_hp_out(struct hda_codec *codec)
13102 struct alc_spec *spec = codec->spec;
13105 pin = spec->autocfg.hp_pins[0];
13107 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
13108 pin = spec->autocfg.speaker_pins[0];
13110 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
13113 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
13115 struct alc_spec *spec = codec->spec;
13116 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
13117 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
13118 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
13119 unsigned int dac_vol1, dac_vol2;
13121 if (line_nid == 0x1d || speaker_nid == 0x1d) {
13122 snd_hda_codec_write(codec, speaker_nid, 0,
13123 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
13124 /* mute mixer inputs from 0x1d */
13125 snd_hda_codec_write(codec, 0x0f, 0,
13126 AC_VERB_SET_AMP_GAIN_MUTE,
13128 snd_hda_codec_write(codec, 0x10, 0,
13129 AC_VERB_SET_AMP_GAIN_MUTE,
13132 /* unmute mixer inputs from 0x1d */
13133 snd_hda_codec_write(codec, 0x0f, 0,
13134 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13135 snd_hda_codec_write(codec, 0x10, 0,
13136 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13139 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
13140 if (line_nid == 0x14)
13141 dac_vol2 = AMP_OUT_ZERO;
13142 else if (line_nid == 0x15)
13143 dac_vol1 = AMP_OUT_ZERO;
13144 if (hp_nid == 0x14)
13145 dac_vol2 = AMP_OUT_ZERO;
13146 else if (hp_nid == 0x15)
13147 dac_vol1 = AMP_OUT_ZERO;
13148 if (line_nid != 0x16 || hp_nid != 0x16 ||
13149 spec->autocfg.line_out_pins[1] != 0x16 ||
13150 spec->autocfg.line_out_pins[2] != 0x16)
13151 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
13153 snd_hda_codec_write(codec, 0x02, 0,
13154 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
13155 snd_hda_codec_write(codec, 0x03, 0,
13156 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
13159 /* pcm configuration: identical with ALC880 */
13160 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
13161 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
13162 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
13163 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
13166 * BIOS auto configuration
13168 static int alc268_parse_auto_config(struct hda_codec *codec)
13170 struct alc_spec *spec = codec->spec;
13172 static hda_nid_t alc268_ignore[] = { 0 };
13174 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13178 if (!spec->autocfg.line_outs) {
13179 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
13180 spec->multiout.max_channels = 2;
13181 spec->no_analog = 1;
13184 return 0; /* can't find valid BIOS pin config */
13186 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
13189 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
13193 spec->multiout.max_channels = 2;
13196 /* digital only support output */
13197 if (spec->autocfg.dig_outs) {
13198 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
13199 spec->dig_out_type = spec->autocfg.dig_out_type[0];
13201 if (spec->kctls.list)
13202 add_mixer(spec, spec->kctls.list);
13204 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
13205 add_mixer(spec, alc268_beep_mixer);
13207 add_verb(spec, alc268_volume_init_verbs);
13208 spec->num_mux_defs = 2;
13209 spec->input_mux = &spec->private_imux[0];
13211 err = alc_auto_add_mic_boost(codec);
13215 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
13220 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
13222 /* init callback for auto-configuration model -- overriding the default init */
13223 static void alc268_auto_init(struct hda_codec *codec)
13225 struct alc_spec *spec = codec->spec;
13226 alc268_auto_init_multi_out(codec);
13227 alc268_auto_init_hp_out(codec);
13228 alc268_auto_init_mono_speaker_out(codec);
13229 alc268_auto_init_analog_input(codec);
13230 if (spec->unsol_event)
13231 alc_inithook(codec);
13235 * configuration and preset
13237 static const char *alc268_models[ALC268_MODEL_LAST] = {
13238 [ALC267_QUANTA_IL1] = "quanta-il1",
13239 [ALC268_3ST] = "3stack",
13240 [ALC268_TOSHIBA] = "toshiba",
13241 [ALC268_ACER] = "acer",
13242 [ALC268_ACER_DMIC] = "acer-dmic",
13243 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
13244 [ALC268_DELL] = "dell",
13245 [ALC268_ZEPTO] = "zepto",
13246 #ifdef CONFIG_SND_DEBUG
13247 [ALC268_TEST] = "test",
13249 [ALC268_AUTO] = "auto",
13252 static struct snd_pci_quirk alc268_cfg_tbl[] = {
13253 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
13254 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
13255 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
13256 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
13257 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
13258 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
13259 ALC268_ACER_ASPIRE_ONE),
13260 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
13261 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
13262 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
13263 /* almost compatible with toshiba but with optional digital outs;
13264 * auto-probing seems working fine
13266 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
13268 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
13269 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
13270 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
13271 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
13272 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
13273 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
13277 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
13278 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
13279 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
13280 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
13281 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
13286 static struct alc_config_preset alc268_presets[] = {
13287 [ALC267_QUANTA_IL1] = {
13288 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
13289 alc268_capture_nosrc_mixer },
13290 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13291 alc267_quanta_il1_verbs },
13292 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13293 .dac_nids = alc268_dac_nids,
13294 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13295 .adc_nids = alc268_adc_nids_alt,
13297 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13298 .channel_mode = alc268_modes,
13299 .unsol_event = alc_sku_unsol_event,
13300 .setup = alc267_quanta_il1_setup,
13301 .init_hook = alc_inithook,
13304 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13305 alc268_beep_mixer },
13306 .init_verbs = { alc268_base_init_verbs },
13307 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13308 .dac_nids = alc268_dac_nids,
13309 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13310 .adc_nids = alc268_adc_nids_alt,
13311 .capsrc_nids = alc268_capsrc_nids,
13313 .dig_out_nid = ALC268_DIGOUT_NID,
13314 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13315 .channel_mode = alc268_modes,
13316 .input_mux = &alc268_capture_source,
13318 [ALC268_TOSHIBA] = {
13319 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
13320 alc268_beep_mixer },
13321 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13322 alc268_toshiba_verbs },
13323 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13324 .dac_nids = alc268_dac_nids,
13325 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13326 .adc_nids = alc268_adc_nids_alt,
13327 .capsrc_nids = alc268_capsrc_nids,
13329 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13330 .channel_mode = alc268_modes,
13331 .input_mux = &alc268_capture_source,
13332 .unsol_event = alc268_toshiba_unsol_event,
13333 .setup = alc268_toshiba_setup,
13334 .init_hook = alc268_toshiba_automute,
13337 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
13338 alc268_beep_mixer },
13339 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13340 alc268_acer_verbs },
13341 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13342 .dac_nids = alc268_dac_nids,
13343 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13344 .adc_nids = alc268_adc_nids_alt,
13345 .capsrc_nids = alc268_capsrc_nids,
13347 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13348 .channel_mode = alc268_modes,
13349 .input_mux = &alc268_acer_capture_source,
13350 .unsol_event = alc268_acer_unsol_event,
13351 .init_hook = alc268_acer_init_hook,
13353 [ALC268_ACER_DMIC] = {
13354 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
13355 alc268_beep_mixer },
13356 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13357 alc268_acer_verbs },
13358 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13359 .dac_nids = alc268_dac_nids,
13360 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13361 .adc_nids = alc268_adc_nids_alt,
13362 .capsrc_nids = alc268_capsrc_nids,
13364 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13365 .channel_mode = alc268_modes,
13366 .input_mux = &alc268_acer_dmic_capture_source,
13367 .unsol_event = alc268_acer_unsol_event,
13368 .init_hook = alc268_acer_init_hook,
13370 [ALC268_ACER_ASPIRE_ONE] = {
13371 .mixers = { alc268_acer_aspire_one_mixer,
13373 alc268_capture_nosrc_mixer },
13374 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13375 alc268_acer_aspire_one_verbs },
13376 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13377 .dac_nids = alc268_dac_nids,
13378 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13379 .adc_nids = alc268_adc_nids_alt,
13380 .capsrc_nids = alc268_capsrc_nids,
13382 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13383 .channel_mode = alc268_modes,
13384 .unsol_event = alc268_acer_lc_unsol_event,
13385 .setup = alc268_acer_lc_setup,
13386 .init_hook = alc268_acer_lc_init_hook,
13389 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
13390 alc268_capture_nosrc_mixer },
13391 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13392 alc268_dell_verbs },
13393 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13394 .dac_nids = alc268_dac_nids,
13395 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13396 .adc_nids = alc268_adc_nids_alt,
13397 .capsrc_nids = alc268_capsrc_nids,
13399 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13400 .channel_mode = alc268_modes,
13401 .unsol_event = alc_sku_unsol_event,
13402 .setup = alc268_dell_setup,
13403 .init_hook = alc_inithook,
13406 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13407 alc268_beep_mixer },
13408 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13409 alc268_toshiba_verbs },
13410 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13411 .dac_nids = alc268_dac_nids,
13412 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13413 .adc_nids = alc268_adc_nids_alt,
13414 .capsrc_nids = alc268_capsrc_nids,
13416 .dig_out_nid = ALC268_DIGOUT_NID,
13417 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13418 .channel_mode = alc268_modes,
13419 .input_mux = &alc268_capture_source,
13420 .setup = alc268_toshiba_setup,
13421 .init_hook = alc268_toshiba_automute,
13423 #ifdef CONFIG_SND_DEBUG
13425 .mixers = { alc268_test_mixer, alc268_capture_mixer },
13426 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13427 alc268_volume_init_verbs },
13428 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13429 .dac_nids = alc268_dac_nids,
13430 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13431 .adc_nids = alc268_adc_nids_alt,
13432 .capsrc_nids = alc268_capsrc_nids,
13434 .dig_out_nid = ALC268_DIGOUT_NID,
13435 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13436 .channel_mode = alc268_modes,
13437 .input_mux = &alc268_capture_source,
13442 static int patch_alc268(struct hda_codec *codec)
13444 struct alc_spec *spec;
13446 int i, has_beep, err;
13448 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13452 codec->spec = spec;
13454 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
13458 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
13459 board_config = snd_hda_check_board_codec_sid_config(codec,
13460 ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
13462 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
13463 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13465 board_config = ALC268_AUTO;
13468 if (board_config == ALC268_AUTO) {
13469 /* automatic parse from the BIOS config */
13470 err = alc268_parse_auto_config(codec);
13476 "hda_codec: Cannot set up configuration "
13477 "from BIOS. Using base mode...\n");
13478 board_config = ALC268_3ST;
13482 if (board_config != ALC268_AUTO)
13483 setup_preset(codec, &alc268_presets[board_config]);
13485 spec->stream_analog_playback = &alc268_pcm_analog_playback;
13486 spec->stream_analog_capture = &alc268_pcm_analog_capture;
13487 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
13489 spec->stream_digital_playback = &alc268_pcm_digital_playback;
13492 for (i = 0; i < spec->num_mixers; i++) {
13493 if (spec->mixers[i] == alc268_beep_mixer) {
13500 err = snd_hda_attach_beep_device(codec, 0x1);
13505 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
13506 /* override the amp caps for beep generator */
13507 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
13508 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
13509 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
13510 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
13511 (0 << AC_AMPCAP_MUTE_SHIFT));
13514 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
13515 /* check whether NID 0x07 is valid */
13516 unsigned int wcap = get_wcaps(codec, 0x07);
13519 spec->capsrc_nids = alc268_capsrc_nids;
13521 wcap = get_wcaps_type(wcap);
13522 if (spec->auto_mic ||
13523 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
13524 spec->adc_nids = alc268_adc_nids_alt;
13525 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
13526 if (spec->auto_mic)
13527 fixup_automic_adc(codec);
13528 if (spec->auto_mic || spec->input_mux->num_items == 1)
13529 add_mixer(spec, alc268_capture_nosrc_mixer);
13531 add_mixer(spec, alc268_capture_alt_mixer);
13533 spec->adc_nids = alc268_adc_nids;
13534 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
13535 add_mixer(spec, alc268_capture_mixer);
13537 /* set default input source */
13538 for (i = 0; i < spec->num_adc_nids; i++)
13539 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
13540 0, AC_VERB_SET_CONNECT_SEL,
13541 i < spec->num_mux_defs ?
13542 spec->input_mux[i].items[0].index :
13543 spec->input_mux->items[0].index);
13546 spec->vmaster_nid = 0x02;
13548 codec->patch_ops = alc_patch_ops;
13549 if (board_config == ALC268_AUTO)
13550 spec->init_hook = alc268_auto_init;
13556 * ALC269 channel source setting (2 channel)
13558 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
13560 #define alc269_dac_nids alc260_dac_nids
13562 static hda_nid_t alc269_adc_nids[1] = {
13567 static hda_nid_t alc269_capsrc_nids[1] = {
13571 static hda_nid_t alc269vb_adc_nids[1] = {
13576 static hda_nid_t alc269vb_capsrc_nids[1] = {
13580 static hda_nid_t alc269_adc_candidates[] = {
13584 #define alc269_modes alc260_modes
13585 #define alc269_capture_source alc880_lg_lw_capture_source
13587 static struct snd_kcontrol_new alc269_base_mixer[] = {
13588 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13589 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13590 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13591 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13592 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13593 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13594 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13595 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13596 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13597 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13598 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13599 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
13603 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
13604 /* output mixer control */
13605 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13607 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13608 .name = "Master Playback Switch",
13609 .subdevice = HDA_SUBDEV_AMP_FLAG,
13610 .info = snd_hda_mixer_amp_switch_info,
13611 .get = snd_hda_mixer_amp_switch_get,
13612 .put = alc268_acer_master_sw_put,
13613 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13615 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13616 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13617 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13618 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13619 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13620 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13624 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
13625 /* output mixer control */
13626 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13628 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13629 .name = "Master Playback Switch",
13630 .subdevice = HDA_SUBDEV_AMP_FLAG,
13631 .info = snd_hda_mixer_amp_switch_info,
13632 .get = snd_hda_mixer_amp_switch_get,
13633 .put = alc268_acer_master_sw_put,
13634 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13636 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13637 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13638 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13639 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13640 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13641 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13642 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
13643 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
13644 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
13648 static struct snd_kcontrol_new alc269_laptop_mixer[] = {
13649 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13650 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13651 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13652 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13656 static struct snd_kcontrol_new alc269vb_laptop_mixer[] = {
13657 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13658 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13659 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
13660 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13664 /* capture mixer elements */
13665 static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = {
13666 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13667 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13668 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13669 HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT),
13673 static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = {
13674 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13675 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13676 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13680 static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = {
13681 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13682 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13683 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13684 HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT),
13688 static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = {
13689 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13690 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13691 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13696 #define alc269_fujitsu_mixer alc269_laptop_mixer
13698 static struct hda_verb alc269_quanta_fl1_verbs[] = {
13699 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13700 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13701 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13702 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13703 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13704 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13708 static struct hda_verb alc269_lifebook_verbs[] = {
13709 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13710 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
13711 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13712 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13713 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13714 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13715 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13716 {0x1a, 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 /* toggle speaker-output according to the hp-jack state */
13723 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
13725 unsigned int present;
13726 unsigned char bits;
13728 present = snd_hda_jack_detect(codec, 0x15);
13729 bits = present ? HDA_AMP_MUTE : 0;
13730 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13731 HDA_AMP_MUTE, bits);
13732 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13733 HDA_AMP_MUTE, bits);
13735 snd_hda_codec_write(codec, 0x20, 0,
13736 AC_VERB_SET_COEF_INDEX, 0x0c);
13737 snd_hda_codec_write(codec, 0x20, 0,
13738 AC_VERB_SET_PROC_COEF, 0x680);
13740 snd_hda_codec_write(codec, 0x20, 0,
13741 AC_VERB_SET_COEF_INDEX, 0x0c);
13742 snd_hda_codec_write(codec, 0x20, 0,
13743 AC_VERB_SET_PROC_COEF, 0x480);
13746 /* toggle speaker-output according to the hp-jacks state */
13747 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
13749 unsigned int present;
13750 unsigned char bits;
13752 /* Check laptop headphone socket */
13753 present = snd_hda_jack_detect(codec, 0x15);
13755 /* Check port replicator headphone socket */
13756 present |= snd_hda_jack_detect(codec, 0x1a);
13758 bits = present ? HDA_AMP_MUTE : 0;
13759 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13760 HDA_AMP_MUTE, bits);
13761 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13762 HDA_AMP_MUTE, bits);
13764 snd_hda_codec_write(codec, 0x20, 0,
13765 AC_VERB_SET_COEF_INDEX, 0x0c);
13766 snd_hda_codec_write(codec, 0x20, 0,
13767 AC_VERB_SET_PROC_COEF, 0x680);
13769 snd_hda_codec_write(codec, 0x20, 0,
13770 AC_VERB_SET_COEF_INDEX, 0x0c);
13771 snd_hda_codec_write(codec, 0x20, 0,
13772 AC_VERB_SET_PROC_COEF, 0x480);
13775 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
13777 unsigned int present_laptop;
13778 unsigned int present_dock;
13780 present_laptop = snd_hda_jack_detect(codec, 0x18);
13781 present_dock = snd_hda_jack_detect(codec, 0x1b);
13783 /* Laptop mic port overrides dock mic port, design decision */
13785 snd_hda_codec_write(codec, 0x23, 0,
13786 AC_VERB_SET_CONNECT_SEL, 0x3);
13787 if (present_laptop)
13788 snd_hda_codec_write(codec, 0x23, 0,
13789 AC_VERB_SET_CONNECT_SEL, 0x0);
13790 if (!present_dock && !present_laptop)
13791 snd_hda_codec_write(codec, 0x23, 0,
13792 AC_VERB_SET_CONNECT_SEL, 0x1);
13795 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
13798 switch (res >> 26) {
13799 case ALC880_HP_EVENT:
13800 alc269_quanta_fl1_speaker_automute(codec);
13802 case ALC880_MIC_EVENT:
13803 alc_mic_automute(codec);
13808 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
13811 if ((res >> 26) == ALC880_HP_EVENT)
13812 alc269_lifebook_speaker_automute(codec);
13813 if ((res >> 26) == ALC880_MIC_EVENT)
13814 alc269_lifebook_mic_autoswitch(codec);
13817 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
13819 struct alc_spec *spec = codec->spec;
13820 spec->autocfg.hp_pins[0] = 0x15;
13821 spec->autocfg.speaker_pins[0] = 0x14;
13822 spec->ext_mic.pin = 0x18;
13823 spec->ext_mic.mux_idx = 0;
13824 spec->int_mic.pin = 0x19;
13825 spec->int_mic.mux_idx = 1;
13826 spec->auto_mic = 1;
13829 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
13831 alc269_quanta_fl1_speaker_automute(codec);
13832 alc_mic_automute(codec);
13835 static void alc269_lifebook_init_hook(struct hda_codec *codec)
13837 alc269_lifebook_speaker_automute(codec);
13838 alc269_lifebook_mic_autoswitch(codec);
13841 static struct hda_verb alc269_laptop_dmic_init_verbs[] = {
13842 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13843 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
13844 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13845 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13846 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13847 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13848 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13852 static struct hda_verb alc269_laptop_amic_init_verbs[] = {
13853 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13854 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
13855 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13856 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
13857 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13858 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13862 static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = {
13863 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
13864 {0x22, AC_VERB_SET_CONNECT_SEL, 0x06},
13865 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13866 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13867 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13868 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13869 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13873 static struct hda_verb alc269vb_laptop_amic_init_verbs[] = {
13874 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
13875 {0x22, AC_VERB_SET_CONNECT_SEL, 0x01},
13876 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13877 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13878 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13879 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13880 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13884 /* toggle speaker-output according to the hp-jack state */
13885 static void alc269_speaker_automute(struct hda_codec *codec)
13887 struct alc_spec *spec = codec->spec;
13888 unsigned int nid = spec->autocfg.hp_pins[0];
13889 unsigned int present;
13890 unsigned char bits;
13892 present = snd_hda_jack_detect(codec, nid);
13893 bits = present ? HDA_AMP_MUTE : 0;
13894 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13895 HDA_AMP_MUTE, bits);
13896 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13897 HDA_AMP_MUTE, bits);
13900 /* unsolicited event for HP jack sensing */
13901 static void alc269_laptop_unsol_event(struct hda_codec *codec,
13904 switch (res >> 26) {
13905 case ALC880_HP_EVENT:
13906 alc269_speaker_automute(codec);
13908 case ALC880_MIC_EVENT:
13909 alc_mic_automute(codec);
13914 static void alc269_laptop_amic_setup(struct hda_codec *codec)
13916 struct alc_spec *spec = codec->spec;
13917 spec->autocfg.hp_pins[0] = 0x15;
13918 spec->autocfg.speaker_pins[0] = 0x14;
13919 spec->ext_mic.pin = 0x18;
13920 spec->ext_mic.mux_idx = 0;
13921 spec->int_mic.pin = 0x19;
13922 spec->int_mic.mux_idx = 1;
13923 spec->auto_mic = 1;
13926 static void alc269_laptop_dmic_setup(struct hda_codec *codec)
13928 struct alc_spec *spec = codec->spec;
13929 spec->autocfg.hp_pins[0] = 0x15;
13930 spec->autocfg.speaker_pins[0] = 0x14;
13931 spec->ext_mic.pin = 0x18;
13932 spec->ext_mic.mux_idx = 0;
13933 spec->int_mic.pin = 0x12;
13934 spec->int_mic.mux_idx = 5;
13935 spec->auto_mic = 1;
13938 static void alc269vb_laptop_amic_setup(struct hda_codec *codec)
13940 struct alc_spec *spec = codec->spec;
13941 spec->autocfg.hp_pins[0] = 0x21;
13942 spec->autocfg.speaker_pins[0] = 0x14;
13943 spec->ext_mic.pin = 0x18;
13944 spec->ext_mic.mux_idx = 0;
13945 spec->int_mic.pin = 0x19;
13946 spec->int_mic.mux_idx = 1;
13947 spec->auto_mic = 1;
13950 static void alc269vb_laptop_dmic_setup(struct hda_codec *codec)
13952 struct alc_spec *spec = codec->spec;
13953 spec->autocfg.hp_pins[0] = 0x21;
13954 spec->autocfg.speaker_pins[0] = 0x14;
13955 spec->ext_mic.pin = 0x18;
13956 spec->ext_mic.mux_idx = 0;
13957 spec->int_mic.pin = 0x12;
13958 spec->int_mic.mux_idx = 6;
13959 spec->auto_mic = 1;
13962 static void alc269_laptop_inithook(struct hda_codec *codec)
13964 alc269_speaker_automute(codec);
13965 alc_mic_automute(codec);
13969 * generic initialization of ADC, input mixers and output mixers
13971 static struct hda_verb alc269_init_verbs[] = {
13973 * Unmute ADC0 and set the default input to mic-in
13975 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13978 * Set up output mixers (0x02 - 0x03)
13980 /* set vol=0 to output mixers */
13981 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13982 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13984 /* set up input amps for analog loopback */
13985 /* Amp Indices: DAC = 0, mixer = 1 */
13986 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13987 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13988 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13989 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13990 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13991 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13993 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13994 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13995 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13996 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13997 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13998 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13999 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14001 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14002 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14004 /* FIXME: use Mux-type input source selection */
14005 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14006 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14007 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
14010 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14014 static struct hda_verb alc269vb_init_verbs[] = {
14016 * Unmute ADC0 and set the default input to mic-in
14018 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14021 * Set up output mixers (0x02 - 0x03)
14023 /* set vol=0 to output mixers */
14024 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14025 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14027 /* set up input amps for analog loopback */
14028 /* Amp Indices: DAC = 0, mixer = 1 */
14029 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14030 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14031 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14032 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14033 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14034 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14036 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14037 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14038 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14039 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14040 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14041 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14042 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14044 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14045 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14047 /* FIXME: use Mux-type input source selection */
14048 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14049 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14050 {0x22, AC_VERB_SET_CONNECT_SEL, 0x00},
14053 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14057 #define alc269_auto_create_multi_out_ctls \
14058 alc268_auto_create_multi_out_ctls
14059 #define alc269_auto_create_input_ctls \
14060 alc268_auto_create_input_ctls
14062 #ifdef CONFIG_SND_HDA_POWER_SAVE
14063 #define alc269_loopbacks alc880_loopbacks
14066 /* pcm configuration: identical with ALC880 */
14067 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
14068 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
14069 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
14070 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
14072 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
14076 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14077 /* NID is set in alc_build_pcms */
14079 .open = alc880_playback_pcm_open,
14080 .prepare = alc880_playback_pcm_prepare,
14081 .cleanup = alc880_playback_pcm_cleanup
14085 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
14089 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14090 /* NID is set in alc_build_pcms */
14093 #ifdef CONFIG_SND_HDA_POWER_SAVE
14094 static int alc269_mic2_for_mute_led(struct hda_codec *codec)
14096 switch (codec->subsystem_id) {
14103 static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid)
14105 /* update mute-LED according to the speaker mute state */
14106 if (nid == 0x01 || nid == 0x14) {
14108 if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) &
14113 /* mic2 vref pin is used for mute LED control */
14114 snd_hda_codec_update_cache(codec, 0x19, 0,
14115 AC_VERB_SET_PIN_WIDGET_CONTROL,
14118 return alc_check_power_status(codec, nid);
14120 #endif /* CONFIG_SND_HDA_POWER_SAVE */
14123 * BIOS auto configuration
14125 static int alc269_parse_auto_config(struct hda_codec *codec)
14127 struct alc_spec *spec = codec->spec;
14129 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
14131 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14136 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
14139 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
14143 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14145 if (spec->autocfg.dig_outs)
14146 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
14148 if (spec->kctls.list)
14149 add_mixer(spec, spec->kctls.list);
14151 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010) {
14152 add_verb(spec, alc269vb_init_verbs);
14153 alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21);
14155 add_verb(spec, alc269_init_verbs);
14156 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
14159 spec->num_mux_defs = 1;
14160 spec->input_mux = &spec->private_imux[0];
14161 fillup_priv_adc_nids(codec, alc269_adc_candidates,
14162 sizeof(alc269_adc_candidates));
14164 /* set default input source */
14165 snd_hda_codec_write_cache(codec, spec->capsrc_nids[0],
14166 0, AC_VERB_SET_CONNECT_SEL,
14167 spec->input_mux->items[0].index);
14169 err = alc_auto_add_mic_boost(codec);
14173 if (!spec->cap_mixer && !spec->no_analog)
14174 set_capture_mixer(codec);
14179 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
14180 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
14181 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
14184 /* init callback for auto-configuration model -- overriding the default init */
14185 static void alc269_auto_init(struct hda_codec *codec)
14187 struct alc_spec *spec = codec->spec;
14188 alc269_auto_init_multi_out(codec);
14189 alc269_auto_init_hp_out(codec);
14190 alc269_auto_init_analog_input(codec);
14191 if (spec->unsol_event)
14192 alc_inithook(codec);
14196 * configuration and preset
14198 static const char *alc269_models[ALC269_MODEL_LAST] = {
14199 [ALC269_BASIC] = "basic",
14200 [ALC269_QUANTA_FL1] = "quanta",
14201 [ALC269_AMIC] = "laptop-amic",
14202 [ALC269_DMIC] = "laptop-dmic",
14203 [ALC269_FUJITSU] = "fujitsu",
14204 [ALC269_LIFEBOOK] = "lifebook",
14205 [ALC269_AUTO] = "auto",
14208 static struct snd_pci_quirk alc269_cfg_tbl[] = {
14209 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
14210 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
14212 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC),
14213 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC),
14214 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC),
14215 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC),
14216 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC),
14217 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC),
14218 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC),
14219 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC),
14220 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC),
14221 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC),
14222 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC),
14223 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC),
14224 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC),
14225 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC),
14226 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC),
14227 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC),
14228 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC),
14229 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC),
14230 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC),
14231 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC),
14232 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC),
14233 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC),
14234 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC),
14235 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC),
14236 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC),
14237 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC),
14238 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC),
14239 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC),
14240 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC),
14241 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC),
14242 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC),
14243 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC),
14244 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC),
14245 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC),
14246 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC),
14247 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC),
14248 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
14250 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
14252 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC),
14253 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC),
14254 SND_PCI_QUIRK(0x104d, 0x9071, "SONY XTB", ALC269_DMIC),
14255 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
14256 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC),
14257 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
14258 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC),
14259 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC),
14260 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC),
14261 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC),
14265 static struct alc_config_preset alc269_presets[] = {
14267 .mixers = { alc269_base_mixer },
14268 .init_verbs = { alc269_init_verbs },
14269 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14270 .dac_nids = alc269_dac_nids,
14272 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14273 .channel_mode = alc269_modes,
14274 .input_mux = &alc269_capture_source,
14276 [ALC269_QUANTA_FL1] = {
14277 .mixers = { alc269_quanta_fl1_mixer },
14278 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
14279 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14280 .dac_nids = alc269_dac_nids,
14282 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14283 .channel_mode = alc269_modes,
14284 .input_mux = &alc269_capture_source,
14285 .unsol_event = alc269_quanta_fl1_unsol_event,
14286 .setup = alc269_quanta_fl1_setup,
14287 .init_hook = alc269_quanta_fl1_init_hook,
14290 .mixers = { alc269_laptop_mixer },
14291 .cap_mixer = alc269_laptop_analog_capture_mixer,
14292 .init_verbs = { alc269_init_verbs,
14293 alc269_laptop_amic_init_verbs },
14294 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14295 .dac_nids = alc269_dac_nids,
14297 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14298 .channel_mode = alc269_modes,
14299 .unsol_event = alc269_laptop_unsol_event,
14300 .setup = alc269_laptop_amic_setup,
14301 .init_hook = alc269_laptop_inithook,
14304 .mixers = { alc269_laptop_mixer },
14305 .cap_mixer = alc269_laptop_digital_capture_mixer,
14306 .init_verbs = { alc269_init_verbs,
14307 alc269_laptop_dmic_init_verbs },
14308 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14309 .dac_nids = alc269_dac_nids,
14311 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14312 .channel_mode = alc269_modes,
14313 .unsol_event = alc269_laptop_unsol_event,
14314 .setup = alc269_laptop_dmic_setup,
14315 .init_hook = alc269_laptop_inithook,
14317 [ALC269VB_AMIC] = {
14318 .mixers = { alc269vb_laptop_mixer },
14319 .cap_mixer = alc269vb_laptop_analog_capture_mixer,
14320 .init_verbs = { alc269vb_init_verbs,
14321 alc269vb_laptop_amic_init_verbs },
14322 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14323 .dac_nids = alc269_dac_nids,
14325 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14326 .channel_mode = alc269_modes,
14327 .unsol_event = alc269_laptop_unsol_event,
14328 .setup = alc269vb_laptop_amic_setup,
14329 .init_hook = alc269_laptop_inithook,
14331 [ALC269VB_DMIC] = {
14332 .mixers = { alc269vb_laptop_mixer },
14333 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
14334 .init_verbs = { alc269vb_init_verbs,
14335 alc269vb_laptop_dmic_init_verbs },
14336 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14337 .dac_nids = alc269_dac_nids,
14339 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14340 .channel_mode = alc269_modes,
14341 .unsol_event = alc269_laptop_unsol_event,
14342 .setup = alc269vb_laptop_dmic_setup,
14343 .init_hook = alc269_laptop_inithook,
14345 [ALC269_FUJITSU] = {
14346 .mixers = { alc269_fujitsu_mixer },
14347 .cap_mixer = alc269_laptop_digital_capture_mixer,
14348 .init_verbs = { alc269_init_verbs,
14349 alc269_laptop_dmic_init_verbs },
14350 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14351 .dac_nids = alc269_dac_nids,
14353 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14354 .channel_mode = alc269_modes,
14355 .unsol_event = alc269_laptop_unsol_event,
14356 .setup = alc269_laptop_dmic_setup,
14357 .init_hook = alc269_laptop_inithook,
14359 [ALC269_LIFEBOOK] = {
14360 .mixers = { alc269_lifebook_mixer },
14361 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
14362 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14363 .dac_nids = alc269_dac_nids,
14365 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14366 .channel_mode = alc269_modes,
14367 .input_mux = &alc269_capture_source,
14368 .unsol_event = alc269_lifebook_unsol_event,
14369 .init_hook = alc269_lifebook_init_hook,
14373 static int patch_alc269(struct hda_codec *codec)
14375 struct alc_spec *spec;
14378 int is_alc269vb = 0;
14380 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14384 codec->spec = spec;
14386 alc_auto_parse_customize_define(codec);
14388 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){
14389 if (codec->bus->pci->subsystem_vendor == 0x1025 &&
14390 spec->cdefine.platform_type == 1)
14391 alc_codec_rename(codec, "ALC271X");
14393 alc_codec_rename(codec, "ALC259");
14396 alc_fix_pll_init(codec, 0x20, 0x04, 15);
14398 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
14402 if (board_config < 0) {
14403 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14405 board_config = ALC269_AUTO;
14408 if (board_config == ALC269_AUTO) {
14409 /* automatic parse from the BIOS config */
14410 err = alc269_parse_auto_config(codec);
14416 "hda_codec: Cannot set up configuration "
14417 "from BIOS. Using base mode...\n");
14418 board_config = ALC269_BASIC;
14422 err = snd_hda_attach_beep_device(codec, 0x1);
14428 if (board_config != ALC269_AUTO)
14429 setup_preset(codec, &alc269_presets[board_config]);
14431 if (board_config == ALC269_QUANTA_FL1) {
14432 /* Due to a hardware problem on Lenovo Ideadpad, we need to
14433 * fix the sample rate of analog I/O to 44.1kHz
14435 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
14436 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
14438 spec->stream_analog_playback = &alc269_pcm_analog_playback;
14439 spec->stream_analog_capture = &alc269_pcm_analog_capture;
14441 spec->stream_digital_playback = &alc269_pcm_digital_playback;
14442 spec->stream_digital_capture = &alc269_pcm_digital_capture;
14444 if (!spec->adc_nids) { /* wasn't filled automatically? use default */
14445 if (!is_alc269vb) {
14446 spec->adc_nids = alc269_adc_nids;
14447 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
14448 spec->capsrc_nids = alc269_capsrc_nids;
14450 spec->adc_nids = alc269vb_adc_nids;
14451 spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids);
14452 spec->capsrc_nids = alc269vb_capsrc_nids;
14456 if (!spec->cap_mixer)
14457 set_capture_mixer(codec);
14458 if (spec->cdefine.enable_pcbeep)
14459 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
14461 spec->vmaster_nid = 0x02;
14463 codec->patch_ops = alc_patch_ops;
14464 if (board_config == ALC269_AUTO)
14465 spec->init_hook = alc269_auto_init;
14466 #ifdef CONFIG_SND_HDA_POWER_SAVE
14467 if (!spec->loopback.amplist)
14468 spec->loopback.amplist = alc269_loopbacks;
14469 if (alc269_mic2_for_mute_led(codec))
14470 codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps;
14477 * ALC861 channel source setting (2/6 channel selection for 3-stack)
14481 * set the path ways for 2 channel output
14482 * need to set the codec line out and mic 1 pin widgets to inputs
14484 static struct hda_verb alc861_threestack_ch2_init[] = {
14485 /* set pin widget 1Ah (line in) for input */
14486 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14487 /* set pin widget 18h (mic1/2) for input, for mic also enable
14490 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14492 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
14494 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14495 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
14501 * need to set the codec line out and mic 1 pin widgets to outputs
14503 static struct hda_verb alc861_threestack_ch6_init[] = {
14504 /* set pin widget 1Ah (line in) for output (Back Surround)*/
14505 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14506 /* set pin widget 18h (mic1) for output (CLFE)*/
14507 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14509 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
14510 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
14512 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
14514 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14515 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
14520 static struct hda_channel_mode alc861_threestack_modes[2] = {
14521 { 2, alc861_threestack_ch2_init },
14522 { 6, alc861_threestack_ch6_init },
14524 /* Set mic1 as input and unmute the mixer */
14525 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
14526 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14527 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14530 /* Set mic1 as output and mute mixer */
14531 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
14532 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14533 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14537 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
14538 { 2, alc861_uniwill_m31_ch2_init },
14539 { 4, alc861_uniwill_m31_ch4_init },
14542 /* Set mic1 and line-in as input and unmute the mixer */
14543 static struct hda_verb alc861_asus_ch2_init[] = {
14544 /* set pin widget 1Ah (line in) for input */
14545 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14546 /* set pin widget 18h (mic1/2) for input, for mic also enable
14549 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14551 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
14553 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14554 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
14558 /* Set mic1 nad line-in as output and mute mixer */
14559 static struct hda_verb alc861_asus_ch6_init[] = {
14560 /* set pin widget 1Ah (line in) for output (Back Surround)*/
14561 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14562 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
14563 /* set pin widget 18h (mic1) for output (CLFE)*/
14564 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14565 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
14566 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
14567 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
14569 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
14571 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14572 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
14577 static struct hda_channel_mode alc861_asus_modes[2] = {
14578 { 2, alc861_asus_ch2_init },
14579 { 6, alc861_asus_ch6_init },
14584 static struct snd_kcontrol_new alc861_base_mixer[] = {
14585 /* output mixer control */
14586 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14587 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14588 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14589 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14590 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
14592 /*Input mixer control */
14593 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14594 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14595 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14596 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14597 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14598 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14599 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14600 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14601 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14602 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14607 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
14608 /* output mixer control */
14609 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14610 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14611 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14612 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14613 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
14615 /* Input mixer control */
14616 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14617 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14618 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14619 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14620 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14621 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14622 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14623 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14624 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14625 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14628 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14629 .name = "Channel Mode",
14630 .info = alc_ch_mode_info,
14631 .get = alc_ch_mode_get,
14632 .put = alc_ch_mode_put,
14633 .private_value = ARRAY_SIZE(alc861_threestack_modes),
14638 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
14639 /* output mixer control */
14640 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14641 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14642 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14647 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
14648 /* output mixer control */
14649 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14650 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14651 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14652 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14653 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
14655 /* Input mixer control */
14656 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14657 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14658 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14659 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14660 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14661 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14662 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14663 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14664 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14665 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14668 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14669 .name = "Channel Mode",
14670 .info = alc_ch_mode_info,
14671 .get = alc_ch_mode_get,
14672 .put = alc_ch_mode_put,
14673 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
14678 static struct snd_kcontrol_new alc861_asus_mixer[] = {
14679 /* output mixer control */
14680 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14681 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14682 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14683 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14684 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
14686 /* Input mixer control */
14687 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14688 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14689 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14690 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14691 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14692 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14693 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14694 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14695 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14696 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
14699 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14700 .name = "Channel Mode",
14701 .info = alc_ch_mode_info,
14702 .get = alc_ch_mode_get,
14703 .put = alc_ch_mode_put,
14704 .private_value = ARRAY_SIZE(alc861_asus_modes),
14709 /* additional mixer */
14710 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
14711 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14712 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14717 * generic initialization of ADC, input mixers and output mixers
14719 static struct hda_verb alc861_base_init_verbs[] = {
14721 * Unmute ADC0 and set the default input to mic-in
14723 /* port-A for surround (rear panel) */
14724 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14725 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
14726 /* port-B for mic-in (rear panel) with vref */
14727 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14728 /* port-C for line-in (rear panel) */
14729 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14730 /* port-D for Front */
14731 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14732 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14733 /* port-E for HP out (front panel) */
14734 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14735 /* route front PCM to HP */
14736 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14737 /* port-F for mic-in (front panel) with vref */
14738 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14739 /* port-G for CLFE (rear panel) */
14740 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14741 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14742 /* port-H for side (rear panel) */
14743 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14744 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
14746 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14747 /* route front mic to ADC1*/
14748 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14749 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14751 /* Unmute DAC0~3 & spdif out*/
14752 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14753 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14754 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14755 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14756 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14758 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14759 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14760 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14761 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14762 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14764 /* Unmute Stereo Mixer 15 */
14765 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14766 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14767 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14768 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14770 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14771 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14772 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14773 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14774 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14775 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14776 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14777 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14778 /* hp used DAC 3 (Front) */
14779 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14780 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14785 static struct hda_verb alc861_threestack_init_verbs[] = {
14787 * Unmute ADC0 and set the default input to mic-in
14789 /* port-A for surround (rear panel) */
14790 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14791 /* port-B for mic-in (rear panel) with vref */
14792 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14793 /* port-C for line-in (rear panel) */
14794 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14795 /* port-D for Front */
14796 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14797 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14798 /* port-E for HP out (front panel) */
14799 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14800 /* route front PCM to HP */
14801 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14802 /* port-F for mic-in (front panel) with vref */
14803 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14804 /* port-G for CLFE (rear panel) */
14805 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14806 /* port-H for side (rear panel) */
14807 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14809 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14810 /* route front mic to ADC1*/
14811 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14812 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14813 /* Unmute DAC0~3 & spdif out*/
14814 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14815 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14816 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14817 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14818 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14820 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14821 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14822 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14823 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14824 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14826 /* Unmute Stereo Mixer 15 */
14827 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14828 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14829 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14830 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14832 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14833 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14834 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14835 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14836 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14837 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14838 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14839 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14840 /* hp used DAC 3 (Front) */
14841 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14842 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14846 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
14848 * Unmute ADC0 and set the default input to mic-in
14850 /* port-A for surround (rear panel) */
14851 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14852 /* port-B for mic-in (rear panel) with vref */
14853 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14854 /* port-C for line-in (rear panel) */
14855 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14856 /* port-D for Front */
14857 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14858 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14859 /* port-E for HP out (front panel) */
14860 /* this has to be set to VREF80 */
14861 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14862 /* route front PCM to HP */
14863 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14864 /* port-F for mic-in (front panel) with vref */
14865 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14866 /* port-G for CLFE (rear panel) */
14867 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14868 /* port-H for side (rear panel) */
14869 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14871 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14872 /* route front mic to ADC1*/
14873 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14874 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14875 /* Unmute DAC0~3 & spdif out*/
14876 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14877 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14878 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14879 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14880 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14882 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14883 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14884 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14885 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14886 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14888 /* Unmute Stereo Mixer 15 */
14889 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14890 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14891 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14892 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14894 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14895 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14896 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14897 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14898 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14899 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14900 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14901 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14902 /* hp used DAC 3 (Front) */
14903 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14904 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14908 static struct hda_verb alc861_asus_init_verbs[] = {
14910 * Unmute ADC0 and set the default input to mic-in
14912 /* port-A for surround (rear panel)
14913 * according to codec#0 this is the HP jack
14915 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
14916 /* route front PCM to HP */
14917 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
14918 /* port-B for mic-in (rear panel) with vref */
14919 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14920 /* port-C for line-in (rear panel) */
14921 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14922 /* port-D for Front */
14923 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14924 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14925 /* port-E for HP out (front panel) */
14926 /* this has to be set to VREF80 */
14927 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14928 /* route front PCM to HP */
14929 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14930 /* port-F for mic-in (front panel) with vref */
14931 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14932 /* port-G for CLFE (rear panel) */
14933 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14934 /* port-H for side (rear panel) */
14935 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14937 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14938 /* route front mic to ADC1*/
14939 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14940 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14941 /* Unmute DAC0~3 & spdif out*/
14942 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14943 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14944 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14945 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14946 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14947 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14948 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14949 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14950 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14951 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14953 /* Unmute Stereo Mixer 15 */
14954 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14955 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14956 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14957 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14959 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14960 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14961 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14962 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14963 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14964 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14965 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14966 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14967 /* hp used DAC 3 (Front) */
14968 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14969 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14973 /* additional init verbs for ASUS laptops */
14974 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
14975 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
14976 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
14981 * generic initialization of ADC, input mixers and output mixers
14983 static struct hda_verb alc861_auto_init_verbs[] = {
14985 * Unmute ADC0 and set the default input to mic-in
14987 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
14988 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14990 /* Unmute DAC0~3 & spdif out*/
14991 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14992 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14993 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14994 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14995 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14997 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14998 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14999 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15000 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15001 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15003 /* Unmute Stereo Mixer 15 */
15004 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15005 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15006 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15007 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
15009 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15010 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15011 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15012 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15013 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15014 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15015 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15016 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15018 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15019 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15020 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15021 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15022 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15023 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15024 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15025 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15027 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
15032 static struct hda_verb alc861_toshiba_init_verbs[] = {
15033 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15038 /* toggle speaker-output according to the hp-jack state */
15039 static void alc861_toshiba_automute(struct hda_codec *codec)
15041 unsigned int present = snd_hda_jack_detect(codec, 0x0f);
15043 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
15044 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
15045 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
15046 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
15049 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
15052 if ((res >> 26) == ALC880_HP_EVENT)
15053 alc861_toshiba_automute(codec);
15056 /* pcm configuration: identical with ALC880 */
15057 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
15058 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
15059 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
15060 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
15063 #define ALC861_DIGOUT_NID 0x07
15065 static struct hda_channel_mode alc861_8ch_modes[1] = {
15069 static hda_nid_t alc861_dac_nids[4] = {
15070 /* front, surround, clfe, side */
15071 0x03, 0x06, 0x05, 0x04
15074 static hda_nid_t alc660_dac_nids[3] = {
15075 /* front, clfe, surround */
15079 static hda_nid_t alc861_adc_nids[1] = {
15084 static struct hda_input_mux alc861_capture_source = {
15088 { "Front Mic", 0x3 },
15095 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
15097 struct alc_spec *spec = codec->spec;
15098 hda_nid_t mix, srcs[5];
15101 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
15103 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
15106 for (i = 0; i < num; i++) {
15108 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
15109 if (type != AC_WID_AUD_OUT)
15111 for (j = 0; j < spec->multiout.num_dacs; j++)
15112 if (spec->multiout.dac_nids[j] == srcs[i])
15114 if (j >= spec->multiout.num_dacs)
15120 /* fill in the dac_nids table from the parsed pin configuration */
15121 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
15122 const struct auto_pin_cfg *cfg)
15124 struct alc_spec *spec = codec->spec;
15126 hda_nid_t nid, dac;
15128 spec->multiout.dac_nids = spec->private_dac_nids;
15129 for (i = 0; i < cfg->line_outs; i++) {
15130 nid = cfg->line_out_pins[i];
15131 dac = alc861_look_for_dac(codec, nid);
15134 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
15139 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
15140 hda_nid_t nid, unsigned int chs)
15142 return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx,
15143 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
15146 /* add playback controls from the parsed DAC table */
15147 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
15148 const struct auto_pin_cfg *cfg)
15150 struct alc_spec *spec = codec->spec;
15151 static const char *chname[4] = {
15152 "Front", "Surround", NULL /*CLFE*/, "Side"
15157 if (cfg->line_outs == 1) {
15158 const char *pfx = NULL;
15161 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
15164 nid = spec->multiout.dac_nids[0];
15165 return alc861_create_out_sw(codec, pfx, nid, 3);
15169 for (i = 0; i < cfg->line_outs; i++) {
15170 nid = spec->multiout.dac_nids[i];
15175 err = alc861_create_out_sw(codec, "Center", nid, 1);
15178 err = alc861_create_out_sw(codec, "LFE", nid, 2);
15182 err = alc861_create_out_sw(codec, chname[i], nid, 3);
15190 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
15192 struct alc_spec *spec = codec->spec;
15199 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
15200 nid = alc861_look_for_dac(codec, pin);
15202 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
15205 spec->multiout.hp_nid = nid;
15211 /* create playback/capture controls for input pins */
15212 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
15213 const struct auto_pin_cfg *cfg)
15215 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
15218 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
15220 int pin_type, hda_nid_t dac)
15222 hda_nid_t mix, srcs[5];
15225 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
15227 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15229 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
15231 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
15234 for (i = 0; i < num; i++) {
15236 if (srcs[i] == dac || srcs[i] == 0x15)
15237 mute = AMP_IN_UNMUTE(i);
15239 mute = AMP_IN_MUTE(i);
15240 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15245 static void alc861_auto_init_multi_out(struct hda_codec *codec)
15247 struct alc_spec *spec = codec->spec;
15250 for (i = 0; i < spec->autocfg.line_outs; i++) {
15251 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15252 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15254 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
15255 spec->multiout.dac_nids[i]);
15259 static void alc861_auto_init_hp_out(struct hda_codec *codec)
15261 struct alc_spec *spec = codec->spec;
15263 if (spec->autocfg.hp_outs)
15264 alc861_auto_set_output_and_unmute(codec,
15265 spec->autocfg.hp_pins[0],
15267 spec->multiout.hp_nid);
15268 if (spec->autocfg.speaker_outs)
15269 alc861_auto_set_output_and_unmute(codec,
15270 spec->autocfg.speaker_pins[0],
15272 spec->multiout.dac_nids[0]);
15275 static void alc861_auto_init_analog_input(struct hda_codec *codec)
15277 struct alc_spec *spec = codec->spec;
15280 for (i = 0; i < AUTO_PIN_LAST; i++) {
15281 hda_nid_t nid = spec->autocfg.input_pins[i];
15282 if (nid >= 0x0c && nid <= 0x11)
15283 alc_set_input_pin(codec, nid, i);
15287 /* parse the BIOS configuration and set up the alc_spec */
15288 /* return 1 if successful, 0 if the proper config is not found,
15289 * or a negative error code
15291 static int alc861_parse_auto_config(struct hda_codec *codec)
15293 struct alc_spec *spec = codec->spec;
15295 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
15297 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15301 if (!spec->autocfg.line_outs)
15302 return 0; /* can't find valid BIOS pin config */
15304 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
15307 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
15310 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
15313 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
15317 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15319 if (spec->autocfg.dig_outs)
15320 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
15322 if (spec->kctls.list)
15323 add_mixer(spec, spec->kctls.list);
15325 add_verb(spec, alc861_auto_init_verbs);
15327 spec->num_mux_defs = 1;
15328 spec->input_mux = &spec->private_imux[0];
15330 spec->adc_nids = alc861_adc_nids;
15331 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
15332 set_capture_mixer(codec);
15334 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0);
15339 /* additional initialization for auto-configuration model */
15340 static void alc861_auto_init(struct hda_codec *codec)
15342 struct alc_spec *spec = codec->spec;
15343 alc861_auto_init_multi_out(codec);
15344 alc861_auto_init_hp_out(codec);
15345 alc861_auto_init_analog_input(codec);
15346 if (spec->unsol_event)
15347 alc_inithook(codec);
15350 #ifdef CONFIG_SND_HDA_POWER_SAVE
15351 static struct hda_amp_list alc861_loopbacks[] = {
15352 { 0x15, HDA_INPUT, 0 },
15353 { 0x15, HDA_INPUT, 1 },
15354 { 0x15, HDA_INPUT, 2 },
15355 { 0x15, HDA_INPUT, 3 },
15362 * configuration and preset
15364 static const char *alc861_models[ALC861_MODEL_LAST] = {
15365 [ALC861_3ST] = "3stack",
15366 [ALC660_3ST] = "3stack-660",
15367 [ALC861_3ST_DIG] = "3stack-dig",
15368 [ALC861_6ST_DIG] = "6stack-dig",
15369 [ALC861_UNIWILL_M31] = "uniwill-m31",
15370 [ALC861_TOSHIBA] = "toshiba",
15371 [ALC861_ASUS] = "asus",
15372 [ALC861_ASUS_LAPTOP] = "asus-laptop",
15373 [ALC861_AUTO] = "auto",
15376 static struct snd_pci_quirk alc861_cfg_tbl[] = {
15377 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
15378 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
15379 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
15380 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
15381 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
15382 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
15383 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
15384 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
15385 * Any other models that need this preset?
15387 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
15388 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
15389 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
15390 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
15391 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
15392 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
15393 /* FIXME: the below seems conflict */
15394 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
15395 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
15396 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
15400 static struct alc_config_preset alc861_presets[] = {
15402 .mixers = { alc861_3ST_mixer },
15403 .init_verbs = { alc861_threestack_init_verbs },
15404 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15405 .dac_nids = alc861_dac_nids,
15406 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15407 .channel_mode = alc861_threestack_modes,
15409 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15410 .adc_nids = alc861_adc_nids,
15411 .input_mux = &alc861_capture_source,
15413 [ALC861_3ST_DIG] = {
15414 .mixers = { alc861_base_mixer },
15415 .init_verbs = { alc861_threestack_init_verbs },
15416 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15417 .dac_nids = alc861_dac_nids,
15418 .dig_out_nid = ALC861_DIGOUT_NID,
15419 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15420 .channel_mode = alc861_threestack_modes,
15422 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15423 .adc_nids = alc861_adc_nids,
15424 .input_mux = &alc861_capture_source,
15426 [ALC861_6ST_DIG] = {
15427 .mixers = { alc861_base_mixer },
15428 .init_verbs = { alc861_base_init_verbs },
15429 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15430 .dac_nids = alc861_dac_nids,
15431 .dig_out_nid = ALC861_DIGOUT_NID,
15432 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
15433 .channel_mode = alc861_8ch_modes,
15434 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15435 .adc_nids = alc861_adc_nids,
15436 .input_mux = &alc861_capture_source,
15439 .mixers = { alc861_3ST_mixer },
15440 .init_verbs = { alc861_threestack_init_verbs },
15441 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
15442 .dac_nids = alc660_dac_nids,
15443 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15444 .channel_mode = alc861_threestack_modes,
15446 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15447 .adc_nids = alc861_adc_nids,
15448 .input_mux = &alc861_capture_source,
15450 [ALC861_UNIWILL_M31] = {
15451 .mixers = { alc861_uniwill_m31_mixer },
15452 .init_verbs = { alc861_uniwill_m31_init_verbs },
15453 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15454 .dac_nids = alc861_dac_nids,
15455 .dig_out_nid = ALC861_DIGOUT_NID,
15456 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
15457 .channel_mode = alc861_uniwill_m31_modes,
15459 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15460 .adc_nids = alc861_adc_nids,
15461 .input_mux = &alc861_capture_source,
15463 [ALC861_TOSHIBA] = {
15464 .mixers = { alc861_toshiba_mixer },
15465 .init_verbs = { alc861_base_init_verbs,
15466 alc861_toshiba_init_verbs },
15467 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15468 .dac_nids = alc861_dac_nids,
15469 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
15470 .channel_mode = alc883_3ST_2ch_modes,
15471 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15472 .adc_nids = alc861_adc_nids,
15473 .input_mux = &alc861_capture_source,
15474 .unsol_event = alc861_toshiba_unsol_event,
15475 .init_hook = alc861_toshiba_automute,
15478 .mixers = { alc861_asus_mixer },
15479 .init_verbs = { alc861_asus_init_verbs },
15480 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15481 .dac_nids = alc861_dac_nids,
15482 .dig_out_nid = ALC861_DIGOUT_NID,
15483 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
15484 .channel_mode = alc861_asus_modes,
15487 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15488 .adc_nids = alc861_adc_nids,
15489 .input_mux = &alc861_capture_source,
15491 [ALC861_ASUS_LAPTOP] = {
15492 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
15493 .init_verbs = { alc861_asus_init_verbs,
15494 alc861_asus_laptop_init_verbs },
15495 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15496 .dac_nids = alc861_dac_nids,
15497 .dig_out_nid = ALC861_DIGOUT_NID,
15498 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
15499 .channel_mode = alc883_3ST_2ch_modes,
15501 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15502 .adc_nids = alc861_adc_nids,
15503 .input_mux = &alc861_capture_source,
15507 /* Pin config fixes */
15509 PINFIX_FSC_AMILO_PI1505,
15512 static struct alc_pincfg alc861_fsc_amilo_pi1505_pinfix[] = {
15513 { 0x0b, 0x0221101f }, /* HP */
15514 { 0x0f, 0x90170310 }, /* speaker */
15518 static const struct alc_fixup alc861_fixups[] = {
15519 [PINFIX_FSC_AMILO_PI1505] = {
15520 .pins = alc861_fsc_amilo_pi1505_pinfix
15524 static struct snd_pci_quirk alc861_fixup_tbl[] = {
15525 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
15529 static int patch_alc861(struct hda_codec *codec)
15531 struct alc_spec *spec;
15535 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15539 codec->spec = spec;
15541 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
15545 if (board_config < 0) {
15546 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15548 board_config = ALC861_AUTO;
15551 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups);
15553 if (board_config == ALC861_AUTO) {
15554 /* automatic parse from the BIOS config */
15555 err = alc861_parse_auto_config(codec);
15561 "hda_codec: Cannot set up configuration "
15562 "from BIOS. Using base mode...\n");
15563 board_config = ALC861_3ST_DIG;
15567 err = snd_hda_attach_beep_device(codec, 0x23);
15573 if (board_config != ALC861_AUTO)
15574 setup_preset(codec, &alc861_presets[board_config]);
15576 spec->stream_analog_playback = &alc861_pcm_analog_playback;
15577 spec->stream_analog_capture = &alc861_pcm_analog_capture;
15579 spec->stream_digital_playback = &alc861_pcm_digital_playback;
15580 spec->stream_digital_capture = &alc861_pcm_digital_capture;
15582 if (!spec->cap_mixer)
15583 set_capture_mixer(codec);
15584 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
15586 spec->vmaster_nid = 0x03;
15588 codec->patch_ops = alc_patch_ops;
15589 if (board_config == ALC861_AUTO) {
15590 spec->init_hook = alc861_auto_init;
15591 #ifdef CONFIG_SND_HDA_POWER_SAVE
15592 spec->power_hook = alc_power_eapd;
15595 #ifdef CONFIG_SND_HDA_POWER_SAVE
15596 if (!spec->loopback.amplist)
15597 spec->loopback.amplist = alc861_loopbacks;
15604 * ALC861-VD support
15608 * In addition, an independent DAC
15610 #define ALC861VD_DIGOUT_NID 0x06
15612 static hda_nid_t alc861vd_dac_nids[4] = {
15613 /* front, surr, clfe, side surr */
15614 0x02, 0x03, 0x04, 0x05
15617 /* dac_nids for ALC660vd are in a different order - according to
15618 * Realtek's driver.
15619 * This should probably result in a different mixer for 6stack models
15620 * of ALC660vd codecs, but for now there is only 3stack mixer
15621 * - and it is the same as in 861vd.
15622 * adc_nids in ALC660vd are (is) the same as in 861vd
15624 static hda_nid_t alc660vd_dac_nids[3] = {
15625 /* front, rear, clfe, rear_surr */
15629 static hda_nid_t alc861vd_adc_nids[1] = {
15634 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
15637 /* FIXME: should be a matrix-type input source selection */
15638 static struct hda_input_mux alc861vd_capture_source = {
15642 { "Front Mic", 0x1 },
15648 static struct hda_input_mux alc861vd_dallas_capture_source = {
15651 { "Ext Mic", 0x0 },
15652 { "Int Mic", 0x1 },
15656 static struct hda_input_mux alc861vd_hp_capture_source = {
15659 { "Front Mic", 0x0 },
15660 { "ATAPI Mic", 0x1 },
15667 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
15674 static struct hda_verb alc861vd_6stack_ch6_init[] = {
15675 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15676 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15677 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15678 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15685 static struct hda_verb alc861vd_6stack_ch8_init[] = {
15686 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15687 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15688 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15689 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15693 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
15694 { 6, alc861vd_6stack_ch6_init },
15695 { 8, alc861vd_6stack_ch8_init },
15698 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
15700 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15701 .name = "Channel Mode",
15702 .info = alc_ch_mode_info,
15703 .get = alc_ch_mode_get,
15704 .put = alc_ch_mode_put,
15709 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15710 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15712 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
15713 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15714 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15716 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15717 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
15719 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
15721 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
15723 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
15724 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
15726 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
15727 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
15729 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15731 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15732 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15733 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15735 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15736 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15737 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15739 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15740 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15742 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15743 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15748 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
15749 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15750 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15752 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15754 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15755 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15756 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15758 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15759 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15760 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15762 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15763 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15765 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15766 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15771 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
15772 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15773 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
15774 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15776 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15778 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15779 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15780 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15782 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15783 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15784 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15786 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15787 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15792 /* Pin assignment: Speaker=0x14, HP = 0x15,
15793 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
15795 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
15796 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15797 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
15798 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15799 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15800 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
15801 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15802 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15803 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
15804 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15805 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15809 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
15810 * Front Mic=0x18, ATAPI Mic = 0x19,
15812 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
15813 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15814 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15815 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15816 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15817 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15818 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15819 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15820 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15826 * generic initialization of ADC, input mixers and output mixers
15828 static struct hda_verb alc861vd_volume_init_verbs[] = {
15830 * Unmute ADC0 and set the default input to mic-in
15832 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15833 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15835 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
15836 * the analog-loopback mixer widget
15838 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15839 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15840 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15841 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15842 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15843 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15845 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
15846 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15847 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15848 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15849 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15852 * Set up output mixers (0x02 - 0x05)
15854 /* set vol=0 to output mixers */
15855 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15856 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15857 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15858 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15860 /* set up input amps for analog loopback */
15861 /* Amp Indices: DAC = 0, mixer = 1 */
15862 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15863 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15864 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15865 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15866 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15867 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15868 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15869 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15875 * 3-stack pin configuration:
15876 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
15878 static struct hda_verb alc861vd_3stack_init_verbs[] = {
15880 * Set pin mode and muting
15882 /* set front pin widgets 0x14 for output */
15883 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15884 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15885 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15887 /* Mic (rear) pin: input vref at 80% */
15888 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15889 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15890 /* Front Mic pin: input vref at 80% */
15891 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15892 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15893 /* Line In pin: input */
15894 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15895 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15896 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15897 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15898 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15899 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15900 /* CD pin widget for input */
15901 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15907 * 6-stack pin configuration:
15909 static struct hda_verb alc861vd_6stack_init_verbs[] = {
15911 * Set pin mode and muting
15913 /* set front pin widgets 0x14 for output */
15914 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15915 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15916 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15918 /* Rear Pin: output 1 (0x0d) */
15919 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15920 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15921 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
15922 /* CLFE Pin: output 2 (0x0e) */
15923 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15924 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15925 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
15926 /* Side Pin: output 3 (0x0f) */
15927 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15928 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15929 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
15931 /* Mic (rear) pin: input vref at 80% */
15932 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15933 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15934 /* Front Mic pin: input vref at 80% */
15935 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15936 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15937 /* Line In pin: input */
15938 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15939 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15940 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15941 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15942 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15943 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15944 /* CD pin widget for input */
15945 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15950 static struct hda_verb alc861vd_eapd_verbs[] = {
15951 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15955 static struct hda_verb alc660vd_eapd_verbs[] = {
15956 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15957 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15961 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
15962 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15963 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15964 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
15965 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15966 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15970 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
15972 unsigned int present;
15973 unsigned char bits;
15975 present = snd_hda_jack_detect(codec, 0x18);
15976 bits = present ? HDA_AMP_MUTE : 0;
15978 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
15979 HDA_AMP_MUTE, bits);
15982 static void alc861vd_lenovo_setup(struct hda_codec *codec)
15984 struct alc_spec *spec = codec->spec;
15985 spec->autocfg.hp_pins[0] = 0x1b;
15986 spec->autocfg.speaker_pins[0] = 0x14;
15989 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
15991 alc_automute_amp(codec);
15992 alc861vd_lenovo_mic_automute(codec);
15995 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
15998 switch (res >> 26) {
15999 case ALC880_MIC_EVENT:
16000 alc861vd_lenovo_mic_automute(codec);
16003 alc_automute_amp_unsol_event(codec, res);
16008 static struct hda_verb alc861vd_dallas_verbs[] = {
16009 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16010 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16011 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16012 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16014 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16015 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16016 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16017 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16018 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16019 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16020 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16021 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16023 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16024 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16025 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16026 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16027 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16028 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16029 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16030 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16032 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
16033 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16034 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
16035 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16036 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16037 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16038 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16039 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16041 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16042 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16043 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16044 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16046 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16047 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16048 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16053 /* toggle speaker-output according to the hp-jack state */
16054 static void alc861vd_dallas_setup(struct hda_codec *codec)
16056 struct alc_spec *spec = codec->spec;
16058 spec->autocfg.hp_pins[0] = 0x15;
16059 spec->autocfg.speaker_pins[0] = 0x14;
16062 #ifdef CONFIG_SND_HDA_POWER_SAVE
16063 #define alc861vd_loopbacks alc880_loopbacks
16066 /* pcm configuration: identical with ALC880 */
16067 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
16068 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
16069 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
16070 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
16073 * configuration and preset
16075 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
16076 [ALC660VD_3ST] = "3stack-660",
16077 [ALC660VD_3ST_DIG] = "3stack-660-digout",
16078 [ALC660VD_ASUS_V1S] = "asus-v1s",
16079 [ALC861VD_3ST] = "3stack",
16080 [ALC861VD_3ST_DIG] = "3stack-digout",
16081 [ALC861VD_6ST_DIG] = "6stack-digout",
16082 [ALC861VD_LENOVO] = "lenovo",
16083 [ALC861VD_DALLAS] = "dallas",
16084 [ALC861VD_HP] = "hp",
16085 [ALC861VD_AUTO] = "auto",
16088 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
16089 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
16090 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
16091 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
16092 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
16093 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
16094 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
16095 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
16096 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
16097 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
16098 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
16099 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
16100 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
16101 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
16102 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
16103 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
16107 static struct alc_config_preset alc861vd_presets[] = {
16109 .mixers = { alc861vd_3st_mixer },
16110 .init_verbs = { alc861vd_volume_init_verbs,
16111 alc861vd_3stack_init_verbs },
16112 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16113 .dac_nids = alc660vd_dac_nids,
16114 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16115 .channel_mode = alc861vd_3stack_2ch_modes,
16116 .input_mux = &alc861vd_capture_source,
16118 [ALC660VD_3ST_DIG] = {
16119 .mixers = { alc861vd_3st_mixer },
16120 .init_verbs = { alc861vd_volume_init_verbs,
16121 alc861vd_3stack_init_verbs },
16122 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16123 .dac_nids = alc660vd_dac_nids,
16124 .dig_out_nid = ALC861VD_DIGOUT_NID,
16125 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16126 .channel_mode = alc861vd_3stack_2ch_modes,
16127 .input_mux = &alc861vd_capture_source,
16130 .mixers = { alc861vd_3st_mixer },
16131 .init_verbs = { alc861vd_volume_init_verbs,
16132 alc861vd_3stack_init_verbs },
16133 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16134 .dac_nids = alc861vd_dac_nids,
16135 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16136 .channel_mode = alc861vd_3stack_2ch_modes,
16137 .input_mux = &alc861vd_capture_source,
16139 [ALC861VD_3ST_DIG] = {
16140 .mixers = { alc861vd_3st_mixer },
16141 .init_verbs = { alc861vd_volume_init_verbs,
16142 alc861vd_3stack_init_verbs },
16143 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16144 .dac_nids = alc861vd_dac_nids,
16145 .dig_out_nid = ALC861VD_DIGOUT_NID,
16146 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16147 .channel_mode = alc861vd_3stack_2ch_modes,
16148 .input_mux = &alc861vd_capture_source,
16150 [ALC861VD_6ST_DIG] = {
16151 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
16152 .init_verbs = { alc861vd_volume_init_verbs,
16153 alc861vd_6stack_init_verbs },
16154 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16155 .dac_nids = alc861vd_dac_nids,
16156 .dig_out_nid = ALC861VD_DIGOUT_NID,
16157 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
16158 .channel_mode = alc861vd_6stack_modes,
16159 .input_mux = &alc861vd_capture_source,
16161 [ALC861VD_LENOVO] = {
16162 .mixers = { alc861vd_lenovo_mixer },
16163 .init_verbs = { alc861vd_volume_init_verbs,
16164 alc861vd_3stack_init_verbs,
16165 alc861vd_eapd_verbs,
16166 alc861vd_lenovo_unsol_verbs },
16167 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16168 .dac_nids = alc660vd_dac_nids,
16169 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16170 .channel_mode = alc861vd_3stack_2ch_modes,
16171 .input_mux = &alc861vd_capture_source,
16172 .unsol_event = alc861vd_lenovo_unsol_event,
16173 .setup = alc861vd_lenovo_setup,
16174 .init_hook = alc861vd_lenovo_init_hook,
16176 [ALC861VD_DALLAS] = {
16177 .mixers = { alc861vd_dallas_mixer },
16178 .init_verbs = { alc861vd_dallas_verbs },
16179 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16180 .dac_nids = alc861vd_dac_nids,
16181 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16182 .channel_mode = alc861vd_3stack_2ch_modes,
16183 .input_mux = &alc861vd_dallas_capture_source,
16184 .unsol_event = alc_automute_amp_unsol_event,
16185 .setup = alc861vd_dallas_setup,
16186 .init_hook = alc_automute_amp,
16189 .mixers = { alc861vd_hp_mixer },
16190 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
16191 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16192 .dac_nids = alc861vd_dac_nids,
16193 .dig_out_nid = ALC861VD_DIGOUT_NID,
16194 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16195 .channel_mode = alc861vd_3stack_2ch_modes,
16196 .input_mux = &alc861vd_hp_capture_source,
16197 .unsol_event = alc_automute_amp_unsol_event,
16198 .setup = alc861vd_dallas_setup,
16199 .init_hook = alc_automute_amp,
16201 [ALC660VD_ASUS_V1S] = {
16202 .mixers = { alc861vd_lenovo_mixer },
16203 .init_verbs = { alc861vd_volume_init_verbs,
16204 alc861vd_3stack_init_verbs,
16205 alc861vd_eapd_verbs,
16206 alc861vd_lenovo_unsol_verbs },
16207 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16208 .dac_nids = alc660vd_dac_nids,
16209 .dig_out_nid = ALC861VD_DIGOUT_NID,
16210 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16211 .channel_mode = alc861vd_3stack_2ch_modes,
16212 .input_mux = &alc861vd_capture_source,
16213 .unsol_event = alc861vd_lenovo_unsol_event,
16214 .setup = alc861vd_lenovo_setup,
16215 .init_hook = alc861vd_lenovo_init_hook,
16220 * BIOS auto configuration
16222 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
16223 const struct auto_pin_cfg *cfg)
16225 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0);
16229 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
16230 hda_nid_t nid, int pin_type, int dac_idx)
16232 alc_set_pin_output(codec, nid, pin_type);
16235 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
16237 struct alc_spec *spec = codec->spec;
16240 for (i = 0; i <= HDA_SIDE; i++) {
16241 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16242 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16244 alc861vd_auto_set_output_and_unmute(codec, nid,
16250 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
16252 struct alc_spec *spec = codec->spec;
16255 pin = spec->autocfg.hp_pins[0];
16256 if (pin) /* connect to front and use dac 0 */
16257 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
16258 pin = spec->autocfg.speaker_pins[0];
16260 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
16263 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
16265 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
16267 struct alc_spec *spec = codec->spec;
16270 for (i = 0; i < AUTO_PIN_LAST; i++) {
16271 hda_nid_t nid = spec->autocfg.input_pins[i];
16272 if (alc_is_input_pin(codec, nid)) {
16273 alc_set_input_pin(codec, nid, i);
16274 if (nid != ALC861VD_PIN_CD_NID &&
16275 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
16276 snd_hda_codec_write(codec, nid, 0,
16277 AC_VERB_SET_AMP_GAIN_MUTE,
16283 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
16285 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
16286 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
16288 /* add playback controls from the parsed DAC table */
16289 /* Based on ALC880 version. But ALC861VD has separate,
16290 * different NIDs for mute/unmute switch and volume control */
16291 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
16292 const struct auto_pin_cfg *cfg)
16294 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
16295 hda_nid_t nid_v, nid_s;
16298 for (i = 0; i < cfg->line_outs; i++) {
16299 if (!spec->multiout.dac_nids[i])
16301 nid_v = alc861vd_idx_to_mixer_vol(
16303 spec->multiout.dac_nids[i]));
16304 nid_s = alc861vd_idx_to_mixer_switch(
16306 spec->multiout.dac_nids[i]));
16310 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
16312 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
16316 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
16318 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
16322 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
16324 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
16328 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
16330 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
16336 if (cfg->line_outs == 1 &&
16337 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
16344 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
16345 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
16349 if (cfg->line_outs == 1 &&
16350 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
16352 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
16353 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
16362 /* add playback controls for speaker and HP outputs */
16363 /* Based on ALC880 version. But ALC861VD has separate,
16364 * different NIDs for mute/unmute switch and volume control */
16365 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
16366 hda_nid_t pin, const char *pfx)
16368 hda_nid_t nid_v, nid_s;
16374 if (alc880_is_fixed_pin(pin)) {
16375 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16376 /* specify the DAC as the extra output */
16377 if (!spec->multiout.hp_nid)
16378 spec->multiout.hp_nid = nid_v;
16380 spec->multiout.extra_out_nid[0] = nid_v;
16381 /* control HP volume/switch on the output mixer amp */
16382 nid_v = alc861vd_idx_to_mixer_vol(
16383 alc880_fixed_pin_idx(pin));
16384 nid_s = alc861vd_idx_to_mixer_switch(
16385 alc880_fixed_pin_idx(pin));
16387 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
16388 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
16391 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
16392 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
16395 } else if (alc880_is_multi_pin(pin)) {
16396 /* set manual connection */
16397 /* we have only a switch on HP-out PIN */
16398 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
16399 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
16406 /* parse the BIOS configuration and set up the alc_spec
16407 * return 1 if successful, 0 if the proper config is not found,
16408 * or a negative error code
16409 * Based on ALC880 version - had to change it to override
16410 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
16411 static int alc861vd_parse_auto_config(struct hda_codec *codec)
16413 struct alc_spec *spec = codec->spec;
16415 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
16417 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16421 if (!spec->autocfg.line_outs)
16422 return 0; /* can't find valid BIOS pin config */
16424 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
16427 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
16430 err = alc861vd_auto_create_extra_out(spec,
16431 spec->autocfg.speaker_pins[0],
16435 err = alc861vd_auto_create_extra_out(spec,
16436 spec->autocfg.hp_pins[0],
16440 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
16444 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16446 if (spec->autocfg.dig_outs)
16447 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
16449 if (spec->kctls.list)
16450 add_mixer(spec, spec->kctls.list);
16452 add_verb(spec, alc861vd_volume_init_verbs);
16454 spec->num_mux_defs = 1;
16455 spec->input_mux = &spec->private_imux[0];
16457 err = alc_auto_add_mic_boost(codec);
16461 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
16466 /* additional initialization for auto-configuration model */
16467 static void alc861vd_auto_init(struct hda_codec *codec)
16469 struct alc_spec *spec = codec->spec;
16470 alc861vd_auto_init_multi_out(codec);
16471 alc861vd_auto_init_hp_out(codec);
16472 alc861vd_auto_init_analog_input(codec);
16473 alc861vd_auto_init_input_src(codec);
16474 if (spec->unsol_event)
16475 alc_inithook(codec);
16479 ALC660VD_FIX_ASUS_GPIO1
16483 static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = {
16484 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
16485 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
16486 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
16490 static const struct alc_fixup alc861vd_fixups[] = {
16491 [ALC660VD_FIX_ASUS_GPIO1] = {
16492 .verbs = alc660vd_fix_asus_gpio1_verbs,
16496 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
16497 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
16501 static int patch_alc861vd(struct hda_codec *codec)
16503 struct alc_spec *spec;
16504 int err, board_config;
16506 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16510 codec->spec = spec;
16512 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
16516 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
16517 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
16519 board_config = ALC861VD_AUTO;
16522 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups);
16524 if (board_config == ALC861VD_AUTO) {
16525 /* automatic parse from the BIOS config */
16526 err = alc861vd_parse_auto_config(codec);
16532 "hda_codec: Cannot set up configuration "
16533 "from BIOS. Using base mode...\n");
16534 board_config = ALC861VD_3ST;
16538 err = snd_hda_attach_beep_device(codec, 0x23);
16544 if (board_config != ALC861VD_AUTO)
16545 setup_preset(codec, &alc861vd_presets[board_config]);
16547 if (codec->vendor_id == 0x10ec0660) {
16548 /* always turn on EAPD */
16549 add_verb(spec, alc660vd_eapd_verbs);
16552 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
16553 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
16555 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
16556 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
16558 if (!spec->adc_nids) {
16559 spec->adc_nids = alc861vd_adc_nids;
16560 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
16562 if (!spec->capsrc_nids)
16563 spec->capsrc_nids = alc861vd_capsrc_nids;
16565 set_capture_mixer(codec);
16566 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
16568 spec->vmaster_nid = 0x02;
16570 codec->patch_ops = alc_patch_ops;
16572 if (board_config == ALC861VD_AUTO)
16573 spec->init_hook = alc861vd_auto_init;
16574 #ifdef CONFIG_SND_HDA_POWER_SAVE
16575 if (!spec->loopback.amplist)
16576 spec->loopback.amplist = alc861vd_loopbacks;
16585 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
16586 * configuration. Each pin widget can choose any input DACs and a mixer.
16587 * Each ADC is connected from a mixer of all inputs. This makes possible
16588 * 6-channel independent captures.
16590 * In addition, an independent DAC for the multi-playback (not used in this
16593 #define ALC662_DIGOUT_NID 0x06
16594 #define ALC662_DIGIN_NID 0x0a
16596 static hda_nid_t alc662_dac_nids[4] = {
16597 /* front, rear, clfe, rear_surr */
16601 static hda_nid_t alc272_dac_nids[2] = {
16605 static hda_nid_t alc662_adc_nids[2] = {
16610 static hda_nid_t alc272_adc_nids[1] = {
16615 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
16616 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
16620 /* FIXME: should be a matrix-type input source selection */
16621 static struct hda_input_mux alc662_capture_source = {
16625 { "Front Mic", 0x1 },
16631 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
16639 static struct hda_input_mux alc663_capture_source = {
16643 { "Front Mic", 0x1 },
16648 #if 0 /* set to 1 for testing other input sources below */
16649 static struct hda_input_mux alc272_nc10_capture_source = {
16652 { "Autoselect Mic", 0x0 },
16653 { "Internal Mic", 0x1 },
16654 { "In-0x02", 0x2 },
16655 { "In-0x03", 0x3 },
16656 { "In-0x04", 0x4 },
16657 { "In-0x05", 0x5 },
16658 { "In-0x06", 0x6 },
16659 { "In-0x07", 0x7 },
16660 { "In-0x08", 0x8 },
16661 { "In-0x09", 0x9 },
16662 { "In-0x0a", 0x0a },
16663 { "In-0x0b", 0x0b },
16664 { "In-0x0c", 0x0c },
16665 { "In-0x0d", 0x0d },
16666 { "In-0x0e", 0x0e },
16667 { "In-0x0f", 0x0f },
16675 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
16682 static struct hda_verb alc662_3ST_ch2_init[] = {
16683 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
16684 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
16685 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
16686 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
16693 static struct hda_verb alc662_3ST_ch6_init[] = {
16694 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16695 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
16696 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
16697 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16698 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
16699 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
16703 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
16704 { 2, alc662_3ST_ch2_init },
16705 { 6, alc662_3ST_ch6_init },
16711 static struct hda_verb alc662_sixstack_ch6_init[] = {
16712 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16713 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16714 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16721 static struct hda_verb alc662_sixstack_ch8_init[] = {
16722 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16723 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16724 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16728 static struct hda_channel_mode alc662_5stack_modes[2] = {
16729 { 2, alc662_sixstack_ch6_init },
16730 { 6, alc662_sixstack_ch8_init },
16733 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16734 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16737 static struct snd_kcontrol_new alc662_base_mixer[] = {
16738 /* output mixer control */
16739 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
16740 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16741 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
16742 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16743 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16744 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16745 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16746 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16747 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16749 /*Input mixer control */
16750 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
16751 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
16752 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
16753 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
16754 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
16755 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
16756 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
16757 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
16761 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
16762 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16763 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16764 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16765 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16766 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16767 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16768 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16769 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16770 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16771 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16772 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16776 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
16777 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16778 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16779 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16780 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16781 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16782 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16783 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16784 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16785 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16786 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16787 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16788 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16789 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16790 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16791 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16792 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16793 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16797 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
16798 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16799 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
16800 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16801 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
16802 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16803 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16804 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16805 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16806 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16810 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
16811 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16812 ALC262_HIPPO_MASTER_SWITCH,
16814 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
16815 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16816 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16818 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16819 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16820 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16824 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
16825 ALC262_HIPPO_MASTER_SWITCH,
16826 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16827 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16828 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16829 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16830 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
16831 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16832 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16833 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16834 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16838 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
16839 .ops = &snd_hda_bind_vol,
16841 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16842 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
16847 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
16848 .ops = &snd_hda_bind_sw,
16850 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16851 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16856 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
16857 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16858 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
16859 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16860 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16864 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
16865 .ops = &snd_hda_bind_sw,
16867 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16868 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16869 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16874 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
16875 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16876 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
16877 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16878 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16879 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16880 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16885 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
16886 .ops = &snd_hda_bind_sw,
16888 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16889 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16890 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16895 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
16896 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16897 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
16898 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16899 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16900 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16901 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16905 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
16906 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16907 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16908 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16909 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16910 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16911 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16912 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16916 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
16917 .ops = &snd_hda_bind_vol,
16919 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16920 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
16925 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
16926 .ops = &snd_hda_bind_sw,
16928 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16929 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
16934 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
16935 HDA_BIND_VOL("Master Playback Volume",
16936 &alc663_asus_two_bind_master_vol),
16937 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16938 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16939 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16940 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16941 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16945 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
16946 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16947 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16948 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16949 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16950 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16951 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16955 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
16956 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16957 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16958 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16959 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16960 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16962 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16963 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16964 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16965 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16969 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
16970 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16971 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16972 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16974 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16975 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16976 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16977 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16978 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16979 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16983 static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
16984 .ops = &snd_hda_bind_sw,
16986 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16987 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16988 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16989 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16990 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16995 static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
16996 .ops = &snd_hda_bind_sw,
16998 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16999 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
17004 static struct snd_kcontrol_new alc663_mode7_mixer[] = {
17005 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17006 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17007 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
17008 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17009 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17010 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17011 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17012 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17013 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17017 static struct snd_kcontrol_new alc663_mode8_mixer[] = {
17018 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17019 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17020 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
17021 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17022 HDA_CODEC_MUTE("Headphone2 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),
17029 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
17031 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
17032 .name = "Channel Mode",
17033 .info = alc_ch_mode_info,
17034 .get = alc_ch_mode_get,
17035 .put = alc_ch_mode_put,
17040 static struct hda_verb alc662_init_verbs[] = {
17041 /* ADC: mute amp left and right */
17042 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17043 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
17045 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17046 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17047 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17048 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17049 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17050 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17052 /* Front Pin: output 0 (0x0c) */
17053 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17054 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17056 /* Rear Pin: output 1 (0x0d) */
17057 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17058 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17060 /* CLFE Pin: output 2 (0x0e) */
17061 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17062 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17064 /* Mic (rear) pin: input vref at 80% */
17065 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
17066 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17067 /* Front Mic pin: input vref at 80% */
17068 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
17069 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17070 /* Line In pin: input */
17071 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17072 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17073 /* Line-2 In: Headphone output (output 0 - 0x0c) */
17074 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17075 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17076 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
17077 /* CD pin widget for input */
17078 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17080 /* FIXME: use matrix-type input source selection */
17081 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
17083 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17084 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17086 /* always trun on EAPD */
17087 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
17088 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
17093 static struct hda_verb alc663_init_verbs[] = {
17094 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17095 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17096 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17097 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17098 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17099 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17103 static struct hda_verb alc272_init_verbs[] = {
17104 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17105 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17106 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17107 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17108 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17109 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17110 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17111 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17115 static struct hda_verb alc662_sue_init_verbs[] = {
17116 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
17117 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
17121 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
17122 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17123 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17127 /* Set Unsolicited Event*/
17128 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
17129 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17130 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17134 static struct hda_verb alc663_m51va_init_verbs[] = {
17135 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17136 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17137 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17138 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17139 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17140 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17141 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17142 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17143 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17147 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
17148 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17149 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17150 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17151 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17152 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17153 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17154 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17158 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
17159 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17160 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17161 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17162 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17163 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17164 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17165 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17166 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17170 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
17171 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17172 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17173 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17174 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17175 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17176 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17177 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17181 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
17182 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17183 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17184 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17185 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
17186 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17187 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17188 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
17189 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17190 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
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},
17193 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17197 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
17198 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17199 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17200 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17201 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17202 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17203 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17204 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17205 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17206 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17207 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17208 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17209 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17213 static struct hda_verb alc663_g71v_init_verbs[] = {
17214 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17215 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
17216 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
17218 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17219 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17220 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17222 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
17223 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
17224 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
17228 static struct hda_verb alc663_g50v_init_verbs[] = {
17229 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17230 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17231 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17233 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17234 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17238 static struct hda_verb alc662_ecs_init_verbs[] = {
17239 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
17240 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17241 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17242 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17246 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
17247 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17248 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17249 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17250 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17251 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17252 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17253 {0x21, 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(9)},
17256 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17257 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17261 static struct hda_verb alc272_dell_init_verbs[] = {
17262 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17263 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17264 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17265 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17266 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17267 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17268 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17269 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17270 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17271 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17272 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17276 static struct hda_verb alc663_mode7_init_verbs[] = {
17277 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17278 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17279 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17280 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17281 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17282 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17283 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
17284 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17285 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17286 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17287 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17288 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17289 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17290 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17291 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17295 static struct hda_verb alc663_mode8_init_verbs[] = {
17296 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17297 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17298 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17299 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
17300 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17301 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17302 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17303 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17304 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17305 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17306 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17307 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17308 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17309 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17310 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17311 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17315 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
17316 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
17317 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
17321 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
17322 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
17323 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
17327 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
17329 unsigned int present;
17330 unsigned char bits;
17332 present = snd_hda_jack_detect(codec, 0x14);
17333 bits = present ? HDA_AMP_MUTE : 0;
17335 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17336 HDA_AMP_MUTE, bits);
17339 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
17341 unsigned int present;
17342 unsigned char bits;
17344 present = snd_hda_jack_detect(codec, 0x1b);
17345 bits = present ? HDA_AMP_MUTE : 0;
17347 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17348 HDA_AMP_MUTE, bits);
17349 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17350 HDA_AMP_MUTE, bits);
17353 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
17356 if ((res >> 26) == ALC880_HP_EVENT)
17357 alc662_lenovo_101e_all_automute(codec);
17358 if ((res >> 26) == ALC880_FRONT_EVENT)
17359 alc662_lenovo_101e_ispeaker_automute(codec);
17362 /* unsolicited event for HP jack sensing */
17363 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
17366 if ((res >> 26) == ALC880_MIC_EVENT)
17367 alc_mic_automute(codec);
17369 alc262_hippo_unsol_event(codec, res);
17372 static void alc662_eeepc_setup(struct hda_codec *codec)
17374 struct alc_spec *spec = codec->spec;
17376 alc262_hippo1_setup(codec);
17377 spec->ext_mic.pin = 0x18;
17378 spec->ext_mic.mux_idx = 0;
17379 spec->int_mic.pin = 0x19;
17380 spec->int_mic.mux_idx = 1;
17381 spec->auto_mic = 1;
17384 static void alc662_eeepc_inithook(struct hda_codec *codec)
17386 alc262_hippo_automute(codec);
17387 alc_mic_automute(codec);
17390 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
17392 struct alc_spec *spec = codec->spec;
17394 spec->autocfg.hp_pins[0] = 0x14;
17395 spec->autocfg.speaker_pins[0] = 0x1b;
17398 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
17400 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
17402 unsigned int present;
17403 unsigned char bits;
17405 present = snd_hda_jack_detect(codec, 0x21);
17406 bits = present ? HDA_AMP_MUTE : 0;
17407 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17408 HDA_AMP_MUTE, bits);
17409 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17410 HDA_AMP_MUTE, bits);
17413 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
17415 unsigned int present;
17416 unsigned char bits;
17418 present = snd_hda_jack_detect(codec, 0x21);
17419 bits = present ? HDA_AMP_MUTE : 0;
17420 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17421 HDA_AMP_MUTE, bits);
17422 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17423 HDA_AMP_MUTE, bits);
17424 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
17425 HDA_AMP_MUTE, bits);
17426 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
17427 HDA_AMP_MUTE, bits);
17430 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
17432 unsigned int present;
17433 unsigned char bits;
17435 present = snd_hda_jack_detect(codec, 0x15);
17436 bits = present ? HDA_AMP_MUTE : 0;
17437 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17438 HDA_AMP_MUTE, bits);
17439 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17440 HDA_AMP_MUTE, bits);
17441 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
17442 HDA_AMP_MUTE, bits);
17443 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
17444 HDA_AMP_MUTE, bits);
17447 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
17449 unsigned int present;
17450 unsigned char bits;
17452 present = snd_hda_jack_detect(codec, 0x1b);
17453 bits = present ? 0 : PIN_OUT;
17454 snd_hda_codec_write(codec, 0x14, 0,
17455 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
17458 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
17460 unsigned int present1, present2;
17462 present1 = snd_hda_jack_detect(codec, 0x21);
17463 present2 = snd_hda_jack_detect(codec, 0x15);
17465 if (present1 || present2) {
17466 snd_hda_codec_write_cache(codec, 0x14, 0,
17467 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17469 snd_hda_codec_write_cache(codec, 0x14, 0,
17470 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17474 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
17476 unsigned int present1, present2;
17478 present1 = snd_hda_jack_detect(codec, 0x1b);
17479 present2 = snd_hda_jack_detect(codec, 0x15);
17481 if (present1 || present2) {
17482 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17483 HDA_AMP_MUTE, HDA_AMP_MUTE);
17484 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17485 HDA_AMP_MUTE, HDA_AMP_MUTE);
17487 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17489 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17494 static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
17496 unsigned int present1, present2;
17498 present1 = snd_hda_codec_read(codec, 0x1b, 0,
17499 AC_VERB_GET_PIN_SENSE, 0)
17500 & AC_PINSENSE_PRESENCE;
17501 present2 = snd_hda_codec_read(codec, 0x21, 0,
17502 AC_VERB_GET_PIN_SENSE, 0)
17503 & AC_PINSENSE_PRESENCE;
17505 if (present1 || present2) {
17506 snd_hda_codec_write_cache(codec, 0x14, 0,
17507 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17508 snd_hda_codec_write_cache(codec, 0x17, 0,
17509 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17511 snd_hda_codec_write_cache(codec, 0x14, 0,
17512 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17513 snd_hda_codec_write_cache(codec, 0x17, 0,
17514 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17518 static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
17520 unsigned int present1, present2;
17522 present1 = snd_hda_codec_read(codec, 0x21, 0,
17523 AC_VERB_GET_PIN_SENSE, 0)
17524 & AC_PINSENSE_PRESENCE;
17525 present2 = snd_hda_codec_read(codec, 0x15, 0,
17526 AC_VERB_GET_PIN_SENSE, 0)
17527 & AC_PINSENSE_PRESENCE;
17529 if (present1 || present2) {
17530 snd_hda_codec_write_cache(codec, 0x14, 0,
17531 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17532 snd_hda_codec_write_cache(codec, 0x17, 0,
17533 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17535 snd_hda_codec_write_cache(codec, 0x14, 0,
17536 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17537 snd_hda_codec_write_cache(codec, 0x17, 0,
17538 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17542 static void alc663_m51va_unsol_event(struct hda_codec *codec,
17545 switch (res >> 26) {
17546 case ALC880_HP_EVENT:
17547 alc663_m51va_speaker_automute(codec);
17549 case ALC880_MIC_EVENT:
17550 alc_mic_automute(codec);
17555 static void alc663_m51va_setup(struct hda_codec *codec)
17557 struct alc_spec *spec = codec->spec;
17558 spec->ext_mic.pin = 0x18;
17559 spec->ext_mic.mux_idx = 0;
17560 spec->int_mic.pin = 0x12;
17561 spec->int_mic.mux_idx = 9;
17562 spec->auto_mic = 1;
17565 static void alc663_m51va_inithook(struct hda_codec *codec)
17567 alc663_m51va_speaker_automute(codec);
17568 alc_mic_automute(codec);
17571 /* ***************** Mode1 ******************************/
17572 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
17574 static void alc663_mode1_setup(struct hda_codec *codec)
17576 struct alc_spec *spec = codec->spec;
17577 spec->ext_mic.pin = 0x18;
17578 spec->ext_mic.mux_idx = 0;
17579 spec->int_mic.pin = 0x19;
17580 spec->int_mic.mux_idx = 1;
17581 spec->auto_mic = 1;
17584 #define alc663_mode1_inithook alc663_m51va_inithook
17586 /* ***************** Mode2 ******************************/
17587 static void alc662_mode2_unsol_event(struct hda_codec *codec,
17590 switch (res >> 26) {
17591 case ALC880_HP_EVENT:
17592 alc662_f5z_speaker_automute(codec);
17594 case ALC880_MIC_EVENT:
17595 alc_mic_automute(codec);
17600 #define alc662_mode2_setup alc663_mode1_setup
17602 static void alc662_mode2_inithook(struct hda_codec *codec)
17604 alc662_f5z_speaker_automute(codec);
17605 alc_mic_automute(codec);
17607 /* ***************** Mode3 ******************************/
17608 static void alc663_mode3_unsol_event(struct hda_codec *codec,
17611 switch (res >> 26) {
17612 case ALC880_HP_EVENT:
17613 alc663_two_hp_m1_speaker_automute(codec);
17615 case ALC880_MIC_EVENT:
17616 alc_mic_automute(codec);
17621 #define alc663_mode3_setup alc663_mode1_setup
17623 static void alc663_mode3_inithook(struct hda_codec *codec)
17625 alc663_two_hp_m1_speaker_automute(codec);
17626 alc_mic_automute(codec);
17628 /* ***************** Mode4 ******************************/
17629 static void alc663_mode4_unsol_event(struct hda_codec *codec,
17632 switch (res >> 26) {
17633 case ALC880_HP_EVENT:
17634 alc663_21jd_two_speaker_automute(codec);
17636 case ALC880_MIC_EVENT:
17637 alc_mic_automute(codec);
17642 #define alc663_mode4_setup alc663_mode1_setup
17644 static void alc663_mode4_inithook(struct hda_codec *codec)
17646 alc663_21jd_two_speaker_automute(codec);
17647 alc_mic_automute(codec);
17649 /* ***************** Mode5 ******************************/
17650 static void alc663_mode5_unsol_event(struct hda_codec *codec,
17653 switch (res >> 26) {
17654 case ALC880_HP_EVENT:
17655 alc663_15jd_two_speaker_automute(codec);
17657 case ALC880_MIC_EVENT:
17658 alc_mic_automute(codec);
17663 #define alc663_mode5_setup alc663_mode1_setup
17665 static void alc663_mode5_inithook(struct hda_codec *codec)
17667 alc663_15jd_two_speaker_automute(codec);
17668 alc_mic_automute(codec);
17670 /* ***************** Mode6 ******************************/
17671 static void alc663_mode6_unsol_event(struct hda_codec *codec,
17674 switch (res >> 26) {
17675 case ALC880_HP_EVENT:
17676 alc663_two_hp_m2_speaker_automute(codec);
17678 case ALC880_MIC_EVENT:
17679 alc_mic_automute(codec);
17684 #define alc663_mode6_setup alc663_mode1_setup
17686 static void alc663_mode6_inithook(struct hda_codec *codec)
17688 alc663_two_hp_m2_speaker_automute(codec);
17689 alc_mic_automute(codec);
17692 /* ***************** Mode7 ******************************/
17693 static void alc663_mode7_unsol_event(struct hda_codec *codec,
17696 switch (res >> 26) {
17697 case ALC880_HP_EVENT:
17698 alc663_two_hp_m7_speaker_automute(codec);
17700 case ALC880_MIC_EVENT:
17701 alc_mic_automute(codec);
17706 #define alc663_mode7_setup alc663_mode1_setup
17708 static void alc663_mode7_inithook(struct hda_codec *codec)
17710 alc663_two_hp_m7_speaker_automute(codec);
17711 alc_mic_automute(codec);
17714 /* ***************** Mode8 ******************************/
17715 static void alc663_mode8_unsol_event(struct hda_codec *codec,
17718 switch (res >> 26) {
17719 case ALC880_HP_EVENT:
17720 alc663_two_hp_m8_speaker_automute(codec);
17722 case ALC880_MIC_EVENT:
17723 alc_mic_automute(codec);
17728 #define alc663_mode8_setup alc663_m51va_setup
17730 static void alc663_mode8_inithook(struct hda_codec *codec)
17732 alc663_two_hp_m8_speaker_automute(codec);
17733 alc_mic_automute(codec);
17736 static void alc663_g71v_hp_automute(struct hda_codec *codec)
17738 unsigned int present;
17739 unsigned char bits;
17741 present = snd_hda_jack_detect(codec, 0x21);
17742 bits = present ? HDA_AMP_MUTE : 0;
17743 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17744 HDA_AMP_MUTE, bits);
17745 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17746 HDA_AMP_MUTE, bits);
17749 static void alc663_g71v_front_automute(struct hda_codec *codec)
17751 unsigned int present;
17752 unsigned char bits;
17754 present = snd_hda_jack_detect(codec, 0x15);
17755 bits = present ? HDA_AMP_MUTE : 0;
17756 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17757 HDA_AMP_MUTE, bits);
17760 static void alc663_g71v_unsol_event(struct hda_codec *codec,
17763 switch (res >> 26) {
17764 case ALC880_HP_EVENT:
17765 alc663_g71v_hp_automute(codec);
17767 case ALC880_FRONT_EVENT:
17768 alc663_g71v_front_automute(codec);
17770 case ALC880_MIC_EVENT:
17771 alc_mic_automute(codec);
17776 #define alc663_g71v_setup alc663_m51va_setup
17778 static void alc663_g71v_inithook(struct hda_codec *codec)
17780 alc663_g71v_front_automute(codec);
17781 alc663_g71v_hp_automute(codec);
17782 alc_mic_automute(codec);
17785 static void alc663_g50v_unsol_event(struct hda_codec *codec,
17788 switch (res >> 26) {
17789 case ALC880_HP_EVENT:
17790 alc663_m51va_speaker_automute(codec);
17792 case ALC880_MIC_EVENT:
17793 alc_mic_automute(codec);
17798 #define alc663_g50v_setup alc663_m51va_setup
17800 static void alc663_g50v_inithook(struct hda_codec *codec)
17802 alc663_m51va_speaker_automute(codec);
17803 alc_mic_automute(codec);
17806 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
17807 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17808 ALC262_HIPPO_MASTER_SWITCH,
17810 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
17811 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
17812 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
17814 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
17815 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17816 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17820 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
17821 /* Master Playback automatically created from Speaker and Headphone */
17822 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17823 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17824 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17825 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17827 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17828 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17829 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
17831 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17832 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17833 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
17837 #ifdef CONFIG_SND_HDA_POWER_SAVE
17838 #define alc662_loopbacks alc880_loopbacks
17842 /* pcm configuration: identical with ALC880 */
17843 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
17844 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
17845 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
17846 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
17849 * configuration and preset
17851 static const char *alc662_models[ALC662_MODEL_LAST] = {
17852 [ALC662_3ST_2ch_DIG] = "3stack-dig",
17853 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
17854 [ALC662_3ST_6ch] = "3stack-6ch",
17855 [ALC662_5ST_DIG] = "6stack-dig",
17856 [ALC662_LENOVO_101E] = "lenovo-101e",
17857 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
17858 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
17859 [ALC662_ECS] = "ecs",
17860 [ALC663_ASUS_M51VA] = "m51va",
17861 [ALC663_ASUS_G71V] = "g71v",
17862 [ALC663_ASUS_H13] = "h13",
17863 [ALC663_ASUS_G50V] = "g50v",
17864 [ALC663_ASUS_MODE1] = "asus-mode1",
17865 [ALC662_ASUS_MODE2] = "asus-mode2",
17866 [ALC663_ASUS_MODE3] = "asus-mode3",
17867 [ALC663_ASUS_MODE4] = "asus-mode4",
17868 [ALC663_ASUS_MODE5] = "asus-mode5",
17869 [ALC663_ASUS_MODE6] = "asus-mode6",
17870 [ALC663_ASUS_MODE7] = "asus-mode7",
17871 [ALC663_ASUS_MODE8] = "asus-mode8",
17872 [ALC272_DELL] = "dell",
17873 [ALC272_DELL_ZM1] = "dell-zm1",
17874 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
17875 [ALC662_AUTO] = "auto",
17878 static struct snd_pci_quirk alc662_cfg_tbl[] = {
17879 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
17880 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
17881 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
17882 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
17883 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
17884 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1),
17885 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
17886 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
17887 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
17888 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
17889 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
17890 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
17891 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
17892 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
17893 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
17894 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
17895 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
17896 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
17897 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
17898 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
17899 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
17900 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
17901 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
17902 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
17903 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
17904 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
17905 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
17906 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
17907 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
17908 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
17909 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
17910 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
17911 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
17912 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
17913 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
17914 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
17915 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
17916 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
17917 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
17918 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
17919 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
17920 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1),
17921 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
17922 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
17923 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
17924 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
17925 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
17926 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
17927 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
17928 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
17929 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
17930 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
17931 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
17932 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
17933 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
17934 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
17935 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
17936 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
17937 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
17938 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
17939 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
17940 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
17941 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
17942 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
17943 ALC662_3ST_6ch_DIG),
17944 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO),
17945 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
17946 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
17947 ALC662_3ST_6ch_DIG),
17948 SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13),
17949 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
17950 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
17951 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
17952 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
17953 ALC662_3ST_6ch_DIG),
17954 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
17956 SND_PCI_QUIRK(0x8086, 0xd604, "Intel mobo", ALC662_3ST_2ch_DIG),
17960 static struct alc_config_preset alc662_presets[] = {
17961 [ALC662_3ST_2ch_DIG] = {
17962 .mixers = { alc662_3ST_2ch_mixer },
17963 .init_verbs = { alc662_init_verbs },
17964 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17965 .dac_nids = alc662_dac_nids,
17966 .dig_out_nid = ALC662_DIGOUT_NID,
17967 .dig_in_nid = ALC662_DIGIN_NID,
17968 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17969 .channel_mode = alc662_3ST_2ch_modes,
17970 .input_mux = &alc662_capture_source,
17972 [ALC662_3ST_6ch_DIG] = {
17973 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17974 .init_verbs = { alc662_init_verbs },
17975 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17976 .dac_nids = alc662_dac_nids,
17977 .dig_out_nid = ALC662_DIGOUT_NID,
17978 .dig_in_nid = ALC662_DIGIN_NID,
17979 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17980 .channel_mode = alc662_3ST_6ch_modes,
17982 .input_mux = &alc662_capture_source,
17984 [ALC662_3ST_6ch] = {
17985 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17986 .init_verbs = { alc662_init_verbs },
17987 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17988 .dac_nids = alc662_dac_nids,
17989 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17990 .channel_mode = alc662_3ST_6ch_modes,
17992 .input_mux = &alc662_capture_source,
17994 [ALC662_5ST_DIG] = {
17995 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
17996 .init_verbs = { alc662_init_verbs },
17997 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17998 .dac_nids = alc662_dac_nids,
17999 .dig_out_nid = ALC662_DIGOUT_NID,
18000 .dig_in_nid = ALC662_DIGIN_NID,
18001 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
18002 .channel_mode = alc662_5stack_modes,
18003 .input_mux = &alc662_capture_source,
18005 [ALC662_LENOVO_101E] = {
18006 .mixers = { alc662_lenovo_101e_mixer },
18007 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
18008 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18009 .dac_nids = alc662_dac_nids,
18010 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18011 .channel_mode = alc662_3ST_2ch_modes,
18012 .input_mux = &alc662_lenovo_101e_capture_source,
18013 .unsol_event = alc662_lenovo_101e_unsol_event,
18014 .init_hook = alc662_lenovo_101e_all_automute,
18016 [ALC662_ASUS_EEEPC_P701] = {
18017 .mixers = { alc662_eeepc_p701_mixer },
18018 .init_verbs = { alc662_init_verbs,
18019 alc662_eeepc_sue_init_verbs },
18020 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18021 .dac_nids = alc662_dac_nids,
18022 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18023 .channel_mode = alc662_3ST_2ch_modes,
18024 .unsol_event = alc662_eeepc_unsol_event,
18025 .setup = alc662_eeepc_setup,
18026 .init_hook = alc662_eeepc_inithook,
18028 [ALC662_ASUS_EEEPC_EP20] = {
18029 .mixers = { alc662_eeepc_ep20_mixer,
18030 alc662_chmode_mixer },
18031 .init_verbs = { alc662_init_verbs,
18032 alc662_eeepc_ep20_sue_init_verbs },
18033 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18034 .dac_nids = alc662_dac_nids,
18035 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18036 .channel_mode = alc662_3ST_6ch_modes,
18037 .input_mux = &alc662_lenovo_101e_capture_source,
18038 .unsol_event = alc662_eeepc_unsol_event,
18039 .setup = alc662_eeepc_ep20_setup,
18040 .init_hook = alc662_eeepc_ep20_inithook,
18043 .mixers = { alc662_ecs_mixer },
18044 .init_verbs = { alc662_init_verbs,
18045 alc662_ecs_init_verbs },
18046 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18047 .dac_nids = alc662_dac_nids,
18048 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18049 .channel_mode = alc662_3ST_2ch_modes,
18050 .unsol_event = alc662_eeepc_unsol_event,
18051 .setup = alc662_eeepc_setup,
18052 .init_hook = alc662_eeepc_inithook,
18054 [ALC663_ASUS_M51VA] = {
18055 .mixers = { alc663_m51va_mixer },
18056 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
18057 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18058 .dac_nids = alc662_dac_nids,
18059 .dig_out_nid = ALC662_DIGOUT_NID,
18060 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18061 .channel_mode = alc662_3ST_2ch_modes,
18062 .unsol_event = alc663_m51va_unsol_event,
18063 .setup = alc663_m51va_setup,
18064 .init_hook = alc663_m51va_inithook,
18066 [ALC663_ASUS_G71V] = {
18067 .mixers = { alc663_g71v_mixer },
18068 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
18069 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18070 .dac_nids = alc662_dac_nids,
18071 .dig_out_nid = ALC662_DIGOUT_NID,
18072 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18073 .channel_mode = alc662_3ST_2ch_modes,
18074 .unsol_event = alc663_g71v_unsol_event,
18075 .setup = alc663_g71v_setup,
18076 .init_hook = alc663_g71v_inithook,
18078 [ALC663_ASUS_H13] = {
18079 .mixers = { alc663_m51va_mixer },
18080 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
18081 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18082 .dac_nids = alc662_dac_nids,
18083 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18084 .channel_mode = alc662_3ST_2ch_modes,
18085 .unsol_event = alc663_m51va_unsol_event,
18086 .init_hook = alc663_m51va_inithook,
18088 [ALC663_ASUS_G50V] = {
18089 .mixers = { alc663_g50v_mixer },
18090 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
18091 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18092 .dac_nids = alc662_dac_nids,
18093 .dig_out_nid = ALC662_DIGOUT_NID,
18094 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18095 .channel_mode = alc662_3ST_6ch_modes,
18096 .input_mux = &alc663_capture_source,
18097 .unsol_event = alc663_g50v_unsol_event,
18098 .setup = alc663_g50v_setup,
18099 .init_hook = alc663_g50v_inithook,
18101 [ALC663_ASUS_MODE1] = {
18102 .mixers = { alc663_m51va_mixer },
18103 .cap_mixer = alc662_auto_capture_mixer,
18104 .init_verbs = { alc662_init_verbs,
18105 alc663_21jd_amic_init_verbs },
18106 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18108 .dac_nids = alc662_dac_nids,
18109 .dig_out_nid = ALC662_DIGOUT_NID,
18110 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18111 .channel_mode = alc662_3ST_2ch_modes,
18112 .unsol_event = alc663_mode1_unsol_event,
18113 .setup = alc663_mode1_setup,
18114 .init_hook = alc663_mode1_inithook,
18116 [ALC662_ASUS_MODE2] = {
18117 .mixers = { alc662_1bjd_mixer },
18118 .cap_mixer = alc662_auto_capture_mixer,
18119 .init_verbs = { alc662_init_verbs,
18120 alc662_1bjd_amic_init_verbs },
18121 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18122 .dac_nids = alc662_dac_nids,
18123 .dig_out_nid = ALC662_DIGOUT_NID,
18124 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18125 .channel_mode = alc662_3ST_2ch_modes,
18126 .unsol_event = alc662_mode2_unsol_event,
18127 .setup = alc662_mode2_setup,
18128 .init_hook = alc662_mode2_inithook,
18130 [ALC663_ASUS_MODE3] = {
18131 .mixers = { alc663_two_hp_m1_mixer },
18132 .cap_mixer = alc662_auto_capture_mixer,
18133 .init_verbs = { alc662_init_verbs,
18134 alc663_two_hp_amic_m1_init_verbs },
18135 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18137 .dac_nids = alc662_dac_nids,
18138 .dig_out_nid = ALC662_DIGOUT_NID,
18139 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18140 .channel_mode = alc662_3ST_2ch_modes,
18141 .unsol_event = alc663_mode3_unsol_event,
18142 .setup = alc663_mode3_setup,
18143 .init_hook = alc663_mode3_inithook,
18145 [ALC663_ASUS_MODE4] = {
18146 .mixers = { alc663_asus_21jd_clfe_mixer },
18147 .cap_mixer = alc662_auto_capture_mixer,
18148 .init_verbs = { alc662_init_verbs,
18149 alc663_21jd_amic_init_verbs},
18150 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18152 .dac_nids = alc662_dac_nids,
18153 .dig_out_nid = ALC662_DIGOUT_NID,
18154 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18155 .channel_mode = alc662_3ST_2ch_modes,
18156 .unsol_event = alc663_mode4_unsol_event,
18157 .setup = alc663_mode4_setup,
18158 .init_hook = alc663_mode4_inithook,
18160 [ALC663_ASUS_MODE5] = {
18161 .mixers = { alc663_asus_15jd_clfe_mixer },
18162 .cap_mixer = alc662_auto_capture_mixer,
18163 .init_verbs = { alc662_init_verbs,
18164 alc663_15jd_amic_init_verbs },
18165 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18167 .dac_nids = alc662_dac_nids,
18168 .dig_out_nid = ALC662_DIGOUT_NID,
18169 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18170 .channel_mode = alc662_3ST_2ch_modes,
18171 .unsol_event = alc663_mode5_unsol_event,
18172 .setup = alc663_mode5_setup,
18173 .init_hook = alc663_mode5_inithook,
18175 [ALC663_ASUS_MODE6] = {
18176 .mixers = { alc663_two_hp_m2_mixer },
18177 .cap_mixer = alc662_auto_capture_mixer,
18178 .init_verbs = { alc662_init_verbs,
18179 alc663_two_hp_amic_m2_init_verbs },
18180 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18182 .dac_nids = alc662_dac_nids,
18183 .dig_out_nid = ALC662_DIGOUT_NID,
18184 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18185 .channel_mode = alc662_3ST_2ch_modes,
18186 .unsol_event = alc663_mode6_unsol_event,
18187 .setup = alc663_mode6_setup,
18188 .init_hook = alc663_mode6_inithook,
18190 [ALC663_ASUS_MODE7] = {
18191 .mixers = { alc663_mode7_mixer },
18192 .cap_mixer = alc662_auto_capture_mixer,
18193 .init_verbs = { alc662_init_verbs,
18194 alc663_mode7_init_verbs },
18195 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18197 .dac_nids = alc662_dac_nids,
18198 .dig_out_nid = ALC662_DIGOUT_NID,
18199 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18200 .channel_mode = alc662_3ST_2ch_modes,
18201 .unsol_event = alc663_mode7_unsol_event,
18202 .setup = alc663_mode7_setup,
18203 .init_hook = alc663_mode7_inithook,
18205 [ALC663_ASUS_MODE8] = {
18206 .mixers = { alc663_mode8_mixer },
18207 .cap_mixer = alc662_auto_capture_mixer,
18208 .init_verbs = { alc662_init_verbs,
18209 alc663_mode8_init_verbs },
18210 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18212 .dac_nids = alc662_dac_nids,
18213 .dig_out_nid = ALC662_DIGOUT_NID,
18214 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18215 .channel_mode = alc662_3ST_2ch_modes,
18216 .unsol_event = alc663_mode8_unsol_event,
18217 .setup = alc663_mode8_setup,
18218 .init_hook = alc663_mode8_inithook,
18221 .mixers = { alc663_m51va_mixer },
18222 .cap_mixer = alc272_auto_capture_mixer,
18223 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
18224 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18225 .dac_nids = alc662_dac_nids,
18226 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18227 .adc_nids = alc272_adc_nids,
18228 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
18229 .capsrc_nids = alc272_capsrc_nids,
18230 .channel_mode = alc662_3ST_2ch_modes,
18231 .unsol_event = alc663_m51va_unsol_event,
18232 .setup = alc663_m51va_setup,
18233 .init_hook = alc663_m51va_inithook,
18235 [ALC272_DELL_ZM1] = {
18236 .mixers = { alc663_m51va_mixer },
18237 .cap_mixer = alc662_auto_capture_mixer,
18238 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
18239 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18240 .dac_nids = alc662_dac_nids,
18241 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18242 .adc_nids = alc662_adc_nids,
18244 .capsrc_nids = alc662_capsrc_nids,
18245 .channel_mode = alc662_3ST_2ch_modes,
18246 .unsol_event = alc663_m51va_unsol_event,
18247 .setup = alc663_m51va_setup,
18248 .init_hook = alc663_m51va_inithook,
18250 [ALC272_SAMSUNG_NC10] = {
18251 .mixers = { alc272_nc10_mixer },
18252 .init_verbs = { alc662_init_verbs,
18253 alc663_21jd_amic_init_verbs },
18254 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18255 .dac_nids = alc272_dac_nids,
18256 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18257 .channel_mode = alc662_3ST_2ch_modes,
18258 /*.input_mux = &alc272_nc10_capture_source,*/
18259 .unsol_event = alc663_mode4_unsol_event,
18260 .setup = alc663_mode4_setup,
18261 .init_hook = alc663_mode4_inithook,
18267 * BIOS auto configuration
18270 /* convert from MIX nid to DAC */
18271 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
18275 else if (nid >= 0x0c && nid <= 0x0e)
18276 return nid - 0x0c + 0x02;
18281 /* get MIX nid connected to the given pin targeted to DAC */
18282 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
18288 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
18289 for (i = 0; i < num; i++) {
18290 if (alc662_mix_to_dac(mix[i]) == dac)
18296 /* look for an empty DAC slot */
18297 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
18299 struct alc_spec *spec = codec->spec;
18303 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
18306 for (i = 0; i < num; i++) {
18307 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
18310 for (j = 0; j < spec->multiout.num_dacs; j++)
18311 if (spec->multiout.dac_nids[j] == nid)
18313 if (j >= spec->multiout.num_dacs)
18319 /* fill in the dac_nids table from the parsed pin configuration */
18320 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
18321 const struct auto_pin_cfg *cfg)
18323 struct alc_spec *spec = codec->spec;
18327 spec->multiout.dac_nids = spec->private_dac_nids;
18328 for (i = 0; i < cfg->line_outs; i++) {
18329 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
18332 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
18337 static inline int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
18338 hda_nid_t nid, unsigned int chs)
18340 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
18341 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
18344 static inline int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
18345 hda_nid_t nid, unsigned int chs)
18347 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
18348 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
18351 #define alc662_add_stereo_vol(spec, pfx, nid) \
18352 alc662_add_vol_ctl(spec, pfx, nid, 3)
18353 #define alc662_add_stereo_sw(spec, pfx, nid) \
18354 alc662_add_sw_ctl(spec, pfx, nid, 3)
18356 /* add playback controls from the parsed DAC table */
18357 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
18358 const struct auto_pin_cfg *cfg)
18360 struct alc_spec *spec = codec->spec;
18361 static const char *chname[4] = {
18362 "Front", "Surround", NULL /*CLFE*/, "Side"
18364 hda_nid_t nid, mix;
18367 for (i = 0; i < cfg->line_outs; i++) {
18368 nid = spec->multiout.dac_nids[i];
18371 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
18376 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
18379 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
18382 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
18385 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
18390 if (cfg->line_outs == 1 &&
18391 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
18398 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
18401 if (cfg->line_outs == 1 &&
18402 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
18404 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
18412 /* add playback controls for speaker and HP outputs */
18413 /* return DAC nid if any new DAC is assigned */
18414 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
18417 struct alc_spec *spec = codec->spec;
18418 hda_nid_t nid, mix;
18423 nid = alc662_look_for_dac(codec, pin);
18425 /* the corresponding DAC is already occupied */
18426 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
18427 return 0; /* no way */
18428 /* create a switch only */
18429 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
18430 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
18433 mix = alc662_dac_to_mix(codec, pin, nid);
18436 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
18439 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
18445 /* create playback/capture controls for input pins */
18446 #define alc662_auto_create_input_ctls \
18447 alc882_auto_create_input_ctls
18449 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
18450 hda_nid_t nid, int pin_type,
18456 alc_set_pin_output(codec, nid, pin_type);
18457 /* need the manual connection? */
18458 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
18461 for (i = 0; i < num; i++) {
18462 if (alc662_mix_to_dac(srcs[i]) != dac)
18464 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
18469 static void alc662_auto_init_multi_out(struct hda_codec *codec)
18471 struct alc_spec *spec = codec->spec;
18472 int pin_type = get_pin_type(spec->autocfg.line_out_type);
18475 for (i = 0; i <= HDA_SIDE; i++) {
18476 hda_nid_t nid = spec->autocfg.line_out_pins[i];
18478 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
18479 spec->multiout.dac_nids[i]);
18483 static void alc662_auto_init_hp_out(struct hda_codec *codec)
18485 struct alc_spec *spec = codec->spec;
18488 pin = spec->autocfg.hp_pins[0];
18490 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
18491 spec->multiout.hp_nid);
18492 pin = spec->autocfg.speaker_pins[0];
18494 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
18495 spec->multiout.extra_out_nid[0]);
18498 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
18500 static void alc662_auto_init_analog_input(struct hda_codec *codec)
18502 struct alc_spec *spec = codec->spec;
18505 for (i = 0; i < AUTO_PIN_LAST; i++) {
18506 hda_nid_t nid = spec->autocfg.input_pins[i];
18507 if (alc_is_input_pin(codec, nid)) {
18508 alc_set_input_pin(codec, nid, i);
18509 if (nid != ALC662_PIN_CD_NID &&
18510 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
18511 snd_hda_codec_write(codec, nid, 0,
18512 AC_VERB_SET_AMP_GAIN_MUTE,
18518 #define alc662_auto_init_input_src alc882_auto_init_input_src
18520 static int alc662_parse_auto_config(struct hda_codec *codec)
18522 struct alc_spec *spec = codec->spec;
18524 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
18526 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
18530 if (!spec->autocfg.line_outs)
18531 return 0; /* can't find valid BIOS pin config */
18533 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
18536 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
18539 err = alc662_auto_create_extra_out(codec,
18540 spec->autocfg.speaker_pins[0],
18545 spec->multiout.extra_out_nid[0] = err;
18546 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
18551 spec->multiout.hp_nid = err;
18552 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
18556 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
18558 if (spec->autocfg.dig_outs)
18559 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
18561 if (spec->kctls.list)
18562 add_mixer(spec, spec->kctls.list);
18564 spec->num_mux_defs = 1;
18565 spec->input_mux = &spec->private_imux[0];
18567 add_verb(spec, alc662_init_verbs);
18568 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
18569 codec->vendor_id == 0x10ec0665)
18570 add_verb(spec, alc663_init_verbs);
18572 if (codec->vendor_id == 0x10ec0272)
18573 add_verb(spec, alc272_init_verbs);
18575 err = alc_auto_add_mic_boost(codec);
18579 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
18580 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
18581 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21);
18583 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
18588 /* additional initialization for auto-configuration model */
18589 static void alc662_auto_init(struct hda_codec *codec)
18591 struct alc_spec *spec = codec->spec;
18592 alc662_auto_init_multi_out(codec);
18593 alc662_auto_init_hp_out(codec);
18594 alc662_auto_init_analog_input(codec);
18595 alc662_auto_init_input_src(codec);
18596 if (spec->unsol_event)
18597 alc_inithook(codec);
18600 static int patch_alc662(struct hda_codec *codec)
18602 struct alc_spec *spec;
18603 int err, board_config;
18605 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
18609 codec->spec = spec;
18611 alc_auto_parse_customize_define(codec);
18613 alc_fix_pll_init(codec, 0x20, 0x04, 15);
18615 if (alc_read_coef_idx(codec, 0) == 0x8020)
18616 alc_codec_rename(codec, "ALC661");
18617 else if ((alc_read_coef_idx(codec, 0) & (1 << 14)) &&
18618 codec->bus->pci->subsystem_vendor == 0x1025 &&
18619 spec->cdefine.platform_type == 1)
18620 alc_codec_rename(codec, "ALC272X");
18622 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
18625 if (board_config < 0) {
18626 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
18628 board_config = ALC662_AUTO;
18631 if (board_config == ALC662_AUTO) {
18632 /* automatic parse from the BIOS config */
18633 err = alc662_parse_auto_config(codec);
18639 "hda_codec: Cannot set up configuration "
18640 "from BIOS. Using base mode...\n");
18641 board_config = ALC662_3ST_2ch_DIG;
18645 err = snd_hda_attach_beep_device(codec, 0x1);
18651 if (board_config != ALC662_AUTO)
18652 setup_preset(codec, &alc662_presets[board_config]);
18654 spec->stream_analog_playback = &alc662_pcm_analog_playback;
18655 spec->stream_analog_capture = &alc662_pcm_analog_capture;
18657 spec->stream_digital_playback = &alc662_pcm_digital_playback;
18658 spec->stream_digital_capture = &alc662_pcm_digital_capture;
18660 if (!spec->adc_nids) {
18661 spec->adc_nids = alc662_adc_nids;
18662 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
18664 if (!spec->capsrc_nids)
18665 spec->capsrc_nids = alc662_capsrc_nids;
18667 if (!spec->cap_mixer)
18668 set_capture_mixer(codec);
18670 if (spec->cdefine.enable_pcbeep) {
18671 switch (codec->vendor_id) {
18673 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
18678 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
18681 set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
18685 spec->vmaster_nid = 0x02;
18687 codec->patch_ops = alc_patch_ops;
18688 if (board_config == ALC662_AUTO)
18689 spec->init_hook = alc662_auto_init;
18690 #ifdef CONFIG_SND_HDA_POWER_SAVE
18691 if (!spec->loopback.amplist)
18692 spec->loopback.amplist = alc662_loopbacks;
18698 static int patch_alc888(struct hda_codec *codec)
18700 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
18701 kfree(codec->chip_name);
18702 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
18703 if (!codec->chip_name) {
18707 return patch_alc662(codec);
18709 return patch_alc882(codec);
18715 static struct hda_codec_preset snd_hda_preset_realtek[] = {
18716 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
18717 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
18718 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
18719 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
18720 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
18721 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
18722 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
18723 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
18724 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
18725 .patch = patch_alc861 },
18726 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
18727 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
18728 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
18729 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
18730 .patch = patch_alc882 },
18731 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
18732 .patch = patch_alc662 },
18733 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
18734 { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
18735 { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
18736 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
18737 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
18738 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
18739 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
18740 .patch = patch_alc882 },
18741 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
18742 .patch = patch_alc882 },
18743 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
18744 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
18745 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
18746 .patch = patch_alc882 },
18747 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
18748 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
18749 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
18750 {} /* terminator */
18753 MODULE_ALIAS("snd-hda-codec-id:10ec*");
18755 MODULE_LICENSE("GPL");
18756 MODULE_DESCRIPTION("Realtek HD-audio codec");
18758 static struct hda_codec_preset_list realtek_list = {
18759 .preset = snd_hda_preset_realtek,
18760 .owner = THIS_MODULE,
18763 static int __init patch_realtek_init(void)
18765 return snd_hda_add_codec_preset(&realtek_list);
18768 static void __exit patch_realtek_exit(void)
18770 snd_hda_delete_codec_preset(&realtek_list);
18773 module_init(patch_realtek_init)
18774 module_exit(patch_realtek_exit)